main-embed.py 232 KB

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