Call openFile instead of open and avoid unwrapping the Activity context.

This commit is contained in:
Benoit Marty
2023-09-26 15:01:30 +02:00
committed by Benoit Marty
parent 9a74948536
commit 7d12425a6f

View File

@@ -72,7 +72,7 @@ class AndroidLocalMediaActions @Inject constructor(
if (activityResult.resultCode == Activity.RESULT_OK) {
pendingMedia?.let {
coroutineScope.launch {
open(it)
openFile(it)
}
}
} else {
@@ -152,7 +152,7 @@ class AndroidLocalMediaActions @Inject constructor(
.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.setDataAndType(localMedia.toShareableUri(), localMedia.info.mimeType)
withContext(coroutineDispatchers.main) {
activityContext!!.startActivity(openMediaIntent)
activityContext?.startActivity(openMediaIntent)
}
}