Fix multiple share intent issue

This commit is contained in:
Benoit Marty 2020-02-17 17:26:19 +01:00
parent 51bbee297c
commit 002e881704
1 changed files with 12 additions and 10 deletions

View File

@ -76,17 +76,19 @@ class IncomingShareFragment @Inject constructor(
attachmentsHelper = AttachmentsHelper.create(this, this).register()
val intent = vectorBaseActivity.intent
if (intent?.action == Intent.ACTION_SEND || intent?.action == Intent.ACTION_SEND_MULTIPLE) {
var isShareManaged = attachmentsHelper.handleShareIntent(
IntentUtils.getPickerIntentForSharing(intent)
)
if (!isShareManaged) {
isShareManaged = handleTextShare(intent)
val isShareManaged = when (intent?.action) {
Intent.ACTION_SEND -> {
var isShareManaged = attachmentsHelper.handleShareIntent(IntentUtils.getPickerIntentForSharing(intent))
if (!isShareManaged) {
isShareManaged = handleTextShare(intent)
}
isShareManaged
}
if (!isShareManaged) {
cannotManageShare(R.string.error_handling_incoming_share)
}
} else {
Intent.ACTION_SEND_MULTIPLE -> attachmentsHelper.handleShareIntent(intent)
else -> false
}
if (!isShareManaged) {
cannotManageShare(R.string.error_handling_incoming_share)
}