Skip to content

Commit

Permalink
Merge pull request #15 from ItsMadruga/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Darker935 authored Mar 19, 2024
2 parents 2c794e3 + b272def commit c5bacbf
Show file tree
Hide file tree
Showing 20 changed files with 356 additions and 944 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**English** | [Português](languages/README_PTBR.md)
**English** | [Português](languages/README_PTBR.md) | [Turkish](languages/README_TR.md)

# MdgWa

Expand Down
681 changes: 0 additions & 681 deletions app/src/main/java/es/chiteroman/bootloaderspoofer/XSpoofBl.java

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/java/its/madruga/wpp/ClassesReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,6 @@ public static class ChatsFilter {
public static String methodTabIcon = "A3l";
public static String methodTabInstance = "A1e"; // Method without parameters returning List
public static int nameId = 0x7f120528;
public static int tabIconId = 0x7f0803ce;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void replace(Object view) {
callMethod(view, "setProgressBarColor", parseColor(newPColor));
}

if (newPColor != null) {
if (newPBColor != null) {
callMethod(view, "setProgressBarBackgroundColor", parseColor(newPBColor));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public XAntiRevoke(ClassLoader loader, XSharedPreferences preferences) {
}

private void isMRevoked(Object objMessage, TextView dateTextView, String antirevokeType) {
if (dateTextView == null) return;
var fieldMessageDetails = XposedHelpers.getObjectField(objMessage, fieldMessageKey);
var messageKey = (String) XposedHelpers.getObjectField(fieldMessageDetails, "A01");
var stripJID = stripJID(getJidAuthor(objMessage));
Expand Down Expand Up @@ -80,7 +81,7 @@ private void isMRevoked(Object objMessage, TextView dateTextView, String antirev
@Override
public void doHook() {
mShared = mApp.getSharedPreferences(mApp.getPackageName() + "_mdgwa_preferences", Context.MODE_PRIVATE);
var antirevoke = prefs != null ? prefs.getInt("antirevoke", 0) : 0;
var antirevoke = prefs.getInt("antirevoke", 0);
var antirevokestatus = prefs != null ? prefs.getInt("antirevokestatus", 0) : 0;

// Toast.makeText(mContext, "AR: " + antirevoke + " / ARS: " + antirevokestatus, Toast.LENGTH_SHORT).show();
Expand Down Expand Up @@ -120,7 +121,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
}
XposedHelpers.findAndHookMethod(bubbleViewClass, loader, bubbleViewMethod, ViewGroup.class, TextView.class, classMessage, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) {
var objMessage = param.args[2];
var dateTextView = (TextView) param.args[1];
isMRevoked(objMessage, dateTextView, "antirevoke");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import static its.madruga.wpp.ClassesReference.MediaQuality.vmethod;
import static its.madruga.wpp.ClassesReference.MediaQuality.vmethod2;

import android.graphics.Bitmap;
import android.graphics.RecordingCanvas;
import android.util.Pair;

import java.util.ArrayList;
Expand All @@ -34,53 +36,53 @@ public void doHook() {
if (videoQuality) {
XposedHelpers.findAndHookMethod(vClassQuality, loader, vMethodResolution, int.class, int.class, int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) {
var pair = new Pair<>(param.args[0], param.args[1]);
param.setResult(pair);
}
});

XposedHelpers.findAndHookMethod(vClassQuality, loader, vmethod2, int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) {
param.setResult(1600000);
}
});

XposedHelpers.findAndHookMethod(vClassQuality, loader, vmethod, findClass(vParam1, loader), findClass(vParam2, loader), int.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
protected Object replaceHookedMethod(MethodHookParam param) {
return new Pair<>(true, new ArrayList<>());
}
});
}

if (imageQuality) {
// 6Ex
var iqClass = findClass(imainClass, loader);
XposedHelpers.findAndHookMethod(iqClass, imethod, findClass(iparam1, loader), iqClass, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
int p1 = (int) param.args[2];
if (checkMedia(p1, 1)) {
param.setResult(1000);
}
if (checkMedia(p1, 2)) {
param.setResult(10000);
}
if (checkMedia(p1, 4)) {
param.setResult(100000);
int[] props = {1573, 1575, 1578, 1574, 1576, 1577};
int max = 10000;
int min = 1000;
for (int index = 0; index < props.length; index++) {
if (props[index] == p1) {
if (index <= 2) {
param.setResult(min);
} else {
param.setResult(max);
}
}
}
super.beforeHookedMethod(param);
}
});
}
}

private boolean checkMedia(int i, int i2) {
int[] validValues = {1578, 1575, 1581, 1576, 1574, 1580, 596, 4155, 3659, 3660, 3658, 3306, 3656, 3185, 595, 3655, 3755, 3756, 3757, 3758, 3657};
int index = (i2 - 1) * 3;
return index >= 0 && index < validValues.length && validValues[index] == i;
// Prevent crashes in Media preview
XposedHelpers.findAndHookMethod(RecordingCanvas.class, "throwIfCannotDraw", Bitmap.class, XC_MethodReplacement.DO_NOTHING);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import its.madruga.wpp.ClassesReference;
import its.madruga.wpp.xposed.models.XHookBase;

public class XChatsFilter extends XHookBase {
Expand All @@ -35,6 +36,7 @@ public class XChatsFilter extends XHookBase {
public final int COMMUNITY = 600;
public final int GROUPS = 800;
public final ArrayList<Integer> tabs = new ArrayList<>();
public int tabCount = 0;

public XChatsFilter(ClassLoader loader, XSharedPreferences preferences) {
super(loader, preferences);
Expand Down Expand Up @@ -93,7 +95,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (menu != null) {
var menuItem = (MenuItem) callMethod(menu, "findItem", GROUPS);
if (menuItem != null) {
menuItem.setIcon(0x7f0803ce);
menuItem.setIcon(ClassesReference.ChatsFilter.tabIconId);
}
}
}
Expand Down Expand Up @@ -132,7 +134,24 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.findAndHookMethod(convFragmentClass.getName(), convFragmentClass.getClassLoader(), methodTabInstance, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
var isGroup = (boolean) XposedHelpers.getAdditionalInstanceField(param.thisObject, "isGroup");
var isGroup = false;
var isGroupField = XposedHelpers.getAdditionalInstanceField(param.thisObject, "isGroup");

// Temp fix for
if (isGroupField == null) {
XposedBridge.log("-----------------------------------");
XposedBridge.log("isGroupTabCount: " + tabCount);
XposedBridge.log("isGroupTabField: " + (isGroupField != null));
XposedBridge.log("isGroupTabCount >= 2: " + (tabCount >= 2));
XposedBridge.log("-----------------------------------");
isGroup = tabCount >= 2;
tabCount++;
if (tabCount == 4) tabCount = 0;
} else {
isGroup = (boolean) isGroupField;
}
XposedBridge.log("[•] isGroup: " + isGroup);

var chatsList = (List) param.getResult();
var editableChatList = new ArrayList<>();
var requiredServer = isGroup ? "g.us" : "s.whatsapp.net";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package its.madruga.wpp.xposed.plugins.privacy;

import static its.madruga.wpp.ClassesReference.GhostMode.methodName;
import static its.madruga.wpp.ClassesReference.GhostMode.param1;
import static its.madruga.wpp.ClassesReference.GhostMode.param2;

import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedHelpers;
import its.madruga.wpp.ClassesReference;
import its.madruga.wpp.xposed.models.XHookBase;

public class XGhostMode extends XHookBase {
Expand All @@ -20,13 +20,23 @@ public void doHook() {
Class<?> class1 = XposedHelpers.findClass(param1, loader);
Class<?> class2 = XposedHelpers.findClass(param2, loader);

var ghostmode = prefs.getBoolean("ghostmode", false);
if (!ghostmode) return;
var ghostmode_t = prefs.getBoolean("ghostmode_t", false);
var ghostmode_r = prefs.getBoolean("ghostmode_r", false);

XposedHelpers.findAndHookMethod(class1, ClassesReference.GhostMode.methodName, class1, class2, int.class, new XC_MethodReplacement() {

XposedHelpers.findAndHookMethod(class1, methodName, class1, class2, int.class, new XC_MethodHook() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) {
return null;
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
var p1 = (int) param.args[2];
if (p1 == 1 && ghostmode_r) {
param.setResult(null);
return;
}
if (p1 == 0 && ghostmode_t) {
param.setResult(null);
return;
}
super.beforeHookedMethod(param);
}
});
}
Expand Down
25 changes: 0 additions & 25 deletions app/src/main/res/layout/activity_functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,5 @@
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
app:cardCornerRadius="15dp"
app:cardElevation="1dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<its.madruga.wpp.views.SwitchButtonTop
android:id="@+id/removeforwardlimit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:summary="@string/removeforwardlimit_sum"
android:tag="removeforwardlimit"
android:text="@string/removeforwardlimit"
android:title="@string/forward" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>


</LinearLayout>
</ScrollView>
19 changes: 17 additions & 2 deletions app/src/main/res/layout/activity_functions_privacy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
android:text="@string/hidetag"
android:title="@string/privacy_title" />

<its.madruga.wpp.views.SwitchButton
android:id="@+id/removeforwardlimit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:summary="@string/removeforwardlimit_sum"
android:tag="removeforwardlimit"
android:text="@string/removeforwardlimit" />

<its.madruga.wpp.views.SwitchButton
android:id="@+id/freezelastseen"
android:layout_width="match_parent"
Expand Down Expand Up @@ -83,12 +91,19 @@
android:text="@string/hidereceipt" />

<its.madruga.wpp.views.SwitchButton
android:id="@+id/ghostmode"
android:id="@+id/ghostmode_t"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:summary="@string/ghostmode_sum"
android:tag="ghostmode"
android:tag="ghostmode_t"
android:text="@string/ghostmode" />
<its.madruga.wpp.views.SwitchButton
android:id="@+id/ghostmode_r"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:summary="@string/ghostmode_sum_r"
android:tag="ghostmode_r"
android:text="@string/ghostmode_r" />

<its.madruga.wpp.views.SwitchButton
android:id="@+id/viewonce"
Expand Down
Loading

0 comments on commit c5bacbf

Please sign in to comment.