Skip to content

Commit

Permalink
Add Voice note Speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod committed Jun 19, 2024
1 parent 50805ff commit 54af819
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static String getContactName(Object userJid) {
var stringField = Arrays.stream(contact.getClass().getDeclaredFields()).filter(f -> f.getType().equals(String.class)).toArray(Field[]::new);
return (String) stringField[3].get(contact);
}
} catch (Exception e) {
} catch (Throwable e) {
XposedBridge.log(e);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ public void doHook() throws Exception {
if (audio_type > 0) {
sendAudioType(audio_type);
}

copieStatusToClipboard();

customPlayBackSpeed();

}
Expand Down Expand Up @@ -203,7 +205,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
var view = (View) param.thisObject;
var playback = (TextView) view.findViewById(Utils.getID("fast_playback_overlay", "id"));
if (playback != null) {
playback.setText(voicenote_speed + "x");
playback.setText(String.valueOf(voicenote_speed).replace(".", ",") + "×");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.wmods.wppenhacer.xposed.core.Utils;
import com.wmods.wppenhacer.xposed.core.WppCore;

import java.util.Objects;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
Expand Down Expand Up @@ -55,19 +57,6 @@ public static void sendTaskerEvent(String number, String event) {
Utils.getApplication().sendBroadcast(intent);
}

public static class SenderMessageBroadcastReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
XposedBridge.log("Message sent");
var number = intent.getStringExtra("number");
var message = intent.getStringExtra("message");
if (number == null || message == null) return;
number = number.replaceAll("\\D", "");
WppCore.sendMessage(number, message);
}
}

public void hookReceiveMessage() throws Throwable {
var method = Unobfuscator.loadReceiptMethod(classLoader);
var method2 = Unobfuscator.loadReceiptOutsideChat(classLoader);
Expand All @@ -88,12 +77,14 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
var messageKey = fieldMessageKey.get(fMessage);
var userJid = XposedHelpers.getObjectField(messageKey, "A00");
var rawJid = WppCore.getRawString(userJid);
var name = WppCore.getContactName(userJid);
var number = WppCore.stripJID(rawJid);
var msg = (String) newMessageMethod.invoke(fMessage);
if (TextUtils.isEmpty(msg) || TextUtils.isEmpty(number)) return;
new Handler(Utils.getApplication().getMainLooper()).post(() -> {
Intent intent = new Intent("com.wmods.wppenhacer.MESSAGE_RECEIVED");
intent.putExtra("number", number);
intent.putExtra("name", name);
intent.putExtra("message", msg);
Utils.getApplication().sendBroadcast(intent);
});
Expand All @@ -102,4 +93,21 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

}

public static class SenderMessageBroadcastReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
XposedBridge.log("Message sent");
var number = intent.getStringExtra("number");
if (number == null) {
number = String.valueOf(intent.getLongExtra("number", 0));
number = Objects.equals(number, "0") ? null : number;
}
var message = intent.getStringExtra("message");
if (number == null || message == null) return;
number = number.replaceAll("\\D", "");
WppCore.sendMessage(number, message);
}
}

}
17 changes: 11 additions & 6 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[STATUS]
* Add copie status caption to clipboard (press and hold on the text)
[MEDIA QUALITY]
* Force use MediaComposer to process videos

[NEW FUNCTION]
* Add a function to change the 2x speed of voice notes to a custom speed (check in Media on Wa Enhancer)


[TASKER]
* Fix %number to support long value (no need "(quote) anymore)
* Add %name to MESSAGE_RECEIVED to show contact name


[BLUE TICK ON REPLY]
* Add sending a blue tick when replying to a status

[STATUS]
* Add button to delete other people's status (NOTE: it will only be deleted for you)

0 comments on commit 54af819

Please sign in to comment.