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

Commit

Permalink
feat: remove live ad thread
Browse files Browse the repository at this point in the history
  • Loading branch information
mkx173 committed Feb 17, 2024
1 parent a829e3f commit dbb8965
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/src/main/java/gm/tieba/tabswitch/hooker/eliminate/Purge.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,13 @@ protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
XposedHelpers.setObjectField(param.thisObject, "star_enter", new ArrayList<>());

final List<?> threadList = (List<?>) XposedHelpers.getObjectField(param.thisObject, "thread_list");
if (threadList == null) return;

// 话题贴
threadList.removeIf(o -> (Integer) XposedHelpers.getObjectField(o, "thread_type") == 41);
if (threadList != null) {
// 吧页面头条贴(41), 直播贴(69)
threadList.removeIf(o -> {
var threadType = (Integer) XposedHelpers.getObjectField(o, "thread_type");
return threadType == 41 || threadType == 69;
});
}

// 万人直播互动 吧友开黑组队中
XposedHelpers.setObjectField(param.thisObject, "live_fuse_forum", new ArrayList<>());
Expand Down Expand Up @@ -380,7 +383,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
});
}
});
// 吧页面头条贴
// 吧页面头条贴(41), 直播贴(69)
XposedHelpers.findAndHookMethod("tbclient.FrsPage.PageData$Builder", sClassLoader, "build", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
Expand All @@ -393,7 +396,8 @@ protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
List<?> businessInfo = (List<?>) XposedHelpers.getObjectField(currFeed, "business_info");
for (var feedKV : businessInfo) {
if (XposedHelpers.getObjectField(feedKV, "key").toString().equals("thread_type")) {
return XposedHelpers.getObjectField(feedKV, "value").toString().equals("41");
var threadType = XposedHelpers.getObjectField(feedKV, "value").toString();
return threadType.equals("41") || threadType.equals("69");
}
}
}
Expand Down

0 comments on commit dbb8965

Please sign in to comment.