This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prevent auto refreshing of personalized page
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/src/main/java/gm/tieba/tabswitch/hooker/extra/AutoRefresh.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package gm.tieba.tabswitch.hooker.extra | ||
|
||
import de.robv.android.xposed.XposedHelpers | ||
import gm.tieba.tabswitch.XposedContext | ||
import gm.tieba.tabswitch.dao.AcRules.findRule | ||
import gm.tieba.tabswitch.hooker.IHooker | ||
import gm.tieba.tabswitch.hooker.Obfuscated | ||
import gm.tieba.tabswitch.hooker.deobfuscation.Matcher | ||
import gm.tieba.tabswitch.hooker.deobfuscation.StringMatcher | ||
|
||
class AutoRefresh : XposedContext(), IHooker, Obfuscated { | ||
|
||
override fun key(): String { | ||
return "auto_refresh" | ||
} | ||
|
||
override fun matchers(): List<Matcher> { | ||
return listOf( | ||
StringMatcher("recommend_frs_refresh_time") | ||
) | ||
} | ||
|
||
override fun hook() { | ||
findRule(matchers()) { _, clazz, method -> | ||
val md = XposedHelpers.findMethodExactIfExists( | ||
findClass(clazz), | ||
method, | ||
Boolean::class.javaPrimitiveType | ||
) ?: XposedHelpers.findMethodExactIfExists( | ||
findClass(clazz), | ||
method | ||
) | ||
md?.let { hookReplaceMethod(it) { false } } | ||
} | ||
} | ||
} |