Skip to content

Commit

Permalink
Update v0.0.6
Browse files Browse the repository at this point in the history
Merge pull request #4 from ItsMadruga/dev
  • Loading branch information
ItsMadruga authored Jan 7, 2025
2 parents 550022d + 6a00d23 commit 98df6b1
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 55 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ jobs:
run: |
./gradlew assembleRelease
- name: Upload artifacts
uses: actions/upload-artifact@v4
id: upload
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk

- name: Setup NodeJs
uses: actions/[email protected]
with:
Expand All @@ -65,3 +58,10 @@ jobs:

- name: Run Node.js script
run: node index.js

- name: Upload artifacts
uses: actions/upload-artifact@v4
id: upload
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
//noinspection OldTargetApi
targetSdk = 34
versionCode = 1
versionName = "0.0.5"
versionName = "0.0.6"
}

signingConfigs {
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/its/madruga/warevamp/core/Utils.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package its.madruga.warevamp.core;


import static its.madruga.warevamp.module.hooks.core.HooksLoader.mApp;

import android.util.Log;

import its.madruga.warevamp.App;

public class Utils {
Expand All @@ -19,12 +15,4 @@ public static boolean isInstalled(String packageWpp) {
}
return false;
}

public static int getResourceId(String name, String type) {
int id = App.getInstance().getResources().getIdentifier(name, type, App.getInstance().getPackageName());
if (id == 0) {
Log.e("WaRevamp", "Resource not found: " + name);
}
return id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,25 @@ public boolean isMediaFile() {
try {
return mediaMessageClass.isInstance(messageObject);
} catch (Exception e) {
XposedBridge.log(e.getMessage() + " | " + (mediaMessageClass == null ? "MediaMessageClass" : "MessageObject"));
return false;
}
}

public File getMediaFile() {
try {
if (!isMediaFile()) return null;
if (!isMediaFile()) {
XposedBridge.log("Not Media file");
return null;
}
for (var field : mediaMessageClass.getDeclaredFields()) {
if (field.getType().isPrimitive()) continue;
var fileField = ReferencesUtils.getFieldByType(field.getType(), File.class);
if (fileField != null) {
var mediaFile = ReferencesUtils.getObjectField(field, messageObject);
return (File) fileField.get(mediaFile);
} else {
XposedBridge.log("File field is null!!");
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import its.madruga.warevamp.module.hooks.customization.SeparateGroupsHook;
import its.madruga.warevamp.module.hooks.others.MenuHook;
import its.madruga.warevamp.module.hooks.privacy.DndModeHook;
import its.madruga.warevamp.module.hooks.privacy.FreezeLastSeenHook;
import its.madruga.warevamp.module.hooks.privacy.HideReadHook;
import its.madruga.warevamp.module.hooks.privacy.HideReceiptHook;
import its.madruga.warevamp.module.hooks.privacy.HideTypingRecordingHook;
import its.madruga.warevamp.module.references.References;
import its.madruga.warevamp.module.hooks.media.MediaQualityHook;
import its.madruga.warevamp.module.hooks.others.OthersHook;
Expand Down Expand Up @@ -92,7 +94,9 @@ private static void plugins(@NonNull ClassLoader loader, @NonNull XSharedPrefere
HideReadHook.class,
HideArchivedChatsHook.class,
DownloadStatusHook.class,
DownloadViewOnceHook.class
DownloadViewOnceHook.class,
HideTypingRecordingHook.class,
FreezeLastSeenHook.class
};

for (var c : classes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static its.madruga.warevamp.module.references.ModuleResources.string.download_status;
import static its.madruga.warevamp.module.references.References.menuManagerClass;
import static its.madruga.warevamp.module.references.References.menuStatusClickMethod;
import static its.madruga.warevamp.module.references.References.setPageActiveMethod;

import android.media.MediaScannerConnection;
import android.os.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.hookMethod(videoBitrateMethod(loader), new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
param.setResult(40000);
param.setResult(1600000);
}
});
XposedBridge.hookMethod(videoGifBitrateMethod(loader), new XC_MethodReplacement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Objects;

import static its.madruga.warevamp.module.references.References.expirationTimeClass;
import static its.madruga.warevamp.module.references.References.propsMethod;
import static its.madruga.warevamp.module.references.ReferencesUtils.findMethodUsingFilter;

import android.util.Log;

public class OthersHook extends HooksBase {
HashMap<Integer, Boolean> propList;

Expand All @@ -35,12 +30,10 @@ public void doHook() throws Exception {

propList = new HashMap<>();

propList.put(4524, prefs.getBoolean("novoTema", false));

// // Transcrição
// propList.put(8632, true);
// propList.put(2890, true);
// propList.put(9215, true);
// Transcrição
propList.put(8632, true);
propList.put(2890, true);
propList.put(9215, true);

// Novo menu
propList.put(2889, prefs.getBoolean("novoMenu", false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ public DndModeHook(@NonNull @NotNull ClassLoader loader, @NonNull @NotNull XShar
@Override
public void doHook() throws Exception {
super.doHook();
boolean dndMode = prefs.getBoolean("dnd_Mode", false);
boolean dndMode = prefs.getBoolean("dndMode", false);

if(!dndMode) return;
if(dndMode) {
XposedBridge.hookMethod(dndModeMethod(loader), new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
return null;
}
});
}

XposedBridge.hookMethod(dndModeMethod(loader), XC_MethodReplacement.DO_NOTHING);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package its.madruga.warevamp.module.hooks.privacy;

import static its.madruga.warevamp.module.references.References.freezeLastSeenMethod;

import androidx.annotation.NonNull;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import its.madruga.warevamp.module.hooks.core.HooksBase;

public class FreezeLastSeenHook extends HooksBase {
public FreezeLastSeenHook(@NonNull ClassLoader loader, @NonNull XSharedPreferences preferences) {
super(loader, preferences);
}

@Override
public void doHook() throws Exception {
super.doHook();

boolean freeze = prefs.getBoolean("freeze_last_seen", false);

if (!freeze) return;

XposedBridge.hookMethod(freezeLastSeenMethod(loader), new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (freeze) param.setResult(null);
else super.beforeHookedMethod(param);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package its.madruga.warevamp.module.hooks.privacy;

import static its.madruga.warevamp.module.references.References.typingAndRecordingMethod;

import androidx.annotation.NonNull;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import its.madruga.warevamp.module.hooks.core.HooksBase;

public class HideTypingRecordingHook extends HooksBase {
public HideTypingRecordingHook(@NonNull ClassLoader loader, @NonNull XSharedPreferences preferences) {
super(loader, preferences);
}

@Override
public void doHook() throws Exception {
super.doHook();

boolean hide_typing = prefs.getBoolean("hide_typing", false);
boolean hide_recording = prefs.getBoolean("hide_recording", false);

if (!hide_typing && !hide_recording) return;

XposedBridge.hookMethod(typingAndRecordingMethod(loader), new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
var p1 = (int) param.args[2];
if (p1 == 1 && hide_recording) {
param.setResult(null);
return;
}
if (p1 == 0 && hide_typing) {
param.setResult(null);
return;
}
super.beforeHookedMethod(param);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ public synchronized static Method newMessageMethod(ClassLoader loader) throws Ex
.matcher(new MethodMatcher()
.addUsingString("\n")
.returnType(String.class)));
if (methodDataList.isEmpty()) throw new Exception("FMessage method not found");
if (methodDataList.isEmpty()) {
methodDataList = fMessageData.findMethod(new FindMethod()
.matcher(new MethodMatcher()
.paramCount(0)
.returnType(String.class)));
if (methodDataList.isEmpty()) throw new Exception("FMessage method not found");
}
result = methodDataList.get(0).getMethodInstance(loader);
saveMethodPath(result, "newMessageMethod");
return result;
Expand All @@ -180,12 +186,17 @@ public synchronized static Method newMessageWithMediaMethod(ClassLoader loader)
Method result = getMethod("newMessageWithMediaMethod");
if (result != null) return result;
ClassData fMessageData = dexKitBridge.getClassData(FMessageClass(loader));
MethodDataList methodDataList = fMessageData.findMethod(new FindMethod()
MethodDataList methodDataList = dexKitBridge.findMethod(new FindMethod()
.matcher(new MethodMatcher()
.addUsingNumber(0x200000)
.returnType(String.class)));
if (methodDataList.isEmpty()) throw new Exception("FMessage method not found");
result = methodDataList.get(0).getMethodInstance(loader);
.addUsingString("Quoted message chatJid is not specified, parentJid is not a UserJid.", StringMatchType.Contains)
));
for (MethodData m : methodDataList) {
MethodDataList m2 = m.getInvokes();
for (MethodData n : m2) {
if(n.getClassName().equals(fMessageData.getName()) && n.getReturnType().getName().equals(String.class.getName())) result = n.getMethodInstance(loader);
}
}
if (result == null) throw new Exception("newMessageWithMediaMethod not found");
saveMethodPath(result, "newMessageWithMediaMethod");
return result;
}
Expand Down Expand Up @@ -591,7 +602,7 @@ public synchronized static Method pinnedChatsMethod(ClassLoader loader) throws E
public synchronized static Method pinnedHashSetMethod(ClassLoader loader) throws Exception {
Method result = getMethod("pinnedHashSetMethod");
if (result != null) return result;
Class<?> cls = getIns().findClassByString(StringMatchType.Contains, loader, "SELECT jid, pinned_time FROM settings");
Class<?> cls = getIns().findClassByString(StringMatchType.Contains, loader, "getPinnedJids/QUERY");
if (cls == null) throw new Exception("pinnedClassList not found");
result = Arrays.stream(cls.getDeclaredMethods()).filter(m -> m.getReturnType().equals(Set.class)).findFirst().orElse(null);
if (result == null) throw new Exception("pinnedHashSetMethod not found");
Expand Down Expand Up @@ -699,7 +710,7 @@ public synchronized static Method setPageActiveMethod(ClassLoader loader) throws
public synchronized static Method menuStatusClickMethod(ClassLoader loader) throws Exception {
Method result = getMethod("menuStatusClickMethod");
if (result != null) return result;
result = getIns().findMethodByString(StringMatchType.Contains, loader, "chatSettingsStore", "systemFeatures");
result = getIns().findMethodByString(StringMatchType.Contains, loader, "biz_block_header_chat", "Required value was null.");
if (result == null) throw new Exception("menuStatusClickMethod not found");
saveMethodPath(result, "menuStatusClickMethod");
return result;
Expand Down Expand Up @@ -738,6 +749,28 @@ public synchronized static Field menuStyleField(ClassLoader loader) throws Excep
return result;
}

// Hide Typing and Recording

public synchronized static Method typingAndRecordingMethod(ClassLoader loader) throws Exception {
Method result = getMethod("typingAndRecordingMethod");
if (result != null) return result;
result = getIns().findMethodByString(StringMatchType.Contains, loader, "HandleMeComposing/sendComposing; toJid=");
if (result == null) throw new Exception("typingAndRecordingMethod not found");
saveMethodPath(result, "typingAndRecordingMethod");
return result;
}

// Freeze Last Seen

public synchronized static Method freezeLastSeenMethod(ClassLoader loader) throws Exception {
Method result = getMethod("freezeLastSeenMethod");
if (result != null) return result;
result = getIns().findMethodByString(StringMatchType.Contains, loader, "presencestatemanager/setAvailable/new-state:");
if (result == null) throw new Exception("freezeLastSeenMethod not found");
saveMethodPath(result, "freezeLastSeenMethod");
return result;
}

public static void start() {
ins = new References();
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<string name="module_update_summary">Click for more information.</string>
<string name="module_update">Update</string>
<string name="message_deleted">Message Deleted</string>
<string name="privacy_features">Privacy Features</string>
<string name="perso">Customization</string>
<string name="perso_sum">Home Screen • Chat Screen</string>
<string name="general">General</string>
Expand Down Expand Up @@ -73,4 +74,10 @@
<string name="download_viewonce_sum">Create a view once download button.</string>
<string name="disable_secure_flags">Remove FLAG_SECURE from Window</string>
<string name="disable_secure_flags_sum">This function removes the FLAG_SECURE from app windows, allowing unrestricted screenshot and screen recording capabilities.</string>
<string name="hide_recording">Hide Recording Audio</string>
<string name="hide_recording_sum">When active, the person cannot see that you are recording audio.</string>
<string name="hide_typing">Hide Typing</string>
<string name="hide_typing_sum">When active, the person cannot see that you are typing.</string>
<string name="freeze_last_seen">Freeze last seen</string>
<string name="freeze_last_seen_sum">When it\'is enabled, you\'ll don\'t see any presence updates from other users, like typing, recording, online.</string>
</resources>
4 changes: 0 additions & 4 deletions app/src/main/res/xml/perso_general_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<rikka.material.preference.MaterialSwitchPreference
android:title="@string/novotema"
android:summary="@string/novotema_sum"
android:key="novoTema"/>
<rikka.material.preference.MaterialSwitchPreference
android:title="@string/disable_secure_flags"
android:summary="@string/disable_secure_flags_sum"
Expand Down
Loading

0 comments on commit 98df6b1

Please sign in to comment.