|
@@ -551,6 +551,7 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(line)
|
|
|
elif platform == "android_ionic":
|
|
|
main_act_path = os.path.join(path_dest,"src/app/app.component.ts")
|
|
|
+ main_act_android = os.path.join(path_dest, "android/app/src/main/java/com/example/paliolitesamplecodeionic/MainActivity.java")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -640,6 +641,136 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(indented_str(4, "// },", spaces=2))
|
|
|
else:
|
|
|
f.write(line)
|
|
|
+ with open(main_act_android, "r") as f:
|
|
|
+ lines = f.readlines()
|
|
|
+ with open(main_act_android, "w") as f:
|
|
|
+ for line in lines:
|
|
|
+ if "//SECURITY" in line:
|
|
|
+ if security["show_security"]:
|
|
|
+ f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["emulator"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckEmulator(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckEmulator(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["debug"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckAdb(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["sim_swap"]:
|
|
|
+ f.write(indented_str(2,
|
|
|
+ "API.setCheckSimCardSwapListener(MainActivity.this, new SimCardDetectionCallback() {", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override", spaces=2))
|
|
|
+ f.write(indented_str(3, "public boolean onSimCardChange() {", spaces=2))
|
|
|
+ f.write(indented_str(4, "return false;", spaces=2))
|
|
|
+ f.write(indented_str(3, "}", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override", spaces=2))
|
|
|
+ f.write(indented_str(3, "public void onError(String s) {", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "}", spaces=2))
|
|
|
+ f.write(indented_str(2, "});", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2,
|
|
|
+ "/* API.setCheckSimCardSwapListener(MainActivity.this, new SimCardDetectionCallback() {", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override", spaces=2))
|
|
|
+ f.write(indented_str(3, "public boolean onSimCardChange() {", spaces=2))
|
|
|
+ f.write(indented_str(4, "return false;", spaces=2))
|
|
|
+ f.write(indented_str(3, "}", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override", spaces=2))
|
|
|
+ f.write(indented_str(3, "public void onError(String s) {", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "}", spaces=2))
|
|
|
+ f.write(indented_str(2, "}); */", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["malware"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckMalware(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckMalware(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["capture"]:
|
|
|
+ f.write(indented_str(2, "API.setPreventScreenCapture(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setPreventScreenCapture(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["call_forwarding"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckCallForwarding(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckCallForwarding(true);", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["secure_folder"]:
|
|
|
+ f.write(indented_str(2, "API.openSecureFolder();", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.openSecureFolder();", spaces=2))
|
|
|
+ f.write(os.linesep)
|
|
|
+ elif "//SMS" in line:
|
|
|
+ if features["sms"]["status"]:
|
|
|
+ f.write(indented_str(2, "API.setEnabledSMS(true);", spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setEnabledSMS(true);", spaces=2))
|
|
|
+ elif "//EMAIL" in line:
|
|
|
+ if features["email"]["status"]:
|
|
|
+ f.write(indented_str(2, "API.setEnabledEmail(true);", spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setEnabledEmail(true);", spaces=2))
|
|
|
+ elif "//FLOATING" in line:
|
|
|
+ if mode == "floating":
|
|
|
+ f.write(indented_str(6, "ArrayList<FloatingButton> fb = new ArrayList<>();", spaces=2))
|
|
|
+ if features["cc"]["status"]:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ 'fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));', spaces=2))
|
|
|
+ if features["nc"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));', spaces=2))
|
|
|
+ if features["im"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));', spaces=2))
|
|
|
+ if features["call"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6,
|
|
|
+ 'fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));', spaces=2))
|
|
|
+ if features["ls"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));', spaces=2))
|
|
|
+ f.write(indented_str(6,
|
|
|
+ 'API.configureFloating(fb);', spaces=2))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(0, "", spaces=2))
|
|
|
+ elif "API.connect" in line:
|
|
|
+ if mode == "floating":
|
|
|
+ replaced = line.replace("0", "1")
|
|
|
+ f.write(replaced)
|
|
|
+ else:
|
|
|
+ f.write(line)
|
|
|
+ else:
|
|
|
+ f.write(line)
|
|
|
elif platform == "android_react":
|
|
|
main_act_path = os.path.join(path_dest, "App.tsx")
|
|
|
with open(main_act_path, "r") as f:
|