@onairos/react-native 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1 +1,456 @@
|
|
|
1
|
-
import React,{useState,useEffect,useCallback,useRef}from'react';function _0x47d0(){const _0x587290=['get','window','Your\x20App','Development\x20mode\x20-\x20mock\x20account\x20info','pXoXZ','Error\x20getting\x20account\x20info:','object','Error\x20getting\x20server\x20public\x20key:','Error\x20encrypting\x20model\x20key:','Error\x20confirming\x20selection:','error-fallback-token','Failed\x20to\x20confirm\x20selection.\x20Please\x20try\x20again.','YxdNJ','com.onairos.mock','unknown','YyEOx','public/key','QjBXj','faIiR','fxMdQ','devURL','fallback-token','LnzpA','Error','#999','Cancel','#000','BDvUn','whFZQ','Value','current','JyiXH','SRPwe','JoSBo','keys','forEach','StJrH','purLa','HTKNd','ZgBcm','XIQLo','BASE_URL','Knjbp','spring','start','sBsVJ','post','XzZFr','data','AccountInfo','User:\x20','QQsis','OeMtx','YNhsX','error','qIbrS','KcKXt','PRAnn','fcVsh','OiyPl','oujqD','LCSix','TyCTX','XFUjR','ePozV','ERYSN','RtyxX','yvDPJ','select','DaPkz','nGfNO','nixhX','mock-key','RniLS','njVeg','YuirT','Yzqnx','bpxjq','RZkGa','dHpdP','edTrs','lrSGs','nVdln','APIUrl','token','pJGau','OnPkT','twVsL','Dvfbk','otNKi','MIGhl','qwvaU','Lxsho','GuZop','ChWOB','JoUIA','oYWXr','Nimim','alert','EBXAD','createElement','none','modalOverlay','View','bottomSheet','darkContainer','interpolate','handle','darkHandle','container','darkHeader','headerContent','appIcon','darkAppIcon','darkText','charAt','arrow_forward','#666','arrow','onairosIcon','content','titleContainer','mainTitle','Connect\x20your\x20data\x20to\x20create\x20a\x20Persona\x20of\x20you,\x20to\x20connect\x20to\x20Cosmos','platformsContainer','platformItem','platformInfo','platformIcon','platformName','name','#767577','#f4f3f4','footer','darkFooter','footerButtonText','darkSubText','vWIWb','footerButtonConfirm','darkFooterButtonConfirm','footerButtonTextConfirm','xOqij','iSotm','BWwDq','create','rgba(0,\x200,\x200,\x200.5)','hidden','100%','#E0E0E0','#fff','#1A1A1A','center','#F5F5F5','#2A2A2A','600','space-between','#eee','#333','row','transparent'];_0x47d0=function(){return _0x587290;};return _0x47d0();}import{View,Text,StyleSheet,TouchableOpacity,ScrollView,Alert,Platform,Dimensions,Modal,Animated,TouchableWithoutFeedback,SafeAreaView,Image,Switch}from'react-native';import _0x2eeaa1 from'react-native-vector-icons/MaterialIcons';import{onairosApi}from'../api';import{encryptModelKey}from'../utils/encryption';function _0x83df(_0x47d09d,_0x83df96){_0x47d09d=_0x47d09d-0x0;const _0x4c2456=_0x47d0();let _0x47fda1=_0x4c2456[_0x47d09d];return _0x47fda1;}import{OVERLAY_PLATFORMS}from'../utils/assetRegistry';const {width:SCREEN_WIDTH,height:SCREEN_HEIGHT}=Dimensions[_0x83df(0x0)](_0x83df(0x1));import{API_CONFIG}from'../config/api';export const Overlay=({data:_0x37b483,username:_0x4ba1da,modelKey:_0x21672b,onResolved:_0x4ca70f,appName:appName=_0x83df(0x2),darkMode:darkMode=![],platforms:platforms=OVERLAY_PLATFORMS})=>{const _0x112f7b={'HTKNd':function(_0x31a0bc,_0x153ee5){return _0x31a0bc===_0x153ee5;},'ZgBcm':'TxmJC','XIQLo':'ckmPM','SRPwe':function(_0x289135,_0x33f917){return _0x289135===_0x33f917;},'JoSBo':'kedfG','nixhX':'mock-token','Knjbp':function(_0x5201ef){return _0x5201ef();},'sBsVJ':function(_0xcf3e85,_0x3da5c7){return _0xcf3e85(_0x3da5c7);},'KcKXt':_0x83df(0x3),'XzZFr':'getAccountInfo','QQsis':function(_0x22dae3,_0x24ce6c){return _0x22dae3(_0x24ce6c);},'OeMtx':function(_0x124076,_0x635fde){return _0x124076!==_0x635fde;},'YNhsX':_0x83df(0x4),'qIbrS':_0x83df(0x5),'whFZQ':function(_0x337320,_0x882c59){return _0x337320(_0x882c59);},'LCSix':function(_0x4f7db5,_0x18d2f8){return _0x4f7db5(_0x18d2f8);},'ERYSN':function(_0x46e408,_0x2d4c0c){return _0x46e408===_0x2d4c0c;},'RtyxX':_0x83df(0x6),'yvDPJ':function(_0x3316ac,_0x1275d9){return _0x3316ac(_0x1275d9);},'YuirT':_0x83df(0x7),'JyiXH':function(_0x44ae4b,_0xa29671,_0x323dcc){return _0x44ae4b(_0xa29671,_0x323dcc);},'lrSGs':_0x83df(0x8),'OnPkT':_0x83df(0x9),'oWqCi':function(_0x114741,_0x303ea2,_0x2f26d6,_0x31739e){return _0x114741(_0x303ea2,_0x2f26d6,_0x31739e);},'twVsL':_0x83df(0xa),'Dvfbk':function(_0x3961e0){return _0x3961e0();},'ChWOB':_0x83df(0xb),'XFUjR':function(_0x115387,_0x146b1f){return _0x115387!==_0x146b1f;},'ePozV':_0x83df(0xc),'yhmrB':_0x83df(0xd),'DaPkz':_0x83df(0xe),'nGfNO':_0x83df(0xf),'RniLS':_0x83df(0x10),'njVeg':_0x83df(0x11),'Yzqnx':'function','RZkGa':_0x83df(0x12),'edTrs':_0x83df(0x13),'CzrmW':function(_0x1e3359,_0x531b72,_0x171021){return _0x1e3359(_0x531b72,_0x171021);},'nowMS':'getAPIUrlMobile','nVdln':'local','uMBOH':_0x83df(0x14),'pJGau':'QWIoD','otNKi':function(_0x167d56,_0x2e0130,_0x5103c3,_0x14f62c){return _0x167d56(_0x2e0130,_0x5103c3,_0x14f62c);},'MIGhl':function(_0x1e3ae8,_0x591a41,_0x263e5b,_0x523d40){return _0x1e3ae8(_0x591a41,_0x263e5b,_0x523d40);},'qwvaU':_0x83df(0x15),'Lxsho':function(_0x5f31ff,_0x2d06c0){return _0x5f31ff===_0x2d06c0;},'GuZop':_0x83df(0x16),'JoUIA':function(_0x1aab32,_0x2bb84c){return _0x1aab32(_0x2bb84c);},'JeoHg':'oYWXr','EBXAD':_0x83df(0x17),'BDvUn':function(_0x1bb9f4,_0xa5bb9c){return _0x1bb9f4(_0xa5bb9c);},'TyCTX':function(_0x4081b5,_0x4993a4,_0x314392){return _0x4081b5(_0x4993a4,_0x314392);},'VNNod':_0x83df(0x18),'lSIQw':'None\x20of\x20your\x20app\x20data\x20is\x20shared\x20with\x20ANYONE','vWIWb':_0x83df(0x19),'xOqij':function(_0x79a3f3,_0x4b9700){return _0x79a3f3&&_0x4b9700;},'iSotm':_0x83df(0x1a),'BWwDq':'Connect'},[_0x1065d2,_0x1bc510]=_0x112f7b[_0x83df(0x1b)](useState,{}),[_0x379c60,_0xc9662f]=useState(''),[_0x2ef258,_0x25cd2a]=_0x112f7b[_0x83df(0x1c)](useState,!![]),[_0x5f5694,_0x41f8c5]=useState({}),_0x372af3=useRef(new Animated[(_0x83df(0x1d))](0x0))[_0x83df(0x1e)];_0x112f7b[_0x83df(0x1f)](useEffect,()=>{const _0x9e15a6={'StJrH':function(_0x56dc2e,_0x5da775){return _0x112f7b[_0x83df(0x20)](_0x56dc2e,_0x5da775);},'purLa':_0x112f7b[_0x83df(0x21)],'SHmoJ':_0x112f7b['nixhX']},_0xac88ff={};Object[_0x83df(0x22)](_0x37b483)[_0x83df(0x23)](_0x30da3a=>{_0x9e15a6[_0x83df(0x24)](_0x9e15a6[_0x83df(0x25)],_0x9e15a6[_0x83df(0x25)])?_0xac88ff[_0x30da3a]=![]:_0x53fdfa[_0x803da['id']]=![];}),_0x1bc510(_0xac88ff);const _0x44d106={};platforms[_0x83df(0x23)](_0xe5784a=>{if(_0x112f7b[_0x83df(0x26)](_0x112f7b[_0x83df(0x27)],_0x112f7b[_0x83df(0x28)])){_0x156bd5(''+_0x4d1cb7[_0x83df(0x29)],_0x9e15a6['SHmoJ'],{'username':_0x1124ef,'selections':_0x33e8ee,'platforms':_0x28d9e5}),_0x5be252();return;}else _0x44d106[_0xe5784a['id']]=![];}),_0x41f8c5(_0x44d106),_0x112f7b[_0x83df(0x2a)](_0x1fd06a),Animated[_0x83df(0x2b)](_0x372af3,{'toValue':0x1,'useNativeDriver':!![],'bounciness':0x0})[_0x83df(0x2c)]();},[]);const _0x1fd06a=async()=>{try{if(__DEV__){_0x112f7b[_0x83df(0x2d)](_0xc9662f,_0x112f7b['KcKXt']);return;}const _0xb431ea=await onairosApi[_0x83df(0x2e)](_0x112f7b[_0x83df(0x2f)],{'Info':{'username':_0x4ba1da}});if(_0xb431ea&&_0xb431ea[_0x83df(0x30)]){const _0x3192a5=_0x112f7b['SRPwe'](typeof _0xb431ea['data'],_0x83df(0x6))&&_0xb431ea['data'][_0x83df(0x31)]?_0xb431ea['data'][_0x83df(0x31)]:_0x83df(0x32)+_0x4ba1da;_0x112f7b[_0x83df(0x2d)](_0xc9662f,_0x3192a5);}else _0x112f7b[_0x83df(0x33)](_0xc9662f,'User:\x20'+_0x4ba1da);}catch(_0x499767){if(_0x112f7b[_0x83df(0x34)](_0x112f7b[_0x83df(0x35)],_0x83df(0x4))){const _0x531ed0={};_0x20d6b3[_0x83df(0x22)](_0x5eb2cb)['forEach'](_0x1b3061=>{_0x531ed0[_0x1b3061]=![];}),_0x5bac2a(_0x531ed0);const _0x2bb314={};_0x4d7433['forEach'](_0x39c3bb=>{_0x2bb314[_0x39c3bb['id']]=![];}),_0x44c2bd(_0x2bb314),_0x14b0c5(),Animated['spring'](_0x2523af,{'toValue':0x1,'useNativeDriver':!![],'bounciness':0x0})[_0x83df(0x2c)]();}else console[_0x83df(0x36)](_0x112f7b[_0x83df(0x37)],_0x499767),_0xc9662f(_0x83df(0x32)+_0x4ba1da);}},_0x2c7184=_0x112f7b[_0x83df(0x1f)](useCallback,()=>{Animated['timing'](_0x372af3,{'toValue':0x0,'duration':0xfa,'useNativeDriver':!![]})['start'](()=>{const _0x3b4ee9={'OiyPl':function(_0x5e6fa7,_0x52df40){return _0x5e6fa7(_0x52df40);},'oujqD':_0x112f7b[_0x83df(0x38)]};if(_0x83df(0x39)!==_0x83df(0x3a))_0x112f7b[_0x83df(0x1c)](_0x25cd2a,![]);else{_0x3b4ee9[_0x83df(0x3b)](_0x52706e,_0x3b4ee9[_0x83df(0x3c)]);return;}});},[_0x372af3]),_0x26c013=useCallback(_0x10f881=>{_0x112f7b[_0x83df(0x3d)](_0x41f8c5,_0x515732=>({..._0x515732,[_0x10f881]:!_0x515732[_0x10f881]}));},[]),_0x38d621=_0x112f7b[_0x83df(0x3e)](useCallback,async()=>{try{if(_0x112f7b[_0x83df(0x3f)](_0x112f7b[_0x83df(0x40)],_0x83df(0xc))){const _0x35b19b=_0x112f7b[_0x83df(0x41)](typeof _0x10ac61[_0x83df(0x30)],_0x112f7b[_0x83df(0x42)])&&_0x3f0db6[_0x83df(0x30)][_0x83df(0x31)]?_0x17bbfc[_0x83df(0x30)][_0x83df(0x31)]:_0x83df(0x32)+_0x2fa5ed;_0x112f7b[_0x83df(0x43)](_0x34a029,_0x35b19b);}else{const _0xdcdae6=Platform[_0x83df(0x44)]({'ios':_0x112f7b['yhmrB'],'android':_0x112f7b['yhmrB'],'default':_0x112f7b[_0x83df(0x45)]});if(__DEV__){if(_0x112f7b[_0x83df(0x20)](_0x83df(0xf),_0x112f7b[_0x83df(0x46)])){_0x4ca70f(''+API_CONFIG[_0x83df(0x29)],_0x112f7b[_0x83df(0x47)],{'username':_0x4ba1da,'selections':_0x1065d2,'platforms':_0x5f5694}),_0x2c7184();return;}else Alert['alert'](_0x83df(0x17),_0x2c3440,[{'text':'OK'}]);}let _0x303c23=_0x83df(0x48);try{const _0x4fd6d8=await onairosApi[_0x83df(0x0)](_0x112f7b[_0x83df(0x49)]);_0x4fd6d8&&_0x4fd6d8[_0x83df(0x30)]&&typeof _0x4fd6d8[_0x83df(0x30)]===_0x112f7b[_0x83df(0x42)]&&(_0x112f7b[_0x83df(0x20)](_0x112f7b['njVeg'],_0x112f7b[_0x83df(0x4a)])?_0x303c23=_0x4fd6d8['data']['publicKey']||_0x83df(0x48):_0x484270[_0x83df(0x36)](_0x112f7b[_0x83df(0x4b)],_0x53c783));}catch(_0x307c9b){console[_0x83df(0x36)](_0x112f7b[_0x83df(0x4b)],_0x307c9b);}let _0x10b085=_0x21672b;if(_0x112f7b[_0x83df(0x41)](typeof encryptModelKey,_0x112f7b[_0x83df(0x4c)])&&_0x303c23){if(_0x83df(0x4d)===_0x112f7b[_0x83df(0x4e)])_0x551412(_0x83df(0xb));else try{if(_0x112f7b[_0x83df(0x3f)](_0x83df(0x4f),_0x112f7b[_0x83df(0x50)]))_0x10b085=_0x112f7b['CzrmW'](encryptModelKey,_0x303c23,_0x21672b);else try{_0x2ca4cb=_0x112f7b[_0x83df(0x1f)](_0x2bc273,_0x3d4688,_0x58a50f);}catch(_0x3052cc){_0x4b00ee[_0x83df(0x36)](_0x112f7b[_0x83df(0x51)],_0x3052cc);}}catch(_0x3456ff){console['error'](_0x112f7b[_0x83df(0x51)],_0x3456ff);}}const _0x5550aa=await onairosApi['post'](_0x112f7b['nowMS'],{'Info':{'storage':_0x112f7b[_0x83df(0x52)],'appId':_0xdcdae6,'confirmations':_0x1065d2,'developerURL':_0x112f7b['uMBOH'],'EncryptedUserPin':_0x10b085,'username':_0x4ba1da,'platforms':_0x5f5694}});_0x5550aa&&_0x5550aa['data']&&_0x5550aa[_0x83df(0x30)][_0x83df(0x53)]&&_0x5550aa[_0x83df(0x30)][_0x83df(0x54)]?_0x112f7b[_0x83df(0x55)]!==_0x112f7b[_0x83df(0x55)]?(_0xb29a99[_0x83df(0x36)](_0x112f7b[_0x83df(0x56)],_0x3e582f),_0x3999b5?(_0x112f7b['oWqCi'](_0xa3b65a,''+_0x2b8417[_0x83df(0x29)],_0x112f7b[_0x83df(0x57)],{'username':_0x30c535,'selections':_0x485385,'platforms':_0x3c8015,'error':!![]}),_0x112f7b[_0x83df(0x58)](_0x9454ff)):_0xd84326(_0x112f7b['ChWOB'])):(_0x112f7b[_0x83df(0x59)](_0x4ca70f,_0x5550aa[_0x83df(0x30)][_0x83df(0x53)],_0x5550aa[_0x83df(0x30)][_0x83df(0x54)],{'username':_0x4ba1da,'selections':_0x1065d2,'platforms':_0x5f5694}),_0x112f7b[_0x83df(0x58)](_0x2c7184)):(_0x112f7b[_0x83df(0x5a)](_0x4ca70f,''+API_CONFIG[_0x83df(0x29)],_0x112f7b[_0x83df(0x5b)],{'username':_0x4ba1da,'selections':_0x1065d2,'platforms':_0x5f5694}),_0x2c7184());}}catch(_0x31a27e){console['error'](_0x112f7b[_0x83df(0x56)],_0x31a27e),__DEV__?(_0x112f7b[_0x83df(0x5a)](_0x4ca70f,''+API_CONFIG[_0x83df(0x29)],_0x112f7b[_0x83df(0x57)],{'username':_0x4ba1da,'selections':_0x1065d2,'platforms':_0x5f5694,'error':!![]}),_0x112f7b[_0x83df(0x2a)](_0x2c7184)):_0x112f7b[_0x83df(0x5c)](_0x112f7b[_0x83df(0x5d)],'BvoUd')?_0x17355b=_0x27a7a3[_0x83df(0x30)]['publicKey']||_0x83df(0x48):_0x5d1de7(_0x112f7b[_0x83df(0x5e)]);}},[_0x1065d2,_0x4ba1da,_0x21672b,_0x4ca70f,_0x2c7184,_0x5f5694]),_0x5d1de7=_0x405c2c=>{const _0x10b2dc={'Nimim':function(_0x265498,_0x587711){return _0x112f7b[_0x83df(0x5f)](_0x265498,_0x587711);}};_0x112f7b[_0x83df(0x3f)](_0x112f7b['JeoHg'],_0x83df(0x60))?_0x10b2dc[_0x83df(0x61)](_0x498489,_0x83df(0x32)+_0x165e47):Alert[_0x83df(0x62)](_0x112f7b[_0x83df(0x63)],_0x405c2c,[{'text':'OK'}]);};return React[_0x83df(0x64)](Modal,{'visible':_0x2ef258,'transparent':!![],'animationType':_0x83df(0x65),'statusBarTranslucent':!![],'onRequestClose':_0x2c7184},React[_0x83df(0x64)](TouchableOpacity,{'style':styles[_0x83df(0x66)],'activeOpacity':0x1,'onPress':_0x2c7184},React[_0x83df(0x64)](TouchableWithoutFeedback,{'onPress':_0x18e7eb=>_0x18e7eb['stopPropagation']()},React[_0x83df(0x64)](Animated[_0x83df(0x67)],{'style':[styles[_0x83df(0x68)],darkMode&&styles[_0x83df(0x69)],{'transform':[{'translateY':_0x372af3[_0x83df(0x6a)]({'inputRange':[0x0,0x1],'outputRange':[SCREEN_HEIGHT,0x0]})}]}]},React['createElement'](View,{'style':styles['handleContainer']},React[_0x83df(0x64)](View,{'style':[styles[_0x83df(0x6b)],darkMode&&styles[_0x83df(0x6c)]]})),React[_0x83df(0x64)](SafeAreaView,{'style':[styles[_0x83df(0x6d)],darkMode&&styles[_0x83df(0x69)]]},React[_0x83df(0x64)](View,{'style':[styles['header'],darkMode&&styles[_0x83df(0x6e)]]},React[_0x83df(0x64)](View,{'style':styles[_0x83df(0x6f)]},React[_0x83df(0x64)](View,{'style':[styles[_0x83df(0x70)],darkMode&&styles[_0x83df(0x71)]]},React['createElement'](Text,{'style':[styles['appIconText'],darkMode&&styles[_0x83df(0x72)]]},appName[_0x83df(0x73)](0x0))),React[_0x83df(0x64)](_0x2eeaa1,{'name':_0x83df(0x74),'size':0x18,'color':darkMode?_0x112f7b['VNNod']:_0x83df(0x75),'style':styles[_0x83df(0x76)]}),React['createElement'](View,{'style':[styles[_0x83df(0x77)],darkMode&&styles['darkOnairosIcon']]},React[_0x83df(0x64)](Text,{'style':[styles['onairosIconText'],darkMode&&styles[_0x83df(0x72)]]},'O')))),React[_0x83df(0x64)](ScrollView,{'style':styles[_0x83df(0x78)]},React[_0x83df(0x64)](View,{'style':styles[_0x83df(0x79)]},React[_0x83df(0x64)](Text,{'style':[styles[_0x83df(0x7a)],darkMode&&styles[_0x83df(0x72)]]},_0x83df(0x7b)),React[_0x83df(0x64)](Text,{'style':[styles['privacyMessage'],darkMode&&styles['darkSubText']]},_0x112f7b['lSIQw'])),React[_0x83df(0x64)](View,{'style':styles[_0x83df(0x7c)]},platforms['map'](_0x2fa456=>React[_0x83df(0x64)](View,{'key':_0x2fa456['id'],'style':[styles[_0x83df(0x7d)],darkMode&&styles['darkPlatformItem']]},React['createElement'](View,{'style':styles[_0x83df(0x7e)]},React['createElement'](Image,{'source':_0x2fa456['icon'],'style':styles[_0x83df(0x7f)],'resizeMode':'contain'}),React[_0x83df(0x64)](Text,{'style':[styles[_0x83df(0x80)],darkMode&&styles['darkText']]},_0x2fa456[_0x83df(0x81)])),React['createElement'](Switch,{'value':_0x5f5694[_0x2fa456['id']],'onValueChange':()=>_0x26c013(_0x2fa456['id']),'trackColor':{'false':_0x83df(0x82),'true':'#81b0ff'},'thumbColor':_0x5f5694[_0x2fa456['id']]?'#2196F3':_0x83df(0x83)}))))),React[_0x83df(0x64)](View,{'style':[styles[_0x83df(0x84)],darkMode&&styles[_0x83df(0x85)]]},React[_0x83df(0x64)](TouchableOpacity,{'style':styles['footerButtonCancel'],'onPress':_0x2c7184},React['createElement'](Text,{'style':[styles[_0x83df(0x86)],darkMode&&styles[_0x83df(0x87)]]},_0x112f7b[_0x83df(0x88)])),React[_0x83df(0x64)](TouchableOpacity,{'style':[styles[_0x83df(0x89)],darkMode&&styles[_0x83df(0x8a)]],'onPress':_0x38d621},React[_0x83df(0x64)](Text,{'style':[styles[_0x83df(0x8b)],_0x112f7b[_0x83df(0x8c)](darkMode,{'color':_0x112f7b[_0x83df(0x8d)]})]},_0x112f7b[_0x83df(0x8e)]))))))));};const styles=StyleSheet[_0x83df(0x8f)]({'modalOverlay':{'flex':0x1,'backgroundColor':_0x83df(0x90),'justifyContent':'flex-end'},'bottomSheet':{'backgroundColor':'#fff','borderTopLeftRadius':0x18,'borderTopRightRadius':0x18,'width':SCREEN_WIDTH,'height':SCREEN_HEIGHT*0.8,'overflow':_0x83df(0x91)},'handleContainer':{'width':_0x83df(0x92),'alignItems':'center','paddingTop':0xc,'paddingBottom':0x8},'handle':{'width':0x28,'height':0x5,'borderRadius':0x3,'backgroundColor':_0x83df(0x93)},'darkHandle':{'backgroundColor':_0x83df(0x75)},'container':{'flex':0x1,'backgroundColor':_0x83df(0x94)},'darkContainer':{'backgroundColor':_0x83df(0x95)},'header':{'padding':0x18,'alignItems':_0x83df(0x96)},'darkHeader':{'backgroundColor':_0x83df(0x95)},'headerContent':{'flexDirection':'row','alignItems':_0x83df(0x96),'justifyContent':'center','marginBottom':0x10},'appIcon':{'width':0x30,'height':0x30,'borderRadius':0x10,'backgroundColor':_0x83df(0x97),'alignItems':_0x83df(0x96),'justifyContent':_0x83df(0x96)},'darkAppIcon':{'backgroundColor':_0x83df(0x98)},'appIconText':{'fontSize':0x18,'color':_0x83df(0x1a)},'darkText':{'color':_0x83df(0x94)},'arrow':{'marginHorizontal':0x10},'onairosIcon':{'width':0x30,'height':0x30,'borderRadius':0x10,'backgroundColor':_0x83df(0x97),'alignItems':_0x83df(0x96),'justifyContent':_0x83df(0x96)},'darkOnairosIcon':{'backgroundColor':_0x83df(0x98)},'onairosIconText':{'fontSize':0x18,'color':'#000'},'darkSubText':{'color':'#999'},'titleContainer':{'marginBottom':0x1e},'mainTitle':{'fontSize':0x16,'fontWeight':_0x83df(0x99),'color':_0x83df(0x1a),'textAlign':_0x83df(0x96),'marginBottom':0x10},'privacyMessage':{'fontSize':0xe,'color':_0x83df(0x75),'textAlign':_0x83df(0x96),'marginBottom':0x10},'content':{'flex':0x1,'paddingHorizontal':0x18},'platformsContainer':{'marginTop':0x10},'platformItem':{'flexDirection':'row','justifyContent':_0x83df(0x9a),'alignItems':'center','padding':0x10,'backgroundColor':_0x83df(0x94),'borderRadius':0x10,'marginBottom':0x10,'borderWidth':0x1,'borderColor':_0x83df(0x9b)},'darkPlatformItem':{'backgroundColor':_0x83df(0x98),'borderColor':_0x83df(0x9c)},'platformInfo':{'flexDirection':_0x83df(0x9d),'alignItems':_0x83df(0x96)},'platformIcon':{'width':0x20,'height':0x20,'marginRight':0xc},'platformName':{'fontSize':0x10,'fontWeight':'500','color':_0x83df(0x1a)},'footer':{'flexDirection':'row','alignItems':_0x83df(0x96),'justifyContent':_0x83df(0x9a),'padding':0x18,'borderTopWidth':0x1,'borderTopColor':_0x83df(0x9b),'backgroundColor':_0x83df(0x94)},'darkFooter':{'backgroundColor':_0x83df(0x98),'borderTopColor':'#333'},'footerButtonCancel':{'paddingVertical':0x8,'paddingHorizontal':0x10},'darkFooterButton':{'backgroundColor':_0x83df(0x9e)},'footerButtonConfirm':{'paddingVertical':0x10,'paddingHorizontal':0x20,'borderRadius':0x10,'backgroundColor':'#fff','borderWidth':0x1,'borderColor':'#000'},'darkFooterButtonConfirm':{'backgroundColor':_0x83df(0x94),'borderColor':'#fff'},'footerButtonText':{'color':_0x83df(0x75),'fontSize':0x10},'footerButtonTextConfirm':{'color':_0x83df(0x1a),'fontSize':0x10,'fontWeight':_0x83df(0x99)},'lightBackground':{'backgroundColor':_0x83df(0x94)},'darkBackground':{'backgroundColor':'#1A1A1A'}});
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Alert, Platform, Dimensions, Modal, Animated, TouchableWithoutFeedback, SafeAreaView, Image, Switch } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
import { onairosApi } from '../api';
|
|
5
|
+
import { encryptModelKey } from '../utils/encryption';
|
|
6
|
+
import { OVERLAY_PLATFORMS } from '../utils/assetRegistry';
|
|
7
|
+
const {
|
|
8
|
+
width: SCREEN_WIDTH,
|
|
9
|
+
height: SCREEN_HEIGHT
|
|
10
|
+
} = Dimensions.get('window');
|
|
11
|
+
import { API_CONFIG } from '../config/api';
|
|
12
|
+
export const Overlay = ({
|
|
13
|
+
data,
|
|
14
|
+
username,
|
|
15
|
+
modelKey,
|
|
16
|
+
onResolved,
|
|
17
|
+
appName = 'Your App',
|
|
18
|
+
darkMode = false,
|
|
19
|
+
platforms = OVERLAY_PLATFORMS
|
|
20
|
+
}) => {
|
|
21
|
+
const [selections, setSelections] = useState({});
|
|
22
|
+
const [details, setDetails] = useState('');
|
|
23
|
+
const [visible, setVisible] = useState(true);
|
|
24
|
+
const [platformToggles, setPlatformToggles] = useState({});
|
|
25
|
+
const bottomSheetAnim = useRef(new Animated.Value(0)).current;
|
|
26
|
+
|
|
27
|
+
// Initialize selection state on mount
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
// Initialize selection state
|
|
30
|
+
const initialSelections = {};
|
|
31
|
+
Object.keys(data).forEach(key => {
|
|
32
|
+
initialSelections[key] = false;
|
|
33
|
+
});
|
|
34
|
+
setSelections(initialSelections);
|
|
35
|
+
|
|
36
|
+
// Initialize platform toggles
|
|
37
|
+
const initialToggles = {};
|
|
38
|
+
platforms.forEach(platform => {
|
|
39
|
+
initialToggles[platform.id] = false;
|
|
40
|
+
});
|
|
41
|
+
setPlatformToggles(initialToggles);
|
|
42
|
+
getDetails();
|
|
43
|
+
|
|
44
|
+
// Animate the bottom sheet sliding up
|
|
45
|
+
Animated.spring(bottomSheetAnim, {
|
|
46
|
+
toValue: 1,
|
|
47
|
+
useNativeDriver: true,
|
|
48
|
+
bounciness: 0
|
|
49
|
+
}).start();
|
|
50
|
+
}, []);
|
|
51
|
+
const getDetails = async () => {
|
|
52
|
+
try {
|
|
53
|
+
// In Expo or development, use mock data
|
|
54
|
+
if (__DEV__) {
|
|
55
|
+
setDetails('Development mode - mock account info');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const response = await onairosApi.post('getAccountInfo', {
|
|
59
|
+
Info: {
|
|
60
|
+
username: username
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
// Handle response data properly based on API structure
|
|
64
|
+
if (response && response.data) {
|
|
65
|
+
const accountInfo = typeof response.data === 'object' && response.data.AccountInfo ? response.data.AccountInfo : `User: ${username}`;
|
|
66
|
+
setDetails(accountInfo);
|
|
67
|
+
} else {
|
|
68
|
+
setDetails(`User: ${username}`);
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error('Error getting account info:', e);
|
|
72
|
+
setDetails(`User: ${username}`);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const closeOverlay = useCallback(() => {
|
|
76
|
+
// Animate the overlay sliding down
|
|
77
|
+
Animated.timing(bottomSheetAnim, {
|
|
78
|
+
toValue: 0,
|
|
79
|
+
duration: 250,
|
|
80
|
+
useNativeDriver: true
|
|
81
|
+
}).start(() => {
|
|
82
|
+
setVisible(false);
|
|
83
|
+
});
|
|
84
|
+
}, [bottomSheetAnim]);
|
|
85
|
+
const togglePlatform = useCallback(platformId => {
|
|
86
|
+
setPlatformToggles(prev => ({
|
|
87
|
+
...prev,
|
|
88
|
+
[platformId]: !prev[platformId]
|
|
89
|
+
}));
|
|
90
|
+
}, []);
|
|
91
|
+
const confirmSelection = useCallback(async () => {
|
|
92
|
+
try {
|
|
93
|
+
// Mock app identifier
|
|
94
|
+
const appId = Platform.select({
|
|
95
|
+
ios: 'com.onairos.mock',
|
|
96
|
+
android: 'com.onairos.mock',
|
|
97
|
+
default: 'unknown'
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// In development mode, use mock data
|
|
101
|
+
if (__DEV__) {
|
|
102
|
+
onResolved(`${API_CONFIG.BASE_URL}`, 'mock-token', {
|
|
103
|
+
username,
|
|
104
|
+
selections,
|
|
105
|
+
platforms: platformToggles
|
|
106
|
+
});
|
|
107
|
+
closeOverlay();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Get server public key for encryption
|
|
112
|
+
let serverPublicKey = 'mock-key';
|
|
113
|
+
try {
|
|
114
|
+
const keyResponse = await onairosApi.get('public/key');
|
|
115
|
+
if (keyResponse && keyResponse.data && typeof keyResponse.data === 'object') {
|
|
116
|
+
serverPublicKey = keyResponse.data.publicKey || 'mock-key';
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.error('Error getting server public key:', e);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Encrypt the model key - only if the function exists and server key is valid
|
|
123
|
+
let encryptedModelKey = modelKey;
|
|
124
|
+
if (typeof encryptModelKey === 'function' && serverPublicKey) {
|
|
125
|
+
try {
|
|
126
|
+
encryptedModelKey = encryptModelKey(serverPublicKey, modelKey);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.error('Error encrypting model key:', e);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const response = await onairosApi.post('getAPIUrlMobile', {
|
|
132
|
+
Info: {
|
|
133
|
+
storage: 'local',
|
|
134
|
+
appId: appId,
|
|
135
|
+
confirmations: selections,
|
|
136
|
+
developerURL: 'devURL',
|
|
137
|
+
EncryptedUserPin: encryptedModelKey,
|
|
138
|
+
username: username,
|
|
139
|
+
platforms: platformToggles
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
if (response && response.data && response.data.APIUrl && response.data.token) {
|
|
143
|
+
onResolved(response.data.APIUrl, response.data.token, {
|
|
144
|
+
username,
|
|
145
|
+
selections,
|
|
146
|
+
platforms: platformToggles
|
|
147
|
+
});
|
|
148
|
+
closeOverlay();
|
|
149
|
+
} else {
|
|
150
|
+
// If response doesn't have expected format, use fallbacks
|
|
151
|
+
onResolved(`${API_CONFIG.BASE_URL}`, 'fallback-token', {
|
|
152
|
+
username,
|
|
153
|
+
selections,
|
|
154
|
+
platforms: platformToggles
|
|
155
|
+
});
|
|
156
|
+
closeOverlay();
|
|
157
|
+
}
|
|
158
|
+
} catch (e) {
|
|
159
|
+
console.error('Error confirming selection:', e);
|
|
160
|
+
// In case of error, provide fallback (development mode)
|
|
161
|
+
if (__DEV__) {
|
|
162
|
+
onResolved(`${API_CONFIG.BASE_URL}`, 'error-fallback-token', {
|
|
163
|
+
username,
|
|
164
|
+
selections,
|
|
165
|
+
platforms: platformToggles,
|
|
166
|
+
error: true
|
|
167
|
+
});
|
|
168
|
+
closeOverlay();
|
|
169
|
+
} else {
|
|
170
|
+
showErrorModal('Failed to confirm selection. Please try again.');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, [selections, username, modelKey, onResolved, closeOverlay, platformToggles]);
|
|
174
|
+
const showErrorModal = errorMessage => {
|
|
175
|
+
Alert.alert('Error', errorMessage, [{
|
|
176
|
+
text: 'OK'
|
|
177
|
+
}]);
|
|
178
|
+
};
|
|
179
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
180
|
+
visible: visible,
|
|
181
|
+
transparent: true,
|
|
182
|
+
animationType: "none",
|
|
183
|
+
statusBarTranslucent: true,
|
|
184
|
+
onRequestClose: closeOverlay
|
|
185
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
186
|
+
style: styles.modalOverlay,
|
|
187
|
+
activeOpacity: 1,
|
|
188
|
+
onPress: closeOverlay
|
|
189
|
+
}, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
|
190
|
+
onPress: e => e.stopPropagation()
|
|
191
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
192
|
+
style: [styles.bottomSheet, darkMode && styles.darkContainer, {
|
|
193
|
+
transform: [{
|
|
194
|
+
translateY: bottomSheetAnim.interpolate({
|
|
195
|
+
inputRange: [0, 1],
|
|
196
|
+
outputRange: [SCREEN_HEIGHT, 0]
|
|
197
|
+
})
|
|
198
|
+
}]
|
|
199
|
+
}]
|
|
200
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
201
|
+
style: styles.handleContainer
|
|
202
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
203
|
+
style: [styles.handle, darkMode && styles.darkHandle]
|
|
204
|
+
})), /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
205
|
+
style: [styles.container, darkMode && styles.darkContainer]
|
|
206
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
207
|
+
style: [styles.header, darkMode && styles.darkHeader]
|
|
208
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
209
|
+
style: styles.headerContent
|
|
210
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
211
|
+
style: [styles.appIcon, darkMode && styles.darkAppIcon]
|
|
212
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
213
|
+
style: [styles.appIconText, darkMode && styles.darkText]
|
|
214
|
+
}, appName.charAt(0))), /*#__PURE__*/React.createElement(Icon, {
|
|
215
|
+
name: "arrow_forward",
|
|
216
|
+
size: 24,
|
|
217
|
+
color: darkMode ? '#999' : '#666',
|
|
218
|
+
style: styles.arrow
|
|
219
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
220
|
+
style: [styles.onairosIcon, darkMode && styles.darkOnairosIcon]
|
|
221
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
222
|
+
style: [styles.onairosIconText, darkMode && styles.darkText]
|
|
223
|
+
}, "O")))), /*#__PURE__*/React.createElement(ScrollView, {
|
|
224
|
+
style: styles.content
|
|
225
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
226
|
+
style: styles.titleContainer
|
|
227
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
228
|
+
style: [styles.mainTitle, darkMode && styles.darkText]
|
|
229
|
+
}, "Connect your data to create a Persona of you, to connect to Cosmos"), /*#__PURE__*/React.createElement(Text, {
|
|
230
|
+
style: [styles.privacyMessage, darkMode && styles.darkSubText]
|
|
231
|
+
}, "None of your app data is shared with ANYONE")), /*#__PURE__*/React.createElement(View, {
|
|
232
|
+
style: styles.platformsContainer
|
|
233
|
+
}, platforms.map(platform => /*#__PURE__*/React.createElement(View, {
|
|
234
|
+
key: platform.id,
|
|
235
|
+
style: [styles.platformItem, darkMode && styles.darkPlatformItem]
|
|
236
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
237
|
+
style: styles.platformInfo
|
|
238
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
239
|
+
source: platform.icon,
|
|
240
|
+
style: styles.platformIcon,
|
|
241
|
+
resizeMode: "contain"
|
|
242
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
243
|
+
style: [styles.platformName, darkMode && styles.darkText]
|
|
244
|
+
}, platform.name)), /*#__PURE__*/React.createElement(Switch, {
|
|
245
|
+
value: platformToggles[platform.id],
|
|
246
|
+
onValueChange: () => togglePlatform(platform.id),
|
|
247
|
+
trackColor: {
|
|
248
|
+
false: '#767577',
|
|
249
|
+
true: '#81b0ff'
|
|
250
|
+
},
|
|
251
|
+
thumbColor: platformToggles[platform.id] ? '#2196F3' : '#f4f3f4'
|
|
252
|
+
}))))), /*#__PURE__*/React.createElement(View, {
|
|
253
|
+
style: [styles.footer, darkMode && styles.darkFooter]
|
|
254
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
255
|
+
style: styles.footerButtonCancel,
|
|
256
|
+
onPress: closeOverlay
|
|
257
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
258
|
+
style: [styles.footerButtonText, darkMode && styles.darkSubText]
|
|
259
|
+
}, "Cancel")), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
260
|
+
style: [styles.footerButtonConfirm, darkMode && styles.darkFooterButtonConfirm],
|
|
261
|
+
onPress: confirmSelection
|
|
262
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
263
|
+
style: [styles.footerButtonTextConfirm, darkMode && {
|
|
264
|
+
color: '#000'
|
|
265
|
+
}]
|
|
266
|
+
}, "Connect"))))))));
|
|
267
|
+
};
|
|
268
|
+
const styles = StyleSheet.create({
|
|
269
|
+
modalOverlay: {
|
|
270
|
+
flex: 1,
|
|
271
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
272
|
+
justifyContent: 'flex-end'
|
|
273
|
+
},
|
|
274
|
+
bottomSheet: {
|
|
275
|
+
backgroundColor: '#fff',
|
|
276
|
+
borderTopLeftRadius: 24,
|
|
277
|
+
borderTopRightRadius: 24,
|
|
278
|
+
width: SCREEN_WIDTH,
|
|
279
|
+
height: SCREEN_HEIGHT * 0.8,
|
|
280
|
+
overflow: 'hidden'
|
|
281
|
+
},
|
|
282
|
+
handleContainer: {
|
|
283
|
+
width: '100%',
|
|
284
|
+
alignItems: 'center',
|
|
285
|
+
paddingTop: 12,
|
|
286
|
+
paddingBottom: 8
|
|
287
|
+
},
|
|
288
|
+
handle: {
|
|
289
|
+
width: 40,
|
|
290
|
+
height: 5,
|
|
291
|
+
borderRadius: 3,
|
|
292
|
+
backgroundColor: '#E0E0E0'
|
|
293
|
+
},
|
|
294
|
+
darkHandle: {
|
|
295
|
+
backgroundColor: '#666'
|
|
296
|
+
},
|
|
297
|
+
container: {
|
|
298
|
+
flex: 1,
|
|
299
|
+
backgroundColor: '#fff'
|
|
300
|
+
},
|
|
301
|
+
darkContainer: {
|
|
302
|
+
backgroundColor: '#1A1A1A'
|
|
303
|
+
},
|
|
304
|
+
header: {
|
|
305
|
+
padding: 24,
|
|
306
|
+
alignItems: 'center'
|
|
307
|
+
},
|
|
308
|
+
darkHeader: {
|
|
309
|
+
backgroundColor: '#1A1A1A'
|
|
310
|
+
},
|
|
311
|
+
headerContent: {
|
|
312
|
+
flexDirection: 'row',
|
|
313
|
+
alignItems: 'center',
|
|
314
|
+
justifyContent: 'center',
|
|
315
|
+
marginBottom: 16
|
|
316
|
+
},
|
|
317
|
+
appIcon: {
|
|
318
|
+
width: 48,
|
|
319
|
+
height: 48,
|
|
320
|
+
borderRadius: 16,
|
|
321
|
+
backgroundColor: '#F5F5F5',
|
|
322
|
+
alignItems: 'center',
|
|
323
|
+
justifyContent: 'center'
|
|
324
|
+
},
|
|
325
|
+
darkAppIcon: {
|
|
326
|
+
backgroundColor: '#2A2A2A'
|
|
327
|
+
},
|
|
328
|
+
appIconText: {
|
|
329
|
+
fontSize: 24,
|
|
330
|
+
color: '#000'
|
|
331
|
+
},
|
|
332
|
+
darkText: {
|
|
333
|
+
color: '#fff'
|
|
334
|
+
},
|
|
335
|
+
arrow: {
|
|
336
|
+
marginHorizontal: 16
|
|
337
|
+
},
|
|
338
|
+
onairosIcon: {
|
|
339
|
+
width: 48,
|
|
340
|
+
height: 48,
|
|
341
|
+
borderRadius: 16,
|
|
342
|
+
backgroundColor: '#F5F5F5',
|
|
343
|
+
alignItems: 'center',
|
|
344
|
+
justifyContent: 'center'
|
|
345
|
+
},
|
|
346
|
+
darkOnairosIcon: {
|
|
347
|
+
backgroundColor: '#2A2A2A'
|
|
348
|
+
},
|
|
349
|
+
onairosIconText: {
|
|
350
|
+
fontSize: 24,
|
|
351
|
+
color: '#000'
|
|
352
|
+
},
|
|
353
|
+
darkSubText: {
|
|
354
|
+
color: '#999'
|
|
355
|
+
},
|
|
356
|
+
titleContainer: {
|
|
357
|
+
marginBottom: 30
|
|
358
|
+
},
|
|
359
|
+
mainTitle: {
|
|
360
|
+
fontSize: 22,
|
|
361
|
+
fontWeight: '600',
|
|
362
|
+
color: '#000',
|
|
363
|
+
textAlign: 'center',
|
|
364
|
+
marginBottom: 16
|
|
365
|
+
},
|
|
366
|
+
privacyMessage: {
|
|
367
|
+
fontSize: 14,
|
|
368
|
+
color: '#666',
|
|
369
|
+
textAlign: 'center',
|
|
370
|
+
marginBottom: 16
|
|
371
|
+
},
|
|
372
|
+
content: {
|
|
373
|
+
flex: 1,
|
|
374
|
+
paddingHorizontal: 24
|
|
375
|
+
},
|
|
376
|
+
platformsContainer: {
|
|
377
|
+
marginTop: 16
|
|
378
|
+
},
|
|
379
|
+
platformItem: {
|
|
380
|
+
flexDirection: 'row',
|
|
381
|
+
justifyContent: 'space-between',
|
|
382
|
+
alignItems: 'center',
|
|
383
|
+
padding: 16,
|
|
384
|
+
backgroundColor: '#fff',
|
|
385
|
+
borderRadius: 16,
|
|
386
|
+
marginBottom: 16,
|
|
387
|
+
borderWidth: 1,
|
|
388
|
+
borderColor: '#eee'
|
|
389
|
+
},
|
|
390
|
+
darkPlatformItem: {
|
|
391
|
+
backgroundColor: '#2A2A2A',
|
|
392
|
+
borderColor: '#333'
|
|
393
|
+
},
|
|
394
|
+
platformInfo: {
|
|
395
|
+
flexDirection: 'row',
|
|
396
|
+
alignItems: 'center'
|
|
397
|
+
},
|
|
398
|
+
platformIcon: {
|
|
399
|
+
width: 32,
|
|
400
|
+
height: 32,
|
|
401
|
+
marginRight: 12
|
|
402
|
+
},
|
|
403
|
+
platformName: {
|
|
404
|
+
fontSize: 16,
|
|
405
|
+
fontWeight: '500',
|
|
406
|
+
color: '#000'
|
|
407
|
+
},
|
|
408
|
+
footer: {
|
|
409
|
+
flexDirection: 'row',
|
|
410
|
+
alignItems: 'center',
|
|
411
|
+
justifyContent: 'space-between',
|
|
412
|
+
padding: 24,
|
|
413
|
+
borderTopWidth: 1,
|
|
414
|
+
borderTopColor: '#eee',
|
|
415
|
+
backgroundColor: '#fff'
|
|
416
|
+
},
|
|
417
|
+
darkFooter: {
|
|
418
|
+
backgroundColor: '#2A2A2A',
|
|
419
|
+
borderTopColor: '#333'
|
|
420
|
+
},
|
|
421
|
+
footerButtonCancel: {
|
|
422
|
+
paddingVertical: 8,
|
|
423
|
+
paddingHorizontal: 16
|
|
424
|
+
},
|
|
425
|
+
darkFooterButton: {
|
|
426
|
+
backgroundColor: 'transparent'
|
|
427
|
+
},
|
|
428
|
+
footerButtonConfirm: {
|
|
429
|
+
paddingVertical: 16,
|
|
430
|
+
paddingHorizontal: 32,
|
|
431
|
+
borderRadius: 16,
|
|
432
|
+
backgroundColor: '#fff',
|
|
433
|
+
borderWidth: 1,
|
|
434
|
+
borderColor: '#000'
|
|
435
|
+
},
|
|
436
|
+
darkFooterButtonConfirm: {
|
|
437
|
+
backgroundColor: '#fff',
|
|
438
|
+
borderColor: '#fff'
|
|
439
|
+
},
|
|
440
|
+
footerButtonText: {
|
|
441
|
+
color: '#666',
|
|
442
|
+
fontSize: 16
|
|
443
|
+
},
|
|
444
|
+
footerButtonTextConfirm: {
|
|
445
|
+
color: '#000',
|
|
446
|
+
fontSize: 16,
|
|
447
|
+
fontWeight: '600'
|
|
448
|
+
},
|
|
449
|
+
lightBackground: {
|
|
450
|
+
backgroundColor: '#fff'
|
|
451
|
+
},
|
|
452
|
+
darkBackground: {
|
|
453
|
+
backgroundColor: '#1A1A1A'
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1 +1,129 @@
|
|
|
1
|
-
import React,{useEffect,useRef,useState}from'react';function _0x459f(_0x587ee1,_0x459f41){_0x587ee1=_0x587ee1-0x0;const _0xdb884e=_0x587e();let _0x40864=_0xdb884e[_0x587ee1];return _0x40864;}import{View,StyleSheet}from'react-native';import _0x18c40e from'lottie-react-native';import{ANIMATIONS}from'../utils/assetRegistry';const PersonaImage=({level:_0x65c92c,style:_0x2a5308,disableAnimation:disableAnimation=![]})=>{const _0x28c886={'sehuU':function(_0x4fed2f,_0x29257b){return _0x4fed2f(_0x29257b);},'HuJQo':function(_0x2d3215,_0x57c2b4){return _0x2d3215===_0x57c2b4;},'hrRgZ':_0x459f(0x0),'pmUbk':function(_0x3324a0,_0x1f70bb){return _0x3324a0-_0x1f70bb;},'CALfk':function(_0x307d2d,_0x2d46c6){return _0x307d2d/_0x2d46c6;},'YOMae':function(_0x1cd97b,_0x3eb8cb){return _0x1cd97b*_0x3eb8cb;},'WTDNu':function(_0x2e72ba,_0x3c2a1a){return _0x2e72ba*_0x3c2a1a;},'kiKPm':function(_0x311cb7,_0x3731f1){return _0x311cb7(_0x3731f1);},'CKBkT':function(_0x357078,_0x393d42){return _0x357078<_0x393d42;},'jDKYm':_0x459f(0x1),'TgREw':function(_0x33e549,_0x4564a0){return _0x33e549(_0x4564a0);},'TOaSK':function(_0xf74dc2,_0x5ea218){return _0xf74dc2*_0x5ea218;},'yFozN':function(_0x2f4bdd,_0x5c9674){return _0x2f4bdd+_0x5c9674;},'lDAEA':function(_0x23b375,_0x364fef){return _0x23b375-_0x364fef;},'zKKhp':function(_0x3b68c9,_0x3302d3){return _0x3b68c9<_0x3302d3;},'pIzwR':function(_0x56c928,_0x1de890){return _0x56c928!==_0x1de890;},'Tstkj':'OMrqV','gQBcu':_0x459f(0x2),'dBDAW':function(_0x1e9cc1,_0x2971cb){return _0x1e9cc1!==_0x2971cb;},'YUmZn':_0x459f(0x3),'FADpS':'EifrW','zZDOs':function(_0x140743,_0x379e4e){return _0x140743(_0x379e4e);},'PuYqX':function(_0x558a27,_0x27a892){return _0x558a27+_0x27a892;},'VvyZS':function(_0x4eba3a,_0x3c5843){return _0x4eba3a(_0x3c5843);},'NCmQM':_0x459f(0x4),'ARjqI':function(_0x1aee19,_0x11ad09){return _0x1aee19(_0x11ad09);},'Syljt':function(_0x107b95,_0x1609a8){return _0x107b95!==_0x1609a8;},'ZqWVZ':function(_0x4c9785,_0x1c4165){return _0x4c9785(_0x1c4165);},'PpHEq':function(_0x187f07,_0x29b841){return _0x187f07!==_0x29b841;},'PbOHN':function(_0x2ceaa9,_0x28e0ef){return _0x2ceaa9(_0x28e0ef);},'GIGeX':function(_0x24df66,_0x216a1a,_0x53c02e){return _0x24df66(_0x216a1a,_0x53c02e);},'UanRU':function(_0xe28075,_0x5d3f42){return _0xe28075(_0x5d3f42);},'bhXsk':function(_0x179dc6,_0x951125){return _0x179dc6(_0x951125);},'VfbJB':function(_0x14a59f,_0x5c8404){return _0x14a59f(_0x5c8404);}},_0x57135c=_0x28c886[_0x459f(0x5)](useRef,null),_0x5e82df=[0x0,0.2,0.35,0.52,0.8],_0x1ba670=_0x814083=>_0x5e82df[_0x814083-0x1]||0x0,[_0x825788,_0x5b7f3f]=_0x28c886[_0x459f(0x6)](useState,_0x28c886[_0x459f(0x7)](_0x1ba670,_0x65c92c)),_0x3b4987=useRef(_0x1ba670(_0x65c92c)),_0x3b04a1=_0x28c886[_0x459f(0x8)](useRef,_0x65c92c),_0x51027c=useRef(null),_0x5ee842=_0x28c886[_0x459f(0x6)](useRef,null),_0x717e5f=_0x28c886['PbOHN'](useRef,!![]);return _0x28c886[_0x459f(0x9)](useEffect,()=>{const _0x4acdd7={'JWYDA':function(_0x459bee,_0x158940){return _0x28c886['sehuU'](_0x459bee,_0x158940);},'kfbzV':function(_0x3f66bb,_0x3eccd7){return _0x3f66bb-_0x3eccd7;},'NZAzV':function(_0x4386ca,_0x54461a){return _0x4386ca*_0x54461a;},'ZVAzb':function(_0x2e8c39,_0x4f4b4b){return _0x28c886[_0x459f(0xa)](_0x2e8c39,_0x4f4b4b);},'bYwZa':function(_0x40400b,_0x17ce55){return _0x28c886['PuYqX'](_0x40400b,_0x17ce55);},'fAIEk':function(_0x4eee88,_0xfb0fe3){return _0x28c886[_0x459f(0xb)](_0x4eee88,_0xfb0fe3);},'HsadE':function(_0x3086f5,_0xf376c1){return _0x28c886[_0x459f(0xc)](_0x3086f5,_0xf376c1);},'ITpkr':function(_0x389fce,_0x4366f1){return _0x28c886[_0x459f(0xd)](_0x389fce,_0x4366f1);},'XkPci':function(_0x108f1f,_0x21aad7){return _0x28c886[_0x459f(0xa)](_0x108f1f,_0x21aad7);}},_0x1b7dc0=_0x28c886[_0x459f(0xe)](_0x1ba670,_0x65c92c);if(_0x717e5f[_0x459f(0xf)]){_0x3b4987[_0x459f(0xf)]=_0x1b7dc0,_0x28c886[_0x459f(0xe)](_0x5b7f3f,_0x1b7dc0),_0x3b04a1[_0x459f(0xf)]=_0x65c92c,_0x717e5f[_0x459f(0xf)]=![];return;}if(disableAnimation){if(_0x28c886[_0x459f(0x10)](_0x459f(0x11),_0x28c886[_0x459f(0x12)]))_0x28c886[_0x459f(0x13)](_0x5ae9cd,_0x4fe8c3[_0x459f(0xf)]),_0x128375[_0x459f(0xf)]=null;else{_0x3b4987['current']=_0x1b7dc0,_0x28c886[_0x459f(0x14)](_0x5b7f3f,_0x1b7dc0),_0x3b04a1['current']=_0x65c92c;return;}}if(_0x3b04a1[_0x459f(0xf)]===_0x65c92c)return;_0x28c886[_0x459f(0x15)](_0x51027c[_0x459f(0xf)],null)&&(_0x28c886[_0x459f(0x16)](cancelAnimationFrame,_0x51027c['current']),_0x51027c[_0x459f(0xf)]=null);_0x28c886[_0x459f(0x17)](_0x5ee842[_0x459f(0xf)],null)&&(_0x28c886[_0x459f(0x18)](clearTimeout,_0x5ee842[_0x459f(0xf)]),_0x5ee842[_0x459f(0xf)]=null);const _0x475848=0x96,_0x548b13=0xc80;return _0x5ee842[_0x459f(0xf)]=_0x28c886[_0x459f(0x9)](setTimeout,()=>{const _0xfc1bdb={'Bbhyv':function(_0x44dfd5,_0xfcf2e8){return _0x44dfd5(_0xfcf2e8);},'rPmCm':function(_0x554bba,_0x452484){return _0x554bba(_0x452484);},'lsbZL':function(_0x44851c,_0x5737bb){return _0x28c886[_0x459f(0x10)](_0x44851c,_0x5737bb);},'ivXIU':_0x28c886[_0x459f(0x19)],'UwCec':function(_0x632f45,_0x3ad20e){return _0x28c886['pmUbk'](_0x632f45,_0x3ad20e);},'uvTke':function(_0x1d1f6f,_0xb057e7){return _0x28c886[_0x459f(0x1a)](_0x1d1f6f,_0xb057e7);},'yFSdT':function(_0x275ba4,_0x5d0164){return _0x275ba4*_0x5d0164;},'wbYvL':function(_0x4e4cf1,_0x549c56){return _0x28c886[_0x459f(0xc)](_0x4e4cf1,_0x549c56);},'rVkbh':function(_0x3148e6,_0x4750df){return _0x28c886[_0x459f(0xb)](_0x3148e6,_0x4750df);},'gKwtv':function(_0x4a5f85,_0x2dcf08){return _0x28c886[_0x459f(0x7)](_0x4a5f85,_0x2dcf08);},'eCRLV':function(_0x1752e3,_0x58e948){return _0x28c886[_0x459f(0x1b)](_0x1752e3,_0x58e948);},'HVGGN':_0x28c886[_0x459f(0x1c)]},_0x32aafa=_0x3b4987[_0x459f(0xf)],_0x5ceb70=Date[_0x459f(0x1d)](),_0x325552=()=>{if(_0xfc1bdb['lsbZL'](_0xfc1bdb[_0x459f(0x1e)],_0xfc1bdb[_0x459f(0x1e)])){const _0x48bb20=_0xfc1bdb[_0x459f(0x1f)](Date[_0x459f(0x1d)](),_0x5ceb70),_0x260691=Math[_0x459f(0x20)](_0xfc1bdb[_0x459f(0x21)](_0x48bb20,_0x548b13),0x1),_0xb67b1=_0x260691<0.5?_0xfc1bdb['yFSdT'](0x2,_0x260691)*_0x260691:-0x1+_0xfc1bdb['yFSdT'](0x4-_0xfc1bdb[_0x459f(0x22)](0x2,_0x260691),_0x260691),_0x3815c8=_0x32aafa+_0xfc1bdb[_0x459f(0x23)](_0x1b7dc0-_0x32aafa,_0xb67b1);_0x3b4987[_0x459f(0xf)]=_0x3815c8,_0xfc1bdb[_0x459f(0x24)](_0x5b7f3f,_0x3815c8),_0xfc1bdb[_0x459f(0x25)](_0x260691,0x1)?_0x51027c['current']=requestAnimationFrame(_0x325552):_0xfc1bdb['HVGGN']!==_0x459f(0x1)?(_0xfc1bdb[_0x459f(0x26)](_0x54af3c,_0x4448ea[_0x459f(0xf)]),_0x5a3ffd[_0x459f(0xf)]=null):_0x51027c['current']=null;}else _0xfc1bdb['rPmCm'](_0x30680b,_0x1e3ad7[_0x459f(0xf)]),_0x3eef63[_0x459f(0xf)]=null;};_0x51027c[_0x459f(0xf)]=_0x28c886[_0x459f(0x27)](requestAnimationFrame,_0x325552);},_0x475848),_0x3b04a1[_0x459f(0xf)]=_0x65c92c,()=>{const _0x134fa8={'FOSos':function(_0x365cc6,_0x2b1d6b){return _0x28c886[_0x459f(0x28)](_0x365cc6,_0x2b1d6b);},'NyMwt':function(_0x38eea6,_0xb7634c){return _0x28c886[_0x459f(0x1a)](_0x38eea6,_0xb7634c);},'UojMy':function(_0x2aeee0,_0x27342f){return _0x28c886[_0x459f(0x1b)](_0x2aeee0,_0x27342f);},'dylrG':function(_0x5bc01f,_0x515170){return _0x5bc01f*_0x515170;},'zHACL':function(_0x2b7ef4,_0x2a8660){return _0x28c886['TOaSK'](_0x2b7ef4,_0x2a8660);},'RAoYs':function(_0x445f0c,_0x241d4f){return _0x28c886[_0x459f(0xd)](_0x445f0c,_0x241d4f);},'DsUag':function(_0xdc05a3,_0x1723c8){return _0x28c886[_0x459f(0x29)](_0xdc05a3,_0x1723c8);},'TTpEy':function(_0x1d6dcb,_0x7e7896){return _0x28c886['zKKhp'](_0x1d6dcb,_0x7e7896);},'UUiJa':function(_0x18a690,_0xfb6432){return _0x18a690(_0xfb6432);}};if(_0x28c886[_0x459f(0x2a)](_0x28c886[_0x459f(0x2b)],_0x28c886['Tstkj'])){const _0x1356bc=_0x46b067[_0x459f(0xf)],_0x50d5d2=_0x5ecf9d[_0x459f(0x1d)](),_0x2ea71e=()=>{const _0x1c5f75=_0x134fa8[_0x459f(0x2c)](_0x1c0e58['now'](),_0x50d5d2),_0x474d88=_0x97ec5b[_0x459f(0x20)](_0x134fa8[_0x459f(0x2d)](_0x1c5f75,_0x4b5e53),0x1),_0x1ea26a=_0x134fa8['UojMy'](_0x474d88,0.5)?_0x134fa8[_0x459f(0x2e)](_0x134fa8[_0x459f(0x2f)](0x2,_0x474d88),_0x474d88):_0x134fa8[_0x459f(0x30)](-0x1,_0x134fa8[_0x459f(0x2c)](0x4,_0x134fa8[_0x459f(0x2f)](0x2,_0x474d88))*_0x474d88),_0x36e323=_0x134fa8[_0x459f(0x30)](_0x1356bc,_0x134fa8[_0x459f(0x2f)](_0x134fa8[_0x459f(0x31)](_0x1bb579,_0x1356bc),_0x1ea26a));_0x5cc1da[_0x459f(0xf)]=_0x36e323,_0x3831b7(_0x36e323),_0x134fa8[_0x459f(0x32)](_0x474d88,0x1)?_0x40f613['current']=_0x134fa8[_0x459f(0x33)](_0x26ab15,_0x2ea71e):_0x443d2a[_0x459f(0xf)]=null;};_0x3291aa['current']=_0x4acdd7[_0x459f(0x34)](_0x3ccaa6,_0x2ea71e);}else{if(_0x28c886['pIzwR'](_0x51027c[_0x459f(0xf)],null)){if(_0x28c886[_0x459f(0x10)](_0x28c886[_0x459f(0x35)],_0x28c886[_0x459f(0x35)]))cancelAnimationFrame(_0x51027c[_0x459f(0xf)]),_0x51027c[_0x459f(0xf)]=null;else{const _0x3c5858=_0x4acdd7[_0x459f(0x36)](_0x53f69b[_0x459f(0x1d)](),_0xc76a29),_0x1a0d2d=_0x2bdbf3['min'](_0x3c5858/_0x53761e,0x1),_0x36fdd0=_0x1a0d2d<0.5?_0x4acdd7[_0x459f(0x37)](_0x4acdd7[_0x459f(0x38)](0x2,_0x1a0d2d),_0x1a0d2d):_0x4acdd7['bYwZa'](-0x1,_0x4acdd7[_0x459f(0x39)](_0x4acdd7[_0x459f(0x36)](0x4,_0x4acdd7[_0x459f(0x3a)](0x2,_0x1a0d2d)),_0x1a0d2d)),_0x5411d9=_0x4acdd7[_0x459f(0x3b)](_0x1920ca,_0x4acdd7[_0x459f(0x3c)](_0x4acdd7[_0x459f(0x36)](_0x2e2a3d,_0x34b136),_0x36fdd0));_0x5c61d8[_0x459f(0xf)]=_0x5411d9,_0x4acdd7[_0x459f(0x34)](_0x4577bc,_0x5411d9),_0x1a0d2d<0x1?_0x201dcd['current']=_0x1244ad(_0x3c3d01):_0x1ac861[_0x459f(0xf)]=null;}}_0x28c886[_0x459f(0x3d)](_0x5ee842['current'],null)&&(_0x28c886[_0x459f(0x3e)]!==_0x28c886[_0x459f(0x3f)]?(_0x28c886[_0x459f(0x40)](clearTimeout,_0x5ee842[_0x459f(0xf)]),_0x5ee842['current']=null):_0x1b0322[_0x459f(0xf)]=null);}};},[_0x65c92c,disableAnimation]),React[_0x459f(0x41)](View,{'style':[styles[_0x459f(0x42)],_0x2a5308]},React[_0x459f(0x41)](_0x18c40e,{'ref':_0x57135c,'source':ANIMATIONS[_0x459f(0x43)],'progress':_0x825788,'loop':![],'autoPlay':![],'style':styles['animation'],'resizeMode':'contain'}));},styles=StyleSheet[_0x459f(0x44)]({'container':{'width':0xc8,'height':0xc8,'alignItems':'center','justifyContent':_0x459f(0x45)},'animation':{'width':_0x459f(0x46),'height':_0x459f(0x46)}});function _0x587e(){const _0x23aa8e=['BcglI','kWEpI','TQqlg','QhPhd','FYptz','UanRU','bhXsk','kiKPm','VfbJB','GIGeX','TOaSK','WTDNu','YOMae','yFozN','VvyZS','current','HuJQo','rdpza','NCmQM','sehuU','ARjqI','Syljt','ZqWVZ','PpHEq','PbOHN','hrRgZ','CALfk','CKBkT','jDKYm','now','ivXIU','UwCec','min','uvTke','wbYvL','rVkbh','gKwtv','eCRLV','Bbhyv','TgREw','pmUbk','lDAEA','pIzwR','Tstkj','FOSos','NyMwt','dylrG','zHACL','RAoYs','DsUag','TTpEy','UUiJa','JWYDA','gQBcu','kfbzV','NZAzV','ZVAzb','fAIEk','HsadE','ITpkr','XkPci','dBDAW','YUmZn','FADpS','zZDOs','createElement','container','persona','create','center','100%'];_0x587e=function(){return _0x23aa8e;};return _0x587e();}export default PersonaImage;
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import LottieView from 'lottie-react-native';
|
|
4
|
+
import { ANIMATIONS } from '../utils/assetRegistry';
|
|
5
|
+
const PersonaImage = ({
|
|
6
|
+
level,
|
|
7
|
+
style,
|
|
8
|
+
disableAnimation = false
|
|
9
|
+
}) => {
|
|
10
|
+
const animationRef = useRef(null);
|
|
11
|
+
|
|
12
|
+
// Map level to progress immediately on first render (no initial animation)
|
|
13
|
+
// Smaller, more noticeable increments: keep 1st perfect (20%), then smaller steps
|
|
14
|
+
const progressMap = [0, 0.20, 0.35, 0.52, 0.80];
|
|
15
|
+
const getTargetProgress = lvl => progressMap[lvl - 1] || 0;
|
|
16
|
+
const [progress, setProgress] = useState(getTargetProgress(level)); // Initialize to target progress
|
|
17
|
+
const progressRef = useRef(getTargetProgress(level)); // Initialize ref to target progress
|
|
18
|
+
const previousLevelRef = useRef(level); // Initialize to current level (prevents first animation)
|
|
19
|
+
const animationFrameRef = useRef(null);
|
|
20
|
+
const animationTimeoutRef = useRef(null); // Track animation delay timeout
|
|
21
|
+
const isFirstRenderRef = useRef(true); // Track first render
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const targetProgress = getTargetProgress(level);
|
|
25
|
+
|
|
26
|
+
// On first render, set progress immediately without animation
|
|
27
|
+
if (isFirstRenderRef.current) {
|
|
28
|
+
progressRef.current = targetProgress;
|
|
29
|
+
setProgress(targetProgress);
|
|
30
|
+
previousLevelRef.current = level;
|
|
31
|
+
isFirstRenderRef.current = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// If animations are disabled, set progress immediately
|
|
36
|
+
if (disableAnimation) {
|
|
37
|
+
progressRef.current = targetProgress;
|
|
38
|
+
setProgress(targetProgress);
|
|
39
|
+
previousLevelRef.current = level;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Only animate if the level has actually changed from previous
|
|
44
|
+
if (previousLevelRef.current === level) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Cancel any existing animation and timeout
|
|
49
|
+
if (animationFrameRef.current !== null) {
|
|
50
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
51
|
+
animationFrameRef.current = null;
|
|
52
|
+
}
|
|
53
|
+
if (animationTimeoutRef.current !== null) {
|
|
54
|
+
clearTimeout(animationTimeoutRef.current);
|
|
55
|
+
animationTimeoutRef.current = null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Add a delay before starting the animation so user can see it happen
|
|
59
|
+
// Fast delay so animation starts almost immediately after connection
|
|
60
|
+
const animationDelay = 150; // 150ms delay before animation starts (very fast!)
|
|
61
|
+
const duration = 3200; // 3200ms transition (slower, more visible animation)
|
|
62
|
+
|
|
63
|
+
// Wait before starting the animation
|
|
64
|
+
animationTimeoutRef.current = setTimeout(() => {
|
|
65
|
+
const startProgress = progressRef.current; // Use ref for current progress
|
|
66
|
+
const startTime = Date.now();
|
|
67
|
+
const animate = () => {
|
|
68
|
+
const elapsed = Date.now() - startTime;
|
|
69
|
+
const t = Math.min(elapsed / duration, 1);
|
|
70
|
+
|
|
71
|
+
// Ease-in-out function for smooth animation
|
|
72
|
+
const eased = t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
73
|
+
const currentProgress = startProgress + (targetProgress - startProgress) * eased;
|
|
74
|
+
progressRef.current = currentProgress; // Update ref
|
|
75
|
+
setProgress(currentProgress); // Update state for rendering
|
|
76
|
+
|
|
77
|
+
if (t < 1) {
|
|
78
|
+
animationFrameRef.current = requestAnimationFrame(animate);
|
|
79
|
+
} else {
|
|
80
|
+
animationFrameRef.current = null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
animationFrameRef.current = requestAnimationFrame(animate);
|
|
84
|
+
}, animationDelay);
|
|
85
|
+
|
|
86
|
+
// Update the previous level AFTER starting the animation
|
|
87
|
+
previousLevelRef.current = level;
|
|
88
|
+
|
|
89
|
+
// Cleanup function to cancel animation and timeout on unmount or level change
|
|
90
|
+
return () => {
|
|
91
|
+
if (animationFrameRef.current !== null) {
|
|
92
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
93
|
+
animationFrameRef.current = null;
|
|
94
|
+
}
|
|
95
|
+
if (animationTimeoutRef.current !== null) {
|
|
96
|
+
clearTimeout(animationTimeoutRef.current);
|
|
97
|
+
animationTimeoutRef.current = null;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}, [level, disableAnimation]); // Re-run when level or disableAnimation changes
|
|
101
|
+
|
|
102
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
103
|
+
style: [styles.container, style]
|
|
104
|
+
}, /*#__PURE__*/React.createElement(LottieView, {
|
|
105
|
+
ref: animationRef,
|
|
106
|
+
source: ANIMATIONS.persona,
|
|
107
|
+
progress: progress,
|
|
108
|
+
loop: false // Ensure animation never loops
|
|
109
|
+
,
|
|
110
|
+
autoPlay: false // Ensure animation never auto-plays
|
|
111
|
+
,
|
|
112
|
+
style: styles.animation,
|
|
113
|
+
resizeMode: "contain"
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
const styles = StyleSheet.create({
|
|
117
|
+
container: {
|
|
118
|
+
width: 200,
|
|
119
|
+
height: 200,
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
justifyContent: 'center'
|
|
122
|
+
},
|
|
123
|
+
animation: {
|
|
124
|
+
width: '100%',
|
|
125
|
+
height: '100%'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
export default PersonaImage;
|
|
129
|
+
//# sourceMappingURL=PersonaImage.js.map
|