main-embed.py 224 KB

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