|
|
@ -77,9 +77,9 @@ class DefaultShareIntentHandler @Inject constructor( |
|
|
|
type.isMimeTypeFile() || |
|
|
|
type.isMimeTypeFile() || |
|
|
|
type.isMimeTypeText() || |
|
|
|
type.isMimeTypeText() || |
|
|
|
type.isMimeTypeAny() -> { |
|
|
|
type.isMimeTypeAny() -> { |
|
|
|
val files = getIncomingFiles(intent, type) |
|
|
|
val uris = getIncomingUris(intent, type) |
|
|
|
val result = onUris(files) |
|
|
|
val result = onUris(uris) |
|
|
|
revokeUriPermissions(files.map { it.uri }) |
|
|
|
revokeUriPermissions(uris.map { it.uri }) |
|
|
|
result |
|
|
|
result |
|
|
|
} |
|
|
|
} |
|
|
|
else -> false |
|
|
|
else -> false |
|
|
@ -99,7 +99,7 @@ class DefaultShareIntentHandler @Inject constructor( |
|
|
|
* Use this function to retrieve files which are shared from another application or internally |
|
|
|
* Use this function to retrieve files which are shared from another application or internally |
|
|
|
* by using android.intent.action.SEND or android.intent.action.SEND_MULTIPLE actions. |
|
|
|
* by using android.intent.action.SEND or android.intent.action.SEND_MULTIPLE actions. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun getIncomingFiles(intent: Intent, type: String): List<ShareIntentHandler.UriToShare> { |
|
|
|
private fun getIncomingUris(intent: Intent, type: String): List<ShareIntentHandler.UriToShare> { |
|
|
|
val uriList = mutableListOf<Uri>() |
|
|
|
val uriList = mutableListOf<Uri>() |
|
|
|
if (intent.action == Intent.ACTION_SEND) { |
|
|
|
if (intent.action == Intent.ACTION_SEND) { |
|
|
|
intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM)?.let { uriList.add(it) } |
|
|
|
intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM)?.let { uriList.add(it) } |
|
|
|