From 830b5a595a7c6897c827559d9ddcf5a4e35638fa Mon Sep 17 00:00:00 2001 From: LoveSy Date: Mon, 29 Aug 2022 00:23:07 +0800 Subject: [PATCH] Still use internal browser for official domains --- .../java/me/iacn/biliroaming/hook/StartActivityHook.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/me/iacn/biliroaming/hook/StartActivityHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/StartActivityHook.kt index e55e2df600..69ff45db7f 100644 --- a/app/src/main/java/me/iacn/biliroaming/hook/StartActivityHook.kt +++ b/app/src/main/java/me/iacn/biliroaming/hook/StartActivityHook.kt @@ -4,6 +4,7 @@ import android.app.Instrumentation import android.content.ComponentName import android.content.Intent import android.net.Uri +import me.iacn.biliroaming.utils.Log import me.iacn.biliroaming.utils.hookBeforeAllMethods import me.iacn.biliroaming.utils.packageName import me.iacn.biliroaming.utils.sPrefs @@ -25,7 +26,9 @@ class StartActivityHook(classLoader: ClassLoader) : BaseHook(classLoader) { intent.data = Uri.parse(uri.replace("bilibili://story/", "bilibili://video/")) } if (sPrefs.getBoolean("force_browser", false)) { - if (intent.component?.className?.endsWith("MWebActivity") == true) { + if (intent.component?.className?.endsWith("MWebActivity") == true && + intent.data?.authority?.matches(whileListDomain) == false) { + Log.d("force_browser ${intent.data?.authority}") param.args[4] = Intent(Intent.ACTION_VIEW).apply { data = intent.data } @@ -33,4 +36,7 @@ class StartActivityHook(classLoader: ClassLoader) : BaseHook(classLoader) { } } } + companion object { + val whileListDomain = Regex(""".*bilibili\.com|.*b23\.tv""") + } }