main.py 184 KB

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