tama 1 год назад
Родитель
Сommit
365dcf69ab

+ 14 - 2
NexilisSampleCodeReact-Android/android/app/src/main/java/com/paliolitesamplecode/MainActivity.java

@@ -10,6 +10,8 @@ import com.facebook.react.defaults.DefaultReactActivityDelegate;
 
 import io.nexilis.service.API;
 import io.nexilis.service.Callback;
+import io.nexilis.service.utils.callback.SimCardDetectionCallback;
+import io.nexilis.service.utils.xthunder.FloatingButton;
 
 public class MainActivity extends ReactActivity {
 
@@ -39,6 +41,17 @@ public class MainActivity extends ReactActivity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+
+        /**
+         *
+         * Nexilis provides an API security shield service, which functions to detect threats such as malware, ADB, screencapture, and Sim Swapping.
+         */
+
+        //SECURITY
+
+        //SMS
+        //EMAIL
+
         /*************************************
          Connect to our server with your newuniverse.io Account, and implement the required Callback.
          Please Subscribe or contact us to get your newuniverse.io Account.
@@ -62,8 +75,7 @@ public class MainActivity extends ReactActivity {
          *
          */
 
-//        API.connect("***REPLACE***WITH***YOUR***NEXILIS***ACCOUNT***", this, 0, new Callback() {
-        API.connect("36BCB99AA3885165E64ECC50591C4DA5072A25B2E7BAADA5A1B57E18737FF88C", this, 0, new Callback() {
+        API.connect("***REPLACE***WITH***YOUR***NEXILIS***ACCOUNT***", this, 0, new Callback() {
             @Override
             public void onSuccess(final String NexilisUserID) {
                 /**************************************

+ 131 - 0
main.py

@@ -773,6 +773,7 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                     f.write(line)
     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")
         with open(main_act_path, "r") as f:
             lines = f.readlines()
         with open(main_act_path, "w") as f:
@@ -1027,6 +1028,136 @@ def change(platform: str, mode: str, path_dest: str, features: dict, security: d
                         f.write(indented_str(5, "/> */}", 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 == "ios":
         main_act_path = os.path.join(path_dest, "ExampleCode/ViewController.swift")
         with open(main_act_path, "r") as f: