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

Commit

Permalink
disable location request dialog
Browse files Browse the repository at this point in the history
inline array
bump version
  • Loading branch information
GreenMushroomNew committed Mar 20, 2021
1 parent 77ebb08 commit 97beb86
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 85 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 23
targetSdkVersion 30
versionCode 9
versionName "2.3-beta"
versionName "2.3"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
multiDexEnabled false
ndk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public class AntiConfusion extends Hook {
private static final String springboardActivity = "com.baidu.tieba.tblauncher.MainTabActivity";

public static void hook(ClassLoader classLoader) throws Throwable {
Method[] methods = classLoader.loadClass("com.baidu.tieba.LogoActivity").getDeclaredMethods();
for (Method method : methods)
for (Method method : classLoader.loadClass("com.baidu.tieba.LogoActivity").getDeclaredMethods())
if (Arrays.toString(method.getParameterTypes()).equals("[class android.os.Bundle]") && !method.getName().startsWith("on"))
XposedBridge.hookMethod(method, new XC_MethodReplacement() {
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
Expand Down Expand Up @@ -159,6 +158,11 @@ else if (AntiConfusionHelper.getLostList().size() == 0)
IO.deleteFiles(new File(activity.getCacheDir().getAbsolutePath() + "image"));
IO.deleteFiles(new File(activity.getFilesDir().getAbsolutePath() + File.separator + "newStat" + File.separator + "notUpload"));
} else IO.deleteFiles(dexDir);
if (tsPreference.getBoolean("purify", false)) {
SharedPreferences.Editor settingsEditor = activity.getSharedPreferences("settings", Context.MODE_PRIVATE).edit();
settingsEditor.putString("key_location_request_dialog_last_show_version", AntiConfusionHelper.getTbVersion(activity));
settingsEditor.commit();
}
XposedBridge.log("anti-confusion accomplished, current version: " + AntiConfusionHelper.getTbVersion(activity));
AntiConfusionHelper.saveAndRestart(activity, AntiConfusionHelper.getTbVersion(activity), classLoader.loadClass(springboardActivity));
} catch (Throwable throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public static void hook(ClassLoader classLoader) throws Throwable {
if (Objects.equals(map.get("rule"), "Lcom/baidu/tieba/R$id;->navigationBarGoSignall:I"))
XposedHelpers.findAndHookMethod(map.get("class"), classLoader, map.get("method"), Bundle.class, new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof ImageView) {
ImageView signButton = (ImageView) field.get(param.thisObject);
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/gm/tieba/tabswitch/hookImpl/FontSize.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public static void hook(ClassLoader classLoader) throws Throwable {
XposedBridge.hookAllConstructors(XposedHelpers.findClass(map.get("class"), classLoader), new XC_MethodHook() {
@SuppressLint("ClickableViewAccessibility")
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof RelativeLayout) {
RelativeLayout relativeLayout = (RelativeLayout) field.get(param.thisObject);
Expand All @@ -41,8 +40,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.findAndHookMethod("com.baidu.tieba.pb.videopb.fragment.DetailInfoAndReplyFragment", classLoader, "onCreateView", LayoutInflater.class, ViewGroup.class, Bundle.class, new XC_MethodHook() {
@SuppressLint("ClickableViewAccessibility")
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject).getClass().getName().equals("com.baidu.adp.widget.ListView.BdTypeRecyclerView")) {
ViewGroup recyclerView = (ViewGroup) field.get(param.thisObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Activity activity = (Activity) param.thisObject;
Object mNavigationBar = Reflect.getObjectField(param.thisObject, "com.baidu.tbadk.core.view.NavigationBar");
Class<?> ControlAlign = classLoader.loadClass("com.baidu.tbadk.core.view.NavigationBar$ControlAlign");
Object[] enums = ControlAlign.getEnumConstants();
for (Object HORIZONTAL_RIGHT : enums)
for (Object HORIZONTAL_RIGHT : ControlAlign.getEnumConstants())
if (HORIZONTAL_RIGHT.toString().equals("HORIZONTAL_RIGHT")) {
Class<?> NavigationBar = classLoader.loadClass("com.baidu.tbadk.core.view.NavigationBar");
TextView textView = (TextView) NavigationBar.getDeclaredMethod("addTextButton", ControlAlign, String.class, View.OnClickListener.class)
Expand All @@ -47,8 +46,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
}
});
Method[] methods = classLoader.loadClass("com.baidu.tieba.myCollection.history.PbHistoryActivity").getDeclaredMethods();
for (Method method : methods)
for (Method method : classLoader.loadClass("com.baidu.tieba.myCollection.history.PbHistoryActivity").getDeclaredMethods())
if (Arrays.toString(method.getParameterTypes()).equals("[interface java.util.List]"))
XposedBridge.hookMethod(method, new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/gm/tieba/tabswitch/hookImpl/NewSub.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Activity activity = (Activity) Reflect.getObjectField(param.thisObject, "com.baidu.tieba.pb.pb.sub.NewSubPbActivity");
Object mNavigationBar = Reflect.getObjectField(param.thisObject, "com.baidu.tbadk.core.view.NavigationBar");
Class<?> ControlAlign = classLoader.loadClass("com.baidu.tbadk.core.view.NavigationBar$ControlAlign");
Object[] enums = ControlAlign.getEnumConstants();
for (Object HORIZONTAL_RIGHT : enums)
for (Object HORIZONTAL_RIGHT : ControlAlign.getEnumConstants())
if (HORIZONTAL_RIGHT.toString().equals("HORIZONTAL_RIGHT")) {
Class<?> NavigationBar = classLoader.loadClass("com.baidu.tbadk.core.view.NavigationBar");
TextView textView = (TextView) NavigationBar.getDeclaredMethod("addTextButton", ControlAlign, String.class, View.OnClickListener.class)
Expand Down
52 changes: 22 additions & 30 deletions app/src/main/java/gm/tieba/tabswitch/hookImpl/Purify.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,19 @@ public static void hook(ClassLoader classLoader) throws Throwable {
XposedBridge.hookAllMethods(XposedHelpers.findClass(map.get("class"), classLoader), map.get("method"), XC_MethodReplacement.returnConstant(null));
break;
case "\"pic_amount\""://图片广告:必须"recom_ala_info", "app", 可选"goods_info"
Method[] alas = classLoader.loadClass(map.get("class")).getDeclaredMethods();
for (Method ala : alas)
if (Arrays.toString(ala.getParameterTypes()).contains("JSONObject") && !ala.getName().equals(map.get("method")))
XposedBridge.hookMethod(ala, XC_MethodReplacement.returnConstant(null));
for (Method method : classLoader.loadClass(map.get("class")).getDeclaredMethods())
if (Arrays.toString(method.getParameterTypes()).contains("JSONObject") && !method.getName().equals(map.get("method")))
XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(null));
break;
case "\"key_frs_dialog_ad_last_show_time\""://吧推广弹窗
Method[] dialogs = classLoader.loadClass(map.get("class")).getDeclaredMethods();
for (Method dialog : dialogs)
if (dialog.getName().equals(map.get("method")) && dialog.getReturnType().toString().equals("boolean"))
XposedBridge.hookMethod(dialog, XC_MethodReplacement.returnConstant(true));
for (Method method : classLoader.loadClass(map.get("class")).getDeclaredMethods())
if (method.getName().equals(map.get("method")) && method.getReturnType().toString().equals("boolean"))
XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(true));
break;
case "Lcom/baidu/tieba/R$id;->frs_ad_banner:I"://吧推广横幅
Method[] banners = classLoader.loadClass(map.get("class")).getDeclaredMethods();
for (Method banner : banners)
if (Arrays.toString(banner.getParameterTypes()).startsWith("[interface java.util.List, class "))
XposedBridge.hookMethod(banner, new XC_MethodHook() {
for (Method method : classLoader.loadClass(map.get("class")).getDeclaredMethods())
if (Arrays.toString(method.getParameterTypes()).startsWith("[interface java.util.List, class "))
XposedBridge.hookMethod(method, new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[1] = null;
}
Expand Down Expand Up @@ -87,12 +84,11 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.findAndHookConstructor("com.baidu.mobads.vo.XAdInstanceInfo", classLoader, JSONObject.class, XC_MethodReplacement.returnConstant(null));
//广告sdk:"gdt_plugin.jar", "/api/ad/union/sdk/get_ads/"
try {
Method[] funs = classLoader.loadClass("com.fun.ad.sdk.FunAdSdk").getDeclaredMethods();
for (Method fun : funs)
if (fun.getName().equals("init"))
if (fun.getReturnType().toString().equals("void"))
XposedBridge.hookMethod(fun, XC_MethodReplacement.returnConstant(null));
else XposedBridge.hookMethod(fun, XC_MethodReplacement.returnConstant(true));
for (Method method : classLoader.loadClass("com.fun.ad.sdk.FunAdSdk").getDeclaredMethods())
if (method.getName().equals("init"))
if (method.getReturnType().toString().equals("void"))
XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(null));
else XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(true));
} catch (ClassNotFoundException ignored) {
}
//帖子直播推荐:在com/baidu/tieba/pb/pb/main/包搜索tbclient/AlaLiveInfo
Expand All @@ -103,10 +99,9 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
});
//首页直播推荐卡片:搜索card_home_page_ala_live_item_new,会有两个结果,查找后一个结果所在类构造函数调用
try {
Method[] alas = classLoader.loadClass("com.baidu.tieba.homepage.personalize.adapter.HomePageAlaLiveThreadAdapter").getDeclaredMethods();
for (Method ala : alas)
if (ala.getReturnType().toString().endsWith("HomePageAlaLiveThreadViewHolder"))
XposedBridge.hookMethod(ala, XC_MethodReplacement.returnConstant(null));
for (Method method : classLoader.loadClass("com.baidu.tieba.homepage.personalize.adapter.HomePageAlaLiveThreadAdapter").getDeclaredMethods())
if (method.getReturnType().toString().endsWith("HomePageAlaLiveThreadViewHolder"))
XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(null));
} catch (ClassNotFoundException ignored) {
}
//首页不属于任何吧的视频
Expand All @@ -124,8 +119,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
//欢迎页
XposedHelpers.findAndHookMethod("com.baidu.tieba.launcherGuide.tblauncher.GuideActivity", classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof int[]) {
int[] ints = (int[]) field.get(param.thisObject);
Expand Down Expand Up @@ -157,15 +151,13 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});
//你可能感兴趣的人:initUI
Method[] concerns = classLoader.loadClass("com.baidu.tieba.homepage.concern.view.ConcernRecommendLayout").getDeclaredMethods();
for (Method concern : concerns)
if (Arrays.toString(concern.getParameterTypes()).equals("[]"))
XposedBridge.hookMethod(concern, XC_MethodReplacement.returnConstant(null));
for (Method method : classLoader.loadClass("com.baidu.tieba.homepage.concern.view.ConcernRecommendLayout").getDeclaredMethods())
if (Arrays.toString(method.getParameterTypes()).equals("[]"))
XposedBridge.hookMethod(method, XC_MethodReplacement.returnConstant(null));
//首页任务中心:R.id.task
XposedHelpers.findAndHookMethod("com.baidu.tieba.homepage.framework.indicator.NestedScrollHeader", classLoader, "onAttachedToWindow", new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof ImageView) {
ImageView imageView = (ImageView) field.get(param.thisObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import gm.tieba.tabswitch.Hook;
import gm.tieba.tabswitch.util.DisplayHelper;

Expand All @@ -31,8 +30,7 @@ public static void hook(ClassLoader classLoader) throws Throwable {
case "Lcom/baidu/tieba/R$id;->create_bar_container:I"://创建自己的吧
XposedBridge.hookAllConstructors(XposedHelpers.findClass(map.get("class"), classLoader), new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof View) {
View view = (View) field.get(param.thisObject);
Expand All @@ -56,8 +54,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
XposedBridge.hookMethod(method, new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Field[] fields = param.thisObject.getClass().getDeclaredFields();
for (Field field : fields) {
for (Field field : param.thisObject.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(param.thisObject) instanceof View) {
View view = (View) field.get(param.thisObject);
Expand Down
Loading

0 comments on commit 97beb86

Please sign in to comment.