main.py 183 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997
  1. import os
  2. import random
  3. import string
  4. import traceback
  5. import shutil
  6. import uuid
  7. from flask import Flask, request
  8. # base_directory = "/home/easysoft054/Projects/git-es"
  9. base_directory = "/Users/maronakins/Documents"
  10. ALLOWED_EXTENSIONS_ICON = {'png'}
  11. app = Flask(__name__)
  12. app.base_project = {
  13. "android": base_directory + "/EmbedFeatures/NexilisSampleCode",
  14. "android_flutter": base_directory + "/EmbedFeatures/NexilisSampleCodeFlutter-Android",
  15. "android_ionic": base_directory + "/EmbedFeatures/NexilisSampleCodeIonic-Android",
  16. "android_react": base_directory + "/EmbedFeatures/NexilisSampleCodeReact-Android",
  17. "ios": base_directory + "/EmbedFeatures/NexilisSampleCode-iOS",
  18. "ios_flutter": base_directory + "/EmbedFeatures/NexilisSampleCodeFlutter-iOS",
  19. "ios_ionic": base_directory + "/EmbedFeatures/NexilisSampleCodeIonic-iOS",
  20. "ios_react": base_directory + "/EmbedFeatures/NexilisSampleCodeReact-iOS"
  21. }
  22. app.temp_folder = base_directory + "/EmbedFeatures/BuildExample"
  23. app.zip_folder = base_directory + "/EmbedFeatures/uploads"
  24. # app.ssl = ('/usr/src/app/ssl/STAR_newuniverse_io.crt', '/usr/src/app/ssl/STAR_nexilis.key')
  25. app.ssl = None
  26. app.verbose = True
  27. def vprint(*data):
  28. if app.verbose:
  29. print(*data)
  30. def indented_str(n, s, line=True, spaces=4) -> str:
  31. return " " * n * spaces + s + os.linesep if line else ""
  32. def allowed_file(filename):
  33. return '.' in filename and \
  34. filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS_ICON
  35. def create_folder(platform, uid):
  36. path = os.path.join(app.temp_folder, uid)
  37. if not os.path.exists(path):
  38. os.mkdir(path)
  39. else:
  40. shutil.rmtree(path)
  41. os.mkdir(path)
  42. vprint(path)
  43. base_project = app.base_project[platform]
  44. base_project_name = os.path.basename(base_project)
  45. path_dest = os.path.join(path, base_project_name)
  46. if not os.path.exists(path_dest):
  47. shutil.copytree(base_project, path_dest)
  48. return path_dest
  49. def write_android_manifest(manifest_path: str, features: dict, security: dict):
  50. with open(manifest_path, "r") as f:
  51. lines = f.readlines()
  52. with open(manifest_path, "w") as f:
  53. for line in lines:
  54. if "<!-- FEATURES -->" in line:
  55. if features["sms"]["status"]:
  56. f.write(indented_str(1, '<!-- use SMS permission -->'))
  57. f.write(indented_str(1, '<uses-permission android:name="android.permission.RECEIVE_SMS" />'))
  58. f.write(indented_str(1, '<uses-permission android:name="android.permission.SEND_SMS" />'))
  59. f.write(indented_str(1, '<uses-permission android:name="android.permission.READ_SMS" />'))
  60. f.write(indented_str(1, '<uses-permission android:name="android.permission.WRITE_SMS" />'))
  61. else:
  62. f.write(indented_str(1, '<!-- use SMS permission -->'))
  63. f.write(
  64. indented_str(1, '<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->'))
  65. f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.SEND_SMS" /> -->'))
  66. f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.READ_SMS" /> -->'))
  67. f.write(indented_str(1, '<!-- <uses-permission android:name="android.permission.WRITE_SMS" /> -->'))
  68. elif "<!-- SECURITY -->" in line:
  69. if security["malware"] or security["side_load"]:
  70. f.write(indented_str(1, '<!-- use Malware Detection & Sideload App permission -->'))
  71. f.write(indented_str(1, '<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />'))
  72. else:
  73. f.write(indented_str(1, '<!-- use Malware Detection & Sideload App permission -->'))
  74. f.write(indented_str(1,
  75. '<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> -->'))
  76. else:
  77. f.write(line)
  78. def write_floating_button(f, features: dict, security: dict, spaces=4):
  79. f.write(indented_str(6, "ArrayList<FloatingButton> fb = new ArrayList<>();"))
  80. if features["cc"]["status"]:
  81. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));', spaces))
  82. else:
  83. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_CENTER, ""));', spaces))
  84. if features["cc_chat"]["status"]:
  85. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_CHAT));', spaces))
  86. else:
  87. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_CHAT));', spaces))
  88. if features["cc_voip"]["status"]:
  89. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_AC));', spaces))
  90. else:
  91. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_AC));', spaces))
  92. if features["cc_vidcall"]["status"]:
  93. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_VC));', spaces))
  94. else:
  95. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_VC));', spaces))
  96. if features["cc_email"]["status"]:
  97. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_EMAIL));', spaces))
  98. else:
  99. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_EMAIL));', spaces))
  100. if features["cc_sms"]["status"]:
  101. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_SMS));', spaces))
  102. else:
  103. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_SMS));', spaces))
  104. if features["cc_gsm"]["status"]:
  105. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_GCALL));', spaces))
  106. else:
  107. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_GCALL));', spaces))
  108. if features["cc_whatsapp"]["status"]:
  109. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_WA));', spaces))
  110. else:
  111. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_WA));', spaces))
  112. if features["cc_smartbot"]["status"]:
  113. f.write(indented_str(6, 'fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_CHATBOT));', spaces))
  114. else:
  115. f.write(indented_str(6, '// fb.add(new FloatingButton("", FloatingButtonVar.CC_SUB_CHATBOT));', spaces))
  116. if features["nc"]["status"]:
  117. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));', spaces))
  118. else:
  119. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.NOTIF_CENTER, ""));', spaces))
  120. if features["im"]["status"]:
  121. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));', spaces))
  122. else:
  123. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.MESSAGING, ""));', spaces))
  124. if features["ac"]["status"]:
  125. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_CALL, ""));', spaces))
  126. else:
  127. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_CALL, ""));', spaces))
  128. if features["vc"]["status"]:
  129. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.VIDEO_CALL, ""));', spaces))
  130. else:
  131. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.VIDEO_CALL, ""));', spaces))
  132. if features["call"]["status"]:
  133. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));', spaces))
  134. else:
  135. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.AUDIO_VIDEO_CALL, ""));', spaces))
  136. if features["ls"]["status"]:
  137. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));', spaces))
  138. else:
  139. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.STREAMING, ""));', spaces))
  140. if security["secure_folder"]:
  141. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.SECURE_FOLDER, ""));', spaces))
  142. else:
  143. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.SECURE_FOLDER, ""));', spaces))
  144. if features["conpost"]["status"]:
  145. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.POST, ""));', spaces))
  146. else:
  147. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.POST, ""));', spaces))
  148. if features["ppob"]["status"]:
  149. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.PPOB, ""));', spaces))
  150. else:
  151. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.PPOB, ""));', spaces))
  152. if features["wallet"]["status"]:
  153. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.WALLET, ""));', spaces))
  154. else:
  155. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.WALLET, ""));', spaces))
  156. if features["social_commerce"]["status"]:
  157. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.SOCIAL_COMMERCE, ""));', spaces))
  158. else:
  159. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.SOCIAL_COMMERCE, ""));', spaces))
  160. if features["news_update"]["status"]:
  161. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.NEWS, ""));', spaces))
  162. else:
  163. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.NEWS, ""));', spaces))
  164. if features["contact_list"]["status"]:
  165. f.write(indented_str(6, 'fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_LIST, ""));', spaces))
  166. else:
  167. f.write(indented_str(6, '// fb.add(new FloatingButton(FloatingButton.FEATURE.CONTACT_LIST, ""));', spaces))
  168. f.write(indented_str(6, 'API.configureFloating(fb);', spaces))
  169. def change(app_id: str, platform: str, mode: str, path_dest: str, features: dict, security: dict):
  170. if platform == "android":
  171. main_act_path = os.path.join(path_dest,
  172. "app/src/main/java/com/example/nexilissamplecodeburger/MainActivity.java")
  173. xml_menu_path = os.path.join(path_dest, "app/src/main/res/menu/menu_main.xml")
  174. manifest_path = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
  175. layout_grid_path = os.path.join(path_dest, "app/src/main/res/layout/activity_main_grid.xml")
  176. with open(main_act_path, "r") as f:
  177. lines = f.readlines()
  178. with open(main_act_path, "w") as f:
  179. for line in lines:
  180. if "//FEATURES" in line:
  181. f.write(indented_str(2, "if (id == R.id.action_settings) {"))
  182. f.write(indented_str(3, "API.openSettings();"))
  183. f.write(indented_str(3, "return true;"))
  184. f.write(indented_str(2, "}"))
  185. f.write(indented_str(2, "if (id == R.id.action_profile) {"))
  186. f.write(indented_str(3, "API.openProfile();"))
  187. f.write(indented_str(3, "return true;"))
  188. f.write(indented_str(2, "}"))
  189. if features["cc"]["status"]:
  190. f.write(indented_str(2, "if (id == R.id.action_cc) {"))
  191. f.write(indented_str(3, "API.openContactCenter();"))
  192. f.write(indented_str(3, "return true;"))
  193. f.write(indented_str(2, "}"))
  194. else:
  195. f.write(indented_str(2, "// if (id == R.id.action_cc) {"))
  196. f.write(indented_str(3, "// API.openContactCenter();"))
  197. f.write(indented_str(3, "// return true;"))
  198. f.write(indented_str(2, "// }"))
  199. if features["nc"]["status"]:
  200. f.write(indented_str(2, "if (id == R.id.action_nc) {"))
  201. f.write(indented_str(3, "API.openNotificationCenter();"))
  202. f.write(indented_str(3, "return true;"))
  203. f.write(indented_str(2, "}"))
  204. else:
  205. f.write(indented_str(2, "// if (id == R.id.action_nc) {"))
  206. f.write(indented_str(3, "// API.openNotificationCenter();"))
  207. f.write(indented_str(3, "// return true;"))
  208. f.write(indented_str(2, "// }"))
  209. if features["im"]["status"]:
  210. f.write(indented_str(2, "if (id == R.id.action_chats) {"))
  211. f.write(indented_str(3, "API.openChat();"))
  212. f.write(indented_str(3, "return true;"))
  213. f.write(indented_str(2, "}"))
  214. else:
  215. f.write(indented_str(2, "// if (id == R.id.action_chats) {"))
  216. f.write(indented_str(3, "// API.openChat();"))
  217. f.write(indented_str(3, "// return true;"))
  218. f.write(indented_str(2, "// }"))
  219. if features["ac"]["status"]:
  220. f.write(indented_str(2, "if (id == R.id.action_audio_call) {"))
  221. f.write(indented_str(3, "API.openAudioCall();"))
  222. f.write(indented_str(3, "return true;"))
  223. f.write(indented_str(2, "}"))
  224. else:
  225. f.write(indented_str(2, "// if (id == R.id.action_audio_call) {"))
  226. f.write(indented_str(3, "// API.openAudioCall();"))
  227. f.write(indented_str(3, "// return true;"))
  228. f.write(indented_str(2, "// }"))
  229. if features["vc"]["status"]:
  230. f.write(indented_str(2, "if (id == R.id.action_video_call) {"))
  231. f.write(indented_str(3, "API.openVideoCall();"))
  232. f.write(indented_str(3, "return true;"))
  233. f.write(indented_str(2, "}"))
  234. else:
  235. f.write(indented_str(2, "// if (id == R.id.action_video_call) {"))
  236. f.write(indented_str(3, "// API.openVideoCall();"))
  237. f.write(indented_str(3, "// return true;"))
  238. f.write(indented_str(2, "// }"))
  239. if features["call"]["status"]:
  240. f.write(indented_str(2, "if (id == R.id.action_call) {"))
  241. f.write(indented_str(3, "API.openCall();"))
  242. f.write(indented_str(3, "return true;"))
  243. f.write(indented_str(2, "}"))
  244. else:
  245. f.write(indented_str(2, "// if (id == R.id.action_call) {"))
  246. f.write(indented_str(3, "// API.openCall();"))
  247. f.write(indented_str(3, "// return true;"))
  248. f.write(indented_str(2, "// }"))
  249. if features["ls"]["status"]:
  250. f.write(indented_str(2, "if (id == R.id.action_ls) {"))
  251. f.write(indented_str(3, "API.openOptionsStreaming();"))
  252. f.write(indented_str(3, "return true;"))
  253. f.write(indented_str(2, "}"))
  254. else:
  255. f.write(indented_str(2, "// if (id == R.id.action_ls) {"))
  256. f.write(indented_str(3, "// API.openOptionsStreaming();"))
  257. f.write(indented_str(3, "// return true;"))
  258. f.write(indented_str(2, "// }"))
  259. if features["custom_url"]["status"]:
  260. f.write(indented_str(2, "if (id == R.id.action_custom_url) {"))
  261. f.write(indented_str(3, "API.openCustomURL();"))
  262. f.write(indented_str(3, "return true;"))
  263. f.write(indented_str(2, "}"))
  264. else:
  265. f.write(indented_str(2, "// if (id == R.id.action_custom_url) {"))
  266. f.write(indented_str(3, "// API.openCustomURL();"))
  267. f.write(indented_str(3, "// return true;"))
  268. f.write(indented_str(2, "// }"))
  269. if features["xapps"]["status"]:
  270. f.write(indented_str(2, "if (id == R.id.action_xapps) {"))
  271. f.write(indented_str(3, "API.openExternalApps();"))
  272. f.write(indented_str(3, "return true;"))
  273. f.write(indented_str(2, "}"))
  274. else:
  275. f.write(indented_str(2, "// if (id == R.id.action_xapps) {"))
  276. f.write(indented_str(3, "// API.openExternalApps();"))
  277. f.write(indented_str(3, "// return true;"))
  278. f.write(indented_str(2, "// }"))
  279. if features["conpost"]["status"]:
  280. f.write(indented_str(2, "if (id == R.id.action_conpost) {"))
  281. f.write(indented_str(3, "API.openUserGeneratedContent();"))
  282. f.write(indented_str(3, "return true;"))
  283. f.write(indented_str(2, "}"))
  284. else:
  285. f.write(indented_str(2, "// if (id == R.id.action_conpost) {"))
  286. f.write(indented_str(3, "// API.openUserGeneratedContent();"))
  287. f.write(indented_str(3, "// return true;"))
  288. f.write(indented_str(2, "// }"))
  289. if features["ppob"]["status"]:
  290. f.write(indented_str(2, "if (id == R.id.action_ppob) {"))
  291. f.write(indented_str(3, "API.openPPOB();"))
  292. f.write(indented_str(3, "return true;"))
  293. f.write(indented_str(2, "}"))
  294. else:
  295. f.write(indented_str(2, "// if (id == R.id.action_ppob) {"))
  296. f.write(indented_str(3, "// API.openPPOB();"))
  297. f.write(indented_str(3, "// return true;"))
  298. f.write(indented_str(2, "// }"))
  299. if features["wallet"]["status"]:
  300. f.write(indented_str(2, "if (id == R.id.action_wallet) {"))
  301. f.write(indented_str(3, "API.openWallet();"))
  302. f.write(indented_str(3, "return true;"))
  303. f.write(indented_str(2, "}"))
  304. else:
  305. f.write(indented_str(2, "// if (id == R.id.action_wallet) {"))
  306. f.write(indented_str(3, "// API.openWallet();"))
  307. f.write(indented_str(3, "// return true;"))
  308. f.write(indented_str(2, "// }"))
  309. if features["social_commerce"]["status"]:
  310. f.write(indented_str(2, "if (id == R.id.action_social_commerce) {"))
  311. f.write(indented_str(3, "API.openSocialCommerce();"))
  312. f.write(indented_str(3, "return true;"))
  313. f.write(indented_str(2, "}"))
  314. else:
  315. f.write(indented_str(2, "// if (id == R.id.action_social_commerce) {"))
  316. f.write(indented_str(3, "// API.openSocialCommerce();"))
  317. f.write(indented_str(3, "// return true;"))
  318. f.write(indented_str(2, "// }"))
  319. if features["news_update"]["status"]:
  320. f.write(indented_str(2, "if (id == R.id.action_news_update) {"))
  321. f.write(indented_str(3, "API.openNewsUpdate();"))
  322. f.write(indented_str(3, "return true;"))
  323. f.write(indented_str(2, "}"))
  324. else:
  325. f.write(indented_str(2, "// if (id == R.id.action_news_update) {"))
  326. f.write(indented_str(3, "// API.openNewsUpdate();"))
  327. f.write(indented_str(3, "// return true;"))
  328. f.write(indented_str(2, "// }"))
  329. if features["contact_list"]["status"]:
  330. f.write(indented_str(2, "if (id == R.id.action_contact_list) {"))
  331. f.write(indented_str(3, "API.openConversation();"))
  332. f.write(indented_str(3, "return true;"))
  333. f.write(indented_str(2, "}"))
  334. else:
  335. f.write(indented_str(2, "// if (id == R.id.action_contact_list) {"))
  336. f.write(indented_str(3, "// API.openConversation();"))
  337. f.write(indented_str(3, "// return true;"))
  338. f.write(indented_str(2, "// }"))
  339. if security["secure_folder"]:
  340. f.write(indented_str(2, "if (id == R.id.action_sf) {"))
  341. f.write(indented_str(3, "API.openSecureFolder();"))
  342. f.write(indented_str(3, "return true;"))
  343. f.write(indented_str(2, "}"))
  344. else:
  345. f.write(indented_str(2, "// if (id == R.id.action_sf) {"))
  346. f.write(indented_str(3, "// API.openSecureFolder();"))
  347. f.write(indented_str(3, "// return true;"))
  348. f.write(indented_str(2, "// }"))
  349. elif "//SECURITY" in line:
  350. if security["show_security"]:
  351. f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);"))
  352. f.write(os.linesep)
  353. else:
  354. f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);"))
  355. f.write(os.linesep)
  356. if security["emulator"]:
  357. f.write(indented_str(2, "API.setCheckEmulator(true);"))
  358. f.write(os.linesep)
  359. else:
  360. f.write(indented_str(2, "// API.setCheckEmulator(true);"))
  361. f.write(os.linesep)
  362. if security["debug"]:
  363. f.write(indented_str(2, "API.setCheckAdb(true);"))
  364. f.write(os.linesep)
  365. else:
  366. f.write(indented_str(2, "// API.setCheckAdb(true);"))
  367. f.write(os.linesep)
  368. if security["sim_swap"]:
  369. f.write(indented_str(2, "API.setCheckSimSwap(true);"))
  370. f.write(os.linesep)
  371. else:
  372. f.write(indented_str(2, "// API.setCheckSimSwap(true);"))
  373. f.write(os.linesep)
  374. if security["malware"]:
  375. f.write(indented_str(2, "API.setCheckMalware(true);"))
  376. f.write(os.linesep)
  377. else:
  378. f.write(indented_str(2, "// API.setCheckMalware(true);"))
  379. f.write(os.linesep)
  380. if security["capture"]:
  381. f.write(indented_str(2, "API.setPreventScreenCapture(true);"))
  382. f.write(os.linesep)
  383. else:
  384. f.write(indented_str(2, "// API.setPreventScreenCapture(true);"))
  385. f.write(os.linesep)
  386. if security["call_forwarding"]:
  387. f.write(indented_str(2, "API.setCheckCallForwarding(true);"))
  388. f.write(os.linesep)
  389. else:
  390. f.write(indented_str(2, "// API.setCheckCallForwarding(true);"))
  391. f.write(os.linesep)
  392. if security["screen_share"]:
  393. f.write(indented_str(2, "API.setCheckScreenCasting(true);"))
  394. f.write(os.linesep)
  395. else:
  396. f.write(indented_str(2, "// API.setCheckScreenCasting(true);"))
  397. f.write(os.linesep)
  398. if security["side_load"]:
  399. f.write(indented_str(2, "API.setCheckSideLoadedApp(true);"))
  400. f.write(os.linesep)
  401. else:
  402. f.write(indented_str(2, "// API.setCheckSideLoadedApp(true);"))
  403. f.write(os.linesep)
  404. if security["key_logger"]:
  405. f.write(indented_str(2, "API.setPreventKeylogger(true);"))
  406. f.write(os.linesep)
  407. else:
  408. f.write(indented_str(2, "// API.setPreventKeylogger(true);"))
  409. f.write(os.linesep)
  410. elif "//SMS" in line:
  411. if features["sms"]["status"]:
  412. f.write(indented_str(2, "API.setEnabledSMS(true);"))
  413. else:
  414. f.write(indented_str(2, "// API.setEnabledSMS(true);"))
  415. elif "//EMAIL" in line:
  416. if features["email"]["status"]:
  417. f.write(indented_str(2, "API.setEnabledEmail(true);"))
  418. else:
  419. f.write(indented_str(2, "// API.setEnabledEmail(true);"))
  420. elif "//SMARTBOT" in line:
  421. if features["smartbot"]["status"]:
  422. f.write(indented_str(2, "API.setEnabledSmartBot(true);"))
  423. else:
  424. f.write(indented_str(2, "// API.setEnabledSmartBot(true);"))
  425. elif "//GRID" in line and mode == "grid":
  426. f.write(indented_str(2, "API.setGeneralCallback(new GeneralCallback() {"))
  427. f.write(indented_str(3, "@Override"))
  428. f.write(
  429. indented_str(3, "public void onAddJavasript(WebView webView, WebSettings webSettings) {"))
  430. f.write(indented_str(4, "webSettings.setJavaScriptEnabled(true);"))
  431. f.write(indented_str(3, "}"))
  432. f.write(indented_str(0, ""))
  433. f.write(indented_str(3, "@Override"))
  434. f.write(
  435. indented_str(3,
  436. "public void onAddJavascriptGeneral(WebView webView, WebSettings webSettings) {"))
  437. f.write(indented_str(4, "webSettings.setJavaScriptEnabled(true);"))
  438. f.write(indented_str(3, "}"))
  439. f.write(indented_str(0, ""))
  440. f.write(indented_str(3, "@Override"))
  441. f.write(
  442. indented_str(3,
  443. "public void onAddJavascriptOpenLink(WebView webView, WebSettings webSettings) {"))
  444. f.write(indented_str(4, "webSettings.setJavaScriptEnabled(true);"))
  445. f.write(indented_str(3, "}"))
  446. f.write(indented_str(0, ""))
  447. f.write(indented_str(3, "@Override"))
  448. f.write(
  449. indented_str(3,
  450. "public void onAddJavascriptWebRTC(AppCompatActivity appCompatActivity, WebSettings webSettings) {"))
  451. f.write(indented_str(4, ""))
  452. f.write(indented_str(3, "}"))
  453. f.write(indented_str(2, "});"))
  454. f.write(indented_str(0, ""))
  455. f.write(indented_str(2, "ImageView imageViewSetting = findViewById(R.id.btn_setting);"))
  456. f.write(indented_str(2, "ImageView imageViewProfile = findViewById(R.id.btn_person);"))
  457. if features["cc"]["status"]:
  458. f.write(indented_str(2, "ImageView imageViewCC = findViewById(R.id.btn_cc);"))
  459. else:
  460. f.write(indented_str(2, "// ImageView imageViewCC = findViewById(R.id.btn_cc);"))
  461. if features["nc"]["status"]:
  462. f.write(indented_str(2, "ImageView imageViewNC = findViewById(R.id.btn_nc);"))
  463. else:
  464. f.write(indented_str(2, "// ImageView imageViewNC = findViewById(R.id.btn_nc);"))
  465. if features["im"]["status"]:
  466. f.write(indented_str(2, "ImageView imageViewChat = findViewById(R.id.btn_chat);"))
  467. else:
  468. f.write(indented_str(2, "// ImageView imageViewChat = findViewById(R.id.btn_chat);"))
  469. if features["ac"]["status"]:
  470. f.write(indented_str(2, "ImageView imageViewAudioCall = findViewById(R.id.btn_audio_call);"))
  471. else:
  472. f.write(indented_str(2, "// ImageView imageViewAudioCall = findViewById(R.id.btn_audio_call);"))
  473. if features["vc"]["status"]:
  474. f.write(indented_str(2, "ImageView imageViewVideoCall = findViewById(R.id.btn_video_call);"))
  475. else:
  476. f.write(indented_str(2, "// ImageView imageViewVideoCall = findViewById(R.id.btn_video_call);"))
  477. if features["call"]["status"]:
  478. f.write(indented_str(2, "ImageView imageViewCall = findViewById(R.id.btn_call);"))
  479. else:
  480. f.write(indented_str(2, "// ImageView imageViewCall = findViewById(R.id.btn_call);"))
  481. if features["ls"]["status"]:
  482. f.write(indented_str(2, "ImageView imageViewStream = findViewById(R.id.btn_stream);"))
  483. else:
  484. f.write(indented_str(2, "// ImageView imageViewStream = findViewById(R.id.btn_stream);"))
  485. if security["secure_folder"]:
  486. f.write(indented_str(2, "ImageView imageViewSF = findViewById(R.id.btn_sf);"))
  487. else:
  488. f.write(indented_str(2, "// ImageView imageViewSF = findViewById(R.id.btn_sf);"))
  489. if features["custom_url"]["status"]:
  490. f.write(indented_str(2, "ImageView imageViewCustomURL = findViewById(R.id.btn_custom_url);"))
  491. else:
  492. f.write(indented_str(2, "// ImageView imageViewCustomURL = findViewById(R.id.btn_custom_url);"))
  493. if features["xapps"]["status"]:
  494. f.write(indented_str(2, "ImageView imageViewExternalApps = findViewById(R.id.btn_xapps);"))
  495. else:
  496. f.write(indented_str(2, "// ImageView imageViewExternalApps = findViewById(R.id.btn_xapps);"))
  497. if features["conpost"]["status"]:
  498. f.write(indented_str(2, "ImageView imageViewContentPosting = findViewById(R.id.btn_contentpost);"))
  499. else:
  500. f.write(indented_str(2, "// ImageView imageViewContentPosting = findViewById(R.id.btn_contentpost);"))
  501. if features["ppob"]["status"]:
  502. f.write(indented_str(2, "ImageView imageViewPPOB = findViewById(R.id.btn_ppob);"))
  503. else:
  504. f.write(indented_str(2, "// ImageView imageViewPPOB = findViewById(R.id.btn_ppob);"))
  505. if features["wallet"]["status"]:
  506. f.write(indented_str(2, "ImageView imageViewWallet = findViewById(R.id.btn_wallet);"))
  507. else:
  508. f.write(indented_str(2, "// ImageView imageViewWallet = findViewById(R.id.btn_wallet);"))
  509. if features["social_commerce"]["status"]:
  510. f.write(indented_str(2, "ImageView imageViewSocialCommerce = findViewById(R.id.btn_social_commerce);"))
  511. else:
  512. f.write(indented_str(2, "// ImageView imageViewSocialCommerce = findViewById(R.id.btn_social_commerce);"))
  513. if features["news_update"]["status"]:
  514. f.write(indented_str(2, "ImageView imageViewNews = findViewById(R.id.btn_news);"))
  515. else:
  516. f.write(indented_str(2, "// ImageView imageViewNews = findViewById(R.id.btn_news);"))
  517. if features["contact_list"]["status"]:
  518. f.write(indented_str(2, "ImageView imageViewContactList = findViewById(R.id.btn_contact_list);"))
  519. else:
  520. f.write(indented_str(2, "// ImageView imageViewContactList = findViewById(R.id.btn_contact_list);"))
  521. f.write(indented_str(0, ""))
  522. f.write(indented_str(2, "imageViewSetting.setOnClickListener(v -> {"))
  523. f.write(indented_str(3, "API.openSettings();"))
  524. f.write(indented_str(2, "});"))
  525. f.write(indented_str(2, "imageViewProfile.setOnClickListener(v -> {"))
  526. f.write(indented_str(3, "API.openProfile();"))
  527. f.write(indented_str(2, "});"))
  528. if features["cc"]["status"]:
  529. f.write(indented_str(2, "imageViewCC.setOnClickListener(v -> {"))
  530. f.write(indented_str(3, "API.openContactCenter();"))
  531. f.write(indented_str(2, "});"))
  532. else:
  533. f.write(indented_str(2, "// imageViewCC.setOnClickListener(v -> {"))
  534. f.write(indented_str(3, "// API.openContactCenter();"))
  535. f.write(indented_str(2, "// });"))
  536. if features["nc"]["status"]:
  537. f.write(indented_str(2, "imageViewNC.setOnClickListener(v -> {"))
  538. f.write(indented_str(3, "API.openNotificationCenter();"))
  539. f.write(indented_str(2, "});"))
  540. else:
  541. f.write(indented_str(2, "// imageViewNC.setOnClickListener(v -> {"))
  542. f.write(indented_str(3, "// API.openNotificationCenter();"))
  543. f.write(indented_str(2, "// });"))
  544. if features["im"]["status"]:
  545. f.write(indented_str(2, "imageViewChat.setOnClickListener(v -> {"))
  546. f.write(indented_str(3, "API.openChat();"))
  547. f.write(indented_str(2, "});"))
  548. else:
  549. f.write(indented_str(2, "// imageViewChat.setOnClickListener(v -> {"))
  550. f.write(indented_str(3, "// API.openChat();"))
  551. f.write(indented_str(2, "// });"))
  552. if features["ac"]["status"]:
  553. f.write(indented_str(2, "imageViewAudioCall.setOnClickListener(v -> {"))
  554. f.write(indented_str(3, "API.openAudioCall();"))
  555. f.write(indented_str(2, "});"))
  556. else:
  557. f.write(indented_str(2, "// imageViewAudioCall.setOnClickListener(v -> {"))
  558. f.write(indented_str(3, "// API.openAudioCall();"))
  559. f.write(indented_str(2, "// });"))
  560. if features["vc"]["status"]:
  561. f.write(indented_str(2, "imageViewVideoCall.setOnClickListener(v -> {"))
  562. f.write(indented_str(3, "API.openVideoCall();"))
  563. f.write(indented_str(2, "});"))
  564. else:
  565. f.write(indented_str(2, "// imageViewVideoCall.setOnClickListener(v -> {"))
  566. f.write(indented_str(3, "// API.openVideoCall();"))
  567. f.write(indented_str(2, "// });"))
  568. if features["call"]["status"]:
  569. f.write(indented_str(2, "imageViewCall.setOnClickListener(v -> {"))
  570. f.write(indented_str(3, "API.openCall();"))
  571. f.write(indented_str(2, "});"))
  572. else:
  573. f.write(indented_str(2, "// imageViewCall.setOnClickListener(v -> {"))
  574. f.write(indented_str(3, "// API.openCall();"))
  575. f.write(indented_str(2, "// });"))
  576. if features["ls"]["status"]:
  577. f.write(indented_str(2, "imageViewStream.setOnClickListener(v -> {"))
  578. f.write(indented_str(3, "API.openLiveStreaming();"))
  579. f.write(indented_str(2, "});"))
  580. else:
  581. f.write(indented_str(2, "// imageViewStream.setOnClickListener(v -> {"))
  582. f.write(indented_str(3, "// API.openLiveStreaming();"))
  583. f.write(indented_str(2, "// });"))
  584. if security["secure_folder"]:
  585. f.write(indented_str(2, "imageViewSF.setOnClickListener(v -> {"))
  586. f.write(indented_str(3, "API.openSecureFolder();"))
  587. f.write(indented_str(2, "});"))
  588. else:
  589. f.write(indented_str(2, "// imageViewSF.setOnClickListener(v -> {"))
  590. f.write(indented_str(3, "// API.openSecureFolder();"))
  591. f.write(indented_str(2, "// });"))
  592. if features["custom_url"]["status"]:
  593. f.write(indented_str(2, "imageViewCustomURL.setOnClickListener(v -> {"))
  594. f.write(indented_str(3, "API.openCustomURL();"))
  595. f.write(indented_str(2, "});"))
  596. else:
  597. f.write(indented_str(2, "// imageViewCustomURL.setOnClickListener(v -> {"))
  598. f.write(indented_str(3, "// API.openCustomURL();"))
  599. f.write(indented_str(2, "// });"))
  600. if features["xapps"]["status"]:
  601. f.write(indented_str(2, "imageViewExternalApps.setOnClickListener(v -> {"))
  602. f.write(indented_str(3, "API.openExternalApps();"))
  603. f.write(indented_str(2, "});"))
  604. else:
  605. f.write(indented_str(2, "// imageViewExternalApps.setOnClickListener(v -> {"))
  606. f.write(indented_str(3, "// API.openExternalApps();"))
  607. f.write(indented_str(2, "// });"))
  608. if features["conpost"]["status"]:
  609. f.write(indented_str(2, "imageViewContentPosting.setOnClickListener(v -> {"))
  610. f.write(indented_str(3, "API.openUserGeneratedContent();"))
  611. f.write(indented_str(2, "});"))
  612. else:
  613. f.write(indented_str(2, "// imageViewContentPosting.setOnClickListener(v -> {"))
  614. f.write(indented_str(3, "// API.openUserGeneratedContent();"))
  615. f.write(indented_str(2, "// });"))
  616. if features["ppob"]["status"]:
  617. f.write(indented_str(2, "imageViewPPOB.setOnClickListener(v -> {"))
  618. f.write(indented_str(3, "API.openPPOB();"))
  619. f.write(indented_str(2, "});"))
  620. else:
  621. f.write(indented_str(2, "// imageViewPPOB.setOnClickListener(v -> {"))
  622. f.write(indented_str(3, "// API.openPPOB();"))
  623. f.write(indented_str(2, "// });"))
  624. if features["wallet"]["status"]:
  625. f.write(indented_str(2, "imageViewWallet.setOnClickListener(v -> {"))
  626. f.write(indented_str(3, "API.openWallet();"))
  627. f.write(indented_str(2, "});"))
  628. else:
  629. f.write(indented_str(2, "// imageViewWallet.setOnClickListener(v -> {"))
  630. f.write(indented_str(3, "// API.openWallet();"))
  631. f.write(indented_str(2, "// });"))
  632. if features["social_commerce"]["status"]:
  633. f.write(indented_str(2, "imageViewSocialCommerce.setOnClickListener(v -> {"))
  634. f.write(indented_str(3, "API.openSocialCommerce();"))
  635. f.write(indented_str(2, "});"))
  636. else:
  637. f.write(indented_str(2, "// imageViewSocialCommerce.setOnClickListener(v -> {"))
  638. f.write(indented_str(3, "// API.openSocialCommerce();"))
  639. f.write(indented_str(2, "// });"))
  640. if features["news_update"]["status"]:
  641. f.write(indented_str(2, "imageViewNews.setOnClickListener(v -> {"))
  642. f.write(indented_str(3, "API.openNewsUpdate();"))
  643. f.write(indented_str(2, "});"))
  644. else:
  645. f.write(indented_str(2, "// imageViewNews.setOnClickListener(v -> {"))
  646. f.write(indented_str(3, "// API.openNewsUpdate();"))
  647. f.write(indented_str(2, "// });"))
  648. if features["contact_list"]["status"]:
  649. f.write(indented_str(2, "imageViewContactList.setOnClickListener(v -> {"))
  650. f.write(indented_str(3, "API.openConversation();"))
  651. f.write(indented_str(2, "});"))
  652. else:
  653. f.write(indented_str(2, "// imageViewContactList.setOnClickListener(v -> {"))
  654. f.write(indented_str(3, "// API.openConversation();"))
  655. f.write(indented_str(2, "// });"))
  656. elif "//BREAK" in line:
  657. if mode == "floating" or mode == "grid":
  658. f.write("}")
  659. break
  660. else:
  661. f.write(indented_str(0, ""))
  662. elif "//FLOATING" in line:
  663. if mode == "floating":
  664. write_floating_button(f, features, security)
  665. else:
  666. f.write(indented_str(0, ""))
  667. elif "API.connect" in line:
  668. replaced = line
  669. if app_id:
  670. replaced = replaced.replace('***REPLACE***WITH***YOUR***APPLICATION***NAME***', app_id)
  671. if mode == "floating":
  672. replaced = replaced.replace("0", "1")
  673. f.write(replaced)
  674. elif "R.layout.activity_main" in line:
  675. replaced = line
  676. if mode == "grid":
  677. replaced = replaced.replace("activity_main", "activity_main_grid")
  678. f.write(replaced)
  679. else:
  680. f.write(line)
  681. with open(xml_menu_path, "r") as f:
  682. lines = f.readlines()
  683. with open(xml_menu_path, "w") as f:
  684. for line in lines:
  685. if "<!-- FEATURES -->" in line:
  686. n = 100
  687. f.write(indented_str(1, "<item"))
  688. f.write(indented_str(2, 'android:id="@+id/action_settings"'))
  689. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  690. f.write(indented_str(2, 'android:title="Settings"'))
  691. f.write(indented_str(2, 'app:showAsAction="never" />'))
  692. n = n + 1
  693. f.write(indented_str(1, "<item"))
  694. f.write(indented_str(2, 'android:id="@+id/action_profile"'))
  695. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  696. f.write(indented_str(2, 'android:title="Profile"'))
  697. f.write(indented_str(2, 'app:showAsAction="never" />'))
  698. n = n + 1
  699. if features["cc"]["status"]:
  700. f.write(indented_str(1, "<item"))
  701. f.write(indented_str(2, 'android:id="@+id/action_cc"'))
  702. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  703. f.write(indented_str(2, 'android:title="Contact Center"'))
  704. f.write(indented_str(2, 'app:showAsAction="never" />'))
  705. n = n + 1
  706. else:
  707. f.write(indented_str(1, "<!-- <item"))
  708. f.write(indented_str(2, 'android:id="@+id/action_cc"'))
  709. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  710. f.write(indented_str(2, 'android:title="Contact Center"'))
  711. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  712. n = n + 1
  713. if features["nc"]["status"]:
  714. f.write(indented_str(1, "<item"))
  715. f.write(indented_str(2, 'android:id="@+id/action_nc"'))
  716. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  717. f.write(indented_str(2, 'android:title="Notification Center"'))
  718. f.write(indented_str(2, 'app:showAsAction="never" />'))
  719. n = n + 1
  720. else:
  721. f.write(indented_str(1, "<!-- <item"))
  722. f.write(indented_str(2, 'android:id="@+id/action_nc"'))
  723. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  724. f.write(indented_str(2, 'android:title="Notification Center"'))
  725. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  726. n = n + 1
  727. if features["im"]["status"]:
  728. f.write(indented_str(1, "<item"))
  729. f.write(indented_str(2, 'android:id="@+id/action_chats"'))
  730. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  731. f.write(indented_str(2, 'android:title="Instant Messaging"'))
  732. f.write(indented_str(2, 'app:showAsAction="never" />'))
  733. n = n + 1
  734. else:
  735. f.write(indented_str(1, "<!-- <item"))
  736. f.write(indented_str(2, 'android:id="@+id/action_chats"'))
  737. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  738. f.write(indented_str(2, 'android:title="Instant Messaging"'))
  739. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  740. n = n + 1
  741. if features["ac"]["status"]:
  742. f.write(indented_str(1, "<item"))
  743. f.write(indented_str(2, 'android:id="@+id/action_audio_call"'))
  744. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  745. f.write(indented_str(2, 'android:title="Audio Call"'))
  746. f.write(indented_str(2, 'app:showAsAction="never" />'))
  747. n = n + 1
  748. else:
  749. f.write(indented_str(1, "<!-- <item"))
  750. f.write(indented_str(2, 'android:id="@+id/action_audio_call"'))
  751. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  752. f.write(indented_str(2, 'android:title="Audio Call"'))
  753. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  754. n = n + 1
  755. if features["vc"]["status"]:
  756. f.write(indented_str(1, "<item"))
  757. f.write(indented_str(2, 'android:id="@+id/action_video_call"'))
  758. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  759. f.write(indented_str(2, 'android:title="Video Call"'))
  760. f.write(indented_str(2, 'app:showAsAction="never" />'))
  761. n = n + 1
  762. else:
  763. f.write(indented_str(1, "<!-- <item"))
  764. f.write(indented_str(2, 'android:id="@+id/action_video_call"'))
  765. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  766. f.write(indented_str(2, 'android:title="Video Call"'))
  767. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  768. n = n + 1
  769. if features["call"]["status"]:
  770. f.write(indented_str(1, "<item"))
  771. f.write(indented_str(2, 'android:id="@+id/action_call"'))
  772. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  773. f.write(indented_str(2, 'android:title="Call"'))
  774. f.write(indented_str(2, 'app:showAsAction="never" />'))
  775. n = n + 1
  776. else:
  777. f.write(indented_str(1, "<!-- <item"))
  778. f.write(indented_str(2, 'android:id="@+id/action_call"'))
  779. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  780. f.write(indented_str(2, 'android:title="Call"'))
  781. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  782. n = n + 1
  783. if features["ls"]["status"]:
  784. f.write(indented_str(1, "<item"))
  785. f.write(indented_str(2, 'android:id="@+id/action_ls"'))
  786. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  787. f.write(indented_str(2, 'android:title="Streaming"'))
  788. f.write(indented_str(2, 'app:showAsAction="never" />'))
  789. n = n + 1
  790. else:
  791. f.write(indented_str(1, "<!-- <item"))
  792. f.write(indented_str(2, 'android:id="@+id/action_ls"'))
  793. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  794. f.write(indented_str(2, 'android:title="Streaming"'))
  795. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  796. n = n + 1
  797. if features["custom_url"]["status"]:
  798. f.write(indented_str(1, "<item"))
  799. f.write(indented_str(2, 'android:id="@+id/action_custom_url"'))
  800. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  801. f.write(indented_str(2, 'android:title="Custom URL"'))
  802. f.write(indented_str(2, 'app:showAsAction="never" />'))
  803. n = n + 1
  804. else:
  805. f.write(indented_str(1, "<!-- <item"))
  806. f.write(indented_str(2, 'android:id="@+id/action_custom_url"'))
  807. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  808. f.write(indented_str(2, 'android:title="Custom URL"'))
  809. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  810. n = n + 1
  811. if features["xapps"]["status"]:
  812. f.write(indented_str(1, "<item"))
  813. f.write(indented_str(2, 'android:id="@+id/action_xapps"'))
  814. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  815. f.write(indented_str(2, 'android:title="External Apps"'))
  816. f.write(indented_str(2, 'app:showAsAction="never" />'))
  817. n = n + 1
  818. else:
  819. f.write(indented_str(1, "<!-- <item"))
  820. f.write(indented_str(2, 'android:id="@+id/action_xapps"'))
  821. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  822. f.write(indented_str(2, 'android:title="External Apps"'))
  823. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  824. n = n + 1
  825. if features["conpost"]["status"]:
  826. f.write(indented_str(1, "<item"))
  827. f.write(indented_str(2, 'android:id="@+id/action_conpost"'))
  828. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  829. f.write(indented_str(2, 'android:title="User Generated Content"'))
  830. f.write(indented_str(2, 'app:showAsAction="never" />'))
  831. n = n + 1
  832. else:
  833. f.write(indented_str(1, "<!-- <item"))
  834. f.write(indented_str(2, 'android:id="@+id/action_conpost"'))
  835. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  836. f.write(indented_str(2, 'android:title="User Generated Content"'))
  837. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  838. n = n + 1
  839. if features["ppob"]["status"]:
  840. f.write(indented_str(1, "<item"))
  841. f.write(indented_str(2, 'android:id="@+id/action_ppob"'))
  842. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  843. f.write(indented_str(2, 'android:title="PPOB Agent"'))
  844. f.write(indented_str(2, 'app:showAsAction="never" />'))
  845. n = n + 1
  846. else:
  847. f.write(indented_str(1, "<!-- <item"))
  848. f.write(indented_str(2, 'android:id="@+id/action_ppob"'))
  849. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  850. f.write(indented_str(2, 'android:title="PPOB Agent"'))
  851. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  852. n = n + 1
  853. if features["wallet"]["status"]:
  854. f.write(indented_str(1, "<item"))
  855. f.write(indented_str(2, 'android:id="@+id/action_wallet"'))
  856. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  857. f.write(indented_str(2, 'android:title="Wallet"'))
  858. f.write(indented_str(2, 'app:showAsAction="never" />'))
  859. n = n + 1
  860. else:
  861. f.write(indented_str(1, "<!-- <item"))
  862. f.write(indented_str(2, 'android:id="@+id/action_wallet"'))
  863. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  864. f.write(indented_str(2, 'android:title="Wallet"'))
  865. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  866. n = n + 1
  867. if features["social_commerce"]["status"]:
  868. f.write(indented_str(1, "<item"))
  869. f.write(indented_str(2, 'android:id="@+id/action_social_commerce"'))
  870. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  871. f.write(indented_str(2, 'android:title="Social Commerce"'))
  872. f.write(indented_str(2, 'app:showAsAction="never" />'))
  873. n = n + 1
  874. else:
  875. f.write(indented_str(1, "<!-- <item"))
  876. f.write(indented_str(2, 'android:id="@+id/action_social_commerce"'))
  877. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  878. f.write(indented_str(2, 'android:title="Social Commerce"'))
  879. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  880. n = n + 1
  881. if features["news_update"]["status"]:
  882. f.write(indented_str(1, "<item"))
  883. f.write(indented_str(2, 'android:id="@+id/action_news_update"'))
  884. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  885. f.write(indented_str(2, 'android:title="News & Update"'))
  886. f.write(indented_str(2, 'app:showAsAction="never" />'))
  887. n = n + 1
  888. else:
  889. f.write(indented_str(1, "<!-- <item"))
  890. f.write(indented_str(2, 'android:id="@+id/action_news_update"'))
  891. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  892. f.write(indented_str(2, 'android:title="News & Update"'))
  893. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  894. n = n + 1
  895. if features["contact_list"]["status"]:
  896. f.write(indented_str(1, "<item"))
  897. f.write(indented_str(2, 'android:id="@+id/action_contact_list"'))
  898. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  899. f.write(indented_str(2, 'android:title="Contact List"'))
  900. f.write(indented_str(2, 'app:showAsAction="never" />'))
  901. n = n + 1
  902. else:
  903. f.write(indented_str(1, "<!-- <item"))
  904. f.write(indented_str(2, 'android:id="@+id/action_contact_list"'))
  905. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  906. f.write(indented_str(2, 'android:title="Contact List"'))
  907. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  908. n = n + 1
  909. if security["secure_folder"]:
  910. f.write(indented_str(1, "<item"))
  911. f.write(indented_str(2, 'android:id="@+id/action_sf"'))
  912. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  913. f.write(indented_str(2, 'android:title="Secure Folder"'))
  914. f.write(indented_str(2, 'app:showAsAction="never" />'))
  915. n = n + 1
  916. else:
  917. f.write(indented_str(1, "<!-- <item"))
  918. f.write(indented_str(2, 'android:id="@+id/action_sf"'))
  919. f.write(indented_str(2, f'android:orderInCategory="{n}"'))
  920. f.write(indented_str(2, 'android:title="Secure Folder"'))
  921. f.write(indented_str(2, 'app:showAsAction="never" /> -->'))
  922. n = n + 1
  923. else:
  924. f.write(line)
  925. l_features = [x for x in list(features.keys()) if features[x]["status"] and x != "smartbot" and x != "sms" and x != "email"]
  926. if security["secure_folder"]:
  927. l_features.append("secure_folder")
  928. n_features = len(l_features) + 2
  929. row_count = -(n_features // -3) # ceiling div
  930. column_count = 3
  931. with open(layout_grid_path, "r") as f:
  932. lines = f.readlines()
  933. with open(layout_grid_path, "w") as f:
  934. for line in lines:
  935. if "rowCount" in line:
  936. f.write(indented_str(1, f'android:rowCount="{row_count}"'))
  937. elif "columnCount" in line:
  938. f.write(indented_str(1,f'android:columnCount="{column_count}"'))
  939. elif "<!-- FEATURES -->" in line:
  940. if mode != "grid":
  941. f.write(indented_str(1, "<!--"))
  942. f.write(indented_str(1, "<ImageView"))
  943. f.write(indented_str(2, 'android:id="@+id/btn_setting"'))
  944. f.write(indented_str(2, 'android:layout_height="100dp"'))
  945. f.write(indented_str(2, 'android:layout_width="100dp"'))
  946. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  947. f.write(indented_str(2, 'android:src="@drawable/pb_cuc_menu_item_setting"/>'))
  948. f.write(indented_str(1, "<ImageView"))
  949. f.write(indented_str(2, 'android:id="@+id/btn_person"'))
  950. f.write(indented_str(2, 'android:layout_height="100dp"'))
  951. f.write(indented_str(2, 'android:layout_width="100dp"'))
  952. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  953. f.write(indented_str(2, 'android:src="@drawable/pb_ic_person_boy"/>'))
  954. if mode != "grid":
  955. f.write(indented_str(1, "-->"))
  956. if mode == "grid" and "cc" in l_features:
  957. f.write(indented_str(1, "<ImageView"))
  958. f.write(indented_str(2, 'android:id="@+id/btn_cc"'))
  959. f.write(indented_str(2, 'android:layout_height="100dp"'))
  960. f.write(indented_str(2, 'android:layout_width="100dp"'))
  961. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  962. f.write(indented_str(2, 'android:src="@drawable/pb_button_cc"/>'))
  963. else:
  964. f.write(indented_str(1, "<!--<ImageView-->"))
  965. f.write(indented_str(2, '<!--android:id="@+id/btn_cc"-->'))
  966. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  967. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  968. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  969. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_cc"/>-->'))
  970. if mode == "grid" and "nc" in l_features:
  971. f.write(indented_str(1, "<ImageView"))
  972. f.write(indented_str(2, 'android:id="@+id/btn_nc"'))
  973. f.write(indented_str(2, 'android:layout_height="100dp"'))
  974. f.write(indented_str(2, 'android:layout_width="100dp"'))
  975. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  976. f.write(indented_str(2, 'android:src="@drawable/pb_button_notif_center"/>'))
  977. else:
  978. f.write(indented_str(1, "<!--<ImageView-->"))
  979. f.write(indented_str(2, '<!--android:id="@+id/btn_nc"-->'))
  980. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  981. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  982. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  983. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_notif_center"/>-->'))
  984. if mode == "grid" and "im" in l_features:
  985. f.write(indented_str(1, "<ImageView"))
  986. f.write(indented_str(2, 'android:id="@+id/btn_chat"'))
  987. f.write(indented_str(2, 'android:layout_height="100dp"'))
  988. f.write(indented_str(2, 'android:layout_width="100dp"'))
  989. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  990. f.write(indented_str(2, 'android:src="@drawable/pb_button_chat"/>'))
  991. else:
  992. f.write(indented_str(1, "<!--<ImageView-->"))
  993. f.write(indented_str(2, '<!--android:id="@+id/btn_chat"-->'))
  994. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  995. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  996. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  997. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_chat"/>-->'))
  998. if mode == "grid" and "ac" in l_features:
  999. f.write(indented_str(1, "<ImageView"))
  1000. f.write(indented_str(2, 'android:id="@+id/btn_audio_call"'))
  1001. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1002. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1003. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1004. f.write(indented_str(2, 'android:src="@drawable/pb_button_audio_call"/>'))
  1005. else:
  1006. f.write(indented_str(1, "<!--<ImageView-->"))
  1007. f.write(indented_str(2, '<!--android:id="@+id/btn_audio_call"-->'))
  1008. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1009. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1010. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1011. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_audio_call"/>-->'))
  1012. if mode == "grid" and "vc" in l_features:
  1013. f.write(indented_str(1, "<ImageView"))
  1014. f.write(indented_str(2, 'android:id="@+id/btn_video_call"'))
  1015. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1016. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1017. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1018. f.write(indented_str(2, 'android:src="@drawable/pb_button_video_call"/>'))
  1019. else:
  1020. f.write(indented_str(1, "<!--<ImageView-->"))
  1021. f.write(indented_str(2, '<!--android:id="@+id/btn_video_call"-->'))
  1022. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1023. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1024. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1025. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_video_call"/>-->'))
  1026. if mode == "grid" and "call" in l_features:
  1027. f.write(indented_str(1, "<ImageView"))
  1028. f.write(indented_str(2, 'android:id="@+id/btn_call"'))
  1029. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1030. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1031. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1032. f.write(indented_str(2, 'android:src="@drawable/pb_button_call"/>'))
  1033. else:
  1034. f.write(indented_str(1, "<!--<ImageView-->"))
  1035. f.write(indented_str(2, '<!--android:id="@+id/btn_call"-->'))
  1036. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1037. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1038. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1039. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_call"/>-->'))
  1040. if mode == "grid" and "ls" in l_features:
  1041. f.write(indented_str(1, "<ImageView"))
  1042. f.write(indented_str(2, 'android:id="@+id/btn_stream"'))
  1043. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1044. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1045. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1046. f.write(indented_str(2, 'android:src="@drawable/pb_button_stream"/>'))
  1047. else:
  1048. f.write(indented_str(1, "<!--<ImageView-->"))
  1049. f.write(indented_str(2, '<!--android:id="@+id/btn_stream"-->'))
  1050. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1051. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1052. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1053. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_stream"/>-->'))
  1054. if mode == "grid" and "secure_folder" in l_features:
  1055. f.write(indented_str(1, "<ImageView"))
  1056. f.write(indented_str(2, 'android:id="@+id/btn_sf"'))
  1057. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1058. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1059. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1060. f.write(indented_str(2, 'android:src="@drawable/pb_button_secure_folder"/>'))
  1061. else:
  1062. f.write(indented_str(1, "<!--<ImageView-->"))
  1063. f.write(indented_str(2, '<!--android:id="@+id/btn_sf"-->'))
  1064. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1065. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1066. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1067. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_secure_folder"/>-->'))
  1068. if mode == "grid" and "custom_url" in l_features:
  1069. f.write(indented_str(1, "<ImageView"))
  1070. f.write(indented_str(2, 'android:id="@+id/btn_custom_url"'))
  1071. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1072. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1073. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1074. f.write(indented_str(2, 'android:src="@drawable/pb_button_custom_url"/>'))
  1075. else:
  1076. f.write(indented_str(1, "<!--<ImageView-->"))
  1077. f.write(indented_str(2, '<!--android:id="@+id/btn_custom_url"-->'))
  1078. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1079. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1080. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1081. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_custom_url"/>-->'))
  1082. if mode == "grid" and "xapps" in l_features:
  1083. f.write(indented_str(1, "<ImageView"))
  1084. f.write(indented_str(2, 'android:id="@+id/btn_xapps"'))
  1085. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1086. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1087. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1088. f.write(indented_str(2, 'android:src="@drawable/pb_button_external_apps"/>'))
  1089. else:
  1090. f.write(indented_str(1, "<!--<ImageView-->"))
  1091. f.write(indented_str(2, '<!--android:id="@+id/btn_xapps"-->'))
  1092. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1093. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1094. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1095. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_external_apps"/>-->'))
  1096. if mode == "grid" and "conpost" in l_features:
  1097. f.write(indented_str(1, "<ImageView"))
  1098. f.write(indented_str(2, 'android:id="@+id/btn_contentpost"'))
  1099. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1100. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1101. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1102. f.write(indented_str(2, 'android:src="@drawable/pb_button_user_content"/>'))
  1103. else:
  1104. f.write(indented_str(1, "<!--<ImageView-->"))
  1105. f.write(indented_str(2, '<!--android:id="@+id/btn_contentpost"-->'))
  1106. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1107. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1108. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1109. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_user_content"/>-->'))
  1110. if mode == "grid" and "ppob" in l_features:
  1111. f.write(indented_str(1, "<ImageView"))
  1112. f.write(indented_str(2, 'android:id="@+id/btn_ppob"'))
  1113. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1114. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1115. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1116. f.write(indented_str(2, 'android:src="@drawable/pb_button_ppob"/>'))
  1117. else:
  1118. f.write(indented_str(1, "<!--<ImageView-->"))
  1119. f.write(indented_str(2, '<!--android:id="@+id/btn_ppob"-->'))
  1120. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1121. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1122. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1123. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_ppob"/>-->'))
  1124. if mode == "grid" and "wallet" in l_features:
  1125. f.write(indented_str(1, "<ImageView"))
  1126. f.write(indented_str(2, 'android:id="@+id/btn_wallet"'))
  1127. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1128. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1129. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1130. f.write(indented_str(2, 'android:src="@drawable/pb_button_wallet"/>'))
  1131. else:
  1132. f.write(indented_str(1, "<!--<ImageView-->"))
  1133. f.write(indented_str(2, '<!--android:id="@+id/btn_wallet"-->'))
  1134. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1135. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1136. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1137. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_wallet"/>-->'))
  1138. if mode == "grid" and "social_commerce" in l_features:
  1139. f.write(indented_str(1, "<ImageView"))
  1140. f.write(indented_str(2, 'android:id="@+id/btn_social_commerce"'))
  1141. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1142. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1143. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1144. f.write(indented_str(2, 'android:src="@drawable/pb_button_social_commerce"/>'))
  1145. else:
  1146. f.write(indented_str(1, "<!--<ImageView-->"))
  1147. f.write(indented_str(2, '<!--android:id="@+id/btn_social_commerce"-->'))
  1148. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1149. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1150. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1151. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_social_commerce"/>-->'))
  1152. if mode == "grid" and "news_update" in l_features:
  1153. f.write(indented_str(1, "<ImageView"))
  1154. f.write(indented_str(2, 'android:id="@+id/btn_news"'))
  1155. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1156. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1157. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1158. f.write(indented_str(2, 'android:src="@drawable/pb_button_news"/>'))
  1159. else:
  1160. f.write(indented_str(1, "<!--<ImageView-->"))
  1161. f.write(indented_str(2, '<!--android:id="@+id/btn_news"-->'))
  1162. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1163. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1164. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1165. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_news"/>-->'))
  1166. if mode == "grid" and "contact_list" in l_features:
  1167. f.write(indented_str(1, "<ImageView"))
  1168. f.write(indented_str(2, 'android:id="@+id/btn_contact_list"'))
  1169. f.write(indented_str(2, 'android:layout_height="100dp"'))
  1170. f.write(indented_str(2, 'android:layout_width="100dp"'))
  1171. f.write(indented_str(2, 'android:layout_margin="10dp"'))
  1172. f.write(indented_str(2, 'android:src="@drawable/pb_button_contact_list"/>'))
  1173. else:
  1174. f.write(indented_str(1, "<!--<ImageView-->"))
  1175. f.write(indented_str(2, '<!--android:id="@+id/btn_contact_list"-->'))
  1176. f.write(indented_str(2, '<!--android:layout_height="100dp"-->'))
  1177. f.write(indented_str(2, '<!--android:layout_width="100dp"-->'))
  1178. f.write(indented_str(2, '<!--android:layout_margin="10dp"-->'))
  1179. f.write(indented_str(2, '<!--android:src="@drawable/pb_button_contact_list"/>-->'))
  1180. else:
  1181. f.write(line)
  1182. write_android_manifest(manifest_path, features, security)
  1183. elif platform == "android_flutter":
  1184. main_act_path = os.path.join(path_dest, "lib/main.dart")
  1185. main_act_android = os.path.join(path_dest,
  1186. "android/app/src/main/java/com/example/paliolitesamplecodeflutter/MainActivity.java")
  1187. manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
  1188. with open(main_act_path, "r") as f:
  1189. lines = f.readlines()
  1190. with open(main_act_path, "w") as f:
  1191. features_str = []
  1192. for line in lines:
  1193. if "'Features List'" in line:
  1194. features_str.append("'Settings'")
  1195. features_str.append("'Profile'")
  1196. if features["cc"]["status"]:
  1197. features_str.append("'Contact Center'")
  1198. else:
  1199. features_str.append("// 'Contact Center'")
  1200. if features["nc"]["status"]:
  1201. features_str.append("'Notification Center'")
  1202. else:
  1203. features_str.append("// 'Notification Center'")
  1204. if features["im"]["status"]:
  1205. features_str.append("'Instant Messaging'")
  1206. else:
  1207. features_str.append("// 'Instant Messaging'")
  1208. if features["call"]["status"]:
  1209. features_str.append("'Call'")
  1210. else:
  1211. features_str.append("// 'Call'")
  1212. if features["ls"]["status"]:
  1213. features_str.append("'Streaming'")
  1214. else:
  1215. features_str.append("// 'Streaming'")
  1216. if security["secure_folder"]:
  1217. features_str.append("'Secure Folder'")
  1218. else:
  1219. features_str.append("// 'Secure Folder'")
  1220. for feature_str in features_str:
  1221. f.write(indented_str(8, f"{feature_str},", spaces=2))
  1222. elif "//FEATURES" in line:
  1223. f.write(indented_str(3, 'case "Settings":', spaces=2))
  1224. f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
  1225. f.write(indented_str(4, "break;", spaces=2))
  1226. f.write(indented_str(3, 'case "Profile":', spaces=2))
  1227. f.write(indented_str(4, 'nativeChannel.invokeMethod("openProfile");', spaces=2))
  1228. f.write(indented_str(4, "break;", spaces=2))
  1229. if features["cc"]["status"]:
  1230. f.write(indented_str(3, 'case "Contact Center":', spaces=2))
  1231. f.write(indented_str(4, 'nativeChannel.invokeMethod("openContactCenter");', spaces=2))
  1232. f.write(indented_str(4, "break;", spaces=2))
  1233. else:
  1234. f.write(indented_str(3, '// case "Contact Center":', spaces=2))
  1235. f.write(indented_str(4, '// nativeChannel.invokeMethod("openContactCenter");', spaces=2))
  1236. f.write(indented_str(4, "// break;", spaces=2))
  1237. if features["nc"]["status"]:
  1238. f.write(indented_str(3, 'case "Notification Center":', spaces=2))
  1239. f.write(indented_str(4, 'nativeChannel.invokeMethod("openNotificationCenter");', spaces=2))
  1240. f.write(indented_str(4, "break;", spaces=2))
  1241. else:
  1242. f.write(indented_str(3, '// case "Notification Center":', spaces=2))
  1243. f.write(indented_str(4, '// nativeChannel.invokeMethod("openNotificationCenter");', spaces=2))
  1244. f.write(indented_str(4, "// break;", spaces=2))
  1245. if features["im"]["status"]:
  1246. f.write(indented_str(3, 'case "Instant Messaging":', spaces=2))
  1247. f.write(indented_str(4, 'nativeChannel.invokeMethod("openInstantMessaging");', spaces=2))
  1248. f.write(indented_str(4, "break;", spaces=2))
  1249. else:
  1250. f.write(indented_str(3, '// case "Instant Messaging":', spaces=2))
  1251. f.write(indented_str(4, '// nativeChannel.invokeMethod("openInstantMessaging");', spaces=2))
  1252. f.write(indented_str(4, "// break;", spaces=2))
  1253. if features["call"]["status"]:
  1254. f.write(indented_str(3, 'case "Call":', spaces=2))
  1255. f.write(indented_str(4, 'nativeChannel.invokeMethod("openCall");', spaces=2))
  1256. f.write(indented_str(4, "break;", spaces=2))
  1257. else:
  1258. f.write(indented_str(3, '// case "Call":', spaces=2))
  1259. f.write(indented_str(4, '// nativeChannel.invokeMethod("openCall");', spaces=2))
  1260. f.write(indented_str(4, "// break;", spaces=2))
  1261. if features["ls"]["status"]:
  1262. f.write(indented_str(3, 'case "Streaming":', spaces=2))
  1263. f.write(indented_str(4, 'nativeChannel.invokeMethod("openStreaming");', spaces=2))
  1264. f.write(indented_str(4, "break;", spaces=2))
  1265. else:
  1266. f.write(indented_str(3, '// case "Streaming":', spaces=2))
  1267. f.write(indented_str(4, '// nativeChannel.invokeMethod("openStreaming");', spaces=2))
  1268. f.write(indented_str(4, "// break;", spaces=2))
  1269. if security["secure_folder"]:
  1270. f.write(indented_str(3, 'case "Secure Folder":', spaces=2))
  1271. f.write(indented_str(4, 'nativeChannel.invokeMethod("openSecureFolder");', spaces=2))
  1272. f.write(indented_str(4, "break;", spaces=2))
  1273. else:
  1274. f.write(indented_str(3, '// case "Secure Folder":', spaces=2))
  1275. f.write(indented_str(4, '// nativeChannel.invokeMethod("openSecureFolder");', spaces=2))
  1276. f.write(indented_str(4, "// break;", spaces=2))
  1277. else:
  1278. f.write(line)
  1279. with open(main_act_android, "r") as f:
  1280. lines = f.readlines()
  1281. with open(main_act_android, "w") as f:
  1282. for line in lines:
  1283. if "//SECURITY" in line:
  1284. if security["show_security"]:
  1285. f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);"))
  1286. f.write(os.linesep)
  1287. else:
  1288. f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);"))
  1289. f.write(os.linesep)
  1290. if security["emulator"]:
  1291. f.write(indented_str(2, "API.setCheckEmulator(true);"))
  1292. f.write(os.linesep)
  1293. else:
  1294. f.write(indented_str(2, "// API.setCheckEmulator(true);"))
  1295. f.write(os.linesep)
  1296. if security["debug"]:
  1297. f.write(indented_str(2, "API.setCheckAdb(true);"))
  1298. f.write(os.linesep)
  1299. else:
  1300. f.write(indented_str(2, "// API.setCheckAdb(true);"))
  1301. f.write(os.linesep)
  1302. if security["sim_swap"]:
  1303. f.write(indented_str(2, "API.setCheckSimSwap(true);"))
  1304. f.write(os.linesep)
  1305. else:
  1306. f.write(indented_str(2, "// API.setCheckSimSwap(true);"))
  1307. f.write(os.linesep)
  1308. if security["malware"]:
  1309. f.write(indented_str(2, "API.setCheckMalware(true);"))
  1310. f.write(os.linesep)
  1311. else:
  1312. f.write(indented_str(2, "// API.setCheckMalware(true);"))
  1313. f.write(os.linesep)
  1314. if security["capture"]:
  1315. f.write(indented_str(2, "API.setPreventScreenCapture(true);"))
  1316. f.write(os.linesep)
  1317. else:
  1318. f.write(indented_str(2, "// API.setPreventScreenCapture(true);"))
  1319. f.write(os.linesep)
  1320. if security["call_forwarding"]:
  1321. f.write(indented_str(2, "API.setCheckCallForwarding(true);"))
  1322. f.write(os.linesep)
  1323. else:
  1324. f.write(indented_str(2, "// API.setCheckCallForwarding(true);"))
  1325. f.write(os.linesep)
  1326. if security["screen_share"]:
  1327. f.write(indented_str(2, "API.setCheckScreenCasting(true);"))
  1328. f.write(os.linesep)
  1329. else:
  1330. f.write(indented_str(2, "// API.setCheckScreenCasting(true);"))
  1331. f.write(os.linesep)
  1332. if security["side_load"]:
  1333. f.write(indented_str(2, "API.setCheckSideLoadedApp(true);"))
  1334. f.write(os.linesep)
  1335. else:
  1336. f.write(indented_str(2, "// API.setCheckSideLoadedApp(true);"))
  1337. f.write(os.linesep)
  1338. if security["key_logger"]:
  1339. f.write(indented_str(2, "API.setPreventKeylogger(true);"))
  1340. f.write(os.linesep)
  1341. else:
  1342. f.write(indented_str(2, "// API.setPreventKeylogger(true);"))
  1343. f.write(os.linesep)
  1344. elif "//SMS" in line:
  1345. if features["sms"]["status"]:
  1346. f.write(indented_str(2, "API.setEnabledSMS(true);"))
  1347. else:
  1348. f.write(indented_str(2, "// API.setEnabledSMS(true);"))
  1349. elif "//EMAIL" in line:
  1350. if features["email"]["status"]:
  1351. f.write(indented_str(2, "API.setEnabledEmail(true);"))
  1352. else:
  1353. f.write(indented_str(2, "// API.setEnabledEmail(true);"))
  1354. elif "//SMARTBOT" in line:
  1355. if features["smartbot"]["status"]:
  1356. f.write(indented_str(2, "API.setEnabledSmartBot(true);"))
  1357. else:
  1358. f.write(indented_str(2, "// API.setEnabledSmartBot(true);"))
  1359. elif "//FLOATING" in line:
  1360. if mode == "floating":
  1361. write_floating_button(f, features, security)
  1362. else:
  1363. f.write(indented_str(0, ""))
  1364. elif "API.connect" in line:
  1365. replaced = line
  1366. if app_id:
  1367. replaced = replaced.replace('***REPLACE***WITH***YOUR***APPLICATION***NAME***', app_id)
  1368. if mode == "floating":
  1369. replaced = replaced.replace("0", "1")
  1370. f.write(replaced)
  1371. else:
  1372. f.write(line)
  1373. write_android_manifest(manifest_path, features, security)
  1374. elif platform == "android_ionic":
  1375. main_act_path = os.path.join(path_dest, "src/app/app.component.ts")
  1376. main_act_android = os.path.join(path_dest,
  1377. "android/app/src/main/java/com/example/nexilissamplecodeionic/MainActivity.java")
  1378. manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
  1379. with open(main_act_path, "r") as f:
  1380. lines = f.readlines()
  1381. with open(main_act_path, "w") as f:
  1382. for line in lines:
  1383. if "//FEATURES" in line:
  1384. f.write(indented_str(4, '{', spaces=2))
  1385. f.write(indented_str(5, "text: 'Settings',", spaces=2))
  1386. f.write(indented_str(5, "handler: () => {", spaces=2))
  1387. f.write(indented_str(6, "this.openSettings();", spaces=2))
  1388. f.write(indented_str(5, "},", spaces=2))
  1389. f.write(indented_str(4, "},", spaces=2))
  1390. f.write(indented_str(4, '{', spaces=2))
  1391. f.write(indented_str(5, "text: 'Profile',", spaces=2))
  1392. f.write(indented_str(5, "handler: () => {", spaces=2))
  1393. f.write(indented_str(6, "this.openProfile();", spaces=2))
  1394. f.write(indented_str(5, "},", spaces=2))
  1395. f.write(indented_str(4, "},", spaces=2))
  1396. if features["cc"]["status"]:
  1397. f.write(indented_str(4, '{', spaces=2))
  1398. f.write(indented_str(5, "text: 'Contact Center',", spaces=2))
  1399. f.write(indented_str(5, "handler: () => {", spaces=2))
  1400. f.write(indented_str(6, "this.openContactCenter();", spaces=2))
  1401. f.write(indented_str(5, "},", spaces=2))
  1402. f.write(indented_str(4, "},", spaces=2))
  1403. else:
  1404. f.write(indented_str(4, '// {', spaces=2))
  1405. f.write(indented_str(5, "// text: 'Contact Center',", spaces=2))
  1406. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1407. f.write(indented_str(6, "// this.openContactCenter();", spaces=2))
  1408. f.write(indented_str(5, "// },", spaces=2))
  1409. f.write(indented_str(4, "// },", spaces=2))
  1410. if features["nc"]["status"]:
  1411. f.write(indented_str(4, '{', spaces=2))
  1412. f.write(indented_str(5, "text: 'Notification Center',", spaces=2))
  1413. f.write(indented_str(5, "handler: () => {", spaces=2))
  1414. f.write(indented_str(6, "this.openNotificationCenter();", spaces=2))
  1415. f.write(indented_str(5, "},", spaces=2))
  1416. f.write(indented_str(4, "},", spaces=2))
  1417. else:
  1418. f.write(indented_str(4, '// {', spaces=2))
  1419. f.write(indented_str(5, "// text: 'Notification Center',", spaces=2))
  1420. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1421. f.write(indented_str(6, "// this.openNotificationCenter();", spaces=2))
  1422. f.write(indented_str(5, "// },", spaces=2))
  1423. f.write(indented_str(4, "// },", spaces=2))
  1424. if features["im"]["status"]:
  1425. f.write(indented_str(4, '{', spaces=2))
  1426. f.write(indented_str(5, "text: 'Instant Messaging',", spaces=2))
  1427. f.write(indented_str(5, "handler: () => {", spaces=2))
  1428. f.write(indented_str(6, "this.openChat();", spaces=2))
  1429. f.write(indented_str(5, "},", spaces=2))
  1430. f.write(indented_str(4, "},", spaces=2))
  1431. else:
  1432. f.write(indented_str(4, '// {', spaces=2))
  1433. f.write(indented_str(5, "// text: 'Instant Messaging',", spaces=2))
  1434. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1435. f.write(indented_str(6, "// this.openChat();", spaces=2))
  1436. f.write(indented_str(5, "// },", spaces=2))
  1437. f.write(indented_str(4, "// },", spaces=2))
  1438. if features["call"]["status"]:
  1439. f.write(indented_str(4, '{', spaces=2))
  1440. f.write(indented_str(5, "text: 'Call',", spaces=2))
  1441. f.write(indented_str(5, "handler: () => {", spaces=2))
  1442. f.write(indented_str(6, "this.openCall();", spaces=2))
  1443. f.write(indented_str(5, "},", spaces=2))
  1444. f.write(indented_str(4, "},", spaces=2))
  1445. else:
  1446. f.write(indented_str(4, '// {', spaces=2))
  1447. f.write(indented_str(5, "// text: 'Call',", spaces=2))
  1448. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1449. f.write(indented_str(6, "// this.openCall();", spaces=2))
  1450. f.write(indented_str(5, "// },", spaces=2))
  1451. f.write(indented_str(4, "// },", spaces=2))
  1452. if features["ls"]["status"]:
  1453. f.write(indented_str(4, '{', spaces=2))
  1454. f.write(indented_str(5, "text: 'Streaming',", spaces=2))
  1455. f.write(indented_str(5, "handler: () => {", spaces=2))
  1456. f.write(indented_str(6, "this.openStreaming();", spaces=2))
  1457. f.write(indented_str(5, "},", spaces=2))
  1458. f.write(indented_str(4, "},", spaces=2))
  1459. else:
  1460. f.write(indented_str(4, '// {', spaces=2))
  1461. f.write(indented_str(5, "// text: 'Streaming',", spaces=2))
  1462. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1463. f.write(indented_str(6, "// this.openStreaming();", spaces=2))
  1464. f.write(indented_str(5, "// },", spaces=2))
  1465. f.write(indented_str(4, "// },", spaces=2))
  1466. if security["secure_folder"]:
  1467. f.write(indented_str(4, '{', spaces=2))
  1468. f.write(indented_str(5, "text: 'Secure Folder',", spaces=2))
  1469. f.write(indented_str(5, "handler: () => {", spaces=2))
  1470. f.write(indented_str(6, "this.openSecureFolder();", spaces=2))
  1471. f.write(indented_str(5, "},", spaces=2))
  1472. f.write(indented_str(4, "},", spaces=2))
  1473. else:
  1474. f.write(indented_str(4, '// {', spaces=2))
  1475. f.write(indented_str(5, "// text: 'Secure Folder',", spaces=2))
  1476. f.write(indented_str(5, "// handler: () => {", spaces=2))
  1477. f.write(indented_str(6, "// this.openSecureFolder();", spaces=2))
  1478. f.write(indented_str(5, "// },", spaces=2))
  1479. f.write(indented_str(4, "// },", spaces=2))
  1480. else:
  1481. f.write(line)
  1482. with open(main_act_android, "r") as f:
  1483. lines = f.readlines()
  1484. with open(main_act_android, "w") as f:
  1485. for line in lines:
  1486. if "//SECURITY" in line:
  1487. if security["show_security"]:
  1488. f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);", spaces=2))
  1489. f.write(os.linesep)
  1490. else:
  1491. f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);", spaces=2))
  1492. f.write(os.linesep)
  1493. if security["emulator"]:
  1494. f.write(indented_str(2, "API.setCheckEmulator(true);", spaces=2))
  1495. f.write(os.linesep)
  1496. else:
  1497. f.write(indented_str(2, "// API.setCheckEmulator(true);", spaces=2))
  1498. f.write(os.linesep)
  1499. if security["debug"]:
  1500. f.write(indented_str(2, "API.setCheckAdb(true);", spaces=2))
  1501. f.write(os.linesep)
  1502. else:
  1503. f.write(indented_str(2, "// API.setCheckAdb(true);", spaces=2))
  1504. f.write(os.linesep)
  1505. if security["sim_swap"]:
  1506. f.write(indented_str(2, "API.setCheckSimSwap(true);", spaces=2))
  1507. f.write(os.linesep)
  1508. else:
  1509. f.write(indented_str(2, "// API.setCheckSimSwap(true);", spaces=2))
  1510. f.write(os.linesep)
  1511. if security["malware"]:
  1512. f.write(indented_str(2, "API.setCheckMalware(true);", spaces=2))
  1513. f.write(os.linesep)
  1514. else:
  1515. f.write(indented_str(2, "// API.setCheckMalware(true);", spaces=2))
  1516. f.write(os.linesep)
  1517. if security["capture"]:
  1518. f.write(indented_str(2, "API.setPreventScreenCapture(true);", spaces=2))
  1519. f.write(os.linesep)
  1520. else:
  1521. f.write(indented_str(2, "// API.setPreventScreenCapture(true);", spaces=2))
  1522. f.write(os.linesep)
  1523. if security["call_forwarding"]:
  1524. f.write(indented_str(2, "API.setCheckCallForwarding(true);", spaces=2))
  1525. f.write(os.linesep)
  1526. else:
  1527. f.write(indented_str(2, "// API.setCheckCallForwarding(true);", spaces=2))
  1528. f.write(os.linesep)
  1529. if security["screen_share"]:
  1530. f.write(indented_str(2, "API.setCheckScreenCasting(true);", spaces=2))
  1531. f.write(os.linesep)
  1532. else:
  1533. f.write(indented_str(2, "// API.setCheckScreenCasting(true);", spaces=2))
  1534. f.write(os.linesep)
  1535. if security["side_load"]:
  1536. f.write(indented_str(2, "API.setCheckSideLoadedApp(true);", spaces=2))
  1537. f.write(os.linesep)
  1538. else:
  1539. f.write(indented_str(2, "// API.setCheckSideLoadedApp(true);", spaces=2))
  1540. f.write(os.linesep)
  1541. if security["key_logger"]:
  1542. f.write(indented_str(2, "API.setPreventKeylogger(true);", spaces=2))
  1543. f.write(os.linesep)
  1544. else:
  1545. f.write(indented_str(2, "// API.setPreventKeylogger(true);", spaces=2))
  1546. f.write(os.linesep)
  1547. elif "//SMS" in line:
  1548. if features["sms"]["status"]:
  1549. f.write(indented_str(2, "API.setEnabledSMS(true);", spaces=2))
  1550. else:
  1551. f.write(indented_str(2, "// API.setEnabledSMS(true);", spaces=2))
  1552. elif "//EMAIL" in line:
  1553. if features["email"]["status"]:
  1554. f.write(indented_str(2, "API.setEnabledEmail(true);", spaces=2))
  1555. else:
  1556. f.write(indented_str(2, "// API.setEnabledEmail(true);", spaces=2))
  1557. elif "//SMARTBOT" in line:
  1558. if features["smartbot"]["status"]:
  1559. f.write(indented_str(2, "API.setEnabledSmartBot(true);"))
  1560. else:
  1561. f.write(indented_str(2, "// API.setEnabledSmartBot(true);"))
  1562. elif "//FLOATING" in line:
  1563. if mode == "floating":
  1564. write_floating_button(f, features, security, spaces=2)
  1565. else:
  1566. f.write(indented_str(0, "", spaces=2))
  1567. elif "API.connect" in line:
  1568. replaced = line
  1569. if app_id:
  1570. replaced = replaced.replace('***REPLACE***WITH***YOUR***APPLICATION***NAME***', app_id)
  1571. if mode == "floating":
  1572. replaced = replaced.replace("0", "1")
  1573. f.write(replaced)
  1574. else:
  1575. f.write(line)
  1576. write_android_manifest(manifest_path, features, security)
  1577. elif platform == "android_react":
  1578. main_act_path = os.path.join(path_dest, "App.tsx")
  1579. main_act_android = os.path.join(path_dest,
  1580. "android/app/src/main/java/com/paliolitesamplecode/MainActivity.java")
  1581. manifest_path = os.path.join(path_dest, "android/app/src/main/AndroidManifest.xml")
  1582. with open(main_act_path, "r") as f:
  1583. lines = f.readlines()
  1584. with open(main_act_path, "w") as f:
  1585. for line in lines:
  1586. if "'Features'" in line:
  1587. f.write(indented_str(4, "'Setting',", spaces=2))
  1588. f.write(indented_str(4, "'Profile',", spaces=2))
  1589. if features["cc"]["status"]:
  1590. f.write(indented_str(4, "'Contact Center',", spaces=2))
  1591. else:
  1592. f.write(indented_str(4, "// 'Contact Center',", spaces=2))
  1593. if features["nc"]["status"]:
  1594. f.write(indented_str(4, "'Notification Center',", spaces=2))
  1595. else:
  1596. f.write(indented_str(4, "// 'Notification Center',", spaces=2))
  1597. if features["im"]["status"]:
  1598. f.write(indented_str(4, "'Chat',", spaces=2))
  1599. else:
  1600. f.write(indented_str(4, "// 'Chat',", spaces=2))
  1601. if features["call"]["status"]:
  1602. f.write(indented_str(4, "'Call',", spaces=2))
  1603. else:
  1604. f.write(indented_str(4, "// 'Call',", spaces=2))
  1605. if features["ls"]["status"]:
  1606. f.write(indented_str(4, "'Live Streaming',", spaces=2))
  1607. else:
  1608. f.write(indented_str(4, "// 'Live Streaming',", spaces=2))
  1609. if security["secure_folder"]:
  1610. f.write(indented_str(4, "'Secure Folder',", spaces=2))
  1611. else:
  1612. f.write(indented_str(4, "// 'Secure Folder',", spaces=2))
  1613. elif "//FEATURES1" in line:
  1614. n = 0
  1615. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1616. f.write(indented_str(6, "CallNative.openSetting();", spaces=2))
  1617. f.write(indented_str(5, "}", spaces=2))
  1618. n = n + 1
  1619. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1620. f.write(indented_str(6, "CallNative.openProfile();", spaces=2))
  1621. f.write(indented_str(5, "}", spaces=2))
  1622. n = n + 1
  1623. if features["cc"]["status"]:
  1624. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1625. f.write(indented_str(6, "CallNative.openContactCenter();", spaces=2))
  1626. f.write(indented_str(5, "}", spaces=2))
  1627. n = n + 1
  1628. else:
  1629. f.write(indented_str(5, "// if (buttonIndex === 2) {", spaces=2))
  1630. f.write(indented_str(6, "// CallNative.openContactCenter();", spaces=2))
  1631. f.write(indented_str(5, "// }", spaces=2))
  1632. if features["nc"]["status"]:
  1633. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1634. f.write(indented_str(6, "CallNative.openNotificationCenter();", spaces=2))
  1635. f.write(indented_str(5, "}", spaces=2))
  1636. n = n + 1
  1637. else:
  1638. f.write(indented_str(5, "// if (buttonIndex === 3) {", spaces=2))
  1639. f.write(indented_str(6, "// CallNative.openNotificationCenter();", spaces=2))
  1640. f.write(indented_str(5, "// }", spaces=2))
  1641. if features["im"]["status"]:
  1642. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1643. f.write(indented_str(6, "CallNative.openChat();", spaces=2))
  1644. f.write(indented_str(5, "}", spaces=2))
  1645. n = n + 1
  1646. else:
  1647. f.write(indented_str(5, "// if (buttonIndex === 4) {", spaces=2))
  1648. f.write(indented_str(6, "// CallNative.openChat();", spaces=2))
  1649. f.write(indented_str(5, "// }", spaces=2))
  1650. if features["call"]["status"]:
  1651. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1652. f.write(indented_str(6, "CallNative.openCall();", spaces=2))
  1653. f.write(indented_str(5, "}", spaces=2))
  1654. n = n + 1
  1655. else:
  1656. f.write(indented_str(5, "// if (buttonIndex === 5) {", spaces=2))
  1657. f.write(indented_str(6, "// CallNative.openCall();", spaces=2))
  1658. f.write(indented_str(5, "// }", spaces=2))
  1659. if features["ls"]["status"]:
  1660. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1661. f.write(indented_str(6, "CallNative.openStreaming();", spaces=2))
  1662. f.write(indented_str(5, "}", spaces=2))
  1663. n = n + 1
  1664. else:
  1665. f.write(indented_str(5, "// if (buttonIndex === 6) {", spaces=2))
  1666. f.write(indented_str(6, "// CallNative.openStreaming();", spaces=2))
  1667. f.write(indented_str(5, "// }", spaces=2))
  1668. if security["secure_folder"]:
  1669. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  1670. f.write(indented_str(6, "CallNative.openSecureFolder();", spaces=2))
  1671. f.write(indented_str(5, "}", spaces=2))
  1672. n = n + 1
  1673. else:
  1674. f.write(indented_str(5, "// if (buttonIndex === 7) {", spaces=2))
  1675. f.write(indented_str(6, "// CallNative.openSecureFolder();", spaces=2))
  1676. f.write(indented_str(5, "// }", spaces=2))
  1677. elif "//FEATURES2" in line:
  1678. n = 0
  1679. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1680. f.write(indented_str(3, "try {", spaces=2))
  1681. f.write(indented_str(4, "CallNative.openSetting();", spaces=2))
  1682. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1683. f.write(indented_str(4, "console.log(e);", spaces=2))
  1684. f.write(indented_str(3, "}", spaces=2))
  1685. f.write(indented_str(2, "}", spaces=2))
  1686. n = n + 1
  1687. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1688. f.write(indented_str(3, "try {", spaces=2))
  1689. f.write(indented_str(4, "CallNative.openProfile();", spaces=2))
  1690. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1691. f.write(indented_str(4, "console.log(e);", spaces=2))
  1692. f.write(indented_str(3, "}", spaces=2))
  1693. f.write(indented_str(2, "}", spaces=2))
  1694. n = n + 1
  1695. if features["cc"]["status"]:
  1696. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1697. f.write(indented_str(3, "try {", spaces=2))
  1698. f.write(indented_str(4, "CallNative.openContactCenter();", spaces=2))
  1699. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1700. f.write(indented_str(4, "console.log(e);", spaces=2))
  1701. f.write(indented_str(3, "}", spaces=2))
  1702. f.write(indented_str(2, "}", spaces=2))
  1703. n = n + 1
  1704. else:
  1705. f.write(indented_str(2, "// if (buttonIndex === 2) {", spaces=2))
  1706. f.write(indented_str(3, "// try {", spaces=2))
  1707. f.write(indented_str(4, "// CallNative.openContactCenter();", spaces=2))
  1708. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1709. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1710. f.write(indented_str(3, "// }", spaces=2))
  1711. f.write(indented_str(2, "// }", spaces=2))
  1712. if features["nc"]["status"]:
  1713. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1714. f.write(indented_str(3, "try {", spaces=2))
  1715. f.write(indented_str(4, "CallNative.openNotificationCenter();", spaces=2))
  1716. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1717. f.write(indented_str(4, "console.log(e);", spaces=2))
  1718. f.write(indented_str(3, "}", spaces=2))
  1719. f.write(indented_str(2, "}", spaces=2))
  1720. n = n + 1
  1721. else:
  1722. f.write(indented_str(2, "// if (buttonIndex === 3) {", spaces=2))
  1723. f.write(indented_str(3, "// try {", spaces=2))
  1724. f.write(indented_str(4, "// CallNative.openNotificationCenter();", spaces=2))
  1725. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1726. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1727. f.write(indented_str(3, "// }", spaces=2))
  1728. f.write(indented_str(2, "// }", spaces=2))
  1729. if features["im"]["status"]:
  1730. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1731. f.write(indented_str(3, "try {", spaces=2))
  1732. f.write(indented_str(4, "CallNative.openChat();", spaces=2))
  1733. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1734. f.write(indented_str(4, "console.log(e);", spaces=2))
  1735. f.write(indented_str(3, "}", spaces=2))
  1736. f.write(indented_str(2, "}", spaces=2))
  1737. n = n + 1
  1738. else:
  1739. f.write(indented_str(2, "// if (buttonIndex === 4) {", spaces=2))
  1740. f.write(indented_str(3, "// try {", spaces=2))
  1741. f.write(indented_str(4, "// CallNative.openChat();", spaces=2))
  1742. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1743. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1744. f.write(indented_str(3, "// }", spaces=2))
  1745. f.write(indented_str(2, "// }", spaces=2))
  1746. if features["call"]["status"]:
  1747. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1748. f.write(indented_str(3, "try {", spaces=2))
  1749. f.write(indented_str(4, "CallNative.openCall();", spaces=2))
  1750. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1751. f.write(indented_str(4, "console.log(e);", spaces=2))
  1752. f.write(indented_str(3, "}", spaces=2))
  1753. f.write(indented_str(2, "}", spaces=2))
  1754. n = n + 1
  1755. else:
  1756. f.write(indented_str(2, "// if (buttonIndex === 5) {", spaces=2))
  1757. f.write(indented_str(3, "// try {", spaces=2))
  1758. f.write(indented_str(4, "// CallNative.openCall();", spaces=2))
  1759. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1760. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1761. f.write(indented_str(3, "// }", spaces=2))
  1762. f.write(indented_str(2, "// }", spaces=2))
  1763. if features["ls"]["status"]:
  1764. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1765. f.write(indented_str(3, "try {", spaces=2))
  1766. f.write(indented_str(4, "CallNative.openStreaming();", spaces=2))
  1767. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1768. f.write(indented_str(4, "console.log(e);", spaces=2))
  1769. f.write(indented_str(3, "}", spaces=2))
  1770. f.write(indented_str(2, "}", spaces=2))
  1771. n = n + 1
  1772. else:
  1773. f.write(indented_str(2, "// if (buttonIndex === 6) {", spaces=2))
  1774. f.write(indented_str(3, "// try {", spaces=2))
  1775. f.write(indented_str(4, "// CallNative.openStreaming();", spaces=2))
  1776. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1777. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1778. f.write(indented_str(3, "// }", spaces=2))
  1779. f.write(indented_str(2, "// }", spaces=2))
  1780. if security["secure_folder"]:
  1781. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  1782. f.write(indented_str(3, "try {", spaces=2))
  1783. f.write(indented_str(4, "CallNative.openSecureFolder();", spaces=2))
  1784. f.write(indented_str(3, "} catch (e) {", spaces=2))
  1785. f.write(indented_str(4, "console.log(e);", spaces=2))
  1786. f.write(indented_str(3, "}", spaces=2))
  1787. f.write(indented_str(2, "}", spaces=2))
  1788. n = n + 1
  1789. else:
  1790. f.write(indented_str(2, "// if (buttonIndex === 7) {", spaces=2))
  1791. f.write(indented_str(3, "// try {", spaces=2))
  1792. f.write(indented_str(4, "// CallNative.openSecureFolder();", spaces=2))
  1793. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  1794. f.write(indented_str(4, "// console.log(e);", spaces=2))
  1795. f.write(indented_str(3, "// }", spaces=2))
  1796. f.write(indented_str(2, "// }", spaces=2))
  1797. elif "//FEATURES3" in line:
  1798. n = 0
  1799. f.write(indented_str(5, "<Button", spaces=2))
  1800. f.write(indented_str(6, 'title="Setting"', spaces=2))
  1801. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1802. f.write(indented_str(5, "/>", spaces=2))
  1803. n = n + 1
  1804. f.write(indented_str(5, "<Button", spaces=2))
  1805. f.write(indented_str(6, 'title="Profile"', spaces=2))
  1806. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1807. f.write(indented_str(5, "/>", spaces=2))
  1808. n = n + 1
  1809. if features["cc"]["status"]:
  1810. f.write(indented_str(5, "<Button", spaces=2))
  1811. f.write(indented_str(6, 'title="Contact Center"', spaces=2))
  1812. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1813. f.write(indented_str(5, "/>", spaces=2))
  1814. n = n + 1
  1815. else:
  1816. f.write(indented_str(5, "{/* <Button", spaces=2))
  1817. f.write(indented_str(6, 'title="Contact Center"', spaces=2))
  1818. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(2)}}', spaces=2))
  1819. f.write(indented_str(5, "/> */}", spaces=2))
  1820. if features["nc"]["status"]:
  1821. f.write(indented_str(5, "<Button", spaces=2))
  1822. f.write(indented_str(6, 'title="Notification Center"', spaces=2))
  1823. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1824. f.write(indented_str(5, "/>", spaces=2))
  1825. n = n + 1
  1826. else:
  1827. f.write(indented_str(5, "{/* <Button", spaces=2))
  1828. f.write(indented_str(6, 'title="Notification Center"', spaces=2))
  1829. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(3)}}', spaces=2))
  1830. f.write(indented_str(5, "/> */}", spaces=2))
  1831. if features["im"]["status"]:
  1832. f.write(indented_str(5, "<Button", spaces=2))
  1833. f.write(indented_str(6, 'title="Chat"', spaces=2))
  1834. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1835. f.write(indented_str(5, "/>", spaces=2))
  1836. n = n + 1
  1837. else:
  1838. f.write(indented_str(5, "{/* <Button", spaces=2))
  1839. f.write(indented_str(6, 'title="Chat"', spaces=2))
  1840. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(4)}}', spaces=2))
  1841. f.write(indented_str(5, "/> */}", spaces=2))
  1842. if features["call"]["status"]:
  1843. f.write(indented_str(5, "<Button", spaces=2))
  1844. f.write(indented_str(6, 'title="Call"', spaces=2))
  1845. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1846. f.write(indented_str(5, "/>", spaces=2))
  1847. n = n + 1
  1848. else:
  1849. f.write(indented_str(5, "{/* <Button", spaces=2))
  1850. f.write(indented_str(6, 'title="Call"', spaces=2))
  1851. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(5)}}', spaces=2))
  1852. f.write(indented_str(5, "/> */}", spaces=2))
  1853. if features["ls"]["status"]:
  1854. f.write(indented_str(5, "<Button", spaces=2))
  1855. f.write(indented_str(6, 'title="Live Streaming"', spaces=2))
  1856. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1857. f.write(indented_str(5, "/>", spaces=2))
  1858. n = n + 1
  1859. else:
  1860. f.write(indented_str(5, "{/* <Button", spaces=2))
  1861. f.write(indented_str(6, 'title="Live Streaming"', spaces=2))
  1862. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(6)}}', spaces=2))
  1863. f.write(indented_str(5, "/> */}", spaces=2))
  1864. if security["secure_folder"]:
  1865. f.write(indented_str(5, "<Button", spaces=2))
  1866. f.write(indented_str(6, 'title="Secure Folder"', spaces=2))
  1867. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  1868. f.write(indented_str(5, "/>", spaces=2))
  1869. n = n + 1
  1870. else:
  1871. f.write(indented_str(5, "{/* <Button", spaces=2))
  1872. f.write(indented_str(6, 'title="Secure Folder"', spaces=2))
  1873. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(7)}}', spaces=2))
  1874. f.write(indented_str(5, "/> */}", spaces=2))
  1875. else:
  1876. f.write(line)
  1877. with open(main_act_android, "r") as f:
  1878. lines = f.readlines()
  1879. with open(main_act_android, "w") as f:
  1880. for line in lines:
  1881. if "//SECURITY" in line:
  1882. if security["show_security"]:
  1883. f.write(indented_str(2, "API.setShowSecurityShieldDialog(true);"))
  1884. f.write(os.linesep)
  1885. else:
  1886. f.write(indented_str(2, "// API.setShowSecurityShieldDialog(true);"))
  1887. f.write(os.linesep)
  1888. if security["emulator"]:
  1889. f.write(indented_str(2, "API.setCheckEmulator(true);"))
  1890. f.write(os.linesep)
  1891. else:
  1892. f.write(indented_str(2, "// API.setCheckEmulator(true);"))
  1893. f.write(os.linesep)
  1894. if security["debug"]:
  1895. f.write(indented_str(2, "API.setCheckAdb(true);"))
  1896. f.write(os.linesep)
  1897. else:
  1898. f.write(indented_str(2, "// API.setCheckAdb(true);"))
  1899. f.write(os.linesep)
  1900. if security["sim_swap"]:
  1901. f.write(indented_str(2, "API.setCheckSimSwap(true);"))
  1902. f.write(os.linesep)
  1903. else:
  1904. f.write(indented_str(2, "// API.setCheckSimSwap(true);"))
  1905. f.write(os.linesep)
  1906. if security["malware"]:
  1907. f.write(indented_str(2, "API.setCheckMalware(true);"))
  1908. f.write(os.linesep)
  1909. else:
  1910. f.write(indented_str(2, "// API.setCheckMalware(true);"))
  1911. f.write(os.linesep)
  1912. if security["capture"]:
  1913. f.write(indented_str(2, "API.setPreventScreenCapture(true);"))
  1914. f.write(os.linesep)
  1915. else:
  1916. f.write(indented_str(2, "// API.setPreventScreenCapture(true);"))
  1917. f.write(os.linesep)
  1918. if security["call_forwarding"]:
  1919. f.write(indented_str(2, "API.setCheckCallForwarding(true);"))
  1920. f.write(os.linesep)
  1921. else:
  1922. f.write(indented_str(2, "// API.setCheckCallForwarding(true);"))
  1923. f.write(os.linesep)
  1924. if security["screen_share"]:
  1925. f.write(indented_str(2, "API.setCheckScreenCasting(true);"))
  1926. f.write(os.linesep)
  1927. else:
  1928. f.write(indented_str(2, "// API.setCheckScreenCasting(true);"))
  1929. f.write(os.linesep)
  1930. if security["side_load"]:
  1931. f.write(indented_str(2, "API.setCheckSideLoadedApp(true);"))
  1932. f.write(os.linesep)
  1933. else:
  1934. f.write(indented_str(2, "// API.setCheckSideLoadedApp(true);"))
  1935. f.write(os.linesep)
  1936. if security["key_logger"]:
  1937. f.write(indented_str(2, "API.setPreventKeylogger(true);"))
  1938. f.write(os.linesep)
  1939. else:
  1940. f.write(indented_str(2, "// API.setPreventKeylogger(true);"))
  1941. f.write(os.linesep)
  1942. elif "//SMS" in line:
  1943. if features["sms"]["status"]:
  1944. f.write(indented_str(2, "API.setEnabledSMS(true);"))
  1945. else:
  1946. f.write(indented_str(2, "// API.setEnabledSMS(true);"))
  1947. elif "//EMAIL" in line:
  1948. if features["email"]["status"]:
  1949. f.write(indented_str(2, "API.setEnabledEmail(true);"))
  1950. else:
  1951. f.write(indented_str(2, "// API.setEnabledEmail(true);"))
  1952. elif "//SMARTBOT" in line:
  1953. if features["smartbot"]["status"]:
  1954. f.write(indented_str(2, "API.setEnabledSmartBot(true);"))
  1955. else:
  1956. f.write(indented_str(2, "// API.setEnabledSmartBot(true);"))
  1957. elif "//FLOATING" in line:
  1958. if mode == "floating":
  1959. write_floating_button(f, features, security)
  1960. else:
  1961. f.write(indented_str(0, ""))
  1962. elif "API.connect" in line:
  1963. replaced = line
  1964. if app_id:
  1965. replaced = replaced.replace('***REPLACE***WITH***YOUR***APPLICATION***NAME***', app_id)
  1966. if mode == "floating":
  1967. replaced = replaced.replace("0", "1")
  1968. f.write(replaced)
  1969. else:
  1970. f.write(line)
  1971. write_android_manifest(manifest_path, features, security)
  1972. elif platform == "ios":
  1973. main_act_path = os.path.join(path_dest, "ExampleCode/ViewController.swift")
  1974. with open(main_act_path, "r") as f:
  1975. lines = f.readlines()
  1976. with open(main_act_path, "w") as f:
  1977. for line in lines:
  1978. if "//FEATURES" in line:
  1979. f.write(indented_str(3, 'UIAction(title: "Setting".localized(), handler: {(_) in'))
  1980. f.write(indented_str(4, "APIS.openSetting();"))
  1981. f.write(indented_str(3, "}),"))
  1982. f.write(indented_str(3, 'UIAction(title: "Profile".localized(), handler: {(_) in'))
  1983. f.write(indented_str(4, "APIS.openProfile();"))
  1984. f.write(indented_str(3, "}),"))
  1985. if features["cc"]["status"]:
  1986. f.write(indented_str(3, 'UIAction(title: "Contact Center".localized(), handler: {(_) in'))
  1987. f.write(indented_str(4, "APIS.openContactCenter();"))
  1988. f.write(indented_str(3, "}),"))
  1989. else:
  1990. f.write(indented_str(3, '// UIAction(title: "Contact Center".localized(), handler: {(_) in'))
  1991. f.write(indented_str(4, "// APIS.openContactCenter();"))
  1992. f.write(indented_str(3, "// }),"))
  1993. if features["nc"]["status"]:
  1994. f.write(indented_str(3, 'UIAction(title: "Notification Center".localized(), handler: {(_) in'))
  1995. f.write(indented_str(4, "APIS.openNotificationCenter();"))
  1996. f.write(indented_str(3, "}),"))
  1997. else:
  1998. f.write(
  1999. indented_str(3, '// UIAction(title: "Notification Center".localized(), handler: {(_) in'))
  2000. f.write(indented_str(4, "// APIS.openNotificationCenter();"))
  2001. f.write(indented_str(3, "// }),"))
  2002. if features["im"]["status"]:
  2003. f.write(indented_str(3, 'UIAction(title: "Chat".localized(), handler: {(_) in'))
  2004. f.write(indented_str(4, "APIS.openChat();"))
  2005. f.write(indented_str(3, "}),"))
  2006. else:
  2007. f.write(indented_str(3, '// UIAction(title: "Chat".localized(), handler: {(_) in'))
  2008. f.write(indented_str(4, "// APIS.openChat();"))
  2009. f.write(indented_str(3, "// }),"))
  2010. if features["call"]["status"]:
  2011. f.write(indented_str(3, 'UIAction(title: "Call".localized(), handler: {(_) in'))
  2012. f.write(indented_str(4, "APIS.openCall();"))
  2013. f.write(indented_str(3, "}),"))
  2014. else:
  2015. f.write(indented_str(3, '// UIAction(title: "Call".localized(), handler: {(_) in'))
  2016. f.write(indented_str(4, "// APIS.openCall();"))
  2017. f.write(indented_str(3, "// }),"))
  2018. if features["ls"]["status"]:
  2019. f.write(indented_str(3, 'UIAction(title: "Live Streaming".localized(), handler: {(_) in'))
  2020. f.write(indented_str(4, "APIS.openStreaming();"))
  2021. f.write(indented_str(3, "}),"))
  2022. else:
  2023. f.write(indented_str(3, '// UIAction(title: "Live Streaming".localized(), handler: {(_) in'))
  2024. f.write(indented_str(4, "// APIS.openStreaming();"))
  2025. f.write(indented_str(3, "// }),"))
  2026. elif "//FLOATING" in line:
  2027. if mode == "floating":
  2028. if features["cc"]["status"]:
  2029. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2030. else:
  2031. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2032. if features["nc"]["status"]:
  2033. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2034. else:
  2035. f.write(
  2036. indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2037. if features["im"]["status"]:
  2038. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2039. else:
  2040. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2041. if features["call"]["status"]:
  2042. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2043. else:
  2044. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2045. if features["ls"]["status"]:
  2046. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2047. else:
  2048. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2049. else:
  2050. f.write(indented_str(0, ""))
  2051. elif "APIS.connect" in line:
  2052. if mode == "floating":
  2053. replaced = line.replace("false", "true")
  2054. f.write(replaced)
  2055. else:
  2056. f.write(line)
  2057. else:
  2058. f.write(line)
  2059. elif platform == "ios_flutter":
  2060. main_act_path = os.path.join(path_dest, "lib/main.dart")
  2061. main_act_ios = os.path.join(path_dest, "ios/Runner/AppDelegate.swift")
  2062. with open(main_act_path, "r") as f:
  2063. lines = f.readlines()
  2064. with open(main_act_path, "w") as f:
  2065. features_str = []
  2066. for line in lines:
  2067. if "'Features List'" in line:
  2068. features_str.append("'Settings'")
  2069. features_str.append("'Profile'")
  2070. if features["cc"]["status"]:
  2071. features_str.append("'Contact Center'")
  2072. else:
  2073. features_str.append("// 'Contact Center'")
  2074. if features["nc"]["status"]:
  2075. features_str.append("'Notification Center'")
  2076. else:
  2077. features_str.append("// 'Notification Center'")
  2078. if features["im"]["status"]:
  2079. features_str.append("'Instant Messaging'")
  2080. else:
  2081. features_str.append("// 'Instant Messaging'")
  2082. if features["call"]["status"]:
  2083. features_str.append("'Call'")
  2084. else:
  2085. features_str.append("// 'Call'")
  2086. if features["ls"]["status"]:
  2087. features_str.append("'Streaming'")
  2088. else:
  2089. features_str.append("// 'Streaming'")
  2090. for feature_str in features_str:
  2091. f.write(indented_str(8, f"{feature_str},", spaces=2))
  2092. elif "//FEATURES" in line:
  2093. f.write(indented_str(3, 'case "Settings":', spaces=2))
  2094. f.write(indented_str(4, 'nativeChannel.invokeMethod("openSettings");', spaces=2))
  2095. f.write(indented_str(4, "break;", spaces=2))
  2096. f.write(indented_str(3, 'case "Profile":', spaces=2))
  2097. f.write(indented_str(4, 'nativeChannel.invokeMethod("openProfile");', spaces=2))
  2098. f.write(indented_str(4, "break;", spaces=2))
  2099. if features["cc"]["status"]:
  2100. f.write(indented_str(3, 'case "Contact Center":', spaces=2))
  2101. f.write(indented_str(4, 'nativeChannel.invokeMethod("openContactCenter");', spaces=2))
  2102. f.write(indented_str(4, "break;", spaces=2))
  2103. else:
  2104. f.write(indented_str(3, '// case "Contact Center":', spaces=2))
  2105. f.write(indented_str(4, '// nativeChannel.invokeMethod("openContactCenter");', spaces=2))
  2106. f.write(indented_str(4, "// break;", spaces=2))
  2107. if features["nc"]["status"]:
  2108. f.write(indented_str(3, 'case "Notification Center":', spaces=2))
  2109. f.write(indented_str(4, 'nativeChannel.invokeMethod("openNotificationCenter");', spaces=2))
  2110. f.write(indented_str(4, "break;", spaces=2))
  2111. else:
  2112. f.write(indented_str(3, '// case "Notification Center":', spaces=2))
  2113. f.write(indented_str(4, '// nativeChannel.invokeMethod("openNotificationCenter");', spaces=2))
  2114. f.write(indented_str(4, "// break;", spaces=2))
  2115. if features["im"]["status"]:
  2116. f.write(indented_str(3, 'case "Instant Messaging":', spaces=2))
  2117. f.write(indented_str(4, 'nativeChannel.invokeMethod("openInstantMessaging");', spaces=2))
  2118. f.write(indented_str(4, "break;", spaces=2))
  2119. else:
  2120. f.write(indented_str(3, '// case "Instant Messaging":', spaces=2))
  2121. f.write(indented_str(4, '// nativeChannel.invokeMethod("openInstantMessaging");', spaces=2))
  2122. f.write(indented_str(4, "// break;", spaces=2))
  2123. if features["call"]["status"]:
  2124. f.write(indented_str(3, 'case "Call":', spaces=2))
  2125. f.write(indented_str(4, 'nativeChannel.invokeMethod("openCall");', spaces=2))
  2126. f.write(indented_str(4, "break;", spaces=2))
  2127. else:
  2128. f.write(indented_str(3, '// case "Call":', spaces=2))
  2129. f.write(indented_str(4, '// nativeChannel.invokeMethod("openCall");', spaces=2))
  2130. f.write(indented_str(4, "// break;", spaces=2))
  2131. if features["ls"]["status"]:
  2132. f.write(indented_str(3, 'case "Streaming":', spaces=2))
  2133. f.write(indented_str(4, 'nativeChannel.invokeMethod("openStreaming");', spaces=2))
  2134. f.write(indented_str(4, "break;", spaces=2))
  2135. else:
  2136. f.write(indented_str(3, '// case "Streaming":', spaces=2))
  2137. f.write(indented_str(4, '// nativeChannel.invokeMethod("openStreaming");', spaces=2))
  2138. f.write(indented_str(4, "// break;", spaces=2))
  2139. else:
  2140. f.write(line)
  2141. with open(main_act_ios, "r") as f:
  2142. lines = f.readlines()
  2143. with open(main_act_ios, "w") as f:
  2144. for line in lines:
  2145. if "//FLOATING" in line:
  2146. if mode == "floating":
  2147. if features["cc"]["status"]:
  2148. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2149. else:
  2150. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2151. if features["nc"]["status"]:
  2152. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2153. else:
  2154. f.write(
  2155. indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2156. if features["im"]["status"]:
  2157. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2158. else:
  2159. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2160. if features["call"]["status"]:
  2161. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2162. else:
  2163. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2164. if features["ls"]["status"]:
  2165. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2166. else:
  2167. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2168. else:
  2169. f.write(indented_str(0, ""))
  2170. elif "APIS.connect" in line:
  2171. if mode == "floating":
  2172. replaced = line.replace("false", "true")
  2173. f.write(replaced)
  2174. else:
  2175. f.write(line)
  2176. else:
  2177. f.write(line)
  2178. elif platform == "ios_ionic":
  2179. main_act_path = os.path.join(path_dest, "src/app/app.component.ts")
  2180. main_act_ios = os.path.join(path_dest, "ios/App/App/AppDelegate.swift")
  2181. with open(main_act_path, "r") as f:
  2182. lines = f.readlines()
  2183. with open(main_act_path, "w") as f:
  2184. for line in lines:
  2185. if "//FEATURES" in line:
  2186. f.write(indented_str(4, '{', spaces=2))
  2187. f.write(indented_str(5, "text: 'Settings',", spaces=2))
  2188. f.write(indented_str(5, "handler: () => {", spaces=2))
  2189. f.write(indented_str(6, "this.openSettings();", spaces=2))
  2190. f.write(indented_str(5, "},", spaces=2))
  2191. f.write(indented_str(4, "},", spaces=2))
  2192. f.write(indented_str(4, '{', spaces=2))
  2193. f.write(indented_str(5, "text: 'Profile',", spaces=2))
  2194. f.write(indented_str(5, "handler: () => {", spaces=2))
  2195. f.write(indented_str(6, "this.openProfile();", spaces=2))
  2196. f.write(indented_str(5, "},", spaces=2))
  2197. f.write(indented_str(4, "},", spaces=2))
  2198. if features["cc"]["status"]:
  2199. f.write(indented_str(4, '{', spaces=2))
  2200. f.write(indented_str(5, "text: 'Contact Center',", spaces=2))
  2201. f.write(indented_str(5, "handler: () => {", spaces=2))
  2202. f.write(indented_str(6, "this.openContactCenter();", spaces=2))
  2203. f.write(indented_str(5, "},", spaces=2))
  2204. f.write(indented_str(4, "},", spaces=2))
  2205. else:
  2206. f.write(indented_str(4, '// {', spaces=2))
  2207. f.write(indented_str(5, "// text: 'Contact Center',", spaces=2))
  2208. f.write(indented_str(5, "// handler: () => {", spaces=2))
  2209. f.write(indented_str(6, "// this.openContactCenter();", spaces=2))
  2210. f.write(indented_str(5, "// },", spaces=2))
  2211. f.write(indented_str(4, "// },", spaces=2))
  2212. if features["nc"]["status"]:
  2213. f.write(indented_str(4, '{', spaces=2))
  2214. f.write(indented_str(5, "text: 'Notification Center',", spaces=2))
  2215. f.write(indented_str(5, "handler: () => {", spaces=2))
  2216. f.write(indented_str(6, "this.openNotificationCenter();", spaces=2))
  2217. f.write(indented_str(5, "},", spaces=2))
  2218. f.write(indented_str(4, "},", spaces=2))
  2219. else:
  2220. f.write(indented_str(4, '// {', spaces=2))
  2221. f.write(indented_str(5, "// text: 'Notification Center',", spaces=2))
  2222. f.write(indented_str(5, "// handler: () => {", spaces=2))
  2223. f.write(indented_str(6, "// this.openNotificationCenter();", spaces=2))
  2224. f.write(indented_str(5, "// },", spaces=2))
  2225. f.write(indented_str(4, "// },", spaces=2))
  2226. if features["im"]["status"]:
  2227. f.write(indented_str(4, '{', spaces=2))
  2228. f.write(indented_str(5, "text: 'Instant Messaging',", spaces=2))
  2229. f.write(indented_str(5, "handler: () => {", spaces=2))
  2230. f.write(indented_str(6, "this.openChat();", spaces=2))
  2231. f.write(indented_str(5, "},", spaces=2))
  2232. f.write(indented_str(4, "},", spaces=2))
  2233. else:
  2234. f.write(indented_str(4, '// {', spaces=2))
  2235. f.write(indented_str(5, "// text: 'Instant Messaging',", spaces=2))
  2236. f.write(indented_str(5, "// handler: () => {", spaces=2))
  2237. f.write(indented_str(6, "// this.openChat();", spaces=2))
  2238. f.write(indented_str(5, "// },", spaces=2))
  2239. f.write(indented_str(4, "// },", spaces=2))
  2240. if features["call"]["status"]:
  2241. f.write(indented_str(4, '{', spaces=2))
  2242. f.write(indented_str(5, "text: 'Call',", spaces=2))
  2243. f.write(indented_str(5, "handler: () => {", spaces=2))
  2244. f.write(indented_str(6, "this.openCall();", spaces=2))
  2245. f.write(indented_str(5, "},", spaces=2))
  2246. f.write(indented_str(4, "},", spaces=2))
  2247. else:
  2248. f.write(indented_str(4, '// {', spaces=2))
  2249. f.write(indented_str(5, "// text: 'Call',", spaces=2))
  2250. f.write(indented_str(5, "// handler: () => {", spaces=2))
  2251. f.write(indented_str(6, "// this.openCall();", spaces=2))
  2252. f.write(indented_str(5, "// },", spaces=2))
  2253. f.write(indented_str(4, "// },", spaces=2))
  2254. if features["ls"]["status"]:
  2255. f.write(indented_str(4, '{', spaces=2))
  2256. f.write(indented_str(5, "text: 'Streaming',", spaces=2))
  2257. f.write(indented_str(5, "handler: () => {", spaces=2))
  2258. f.write(indented_str(6, "this.openStreaming();", spaces=2))
  2259. f.write(indented_str(5, "},", spaces=2))
  2260. f.write(indented_str(4, "},", spaces=2))
  2261. else:
  2262. f.write(indented_str(4, '// {', spaces=2))
  2263. f.write(indented_str(5, "// text: 'Streaming',", spaces=2))
  2264. f.write(indented_str(5, "// handler: () => {", spaces=2))
  2265. f.write(indented_str(6, "// this.openStreaming();", spaces=2))
  2266. f.write(indented_str(5, "// },", spaces=2))
  2267. f.write(indented_str(4, "// },", spaces=2))
  2268. else:
  2269. f.write(line)
  2270. with open(main_act_ios, "r") as f:
  2271. lines = f.readlines()
  2272. with open(main_act_ios, "w") as f:
  2273. for line in lines:
  2274. if "//FLOATING" in line:
  2275. if mode == "floating":
  2276. if features["cc"]["status"]:
  2277. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2278. else:
  2279. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2280. if features["nc"]["status"]:
  2281. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2282. else:
  2283. f.write(
  2284. indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2285. if features["im"]["status"]:
  2286. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2287. else:
  2288. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2289. if features["call"]["status"]:
  2290. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2291. else:
  2292. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2293. if features["ls"]["status"]:
  2294. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2295. else:
  2296. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2297. else:
  2298. f.write(indented_str(0, ""))
  2299. elif "APIS.connect" in line:
  2300. if mode == "floating":
  2301. replaced = line.replace("false", "true")
  2302. f.write(replaced)
  2303. else:
  2304. f.write(line)
  2305. else:
  2306. f.write(line)
  2307. elif platform == "ios_react":
  2308. main_act_path = os.path.join(path_dest, "App.tsx")
  2309. main_act_ios = os.path.join(path_dest, "ios/CallNative.swift")
  2310. with open(main_act_path, "r") as f:
  2311. lines = f.readlines()
  2312. with open(main_act_path, "w") as f:
  2313. for line in lines:
  2314. if "'Features'" in line:
  2315. f.write(indented_str(4, "'Setting',", spaces=2))
  2316. f.write(indented_str(4, "'Profile',", spaces=2))
  2317. if features["cc"]["status"]:
  2318. f.write(indented_str(4, "'Contact Center',", spaces=2))
  2319. else:
  2320. f.write(indented_str(4, "// 'Contact Center',", spaces=2))
  2321. if features["nc"]["status"]:
  2322. f.write(indented_str(4, "'Notification Center',", spaces=2))
  2323. else:
  2324. f.write(indented_str(4, "// 'Notification Center',", spaces=2))
  2325. if features["im"]["status"]:
  2326. f.write(indented_str(4, "'Chat',", spaces=2))
  2327. else:
  2328. f.write(indented_str(4, "// 'Chat',", spaces=2))
  2329. if features["call"]["status"]:
  2330. f.write(indented_str(4, "'Call',", spaces=2))
  2331. else:
  2332. f.write(indented_str(4, "// 'Call',", spaces=2))
  2333. if features["ls"]["status"]:
  2334. f.write(indented_str(4, "'Live Streaming',", spaces=2))
  2335. else:
  2336. f.write(indented_str(4, "// 'Live Streaming',", spaces=2))
  2337. elif "//FEATURES1" in line:
  2338. n = 0
  2339. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2340. f.write(indented_str(6, "CallNative.openSetting();", spaces=2))
  2341. f.write(indented_str(5, "}", spaces=2))
  2342. n = n + 1
  2343. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2344. f.write(indented_str(6, "CallNative.openProfile();", spaces=2))
  2345. f.write(indented_str(5, "}", spaces=2))
  2346. n = n + 1
  2347. if features["cc"]["status"]:
  2348. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2349. f.write(indented_str(6, "CallNative.openContactCenter();", spaces=2))
  2350. f.write(indented_str(5, "}", spaces=2))
  2351. n = n + 1
  2352. else:
  2353. f.write(indented_str(5, "// if (buttonIndex === 2) {", spaces=2))
  2354. f.write(indented_str(6, "// CallNative.openContactCenter();", spaces=2))
  2355. f.write(indented_str(5, "// }", spaces=2))
  2356. if features["nc"]["status"]:
  2357. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2358. f.write(indented_str(6, "CallNative.openNotificationCenter();", spaces=2))
  2359. f.write(indented_str(5, "}", spaces=2))
  2360. n = n + 1
  2361. else:
  2362. f.write(indented_str(5, "// if (buttonIndex === 3) {", spaces=2))
  2363. f.write(indented_str(6, "// CallNative.openNotificationCenter();", spaces=2))
  2364. f.write(indented_str(5, "// }", spaces=2))
  2365. if features["im"]["status"]:
  2366. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2367. f.write(indented_str(6, "CallNative.openChat();", spaces=2))
  2368. f.write(indented_str(5, "}", spaces=2))
  2369. n = n + 1
  2370. else:
  2371. f.write(indented_str(5, "// if (buttonIndex === 4) {", spaces=2))
  2372. f.write(indented_str(6, "// CallNative.openChat();", spaces=2))
  2373. f.write(indented_str(5, "// }", spaces=2))
  2374. if features["call"]["status"]:
  2375. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2376. f.write(indented_str(6, "CallNative.openCall();", spaces=2))
  2377. f.write(indented_str(5, "}", spaces=2))
  2378. n = n + 1
  2379. else:
  2380. f.write(indented_str(5, "// if (buttonIndex === 5) {", spaces=2))
  2381. f.write(indented_str(6, "// CallNative.openCall();", spaces=2))
  2382. f.write(indented_str(5, "// }", spaces=2))
  2383. if features["ls"]["status"]:
  2384. f.write(indented_str(5, f"if (buttonIndex === {n}) {{", spaces=2))
  2385. f.write(indented_str(6, "CallNative.openStreaming();", spaces=2))
  2386. f.write(indented_str(5, "}", spaces=2))
  2387. n = n + 1
  2388. else:
  2389. f.write(indented_str(5, "// if (buttonIndex === 6) {", spaces=2))
  2390. f.write(indented_str(6, "// CallNative.openStreaming();", spaces=2))
  2391. f.write(indented_str(5, "// }", spaces=2))
  2392. elif "//FEATURES2" in line:
  2393. n = 0
  2394. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2395. f.write(indented_str(3, "try {", spaces=2))
  2396. f.write(indented_str(4, "CallNative.openSetting();", spaces=2))
  2397. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2398. f.write(indented_str(4, "console.log(e);", spaces=2))
  2399. f.write(indented_str(3, "}", spaces=2))
  2400. f.write(indented_str(2, "}", spaces=2))
  2401. n = n + 1
  2402. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2403. f.write(indented_str(3, "try {", spaces=2))
  2404. f.write(indented_str(4, "CallNative.openProfile();", spaces=2))
  2405. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2406. f.write(indented_str(4, "console.log(e);", spaces=2))
  2407. f.write(indented_str(3, "}", spaces=2))
  2408. f.write(indented_str(2, "}", spaces=2))
  2409. n = n + 1
  2410. if features["cc"]["status"]:
  2411. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2412. f.write(indented_str(3, "try {", spaces=2))
  2413. f.write(indented_str(4, "CallNative.openContactCenter();", spaces=2))
  2414. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2415. f.write(indented_str(4, "console.log(e);", spaces=2))
  2416. f.write(indented_str(3, "}", spaces=2))
  2417. f.write(indented_str(2, "}", spaces=2))
  2418. n = n + 1
  2419. else:
  2420. f.write(indented_str(2, "// if (buttonIndex === 2) {", spaces=2))
  2421. f.write(indented_str(3, "// try {", spaces=2))
  2422. f.write(indented_str(4, "// CallNative.openContactCenter();", spaces=2))
  2423. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  2424. f.write(indented_str(4, "// console.log(e);", spaces=2))
  2425. f.write(indented_str(3, "// }", spaces=2))
  2426. f.write(indented_str(2, "// }", spaces=2))
  2427. if features["nc"]["status"]:
  2428. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2429. f.write(indented_str(3, "try {", spaces=2))
  2430. f.write(indented_str(4, "CallNative.openNotificationCenter();", spaces=2))
  2431. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2432. f.write(indented_str(4, "console.log(e);", spaces=2))
  2433. f.write(indented_str(3, "}", spaces=2))
  2434. f.write(indented_str(2, "}", spaces=2))
  2435. n = n + 1
  2436. else:
  2437. f.write(indented_str(2, "// if (buttonIndex === 3) {", spaces=2))
  2438. f.write(indented_str(3, "// try {", spaces=2))
  2439. f.write(indented_str(4, "// CallNative.openNotificationCenter();", spaces=2))
  2440. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  2441. f.write(indented_str(4, "// console.log(e);", spaces=2))
  2442. f.write(indented_str(3, "// }", spaces=2))
  2443. f.write(indented_str(2, "// }", spaces=2))
  2444. if features["im"]["status"]:
  2445. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2446. f.write(indented_str(3, "try {", spaces=2))
  2447. f.write(indented_str(4, "CallNative.openChat();", spaces=2))
  2448. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2449. f.write(indented_str(4, "console.log(e);", spaces=2))
  2450. f.write(indented_str(3, "}", spaces=2))
  2451. f.write(indented_str(2, "}", spaces=2))
  2452. n = n + 1
  2453. else:
  2454. f.write(indented_str(2, "// if (buttonIndex === 4) {", spaces=2))
  2455. f.write(indented_str(3, "// try {", spaces=2))
  2456. f.write(indented_str(4, "// CallNative.openChat();", spaces=2))
  2457. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  2458. f.write(indented_str(4, "// console.log(e);", spaces=2))
  2459. f.write(indented_str(3, "// }", spaces=2))
  2460. f.write(indented_str(2, "// }", spaces=2))
  2461. if features["call"]["status"]:
  2462. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2463. f.write(indented_str(3, "try {", spaces=2))
  2464. f.write(indented_str(4, "CallNative.openCall();", spaces=2))
  2465. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2466. f.write(indented_str(4, "console.log(e);", spaces=2))
  2467. f.write(indented_str(3, "}", spaces=2))
  2468. f.write(indented_str(2, "}", spaces=2))
  2469. n = n + 1
  2470. else:
  2471. f.write(indented_str(2, "// if (buttonIndex === 5) {", spaces=2))
  2472. f.write(indented_str(3, "// try {", spaces=2))
  2473. f.write(indented_str(4, "// CallNative.openCall();", spaces=2))
  2474. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  2475. f.write(indented_str(4, "// console.log(e);", spaces=2))
  2476. f.write(indented_str(3, "// }", spaces=2))
  2477. f.write(indented_str(2, "// }", spaces=2))
  2478. if features["ls"]["status"]:
  2479. f.write(indented_str(2, f"if (buttonIndex === {n}) {{", spaces=2))
  2480. f.write(indented_str(3, "try {", spaces=2))
  2481. f.write(indented_str(4, "CallNative.openStreaming();", spaces=2))
  2482. f.write(indented_str(3, "} catch (e) {", spaces=2))
  2483. f.write(indented_str(4, "console.log(e);", spaces=2))
  2484. f.write(indented_str(3, "}", spaces=2))
  2485. f.write(indented_str(2, "}", spaces=2))
  2486. n = n + 1
  2487. else:
  2488. f.write(indented_str(2, "// if (buttonIndex === {n}) {", spaces=2))
  2489. f.write(indented_str(3, "// try {", spaces=2))
  2490. f.write(indented_str(4, "// CallNative.openStreaming();", spaces=2))
  2491. f.write(indented_str(3, "// } catch (e) {", spaces=2))
  2492. f.write(indented_str(4, "// console.log(e);", spaces=2))
  2493. f.write(indented_str(3, "// }", spaces=2))
  2494. f.write(indented_str(2, "// }", spaces=2))
  2495. elif "//FEATURES3" in line:
  2496. n = 0
  2497. f.write(indented_str(5, "<Button", spaces=2))
  2498. f.write(indented_str(6, 'title="Setting"', spaces=2))
  2499. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2500. f.write(indented_str(5, "/>", spaces=2))
  2501. n = n + 1
  2502. f.write(indented_str(5, "<Button", spaces=2))
  2503. f.write(indented_str(6, 'title="Profile"', spaces=2))
  2504. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2505. f.write(indented_str(5, "/>", spaces=2))
  2506. n = n + 1
  2507. if features["cc"]["status"]:
  2508. f.write(indented_str(5, "<Button", spaces=2))
  2509. f.write(indented_str(6, 'title="Contact Center"', spaces=2))
  2510. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2511. f.write(indented_str(5, "/>", spaces=2))
  2512. n = n + 1
  2513. else:
  2514. f.write(indented_str(5, "{/* <Button", spaces=2))
  2515. f.write(indented_str(6, 'title="Contact Center"', spaces=2))
  2516. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(2)}}', spaces=2))
  2517. f.write(indented_str(5, "/> */}", spaces=2))
  2518. if features["nc"]["status"]:
  2519. f.write(indented_str(5, "<Button", spaces=2))
  2520. f.write(indented_str(6, 'title="Notification Center"', spaces=2))
  2521. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2522. f.write(indented_str(5, "/>", spaces=2))
  2523. n = n + 1
  2524. else:
  2525. f.write(indented_str(5, "{/* <Button", spaces=2))
  2526. f.write(indented_str(6, 'title="Notification Center"', spaces=2))
  2527. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(3)}}', spaces=2))
  2528. f.write(indented_str(5, "/> */}", spaces=2))
  2529. if features["im"]["status"]:
  2530. f.write(indented_str(5, "<Button", spaces=2))
  2531. f.write(indented_str(6, 'title="Chat"', spaces=2))
  2532. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2533. f.write(indented_str(5, "/>", spaces=2))
  2534. n = n + 1
  2535. else:
  2536. f.write(indented_str(5, "{/* <Button", spaces=2))
  2537. f.write(indented_str(6, 'title="Chat"', spaces=2))
  2538. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(4)}}', spaces=2))
  2539. f.write(indented_str(5, "/> */}", spaces=2))
  2540. if features["call"]["status"]:
  2541. f.write(indented_str(5, "<Button", spaces=2))
  2542. f.write(indented_str(6, 'title="Call"', spaces=2))
  2543. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2544. f.write(indented_str(5, "/>", spaces=2))
  2545. n = n + 1
  2546. else:
  2547. f.write(indented_str(5, "{/* <Button", spaces=2))
  2548. f.write(indented_str(6, 'title="Call"', spaces=2))
  2549. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(5)}}', spaces=2))
  2550. f.write(indented_str(5, "/> */}", spaces=2))
  2551. if features["ls"]["status"]:
  2552. f.write(indented_str(5, "<Button", spaces=2))
  2553. f.write(indented_str(6, 'title="Live Streaming"', spaces=2))
  2554. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress({n})}}', spaces=2))
  2555. f.write(indented_str(5, "/>", spaces=2))
  2556. n = n + 1
  2557. else:
  2558. f.write(indented_str(5, "{/* <Button", spaces=2))
  2559. f.write(indented_str(6, 'title="Live Streaming"', spaces=2))
  2560. f.write(indented_str(6, f'onPress={{() => handleActionSheetPress(5)}}', spaces=2))
  2561. f.write(indented_str(5, "/> */}", spaces=2))
  2562. else:
  2563. f.write(line)
  2564. with open(main_act_ios, "r") as f:
  2565. lines = f.readlines()
  2566. with open(main_act_ios, "w") as f:
  2567. for line in lines:
  2568. if "//FLOATING" in line:
  2569. if mode == "floating":
  2570. if features["cc"]["status"]:
  2571. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2572. else:
  2573. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CC)'))
  2574. if features["nc"]["status"]:
  2575. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2576. else:
  2577. f.write(
  2578. indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_NOTIF_CENTER)'))
  2579. if features["im"]["status"]:
  2580. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2581. else:
  2582. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CHAT)'))
  2583. if features["call"]["status"]:
  2584. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2585. else:
  2586. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_CALL)'))
  2587. if features["ls"]["status"]:
  2588. f.write(indented_str(2, 'Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2589. else:
  2590. f.write(indented_str(2, '// Nexilis.defaultFloatingButton.append(Nexilis.IDX_STREAM)'))
  2591. else:
  2592. f.write(indented_str(0, ""))
  2593. elif "APIS.connect" in line:
  2594. if mode == "floating":
  2595. replaced = line.replace("false", "true")
  2596. f.write(replaced)
  2597. else:
  2598. f.write(line)
  2599. else:
  2600. f.write(line)
  2601. def save_icons(app_id: str, platform: str, mode: str, path_dest: str, features: dict, security: dict):
  2602. if platform == "android" and mode == "grid":
  2603. drawable_path = os.path.join(path_dest, "app/src/main/res/drawable/")
  2604. if features["im"]["icon"]:
  2605. file = features["im"]["icon"]
  2606. file.save(os.path.join(drawable_path, "pb_button_chat.png"))
  2607. if features["cc"]["icon"]:
  2608. file = features["cc"]["icon"]
  2609. file.save(os.path.join(drawable_path, "pb_button_cc.png"))
  2610. if features["ac"]["icon"]:
  2611. file = features["ac"]["icon"]
  2612. file.save(os.path.join(drawable_path, "pb_button_audio_call.png"))
  2613. if features["vc"]["icon"]:
  2614. file = features["vc"]["icon"]
  2615. file.save(os.path.join(drawable_path, "pb_button_video_call.png"))
  2616. if features["call"]["icon"]:
  2617. file = features["call"]["icon"]
  2618. file.save(os.path.join(drawable_path, "pb_button_call.png"))
  2619. if features["ls"]["icon"]:
  2620. file = features["ls"]["icon"]
  2621. file.save(os.path.join(drawable_path, "pb_button_stream.png"))
  2622. if features["nc"]["icon"]:
  2623. file = features["nc"]["icon"]
  2624. file.save(os.path.join(drawable_path, "pb_button_notif_center.png"))
  2625. if features["custom_url"]["icon"]:
  2626. file = features["custom_url"]["icon"]
  2627. file.save(os.path.join(drawable_path, "pb_button_custom_url.png"))
  2628. if features["xapps"]["icon"]:
  2629. file = features["im"]["icon"]
  2630. file.save(os.path.join(drawable_path, "pb_button_external_apps.png"))
  2631. if features["conpost"]["icon"]:
  2632. file = features["im"]["icon"]
  2633. file.save(os.path.join(drawable_path, "pb_button_user_content.png"))
  2634. if features["ppob"]["icon"]:
  2635. file = features["im"]["icon"]
  2636. file.save(os.path.join(drawable_path, "pb_button_ppob.png"))
  2637. if features["wallet"]["icon"]:
  2638. file = features["im"]["icon"]
  2639. file.save(os.path.join(drawable_path, "pb_button_wallet.png"))
  2640. if features["social_commerce"]["icon"]:
  2641. file = features["im"]["icon"]
  2642. file.save(os.path.join(drawable_path, "pb_button_social_commerce.png"))
  2643. if features["news_update"]["icon"]:
  2644. file = features["im"]["icon"]
  2645. file.save(os.path.join(drawable_path, "pb_button_news.png"))
  2646. if features["contact_list"]["icon"]:
  2647. file = features["im"]["icon"]
  2648. file.save(os.path.join(drawable_path, "pb_button_contact_list.png"))
  2649. if features["secure_folder"]["icon"]:
  2650. file = features["im"]["icon"]
  2651. file.save(os.path.join(drawable_path, "pb_button_secure_folder.png"))
  2652. pass
  2653. def deliver_zip(path_dest, uid):
  2654. rand_name = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(32))
  2655. zip_name = f"{rand_name}"
  2656. new_dir = os.path.join(app.zip_folder, zip_name)
  2657. try:
  2658. shutil.make_archive(new_dir, 'zip', path_dest)
  2659. project_path = os.path.join(app.temp_folder, uid)
  2660. shutil.rmtree(project_path)
  2661. return {"status": "0", "name": zip_name + ".zip"}
  2662. except Exception as e:
  2663. return {"status": "4", "message": "Deliver ZIP failed"}
  2664. @app.route('/', methods=["GET", "POST"])
  2665. def build_project():
  2666. vprint('==============================================================')
  2667. if request.method == 'POST':
  2668. platform = "android"
  2669. mode = "burger"
  2670. app_id = ""
  2671. feature_dict = {
  2672. "im": {
  2673. "status": False,
  2674. "icon": None
  2675. },
  2676. "cc": {
  2677. "status": False,
  2678. "icon": None
  2679. },
  2680. "ac": {
  2681. "status": False,
  2682. "icon": None
  2683. },
  2684. "vc": {
  2685. "status": False,
  2686. "icon": None
  2687. },
  2688. "call": {
  2689. "status": False,
  2690. "icon": None
  2691. },
  2692. "ls": {
  2693. "status": False,
  2694. "icon": None
  2695. },
  2696. "nc": {
  2697. "status": False,
  2698. "icon": None
  2699. },
  2700. "sms": {
  2701. "status": False,
  2702. "icon": None
  2703. },
  2704. "email": {
  2705. "status": False,
  2706. "icon": None
  2707. },
  2708. "smartbot": {
  2709. "status": False,
  2710. "icon": None
  2711. },
  2712. "settings": {
  2713. "status": False,
  2714. "icon": None
  2715. },
  2716. "custom_url": {
  2717. "status": False,
  2718. "icon": None
  2719. },
  2720. "xapps": {
  2721. "status": False,
  2722. "icon": None
  2723. },
  2724. "conpost": {
  2725. "status": False,
  2726. "icon": None
  2727. },
  2728. "ppob": {
  2729. "status": False,
  2730. "icon": None
  2731. },
  2732. "wallet": {
  2733. "status": False,
  2734. "icon": None
  2735. },
  2736. "social_commerce": {
  2737. "status": False,
  2738. "icon": None
  2739. },
  2740. "news_update": {
  2741. "status": False,
  2742. "icon": None
  2743. },
  2744. "contact_list": {
  2745. "status": False,
  2746. "icon": None
  2747. },
  2748. "secure_folder": {
  2749. "status": False,
  2750. "icon": None
  2751. },
  2752. "cc_chat": {
  2753. "status": False,
  2754. "icon": None
  2755. },
  2756. "cc_voip": {
  2757. "status": False,
  2758. "icon": None
  2759. },
  2760. "cc_vidcall": {
  2761. "status": False,
  2762. "icon": None
  2763. },
  2764. "cc_smartbot": {
  2765. "status": False,
  2766. "icon": None
  2767. },
  2768. "cc_email": {
  2769. "status": False,
  2770. "icon": None
  2771. },
  2772. "cc_sms": {
  2773. "status": False,
  2774. "icon": None
  2775. },
  2776. "cc_gsm": {
  2777. "status": False,
  2778. "icon": None
  2779. },
  2780. "cc_whatsapp": {
  2781. "status": False,
  2782. "icon": None
  2783. }
  2784. }
  2785. security_dict = {
  2786. "root_device": False,
  2787. "malware": False,
  2788. "clone": False,
  2789. "emulator": False,
  2790. "debug": False,
  2791. "sim_swap": False,
  2792. "capture": False,
  2793. "call_forwarding": False,
  2794. "secure_folder": False,
  2795. "show_security": False,
  2796. "screen_share": False,
  2797. "side_load": False,
  2798. "key_logger": False,
  2799. }
  2800. try:
  2801. if "feature_im" in request.form:
  2802. feature_dict["im"]["status"] = request.form["feature_im"] == "1"
  2803. if "feature_cc" in request.form:
  2804. feature_dict["cc"]["status"] = request.form["feature_cc"] == "1"
  2805. if "feature_vc" in request.form:
  2806. feature_dict["vc"]["status"] = request.form["feature_vc"] == "1"
  2807. if "feature_ac" in request.form:
  2808. feature_dict["ac"]["status"] = request.form["feature_ac"] == "1"
  2809. if "feature_ls" in request.form:
  2810. feature_dict["ls"]["status"] = request.form["feature_ls"] == "1"
  2811. if "feature_avc" in request.form:
  2812. feature_dict["call"]["status"] = request.form["feature_avc"] == "1"
  2813. if "feature_nc" in request.form:
  2814. feature_dict["nc"]["status"] = request.form["feature_nc"] == "1"
  2815. if "feature_sms" in request.form:
  2816. feature_dict["sms"]["status"] = request.form["feature_sms"] == "1"
  2817. if "feature_email" in request.form:
  2818. feature_dict["email"]["status"] = request.form["feature_email"] == "1"
  2819. if "feature_smartbot" in request.form:
  2820. feature_dict["smartbot"]["status"] = request.form["feature_smartbot"] == "1"
  2821. if "feature_settings" in request.form:
  2822. feature_dict["settings"]["status"] = request.form["feature_settings"] == "1"
  2823. if "feature_curl" in request.form:
  2824. feature_dict["custom_url"]["status"] = request.form["feature_curl"] == "1"
  2825. if "feature_xapps" in request.form:
  2826. feature_dict["xapps"]["status"] = request.form["feature_xapps"] == "1"
  2827. if "feature_conpost" in request.form:
  2828. feature_dict["conpost"]["status"] = request.form["feature_conpost"] == "1"
  2829. if "feature_ppob" in request.form:
  2830. feature_dict["ppob"]["status"] = request.form["check_ppob"] == "1"
  2831. if "feature_wallet" in request.form:
  2832. feature_dict["wallet"]["status"] = request.form["check_wallet"] == "1"
  2833. if "feature_social_commerce" in request.form:
  2834. feature_dict["social_commerce"]["status"] = request.form["social_commerce"] == "1"
  2835. if "feature_news_update" in request.form:
  2836. feature_dict["news_update"]["status"] = request.form["news_update"] == "1"
  2837. if "feature_contact_list" in request.form:
  2838. feature_dict["contact_list"]["status"] = request.form["contact_list"] == "1"
  2839. if "feature_cc_chat" in request.form:
  2840. feature_dict["cc_chat"]["status"] = request.form["feature_cc_chat"] == "1"
  2841. if "feature_cc_voip" in request.form:
  2842. feature_dict["cc_voip"]["status"] = request.form["feature_cc_voip"] == "1"
  2843. if "feature_cc_vidcall" in request.form:
  2844. feature_dict["cc_vidcall"]["status"] = request.form["feature_cc_vidcall"] == "1"
  2845. if "feature_cc_smartbot" in request.form:
  2846. feature_dict["cc_smartbot"]["status"] = request.form["feature_cc_smartbot"] == "1"
  2847. if "feature_cc_email" in request.form:
  2848. feature_dict["cc_email"]["status"] = request.form["feature_cc_email"] == "1"
  2849. if "feature_cc_sms" in request.form:
  2850. feature_dict["cc_sms"]["status"] = request.form["feature_cc_sms"] == "1"
  2851. if "feature_cc_gsm" in request.form:
  2852. feature_dict["cc_gsm"]["status"] = request.form["feature_cc_gsm"] == "1"
  2853. if "feature_cc_whatsapp" in request.form:
  2854. feature_dict["cc_whatsapp"]["status"] = request.form["feature_cc_whatsapp"] == "1"
  2855. if "security_malware" in request.form:
  2856. security_dict["malware"] = request.form["security_malware"] == "1"
  2857. if "security_clone" in request.form:
  2858. security_dict["clone"] = request.form["security_clone"] == "1"
  2859. if "security_emulator" in request.form:
  2860. security_dict["emulator"] = request.form["security_emulator"] == "1"
  2861. if "security_debug" in request.form:
  2862. security_dict["debug"] = request.form["security_debug"] == "1"
  2863. if "security_sim_swap" in request.form:
  2864. security_dict["sim_swap"] = request.form["security_sim_swap"] == "1"
  2865. if "security_capture" in request.form:
  2866. security_dict["capture"] = request.form["security_capture"] == "1"
  2867. if "security_call_forwarding" in request.form:
  2868. security_dict["call_forwarding"] = request.form["security_call_forwarding"] == "1"
  2869. if "security_secure_folder" in request.form:
  2870. security_dict["secure_folder"] = request.form["security_secure_folder"] == "1"
  2871. if "secure_folder" in request.form and not security_dict["secure_folder"]:
  2872. security_dict["secure_folder"] = request.form["secure_folder"] == "1"
  2873. if "show_security" in request.form:
  2874. security_dict["show_security"] = request.form["show_security"] == "1"
  2875. if "security_rootdevice" in request.form:
  2876. security_dict["root_device"] = request.form["security_rootdevice"] == "1"
  2877. if "security_screenshare" in request.form:
  2878. security_dict["screen_share"] = request.form["security_screenshare"] == "1"
  2879. if "security_sideloaded" in request.form:
  2880. security_dict["side_load"] = request.form["security_sideloaded"] == "1"
  2881. if "security_keylogger" in request.form:
  2882. security_dict["key_logger"] = request.form["security_keylogger"] == "1"
  2883. security_dict["show_security"] = (security_dict["malware"] or security_dict["clone"]
  2884. or security_dict["emulator"] or security_dict["debug"]
  2885. or security_dict["sim_swap"] or security_dict["capture"]
  2886. or security_dict["call_forwarding"]
  2887. or security_dict["secure_folder"])
  2888. if "gridicon_im" in request.files:
  2889. file = request.files['gridicon_im']
  2890. if file and file.filename and allowed_file(file.filename):
  2891. feature_dict["im"]["icon"] = file
  2892. if "gridicon_cc" in request.files:
  2893. file = request.files['gridicon_cc']
  2894. if file and file.filename and allowed_file(file.filename):
  2895. feature_dict["cc"]["icon"] = file
  2896. if "gridicon_ac" in request.files:
  2897. file = request.files['gridicon_ac']
  2898. if file and file.filename and allowed_file(file.filename):
  2899. feature_dict["ac"]["icon"] = file
  2900. if "gridicon_vc" in request.files:
  2901. file = request.files['gridicon_vc']
  2902. if file and file.filename and allowed_file(file.filename):
  2903. feature_dict["vc"]["icon"] = file
  2904. if "gridicon_avc" in request.files:
  2905. file = request.files['gridicon_avc']
  2906. if file and file.filename and allowed_file(file.filename):
  2907. feature_dict["call"]["icon"] = file
  2908. if "gridicon_ls" in request.files:
  2909. file = request.files['gridicon_ls']
  2910. if file and file.filename and allowed_file(file.filename):
  2911. feature_dict["ls"]["icon"] = file
  2912. if "gridicon_nc" in request.files:
  2913. file = request.files['gridicon_nc']
  2914. if file and file.filename and allowed_file(file.filename):
  2915. feature_dict["nc"]["icon"] = file
  2916. if "gridicon_curl" in request.files:
  2917. file = request.files['gridicon_curl']
  2918. if file and file.filename and allowed_file(file.filename):
  2919. feature_dict["custom_url"]["icon"] = file
  2920. if "gridicon_xapps" in request.files:
  2921. file = request.files['gridicon_xapps']
  2922. if file and file.filename and allowed_file(file.filename):
  2923. feature_dict["xapps"]["icon"] = file
  2924. if "gridicon_conpost" in request.files:
  2925. file = request.files['gridicon_conpost']
  2926. if file and file.filename and allowed_file(file.filename):
  2927. feature_dict["conpost"]["icon"] = file
  2928. if "gridicon_ppob" in request.files:
  2929. file = request.files['gridicon_ppob']
  2930. if file and file.filename and allowed_file(file.filename):
  2931. feature_dict["ppob"]["icon"] = file
  2932. if "gridicon_wallet" in request.files:
  2933. file = request.files['gridicon_wallet']
  2934. if file and file.filename and allowed_file(file.filename):
  2935. feature_dict["wallet"]["icon"] = file
  2936. if "gridicon_social_commerce" in request.files:
  2937. file = request.files['gridicon_social_commerce']
  2938. if file and file.filename and allowed_file(file.filename):
  2939. feature_dict["social_commerce"]["icon"] = file
  2940. if "gridicon_news_update" in request.files:
  2941. file = request.files['gridicon_news_update']
  2942. if file and file.filename and allowed_file(file.filename):
  2943. feature_dict["news_update"]["icon"] = file
  2944. if "gridicon_contact_list" in request.files:
  2945. file = request.files['gridicon_contact_list']
  2946. if file and file.filename and allowed_file(file.filename):
  2947. feature_dict["contact_list"]["icon"] = file
  2948. if "gridicon_secure_folder" in request.files:
  2949. file = request.files['gridicon_secure_folder']
  2950. if file and file.filename and allowed_file(file.filename):
  2951. feature_dict["secure_folder"]["icon"] = file
  2952. if "platform" in request.form:
  2953. platform = request.form["platform"]
  2954. if "mode" in request.form:
  2955. mode = request.form["mode"]
  2956. if "app_id" in request.form:
  2957. app_id = request.form["app_id"]
  2958. except BaseException as e:
  2959. vprint(traceback.format_exc())
  2960. return {"status": "1", "message": "Parameter mismatch\n{}\n".format(str(e))}, 400
  2961. try:
  2962. uu_id = str(uuid.uuid4())
  2963. path_dest = create_folder(platform, uu_id)
  2964. change(app_id, platform, mode, path_dest, feature_dict, security_dict)
  2965. save_icons(app_id, platform, mode, path_dest, feature_dict, security_dict)
  2966. return deliver_zip(path_dest, uu_id)
  2967. except BaseException as e:
  2968. vprint(traceback.format_exc())
  2969. return {"status": "2", "message": "Process failure\n{}\n".format(str(e))}, 200
  2970. else:
  2971. if 'e' in request.args:
  2972. return request.args['e']
  2973. return "Hello World!"
  2974. if __name__ == '__main__':
  2975. app.run(host='0.0.0.0', port=8056, debug=app.verbose, ssl_context=app.ssl)