Kaynağa Gözat

secure folder to features

kevin 1 yıl önce
ebeveyn
işleme
2a7c9c51b5
1 değiştirilmiş dosya ile 93 ekleme ve 26 silme
  1. 93 26
      main.py

+ 93 - 26
main.py

@@ -118,6 +118,16 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(3, "// API.openOptionsStreaming();"))
                         f.write(indented_str(3, "// return true;"))
                         f.write(indented_str(2, "// }"))
+                    if security["secure_folder"]:
+                        f.write(indented_str(2, "if (id == R.id.action_sf) {"))
+                        f.write(indented_str(3, "API.openSecureFolder();"))
+                        f.write(indented_str(3, "return true;"))
+                        f.write(indented_str(2, "}"))
+                    else:
+                        f.write(indented_str(2, "// if (id == R.id.action_sf) {"))
+                        f.write(indented_str(3, "// API.openSecureFolder();"))
+                        f.write(indented_str(3, "// return true;"))
+                        f.write(indented_str(2, "// }"))
                 elif "//SECURITY" in line:
                     if security["show_security"]:
                         f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);"))
@@ -182,12 +192,6 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     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);"))
@@ -335,6 +339,20 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(2, 'android:title="Streaming"'))
                         f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
                         n = n + 1
+                    if security["secure_folder"]:
+                        f.write(indented_str(1, "<item"))
+                        f.write(indented_str(2, 'android:id="@+id/action_sf"'))
+                        f.write(indented_str(2, f'android:orderInCategory="{n}"'))
+                        f.write(indented_str(2, 'android:title="Secure Folder"'))
+                        f.write(indented_str(2, 'app:showAsAction="never" />'))
+                        n = n + 1
+                    else:
+                        f.write(indented_str(1, "<!-- <item"))
+                        f.write(indented_str(2, 'android:id="@+id/action_sf"'))
+                        f.write(indented_str(2, f'android:orderInCategory="{n}"'))
+                        f.write(indented_str(2, 'android:title="Secure Folder"'))
+                        f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
+                        n = n + 1
                 else:
                     f.write(line)
     elif platform == "android_flutter":
@@ -368,6 +386,10 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         features_str.append("'Streaming'")
                     else:
                         features_str.append("// 'Streaming'")
+                    if security["secure_folder"]:
+                        features_str.append("'Secure Folder'")
+                    else:
+                        features_str.append("// 'Secure Folder'")
                     for feature_str in features_str:
                         f.write(indented_str(8, f"{feature_str},", spaces=2))
                 elif "//FEATURES" in line:
@@ -417,6 +439,14 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(3, '// case "Streaming":', spaces=2))
                         f.write(indented_str(4, '// nativeChannel.invokeMethod("openStreaming");', spaces=2))
                         f.write(indented_str(4, "// break;", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(3, 'case "Secure Folder":', spaces=2))
+                        f.write(indented_str(4, 'nativeChannel.invokeMethod("openSecureFolder");', spaces=2))
+                        f.write(indented_str(4, "break;", spaces=2))
+                    else:
+                        f.write(indented_str(3, '// case "Secure Folder":', spaces=2))
+                        f.write(indented_str(4, '// nativeChannel.invokeMethod("openSecureFolder");', spaces=2))
+                        f.write(indented_str(4, "// break;", spaces=2))
                 else:
                     f.write(line)
         with open(main_act_android, "r") as f:
@@ -487,12 +517,6 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     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);"))
@@ -639,6 +663,20 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(6, "// this.openStreaming();", spaces=2))
                         f.write(indented_str(5, "// },", spaces=2))
                         f.write(indented_str(4, "// },", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(4, '{', spaces=2))
+                        f.write(indented_str(5, "text: 'Secure Folder',", spaces=2))
+                        f.write(indented_str(5, "handler: () => {", spaces=2))
+                        f.write(indented_str(6, "this.openSecureFolder();", spaces=2))
+                        f.write(indented_str(5, "},", spaces=2))
+                        f.write(indented_str(4, "},", spaces=2))
+                    else:
+                        f.write(indented_str(4, '// {', spaces=2))
+                        f.write(indented_str(5, "// text: 'Secure Folder',", spaces=2))
+                        f.write(indented_str(5, "// handler: () => {", spaces=2))
+                        f.write(indented_str(6, "// this.openSecureFolder();", spaces=2))
+                        f.write(indented_str(5, "// },", spaces=2))
+                        f.write(indented_str(4, "// },", spaces=2))
                 else:
                     f.write(line)
         with open(main_act_android, "r") as f:
@@ -709,12 +747,6 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     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))
@@ -801,6 +833,10 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(4, "'Live Streaming',", spaces=2))
                     else:
                         f.write(indented_str(4, "// 'Live Streaming',", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(4, "'Secure Folder',", spaces=2))
+                    else:
+                        f.write(indented_str(4, "// 'Secure Folder',", spaces=2))
                 elif "//FEATURES1" in line:
                     n = 0
                     f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
@@ -856,6 +892,15 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(5, "// if (buttonIndex === 6) {", spaces=2))
                         f.write(indented_str(6, "// CallNative.openStreaming();", spaces=2))
                         f.write(indented_str(5, "// }", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
+                        f.write(indented_str(6, "CallNative.openSecureFolder();", spaces=2))
+                        f.write(indented_str(5, "}", spaces=2))
+                        n = n + 1
+                    else:
+                        f.write(indented_str(5, "// if (buttonIndex === 7) {", spaces=2))
+                        f.write(indented_str(6, "// CallNative.openSecureFolder();", spaces=2))
+                        f.write(indented_str(5, "// }", spaces=2))
                 elif "//FEATURES2" in line:
                     n = 0
                     f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
@@ -952,13 +997,30 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(2, "}", spaces=2))
                         n = n + 1
                     else:
-                        f.write(indented_str(2, "// if (buttonIndex === {n}) {", spaces=2))
+                        f.write(indented_str(2, "// if (buttonIndex === 6) {", spaces=2))
                         f.write(indented_str(3, "// try {", spaces=2))
                         f.write(indented_str(4, "// CallNative.openStreaming();", spaces=2))
                         f.write(indented_str(3, "// } catch (e) {", spaces=2))
                         f.write(indented_str(4, "// console.log(e);", spaces=2))
                         f.write(indented_str(3, "// }", spaces=2))
                         f.write(indented_str(2, "// }", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
+                        f.write(indented_str(3, "try {", spaces=2))
+                        f.write(indented_str(4, "CallNative.openSecureFolder();", spaces=2))
+                        f.write(indented_str(3, "} catch (e) {", spaces=2))
+                        f.write(indented_str(4, "console.log(e);", spaces=2))
+                        f.write(indented_str(3, "}", spaces=2))
+                        f.write(indented_str(2, "}", spaces=2))
+                        n = n + 1
+                    else:
+                        f.write(indented_str(2, "// if (buttonIndex === 7) {", spaces=2))
+                        f.write(indented_str(3, "// try {", spaces=2))
+                        f.write(indented_str(4, "// CallNative.openSecureFolder();", spaces=2))
+                        f.write(indented_str(3, "// } catch (e) {", spaces=2))
+                        f.write(indented_str(4, "// console.log(e);", spaces=2))
+                        f.write(indented_str(3, "// }", spaces=2))
+                        f.write(indented_str(2, "// }", spaces=2))
                 elif "//FEATURES3" in line:
                     n = 0
                     f.write(indented_str(5, "<Button", spaces=2))
@@ -1024,7 +1086,18 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     else:
                         f.write(indented_str(5, "{/* <Button", spaces=2))
                         f.write(indented_str(6, 'title="Live Streaming"', spaces=2))
-                        f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(5)}}', spaces=2))
+                        f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(6)}}', spaces=2))
+                        f.write(indented_str(5, "/> */}", spaces=2))
+                    if security["secure_folder"]:
+                        f.write(indented_str(5, "<Button", spaces=2))
+                        f.write(indented_str(6, 'title="Secure Folder"', spaces=2))
+                        f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
+                        f.write(indented_str(5, "/>", spaces=2))
+                        n = n + 1
+                    else:
+                        f.write(indented_str(5, "{/* <Button", spaces=2))
+                        f.write(indented_str(6, 'title="Secure Folder"', spaces=2))
+                        f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(7)}}', spaces=2))
                         f.write(indented_str(5, "/> */}", spaces=2))
                 else:
                     f.write(line)
@@ -1096,12 +1169,6 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     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);"))