Fix quality issues
This commit is contained in:
parent
050dbdfa7c
commit
0ede5d6626
3 changed files with 4 additions and 5 deletions
|
|
@ -102,18 +102,17 @@ class DefaultShareIntentHandler @Inject constructor(
|
|||
}
|
||||
val resInfoList: List<ResolveInfo> = context.packageManager.queryIntentActivitiesCompat(data, PackageManager.MATCH_DEFAULT_ONLY)
|
||||
uriList.forEach {
|
||||
for (resolveInfo in resInfoList) {
|
||||
resInfoList.forEach resolve@{ resolveInfo ->
|
||||
val packageName: String = resolveInfo.activityInfo.packageName
|
||||
// Replace implicit intent by an explicit to fix crash on some devices like Xiaomi.
|
||||
// see https://juejin.cn/post/7031736325422186510
|
||||
try {
|
||||
context.grantUriPermission(packageName, it, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
} catch (e: Exception) {
|
||||
continue
|
||||
return@resolve
|
||||
}
|
||||
data.action = null
|
||||
data.component = ComponentName(packageName, resolveInfo.activityInfo.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
return uriList.map { uri ->
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 20244 New Vector Ltd
|
||||
* Copyright (c) 2024 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class SharePresenter @AssistedInject constructor(
|
|||
}
|
||||
)
|
||||
if (!result) {
|
||||
throw Exception("Failed to handle incoming share intent")
|
||||
error("Failed to handle incoming share intent")
|
||||
}
|
||||
roomIds
|
||||
}.runCatchingUpdatingState(shareActionState)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue