-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dev4Mod <[email protected]>
- Loading branch information
Showing
7 changed files
with
164 additions
and
52 deletions.
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
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
46 changes: 0 additions & 46 deletions
46
app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/HideTagForward.java
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/TagMessage.java
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,93 @@ | ||
package com.wmods.wppenhacer.xposed.features.privacy; | ||
|
||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.wmods.wppenhacer.xposed.core.Feature; | ||
import com.wmods.wppenhacer.xposed.core.components.FMessageWpp; | ||
import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; | ||
import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; | ||
import com.wmods.wppenhacer.xposed.utils.Utils; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XSharedPreferences; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
public class TagMessage extends Feature { | ||
public TagMessage(ClassLoader loader, XSharedPreferences preferences) { | ||
super(loader, preferences); | ||
} | ||
|
||
@Override | ||
public void doHook() throws Exception { | ||
|
||
Method method = Unobfuscator.loadForwardTagMethod(classLoader); | ||
logDebug(Unobfuscator.getMethodDescriptor(method)); | ||
Class<?> forwardClass = Unobfuscator.loadForwardClassMethod(classLoader); | ||
logDebug("ForwardClass: " + forwardClass.getName()); | ||
|
||
XposedBridge.hookMethod(method, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
if (!prefs.getBoolean("hidetag", false)) return; | ||
var arg = (long) param.args[0]; | ||
logDebug("arg: " + arg); | ||
if (arg == 1) { | ||
if (ReflectionUtils.isCalledFromClass(forwardClass)) { | ||
param.args[0] = 0; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
if (prefs.getBoolean("broadcast_tag", false)) { | ||
hookBroadcastView(); | ||
} | ||
} | ||
|
||
private void hookBroadcastView() throws Exception { | ||
Method method1 = Unobfuscator.loadBroadcastTagMethod(classLoader); | ||
|
||
XposedBridge.hookMethod(method1, new XC_MethodHook() { | ||
private FMessageWpp.Key keyObj; | ||
|
||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
keyObj = null; | ||
var fmessage = new FMessageWpp(param.args[0]); | ||
var key = fmessage.getKey(); | ||
if (!key.isFromMe && fmessage.isBroadcast()) { | ||
var view = (ViewGroup) param.thisObject; | ||
var res = view.findViewById((int) param.args[1]); | ||
if (res == null) { | ||
var dateWrapper = (ViewGroup) view.findViewById(Utils.getID("date_wrapper", "id")); | ||
var broadcast = new ImageView(view.getContext()); | ||
broadcast.setId((int) param.args[1]); | ||
dateWrapper.addView(broadcast, 0); | ||
} | ||
key.setIsFromMe(true); | ||
keyObj = key; | ||
} | ||
} | ||
|
||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
if (keyObj != null) { | ||
var find = XposedHelpers.getObjectField(param.thisObject, "A2u"); | ||
keyObj.setIsFromMe(false); | ||
} | ||
} | ||
|
||
}); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getPluginName() { | ||
return "Tag Message"; | ||
} | ||
} |
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