Skip to content

Commit

Permalink
Fix critical bug in confirmation to send sticker.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod committed May 2, 2024
1 parent cb86c6c commit 874a929
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public void doHook() throws Exception {
props.put(5509, outlinedIcons);
props.put(2358, false);
props.put(7516, fbstyle);
//
// props.put(3289, false);
// props.put(4905, false);
// props.put(7558, false);
// props.put(1874, false);
// props.put(7724, false);

var methodProps = Unobfuscator.loadPropsMethod(loader);
logDebug(Unobfuscator.getMethodDescriptor(methodProps));
Expand Down Expand Up @@ -181,34 +187,29 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
var sendStickerMethod = Unobfuscator.loadSendStickerMethod(loader);
XposedBridge.hookMethod(sendStickerMethod, new XC_MethodHook() {
private Unhook unhooked;
private View mView;
private View.OnClickListener mCaptureOnClickListener;

@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
unhooked = XposedHelpers.findAndHookMethod(View.class, "setOnClickListener", View.OnClickListener.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
mView = (View) param.thisObject;
mCaptureOnClickListener = (View.OnClickListener) param.args[0];
param.setResult(null);
View.OnClickListener mCaptureOnClickListener = (View.OnClickListener) param.args[0];
if (mCaptureOnClickListener == null) return;
param.args[0] = (View.OnClickListener) view -> {
log("sendSticker");
AlertDialog.Builder dialog = new AlertDialog.Builder(view.getContext());
dialog.setTitle(ResId.string.send_sticker);
dialog.setMessage(ResId.string.do_you_want_to_send_sticker);
dialog.setPositiveButton(ResId.string.send, (dialog1, which) -> mCaptureOnClickListener.onClick(view));
dialog.setNegativeButton(ResId.string.cancel, null);
dialog.show();
};
}
});
}

@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
unhooked.unhook();
if (mView != null && mCaptureOnClickListener != null) {
mView.setOnClickListener((View v) -> {
AlertDialog.Builder dialog = new AlertDialog.Builder(v.getContext());
dialog.setTitle(ResId.string.send_sticker);
dialog.setMessage(ResId.string.do_you_want_to_send_sticker);
dialog.setPositiveButton(ResId.string.send, (dialog1, which) -> mCaptureOnClickListener.onClick(v));
dialog.setNegativeButton(ResId.string.cancel, null);
dialog.show();
});
}
}

});
Expand Down

0 comments on commit 874a929

Please sign in to comment.