main.py 186 KB

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