|
@@ -52,11 +52,41 @@ def create_folder(platform, uid):
|
|
|
return path_dest
|
|
|
|
|
|
|
|
|
+def write_android_manifest(manifest_path: str, features: dict, security: dict):
|
|
|
+ with open(manifest_path, "r") as f:
|
|
|
+ lines = f.readlines()
|
|
|
+ with open(manifest_path, "w") as f:
|
|
|
+ for line in lines:
|
|
|
+ if "<!-- FEATURES -->" in line:
|
|
|
+ if features["sms"]["status"]:
|
|
|
+ f.write(indented_str(1, '<!-- use SMS permission -->'))
|
|
|
+ f.write(indented_str(1, '<uses-permission android:name="android.permission.RECEIVE_SMS" />'))
|
|
|
+ f.write(indented_str(1, '<uses-permission android:name="android.permission.SEND_SMS" />'))
|
|
|
+ f.write(indented_str(1, '<uses-permission android:name="android.permission.READ_SMS" />'))
|
|
|
+ f.write(indented_str(1, '<uses-permission android:name="android.permission.WRITE_SMS" />'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(1, '<!-- use SMS permission -->'))
|
|
|
+ f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->'))
|
|
|
+ f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.SEND_SMS" /> -->'))
|
|
|
+ f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.READ_SMS" /> -->'))
|
|
|
+ f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.WRITE_SMS" /> -->'))
|
|
|
+ elif "<!-- SECURITY -->" in line:
|
|
|
+ if security["malware"]:
|
|
|
+ f.write(indented_str(1, '<!-- use Malware Detection permission -->'))
|
|
|
+ f.write(indented_str(1, '<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />'))
|
|
|
+ else:
|
|
|
+ f.write(indented_str(1, '<!-- use Malware Detection permission -->'))
|
|
|
+ f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> -->'))
|
|
|
+ else:
|
|
|
+ f.write(line)
|
|
|
+
|
|
|
+
|
|
|
def change(platform: str, mode: str, path_dest: str, features: dict, security: dict):
|
|
|
if platform == "android":
|
|
|
main_act_path = os.path.join(path_dest,
|
|
|
"app/src/main/java/com/example/nexilissamplecodeburger/MainActivity.java")
|
|
|
xml_menu_path = os.path.join(path_dest, "app/src/main/res/menu/menu_main.xml")
|
|
|
+ manifest_path = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -368,9 +398,11 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
n = n + 1
|
|
|
else:
|
|
|
f.write(line)
|
|
|
+ write_android_manifest(manifest_path, features, security)
|
|
|
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")
|
|
|
+ manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -597,9 +629,11 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(line)
|
|
|
else:
|
|
|
f.write(line)
|
|
|
+ write_android_manifest(manifest_path, features, security)
|
|
|
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/nexilissamplecodeionic/MainActivity.java")
|
|
|
+ manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -838,9 +872,11 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(line)
|
|
|
else:
|
|
|
f.write(line)
|
|
|
+ write_android_manifest(manifest_path, features, security)
|
|
|
elif platform == "android_react":
|
|
|
main_act_path = os.path.join(path_dest, "App.tsx")
|
|
|
main_act_android = os.path.join(path_dest, "android/app/src/main/java/com/paliolitesamplecode/MainActivity.java")
|
|
|
+ manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
@@ -1271,6 +1307,7 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
|
|
|
f.write(line)
|
|
|
else:
|
|
|
f.write(line)
|
|
|
+ write_android_manifest(manifest_path, features, security)
|
|
|
elif platform == "ios":
|
|
|
main_act_path = os.path.join(path_dest, "ExampleCode/ViewController.swift")
|
|
|
with open(main_act_path, "r") as f:
|