parent
eb74523905
commit
067a22883c
|
@ -9,6 +9,8 @@ Improvements 🙌:
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Message transitions in encrypted rooms are jarring #518
|
- Message transitions in encrypted rooms are jarring #518
|
||||||
|
- Images that failed to send are waiting to be sent forever #1145
|
||||||
|
- Fix / Crashed when trying to send a gif from the Gboard #1136
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -177,19 +177,28 @@ class AttachmentsHelper private constructor(private val context: Context,
|
||||||
fun handleShareIntent(intent: Intent): Boolean {
|
fun handleShareIntent(intent: Intent): Boolean {
|
||||||
val type = intent.resolveType(context) ?: return false
|
val type = intent.resolveType(context) ?: return false
|
||||||
if (type.startsWith("image")) {
|
if (type.startsWith("image")) {
|
||||||
imagePicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
imagePicker.submit(safeShareIntent(intent))
|
||||||
} else if (type.startsWith("video")) {
|
} else if (type.startsWith("video")) {
|
||||||
videoPicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
videoPicker.submit(safeShareIntent(intent))
|
||||||
} else if (type.startsWith("audio")) {
|
} else if (type.startsWith("audio")) {
|
||||||
videoPicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
videoPicker.submit(safeShareIntent(intent))
|
||||||
} else if (type.startsWith("application") || type.startsWith("file") || type.startsWith("*")) {
|
} else if (type.startsWith("application") || type.startsWith("file") || type.startsWith("*")) {
|
||||||
filePicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
filePicker.submit(safeShareIntent(intent))
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun safeShareIntent(intent: Intent): Intent {
|
||||||
|
// Work around for getPickerIntentForSharing doing NPE in android 10
|
||||||
|
return try {
|
||||||
|
IntentUtils.getPickerIntentForSharing(intent)
|
||||||
|
} catch (failure: Throwable) {
|
||||||
|
intent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getPickerManagerForRequestCode(requestCode: Int): PickerManager? {
|
private fun getPickerManagerForRequestCode(requestCode: Int): PickerManager? {
|
||||||
return when (requestCode) {
|
return when (requestCode) {
|
||||||
PICK_IMAGE_DEVICE -> imagePicker
|
PICK_IMAGE_DEVICE -> imagePicker
|
||||||
|
|
Loading…
Reference in New Issue