Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
feat: prevent auto refreshing of personalized page
Browse files Browse the repository at this point in the history
  • Loading branch information
mkx173 committed May 9, 2024
1 parent 6bbd819 commit baa9d92
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/gm/tieba/tabswitch/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import gm.tieba.tabswitch.hooker.eliminate.PurgeVideo
import gm.tieba.tabswitch.hooker.eliminate.RedTip
import gm.tieba.tabswitch.hooker.eliminate.RemoveUpdate
import gm.tieba.tabswitch.hooker.eliminate.UserFilter
import gm.tieba.tabswitch.hooker.extra.AutoRefresh
import gm.tieba.tabswitch.hooker.extra.ForbidGesture
import gm.tieba.tabswitch.hooker.extra.Hide
import gm.tieba.tabswitch.hooker.extra.StackTrace
Expand Down Expand Up @@ -164,7 +165,8 @@ class XposedInit : XposedContext(), IXposedHookZygoteInit, IXposedHookLoadPackag
PurgeVideo(),
SelectClipboard(),
UserFilter(),
TransitionAnimation()
TransitionAnimation(),
AutoRefresh()
)
val matchers = ArrayList<Obfuscated>(hookers.size + 1)
matchers.add(TbToast())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class TSPreference : XposedContext(), IHooker, Obfuscated {
preferenceLayout.addView(SwitchButtonHolder(activity, "禁用帖子手势", "forbid_gesture", SwitchButtonHolder.TYPE_SWITCH))
preferenceLayout.addView(SwitchButtonHolder(activity, "用赞踩差数代替赞数", "agree_num", SwitchButtonHolder.TYPE_SWITCH))
preferenceLayout.addView(SwitchButtonHolder(activity, "禁止检测通知开启状态", "notification_detect", SwitchButtonHolder.TYPE_SWITCH))
preferenceLayout.addView(SwitchButtonHolder(activity, "禁止首页自动刷新", "auto_refresh", SwitchButtonHolder.TYPE_SWITCH))

preferenceLayout.addView(createButton(TRACE, "希望有一天不再需要贴吧TS", true) { _ ->
activity.startActivity(Intent().apply {
Expand Down
36 changes: 36 additions & 0 deletions app/src/main/java/gm/tieba/tabswitch/hooker/extra/AutoRefresh.kt
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 } }
}
}
}

0 comments on commit baa9d92

Please sign in to comment.