main-embed.py 181 KB

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