Skip to content

Commit

Permalink
Find AppMenuPropertiesDelegate and loadUrlParams
Browse files Browse the repository at this point in the history
The class AppMenuPropertiesDelegate is abstract after Chrome v123.
Close #149 as completed.
  • Loading branch information
JingMatrix committed Feb 6, 2024
1 parent 05a267f commit 6b672a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/org/matrix/chromext/hook/PageMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.View
import android.widget.ImageButton
import android.widget.LinearLayout
import de.robv.android.xposed.XC_MethodHook.Unhook
import java.lang.reflect.Modifier
import java.util.ArrayList
import org.matrix.chromext.Chrome
import org.matrix.chromext.Listener
Expand Down Expand Up @@ -102,8 +103,10 @@ object PageMenuHook : BaseHook() {
findMenuHook =
findMethod(proxy.chromeTabbedActivity) {
parameterTypes.size == 0 &&
returnType.isInterface() &&
returnType.declaredMethods.size >= 6
returnType.declaredMethods.size >= 6 &&
(returnType.declaredFields.size == 0 ||
returnType.declaredFields.find { it.type == Context::class.java } != null) &&
(returnType.isInterface() || Modifier.isAbstract(returnType.modifiers))
}
// public AppMenuPropertiesDelegate createAppMenuPropertiesDelegate()
.hookAfter {
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/java/org/matrix/chromext/proxy/UserScript.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ object UserScriptProxy {
val loadUrl =
findMethod(tabImpl) {
parameterTypes contentDeepEquals arrayOf(loadUrlParams) &&
returnType ==
if (Chrome.isSamsung) {
Void.TYPE
} else {
Int::class.java
}
(Chrome.isSamsung || returnType != Void.TYPE)
}

val kMaxURLChars = 2097152
Expand Down

0 comments on commit 6b672a6

Please sign in to comment.