mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +01:00
Upgrade remaining modules to api 29
This commit is contained in:
+2
-2
@@ -20,11 +20,11 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 29
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 29
|
||||||
publishNonDefault true
|
publishNonDefault true
|
||||||
flavorDimensions "analytics"
|
flavorDimensions "analytics"
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
buildConfigField "String", "AMPLITUDE_API_KEY", "\"${System.getenv("AMPLITUDE_API_KEY")}\""
|
buildConfigField "String", "AMPLITUDE_API_KEY", "\"${System.getenv("AMPLITUDE_API_KEY")}\""
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ import javax.inject.Inject
|
|||||||
class ImageRepostoryImpl @Inject constructor(private val context: Context) : ImageRepository {
|
class ImageRepostoryImpl @Inject constructor(private val context: Context) : ImageRepository {
|
||||||
|
|
||||||
override fun loadImage(uri: Uri): Bitmap? {
|
override fun loadImage(uri: Uri): Bitmap? {
|
||||||
val exif = ExifInterface(context.contentResolver.openInputStream(uri))
|
val exif = context.contentResolver.openInputStream(uri)?.let(::ExifInterface)
|
||||||
val bitmap = BitmapFactory.decodeStream(context.contentResolver.openInputStream(uri))
|
val bitmap = BitmapFactory.decodeStream(context.contentResolver.openInputStream(uri))
|
||||||
val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
val orientation = exif?.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
||||||
|
|
||||||
|
|
||||||
return when (orientation) {
|
return when (orientation) {
|
||||||
ExifInterface.ORIENTATION_ROTATE_90 -> rotateBitmap(bitmap, 90f)
|
ExifInterface.ORIENTATION_ROTATE_90 -> rotateBitmap(bitmap, 90f)
|
||||||
|
|||||||
@@ -415,7 +415,9 @@ class MessageRepositoryImpl @Inject constructor(
|
|||||||
//
|
//
|
||||||
// We do this after inserting the message because it might be slow, and we want the message
|
// We do this after inserting the message because it might be slow, and we want the message
|
||||||
// to be inserted into Realm immediately. We don't need to do this after receiving one
|
// to be inserted into Realm immediately. We don't need to do this after receiving one
|
||||||
realm.executeTransaction { managedMessage?.takeIf { it.isValid }?.contentId = uri.lastPathSegment.toLong() }
|
uri?.lastPathSegment?.toLong()?.let { id ->
|
||||||
|
realm.executeTransaction { managedMessage?.takeIf { it.isValid }?.contentId = id }
|
||||||
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
|
|
||||||
// On some devices, we can't obtain a threadId until after the first message is sent in a
|
// On some devices, we can't obtain a threadId until after the first message is sent in a
|
||||||
@@ -459,9 +461,9 @@ class MessageRepositoryImpl @Inject constructor(
|
|||||||
values.put(Telephony.Sms.SUBSCRIPTION_ID, message.subId)
|
values.put(Telephony.Sms.SUBSCRIPTION_ID, message.subId)
|
||||||
}
|
}
|
||||||
|
|
||||||
context.contentResolver.insert(Telephony.Sms.Inbox.CONTENT_URI, values)?.let { uri ->
|
context.contentResolver.insert(Telephony.Sms.Inbox.CONTENT_URI, values)?.lastPathSegment?.toLong()?.let { id ->
|
||||||
// Update the contentId after the message has been inserted to the content provider
|
// Update the contentId after the message has been inserted to the content provider
|
||||||
realm.executeTransaction { managedMessage?.contentId = uri.lastPathSegment.toLong() }
|
realm.executeTransaction { managedMessage?.contentId = id }
|
||||||
}
|
}
|
||||||
|
|
||||||
realm.close()
|
realm.close()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class HeadlessSmsSendService : IntentService("HeadlessSmsSendService") {
|
|||||||
AndroidInjection.inject(this)
|
AndroidInjection.inject(this)
|
||||||
intent.extras?.getString(Intent.EXTRA_TEXT)?.takeIf { it.isNotBlank() }?.let { body ->
|
intent.extras?.getString(Intent.EXTRA_TEXT)?.takeIf { it.isNotBlank() }?.let { body ->
|
||||||
val intentUri = intent.data
|
val intentUri = intent.data
|
||||||
val recipients = getRecipients(intentUri).split(";")
|
val recipients = intentUri?.let(::getRecipients)?.split(";") ?: return@let
|
||||||
val threadId = conversationRepo.getOrCreateConversation(recipients)?.id ?: 0L
|
val threadId = conversationRepo.getOrCreateConversation(recipients)?.id ?: 0L
|
||||||
sendMessage.execute(SendMessage.Params(-1, threadId, recipients, body))
|
sendMessage.execute(SendMessage.Params(-1, threadId, recipients, body))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 29
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility 1.8
|
sourceCompatibility 1.8
|
||||||
@@ -31,7 +31,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ sealed class Attachment {
|
|||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && inputContent != null) {
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && inputContent != null) {
|
||||||
inputContent.description.hasMimeType("image/gif")
|
inputContent.description.hasMimeType("image/gif")
|
||||||
} else {
|
} else {
|
||||||
context.contentResolver.getType(uri) == "image/gif"
|
uri?.let(context.contentResolver::getType) == "image/gif"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user