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