capacitor-dex-editor 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,8 +12,11 @@ import com.getcapacitor.JSObject;
|
|
|
12
12
|
import com.getcapacitor.Plugin;
|
|
13
13
|
import com.getcapacitor.PluginCall;
|
|
14
14
|
import com.getcapacitor.PluginMethod;
|
|
15
|
+
import com.getcapacitor.annotation.ActivityCallback;
|
|
15
16
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
16
17
|
|
|
18
|
+
import androidx.activity.result.ActivityResult;
|
|
19
|
+
|
|
17
20
|
import org.json.JSONObject;
|
|
18
21
|
|
|
19
22
|
/**
|
|
@@ -24,10 +27,8 @@ import org.json.JSONObject;
|
|
|
24
27
|
public class DexEditorPluginPlugin extends Plugin {
|
|
25
28
|
|
|
26
29
|
private static final String TAG = "DexEditorPlugin";
|
|
27
|
-
private static final int REQUEST_SMALI_EDITOR = 1001;
|
|
28
30
|
private final DexManager dexManager = new DexManager();
|
|
29
31
|
private final ApkManager apkManager = new ApkManager();
|
|
30
|
-
private PluginCall pendingEditorCall;
|
|
31
32
|
|
|
32
33
|
@Override
|
|
33
34
|
public void load() {
|
|
@@ -583,8 +584,6 @@ public class DexEditorPluginPlugin extends Plugin {
|
|
|
583
584
|
String className = call.getString("className", "");
|
|
584
585
|
boolean readOnly = call.getBoolean("readOnly", false);
|
|
585
586
|
|
|
586
|
-
pendingEditorCall = call;
|
|
587
|
-
|
|
588
587
|
Intent intent = new Intent(getContext(), SmaliEditorActivity.class);
|
|
589
588
|
intent.putExtra(SmaliEditorActivity.EXTRA_CONTENT, content);
|
|
590
589
|
intent.putExtra(SmaliEditorActivity.EXTRA_TITLE, title);
|
|
@@ -594,13 +593,16 @@ public class DexEditorPluginPlugin extends Plugin {
|
|
|
594
593
|
startActivityForResult(call, intent, "handleEditorResult");
|
|
595
594
|
}
|
|
596
595
|
|
|
597
|
-
@
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
596
|
+
@ActivityCallback
|
|
597
|
+
private void handleEditorResult(PluginCall call, ActivityResult activityResult) {
|
|
598
|
+
if (call == null) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
JSObject result = new JSObject();
|
|
603
|
+
if (activityResult.getResultCode() == Activity.RESULT_OK) {
|
|
604
|
+
Intent data = activityResult.getData();
|
|
605
|
+
if (data != null) {
|
|
604
606
|
result.put("success", true);
|
|
605
607
|
result.put("content", data.getStringExtra(SmaliEditorActivity.RESULT_CONTENT));
|
|
606
608
|
result.put("modified", data.getBooleanExtra(SmaliEditorActivity.RESULT_MODIFIED, false));
|
|
@@ -608,8 +610,10 @@ public class DexEditorPluginPlugin extends Plugin {
|
|
|
608
610
|
result.put("success", false);
|
|
609
611
|
result.put("cancelled", true);
|
|
610
612
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
+
} else {
|
|
614
|
+
result.put("success", false);
|
|
615
|
+
result.put("cancelled", true);
|
|
613
616
|
}
|
|
617
|
+
call.resolve(result);
|
|
614
618
|
}
|
|
615
619
|
}
|