main.py 185 KB

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