Skip to content

Commit

Permalink
Still use internal browser for official domains
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Aug 28, 2022
1 parent d6779c3 commit 830b5a5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,12 +26,17 @@ 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
}
}
}
}
}
companion object {
val whileListDomain = Regex(""".*bilibili\.com|.*b23\.tv""")
}
}

0 comments on commit 830b5a5

Please sign in to comment.