mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
parent
eb74523905
commit
067a22883c
@ -8,7 +8,9 @@ Improvements 🙌:
|
||||
- Implementation of /join command
|
||||
|
||||
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 🗣:
|
||||
-
|
||||
|
@ -177,19 +177,28 @@ class AttachmentsHelper private constructor(private val context: Context,
|
||||
fun handleShareIntent(intent: Intent): Boolean {
|
||||
val type = intent.resolveType(context) ?: return false
|
||||
if (type.startsWith("image")) {
|
||||
imagePicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
||||
imagePicker.submit(safeShareIntent(intent))
|
||||
} else if (type.startsWith("video")) {
|
||||
videoPicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
||||
videoPicker.submit(safeShareIntent(intent))
|
||||
} else if (type.startsWith("audio")) {
|
||||
videoPicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
||||
videoPicker.submit(safeShareIntent(intent))
|
||||
} else if (type.startsWith("application") || type.startsWith("file") || type.startsWith("*")) {
|
||||
filePicker.submit(IntentUtils.getPickerIntentForSharing(intent))
|
||||
filePicker.submit(safeShareIntent(intent))
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
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? {
|
||||
return when (requestCode) {
|
||||
PICK_IMAGE_DEVICE -> imagePicker
|
||||
|
Loading…
Reference in New Issue
Block a user