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

Commit

Permalink
feat: disable notification status check
Browse files Browse the repository at this point in the history
  • Loading branch information
mkx173 committed Mar 13, 2024
1 parent bf9edd8 commit 7c0eb75
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/gm/tieba/tabswitch/XposedInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import gm.tieba.tabswitch.hooker.auto.AutoSign;
import gm.tieba.tabswitch.hooker.auto.FrsTab;
import gm.tieba.tabswitch.hooker.auto.MsgCenterTab;
import gm.tieba.tabswitch.hooker.auto.NotificationDetect;
import gm.tieba.tabswitch.hooker.auto.OpenSign;
import gm.tieba.tabswitch.hooker.auto.OriginSrc;
import gm.tieba.tabswitch.hooker.deobfuscation.DeobfuscationHelper;
Expand Down Expand Up @@ -150,7 +151,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
new StackTrace(),
new RemoveUpdate(),
new FoldTopCardView(),
new MsgCenterTab()
new MsgCenterTab(),
new NotificationDetect()
);
final var matchers = new ArrayList<Obfuscated>(hookers.size() + 2);
matchers.add(new TbDialog());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ private LinearLayout createRootPreference(final Activity activity) {
preferenceLayout.addView(TSPreferenceHelper.createTextView(isPurgeEnabled ? "奇怪怪" : "其它"));
preferenceLayout.addView(new SwitchButtonHolder(activity, "禁用帖子手势", "forbid_gesture", SwitchButtonHolder.TYPE_SWITCH));
preferenceLayout.addView(new SwitchButtonHolder(activity, "用赞踩差数代替赞数", "agree_num", SwitchButtonHolder.TYPE_SWITCH));
preferenceLayout.addView(new SwitchButtonHolder(activity, "禁止检测通知开启状态", "notification_detect", SwitchButtonHolder.TYPE_SWITCH));
preferenceLayout.addView(TSPreferenceHelper.createButton(TRACE, "希望有一天不再需要贴吧TS", true, v -> {
final Intent intent = new Intent().setClassName(activity, PROXY_ACTIVITY);
intent.putExtra("proxyPage", TRACE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package gm.tieba.tabswitch.hooker.auto;

import androidx.annotation.NonNull;

import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedHelpers;
import gm.tieba.tabswitch.XposedContext;
import gm.tieba.tabswitch.hooker.IHooker;

public class NotificationDetect extends XposedContext implements IHooker {
@NonNull
@Override
public String key() {
return "notification_detect";
}

public void hook() throws Throwable {
// 禁止检测通知开启状态
XposedHelpers.findAndHookMethod(
"androidx.core.app.NotificationManagerCompat",
sClassLoader,
"areNotificationsEnabled",
XC_MethodReplacement.returnConstant(true)
);
}
}

0 comments on commit 7c0eb75

Please sign in to comment.