forked from upstream-mirrors/quik
Upgrade remaining modules to api 29
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user