|
@@ -339,6 +339,7 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(line)
|
|
|
elif platform == "android_flutter":
|
|
|
main_act_path = os.path.join(path_dest, "lib/main.dart")
|
|
|
+ main_act_android = os.path.join(path_dest, "android/app/src/main/java/com/example/paliolitesamplecodeflutter/MainActivity.java")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -418,6 +419,136 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(indented_str(4, "// break;", 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);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["emulator"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckEmulator(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckEmulator(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["debug"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckAdb(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["sim_swap"]:
|
|
|
+ f.write(indented_str(2,
|
|
|
+ "API.setCheckSimCardSwapListener(MainActivity.this, new SimCardDetectionCallback() {"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override"))
|
|
|
+ f.write(indented_str(3, "public boolean onSimCardChange() {"))
|
|
|
+ f.write(indented_str(4, "return false;"))
|
|
|
+ f.write(indented_str(3, "}"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override"))
|
|
|
+ f.write(indented_str(3, "public void onError(String s) {"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "}"))
|
|
|
+ f.write(indented_str(2, "});"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2,
|
|
|
+ "/* API.setCheckSimCardSwapListener(MainActivity.this, new SimCardDetectionCallback() {"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override"))
|
|
|
+ f.write(indented_str(3, "public boolean onSimCardChange() {"))
|
|
|
+ f.write(indented_str(4, "return false;"))
|
|
|
+ f.write(indented_str(3, "}"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "@Override"))
|
|
|
+ f.write(indented_str(3, "public void onError(String s) {"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ f.write(indented_str(3, "}"))
|
|
|
+ f.write(indented_str(2, "}); */"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["malware"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckMalware(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckMalware(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["capture"]:
|
|
|
+ f.write(indented_str(2, "API.setPreventScreenCapture(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setPreventScreenCapture(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["call_forwarding"]:
|
|
|
+ f.write(indented_str(2, "API.setCheckCallForwarding(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setCheckCallForwarding(true);"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ if security["secure_folder"]:
|
|
|
+ f.write(indented_str(2, "API.openSecureFolder();"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.openSecureFolder();"))
|
|
|
+ f.write(os.linesep)
|
|
|
+ elif "//SMS" in line:
|
|
|
+ if features["sms"]["status"]:
|
|
|
+ f.write(indented_str(2, "API.setEnabledSMS(true);"))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setEnabledSMS(true);"))
|
|
|
+ elif "//EMAIL" in line:
|
|
|
+ if features["email"]["status"]:
|
|
|
+ f.write(indented_str(2, "API.setEnabledEmail(true);"))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(2, "// API.setEnabledEmail(true);"))
|
|
|
+ elif "//FLOATING" in line:
|
|
|
+ if mode == "floating":
|
|
|
+ f.write(indented_str(6, "ArrayList<FloatingButton> fb = new ArrayList<>();"))
|
|
|
+ if features["cc"]["status"]:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ 'fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));'))
|
|
|
+ if features["nc"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));'))
|
|
|
+ if features["im"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));'))
|
|
|
+ if features["call"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6,
|
|
|
+ 'fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));'))
|
|
|
+ if features["ls"]["status"]:
|
|
|
+ f.write(
|
|
|
+ indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(6,
|
|
|
+ '// fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));'))
|
|
|
+ f.write(indented_str(6,
|
|
|
+ 'API.configureFloating(fb);'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(0, ""))
|
|
|
+ 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_ionic":
|
|
|
main_act_path = os.path.join(path_dest,"src/app/app.component.ts")
|
|
|
with open(main_act_path, "r") as f:
|
|
@@ -1013,7 +1144,7 @@ def deliver_zip(path_dest, uid):
|
|
|
def build_project():
|
|
|
vprint('==============================================================')
|
|
|
if request.method == 'POST':
|
|
|
- platform = "android"
|
|
|
+ platform = "android_flutter"
|
|
|
mode = "burger"
|
|
|
feature_dict = {
|
|
|
"im": {
|