mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-14 06:22:49 +01:00
Avoid trying to open links in invalid Huawei app
This commit is contained in:
parent
75a2110626
commit
e1b1f4f3fc
@ -304,7 +304,7 @@ fun Context.defaultBrowserPackageName(): String? {
|
|||||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://"))
|
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://"))
|
||||||
return packageManager.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY)
|
return packageManager.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY)
|
||||||
?.activityInfo?.packageName
|
?.activityInfo?.packageName
|
||||||
?.takeIf { it != "android" }
|
?.takeUnless { it in DeviceUtil.invalidDefaultBrowsers }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.createFileInCacheDir(name: String): File {
|
fun Context.createFileInCacheDir(name: String): File {
|
||||||
|
@ -35,6 +35,8 @@ object DeviceUtil {
|
|||||||
DynamicColors.isDynamicColorAvailable() || (isSamsung && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
DynamicColors.isDynamicColorAvailable() || (isSamsung && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val invalidDefaultBrowsers = listOf("android", "com.huawei.android.internal.app")
|
||||||
|
|
||||||
@SuppressLint("PrivateApi")
|
@SuppressLint("PrivateApi")
|
||||||
private fun getSystemProperty(key: String?): String? {
|
private fun getSystemProperty(key: String?): String? {
|
||||||
return try {
|
return try {
|
||||||
|
Loading…
Reference in New Issue
Block a user