|
@@ -55,12 +55,19 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
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")
|
|
|
-
|
|
|
with open(main_act_path, "r") as f:
|
|
|
lines = f.readlines()
|
|
|
with open(main_act_path, "w") as f:
|
|
|
for line in lines:
|
|
|
if "//FEATURES" in line:
|
|
|
+ f.write(indented_str(2, "if (id == R.id.action_settings) {"))
|
|
|
+ f.write(indented_str(3, "API.openSettings();"))
|
|
|
+ f.write(indented_str(3, "return true;"))
|
|
|
+ f.write(indented_str(2, "}"))
|
|
|
+ f.write(indented_str(2, "if (id == R.id.action_profile) {"))
|
|
|
+ f.write(indented_str(3, "API.openProfile();"))
|
|
|
+ f.write(indented_str(3, "return true;"))
|
|
|
+ f.write(indented_str(2, "}"))
|
|
|
if features["cc"]["status"]:
|
|
|
f.write(indented_str(2, "if (id == R.id.action_cc) {"))
|
|
|
f.write(indented_str(3, "API.openContactCenter();"))
|
|
@@ -86,11 +93,6 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
f.write(indented_str(3, "API.openOptionsStreaming();"))
|
|
|
f.write(indented_str(3, "return true;"))
|
|
|
f.write(indented_str(2, "}"))
|
|
|
- if features["settings"]["status"]:
|
|
|
- f.write(indented_str(2, "if (id == R.id.action_settings) {"))
|
|
|
- f.write(indented_str(3, "API.openSettings();"))
|
|
|
- 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);"))
|
|
@@ -140,6 +142,18 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
for line in lines:
|
|
|
if "<!-- FEATURES -->" in line:
|
|
|
n = 100
|
|
|
+ f.write(indented_str(1, "<item"))
|
|
|
+ f.write(indented_str(2, 'android:id="@+id/action_settings"'))
|
|
|
+ f.write(indented_str(2, f'android:orderInCategory="{n}"'))
|
|
|
+ f.write(indented_str(2, 'android:title="Settings"'))
|
|
|
+ f.write(indented_str(2, 'app:showAsAction="never" />'))
|
|
|
+ n = n + 1
|
|
|
+ f.write(indented_str(1, "<item"))
|
|
|
+ f.write(indented_str(2, 'android:id="@+id/action_profile"'))
|
|
|
+ f.write(indented_str(2, f'android:orderInCategory="{n}"'))
|
|
|
+ f.write(indented_str(2, 'android:title="Profile"'))
|
|
|
+ f.write(indented_str(2, 'app:showAsAction="never" />'))
|
|
|
+ n = n + 1
|
|
|
if features["cc"]["status"]:
|
|
|
f.write(indented_str(1, "<item"))
|
|
|
f.write(indented_str(2, 'android:id="@+id/action_cc"'))
|
|
@@ -175,13 +189,6 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
f.write(indented_str(2, 'android:title="Streaming"'))
|
|
|
f.write(indented_str(2, 'app:showAsAction="never" />'))
|
|
|
n = n + 1
|
|
|
- if features["settings"]["status"]:
|
|
|
- f.write(indented_str(1, "<item"))
|
|
|
- f.write(indented_str(2, 'android:id="@+id/action_settings"'))
|
|
|
- f.write(indented_str(2, f'android:orderInCategory="{n}"'))
|
|
|
- f.write(indented_str(2, 'android:title="Settings"'))
|
|
|
- f.write(indented_str(2, 'app:showAsAction="never" />'))
|
|
|
- n = n + 1
|
|
|
else:
|
|
|
f.write(line)
|
|
|
elif platform == "android_flutter":
|
|
@@ -192,6 +199,8 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
features_str = []
|
|
|
for line in lines:
|
|
|
if "'Features List'" in line:
|
|
|
+ features_str.append("Settings")
|
|
|
+ features_str.append("Profile")
|
|
|
if features["cc"]["status"]:
|
|
|
features_str.append("Contact Center")
|
|
|
if features["nc"]["status"]:
|
|
@@ -202,12 +211,16 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
features_str.append("Call")
|
|
|
if features["ls"]["status"]:
|
|
|
features_str.append("Streaming")
|
|
|
- if features["settings"]["status"]:
|
|
|
- features_str.append("Settings")
|
|
|
result_str = ", ".join([f"'{n}'" for n in features_str])
|
|
|
replaced = line.replace("'Features List'", result_str)
|
|
|
f.write(replaced)
|
|
|
elif "//FEATURES" in line:
|
|
|
+ f.write(indented_str(3, 'case "Settings":', spaces=2))
|
|
|
+ f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
|
|
|
+ f.write(indented_str(4, "break;", spaces=2))
|
|
|
+ f.write(indented_str(3, 'case "Profile":', spaces=2))
|
|
|
+ f.write(indented_str(4, 'nativeChannel.invokeMethod("openProfile");', spaces=2))
|
|
|
+ f.write(indented_str(4, "break;", spaces=2))
|
|
|
if features["cc"]["status"]:
|
|
|
f.write(indented_str(3, 'case "Contact Center":', spaces=2))
|
|
|
f.write(indented_str(4, 'nativeChannel.invokeMethod("openContactCenter");', spaces=2))
|
|
@@ -228,10 +241,6 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
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 features["settings"]["status"]:
|
|
|
- f.write(indented_str(3, 'case "Settings":', spaces=2))
|
|
|
- f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
|
|
|
- f.write(indented_str(4, "break;", spaces=2))
|
|
|
else:
|
|
|
f.write(line)
|
|
|
elif platform == "android_ionic":
|
|
@@ -246,6 +255,12 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
with open(main_act_path, "w") as f:
|
|
|
for line in lines:
|
|
|
if "//FEATURES" in line:
|
|
|
+ f.write(indented_str(3, 'UIAction(title: "Setting".localized(), handler: {(_) in'))
|
|
|
+ f.write(indented_str(4, "APIS.openSetting();"))
|
|
|
+ f.write(indented_str(3, "}),"))
|
|
|
+ f.write(indented_str(3, 'UIAction(title: "Profile".localized(), handler: {(_) in'))
|
|
|
+ f.write(indented_str(4, "APIS.openProfile();"))
|
|
|
+ f.write(indented_str(3, "}),"))
|
|
|
if features["cc"]["status"]:
|
|
|
f.write(indented_str(3, 'UIAction(title: "Contact Center".localized(), handler: {(_) in'))
|
|
|
f.write(indented_str(4, "APIS.openContactCenter();"))
|
|
@@ -266,10 +281,6 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
f.write(indented_str(3, 'UIAction(title: "Live Streaming".localized(), handler: {(_) in'))
|
|
|
f.write(indented_str(4, "APIS.openStreaming();"))
|
|
|
f.write(indented_str(3, "}),"))
|
|
|
- if features["settings"]["status"]:
|
|
|
- f.write(indented_str(3, 'UIAction(title: "Setting".localized(), handler: {(_) in'))
|
|
|
- f.write(indented_str(4, "APIS.openSetting();"))
|
|
|
- f.write(indented_str(3, "}),"))
|
|
|
else:
|
|
|
f.write(line)
|
|
|
elif platform == "ios_flutter":
|
|
@@ -280,6 +291,8 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
features_str = []
|
|
|
for line in lines:
|
|
|
if "'Features List'" in line:
|
|
|
+ features_str.append("Settings")
|
|
|
+ features_str.append("Profile")
|
|
|
if features["cc"]["status"]:
|
|
|
features_str.append("Contact Center")
|
|
|
if features["nc"]["status"]:
|
|
@@ -290,12 +303,16 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
features_str.append("Call")
|
|
|
if features["ls"]["status"]:
|
|
|
features_str.append("Streaming")
|
|
|
- if features["settings"]["status"]:
|
|
|
- features_str.append("Settings")
|
|
|
result_str = ", ".join([f"'{n}'" for n in features_str])
|
|
|
replaced = line.replace("'Features List'", result_str)
|
|
|
f.write(replaced)
|
|
|
elif "//FEATURES" in line:
|
|
|
+ f.write(indented_str(3, 'case "Settings":', spaces=2))
|
|
|
+ f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
|
|
|
+ f.write(indented_str(4, "break;", spaces=2))
|
|
|
+ f.write(indented_str(3, 'case "Profile":', spaces=2))
|
|
|
+ f.write(indented_str(4, 'nativeChannel.invokeMethod("openProfile");', spaces=2))
|
|
|
+ f.write(indented_str(4, "break;", spaces=2))
|
|
|
if features["cc"]["status"]:
|
|
|
f.write(indented_str(3, 'case "Contact Center":', spaces=2))
|
|
|
f.write(indented_str(4, 'nativeChannel.invokeMethod("openContactCenter");', spaces=2))
|
|
@@ -316,10 +333,6 @@ def change(platform: str, path_dest: str, features: dict, security: dict):
|
|
|
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 features["settings"]["status"]:
|
|
|
- f.write(indented_str(3, 'case "Settings":', spaces=2))
|
|
|
- f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
|
|
|
- f.write(indented_str(4, "break;", spaces=2))
|
|
|
else:
|
|
|
f.write(line)
|
|
|
elif platform == "ios_ionic":
|