Skip to content

Commit

Permalink
Support old versions of Samsung browsers
Browse files Browse the repository at this point in the history
An ad hoc fix for #169
  • Loading branch information
JingMatrix committed May 21, 2024
1 parent f070143 commit 69f0311
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/matrix/chromext/Chrome.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ object Chrome {
}

fun updateTab(tab: Any?) {
if (tab != null) {
if (tab != null && tab != getTab()) {
mTab = WeakReference(tab)
if (Chrome.isSamsung) {
val context = findField(UserScriptProxy.tabImpl) { name == "mContext" }
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/org/matrix/chromext/hook/UserScript.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ object UserScriptHook : BaseHook() {
// .hookBefore { Chrome.dropTabModel(it.thisObject) }

if (Chrome.isSamsung) {
findMethod(proxy.tabWebContentsDelegateAndroidImpl) { name == "onDidFinishNavigation" }
findMethod(proxy.tabWebContentsDelegateAndroidImpl) {
name == "onDidFinishNavigation" || name == "updateBrowserControlsState"
}
.hookAfter { Chrome.updateTab(it.thisObject) }

runCatching {
Expand Down
Binary file added base.apk
Binary file not shown.

0 comments on commit 69f0311

Please sign in to comment.