Skip to content

Commit

Permalink
Support org.chromium.chrome v129
Browse files Browse the repository at this point in the history
Close #181 as completed
  • Loading branch information
JingMatrix committed Jul 30, 2024
1 parent ff35a9e commit c4f857f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/org/matrix/chromext/MainHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ val supportedPackages =
"com.vivaldi.browser",
"com.vivaldi.browser.snapshot",
"org.bromite.bromite",
"org.chromium.chrome",
"org.chromium.thorium",
"org.cromite.cromite",
"org.greatfire.freebrowser",
Expand Down
8 changes: 6 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 @@ -115,7 +115,9 @@ object PageMenuHook : BaseHook() {
it.returnType == Bundle::class.java && it.parameterTypes.size == 1
} != null) &&
(returnType.declaredFields.size == 0 ||
returnType.declaredFields.find { it.type == Context::class.java } != null) &&
returnType.declaredFields.find {
Context::class.java.isAssignableFrom(it.type)
} != null) &&
(returnType.isInterface() || Modifier.isAbstract(returnType.modifiers))
}
// public AppMenuPropertiesDelegate createAppMenuPropertiesDelegate()
Expand All @@ -124,7 +126,9 @@ object PageMenuHook : BaseHook() {
val appMenuPropertiesDelegateImpl = it.result::class.java.superclass as Class<*>
// Can be found by searching `Android.PrepareMenu`
val mContext =
findField(appMenuPropertiesDelegateImpl, true) { type == Context::class.java }
findField(appMenuPropertiesDelegateImpl, true) {
Context::class.java.isAssignableFrom(type)
}
mContext.setAccessible(true)
val mActivityTabProvider =
findField(appMenuPropertiesDelegateImpl, true) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<item>com.vivaldi.browser</item>
<item>com.vivaldi.browser.snapshot</item>
<item>org.bromite.bromite</item>
<item>org.chromium.chrome</item>
<item>org.chromium.thorium</item>
<item>org.cromite.cromite</item>
<item>org.greatfire.freebrowser</item>
Expand Down

0 comments on commit c4f857f

Please sign in to comment.