Skip to content

Commit

Permalink
Ad hoc fix for method activateReaderMode
Browse files Browse the repository at this point in the history
There is no good solution to find the correct method
  • Loading branch information
JingMatrix committed May 21, 2024
1 parent f056566 commit e925720
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/src/main/java/org/matrix/chromext/hook/PageMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ object readerMode {
findFieldOrNull(it::class.java) { type == PageMenuProxy.propertyModel } != null
}!!

val activateReaderMode =
// There exist other methods with the same signatures
findMethod(readerModeManager::class.java) {
parameterTypes.size == 0 && returnType == Void.TYPE && name != "destroy"
readerModeManager::class
.java
.declaredMethods
.filter {
// There exist other methods with the same signatures, which might be tryShowingPrompt
it.parameterTypes.size == 0 &&
!Modifier.isStatic(it.modifiers) &&
it.returnType == Void.TYPE &&
it.name != "destroy"
}

activateReaderMode.invoke(readerModeManager)
.forEach { it.invoke(readerModeManager) }
}
}

Expand Down

0 comments on commit e925720

Please sign in to comment.