Upgrade remaining modules to api 29

This commit is contained in:
moezbhatti
2019-10-28 00:26:20 -04:00
parent 42d693a08f
commit 24e185ee62
7 changed files with 15 additions and 14 deletions
+2 -2
View File
@@ -20,11 +20,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
+2 -2
View File
@@ -21,7 +21,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
compileSdkVersion 29
publishNonDefault true
flavorDimensions "analytics"
@@ -32,7 +32,7 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
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 {
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 orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
val orientation = exif?.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
return when (orientation) {
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
// 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()
// 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)
}
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
realm.executeTransaction { managedMessage?.contentId = uri.lastPathSegment.toLong() }
realm.executeTransaction { managedMessage?.contentId = id }
}
realm.close()
@@ -38,7 +38,7 @@ class HeadlessSmsSendService : IntentService("HeadlessSmsSendService") {
AndroidInjection.inject(this)
intent.extras?.getString(Intent.EXTRA_TEXT)?.takeIf { it.isNotBlank() }?.let { body ->
val intentUri = intent.data
val recipients = getRecipients(intentUri).split(";")
val recipients = intentUri?.let(::getRecipients)?.split(";") ?: return@let
val threadId = conversationRepo.getOrCreateConversation(recipients)?.id ?: 0L
sendMessage.execute(SendMessage.Params(-1, threadId, recipients, body))
}
+2 -2
View File
@@ -22,7 +22,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
compileSdkVersion 29
compileOptions {
sourceCompatibility 1.8
@@ -31,7 +31,7 @@ android {
defaultConfig {
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) {
inputContent.description.hasMimeType("image/gif")
} else {
context.contentResolver.getType(uri) == "image/gif"
uri?.let(context.contentResolver::getType) == "image/gif"
}
}
}