main-embed.py 250 KB

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