@onairos/react-native 3.7.1 → 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/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- 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/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- 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';import{View,Text,StyleSheet,TouchableOpacity,ScrollView,Alert,Platform,Dimensions,Modal,Animated,TouchableWithoutFeedback,SafeAreaView,Image,Switch}from'react-native';import _0xc6f31a from'react-native-vector-icons/MaterialIcons';function _0xa6e6(_0x15606b,_0xa6e64a){_0x15606b=_0x15606b-0x0;const _0x2dc19a=_0x1560();let _0x2e9313=_0x2dc19a[_0x15606b];return _0x2e9313;}import{onairosApi}from'../api';import{encryptModelKey}from'../utils/encryption';import{OVERLAY_PLATFORMS}from'../utils/assetRegistry';const {width:SCREEN_WIDTH,height:SCREEN_HEIGHT}=Dimensions['get'](_0xa6e6(0x0));import{API_CONFIG}from'../config/api';export const Overlay=({data:_0xea0b94,username:_0xeaa29e,modelKey:_0x3fe198,onResolved:_0x27d20f,appName:appName=_0xa6e6(0x1),darkMode:darkMode=![],platforms:platforms=OVERLAY_PLATFORMS})=>{const _0x110357={'mdKqw':function(_0x1a5fb2,_0x352a0b){return _0x1a5fb2===_0x352a0b;},'gBZgJ':_0xa6e6(0x2),'ydxnl':_0xa6e6(0x3),'sgyhy':function(_0x3198e0,_0x5ef560,_0x3cd991,_0x23f529){return _0x3198e0(_0x5ef560,_0x3cd991,_0x23f529);},'gMhzy':_0xa6e6(0x4),'Xgzbk':function(_0x101ead){return _0x101ead();},'sjZTY':function(_0x10583f,_0x1b648e){return _0x10583f===_0x1b648e;},'VWaqA':_0xa6e6(0x5),'rxgKI':function(_0x4c3acb,_0x4a5035){return _0x4c3acb(_0x4a5035);},'Fpbyj':function(_0x5da1df,_0x334a22){return _0x5da1df(_0x334a22);},'fvSVB':function(_0x3d0a57,_0xc8fb04){return _0x3d0a57(_0xc8fb04);},'VrcIu':function(_0x3d28c9,_0x92aaea){return _0x3d28c9(_0x92aaea);},'lflMZ':_0xa6e6(0x6),'IgbZC':'getAccountInfo','idwaC':_0xa6e6(0x7),'cGIhz':function(_0x24f50f,_0x1c706f){return _0x24f50f(_0x1c706f);},'zdSJk':function(_0x19277a,_0x59ec9f){return _0x19277a!==_0x59ec9f;},'LSJMo':_0xa6e6(0x8),'SVRVN':'giUrA','NkXlm':'Error\x20getting\x20account\x20info:','wwMMb':function(_0x125aed,_0x48256b){return _0x125aed(_0x48256b);},'EPenM':'pBKji','CxbiV':_0xa6e6(0x9),'Npqil':_0xa6e6(0xa),'AYQMG':function(_0x28660c,_0x45824a,_0xeffe2a){return _0x28660c(_0x45824a,_0xeffe2a);},'Efvtd':function(_0x4333dc,_0x28e062){return _0x4333dc(_0x28e062);},'crerg':function(_0x56c626){return _0x56c626();},'xearK':_0xa6e6(0xb),'rgydY':function(_0x22d06e,_0x211b5){return _0x22d06e===_0x211b5;},'Uyiqt':_0xa6e6(0xc),'hrsLb':'riFKs','ZJiaV':function(_0x486eaf,_0x2503f8,_0x3e15ef,_0x47696c){return _0x486eaf(_0x2503f8,_0x3e15ef,_0x47696c);},'WriRr':_0xa6e6(0xd),'dMOJi':_0xa6e6(0xe),'tCZgi':_0xa6e6(0xf),'dDVtn':_0xa6e6(0x10),'zHKkc':_0xa6e6(0x11),'RgUAC':function(_0x58dfb6,_0x2e82c9){return _0x58dfb6===_0x2e82c9;},'Htmdw':_0xa6e6(0x12),'xvfof':_0xa6e6(0x13),'EVVla':function(_0x54cf0d,_0x4bb905){return _0x54cf0d!==_0x4bb905;},'zxbud':_0xa6e6(0x14),'CABAM':_0xa6e6(0x15),'ZikbJ':_0xa6e6(0x16),'jeavj':_0xa6e6(0x17),'kEoyq':function(_0x4b7b5d,_0x69621e){return _0x4b7b5d===_0x69621e;},'wHlIQ':'ukOPn','HmhpE':_0xa6e6(0x18),'HuGIr':function(_0x3eca6d){return _0x3eca6d();},'IQPrh':_0xa6e6(0x19),'rAZKu':function(_0x3c496d){return _0x3c496d();},'gZrgZ':_0xa6e6(0x1a),'mRlwK':_0xa6e6(0x1b),'Vkgfw':'czPlu','sngBm':function(_0x4ece7d,_0x46b23a){return _0x4ece7d(_0x46b23a);},'RaESt':'Failed\x20to\x20confirm\x20selection.\x20Please\x20try\x20again.','OzjxD':function(_0x57413b,_0x20b451){return _0x57413b===_0x20b451;},'TiRuA':_0xa6e6(0x1c),'AAnkS':_0xa6e6(0x1d),'hitYR':function(_0x3b5bb0,_0x328974){return _0x3b5bb0(_0x328974);},'WURQE':function(_0x4d8adb,_0x1d9def){return _0x4d8adb(_0x1d9def);},'wTAkh':function(_0x524283,_0x29ad9d,_0x391953){return _0x524283(_0x29ad9d,_0x391953);},'piUXz':_0xa6e6(0x1e),'ondPB':_0xa6e6(0x1f),'PqAEm':_0xa6e6(0x20),'iaUOo':'Connect\x20your\x20data\x20to\x20create\x20a\x20Persona\x20of\x20you,\x20to\x20connect\x20to\x20Cosmos','AGRqd':_0xa6e6(0x21),'ApCnv':_0xa6e6(0x22),'qtjqn':function(_0xf6d5a,_0x149be5){return _0xf6d5a&&_0x149be5;},'Ergay':_0xa6e6(0x23),'eiQqm':_0xa6e6(0x24)},[_0x18b267,_0x3da77b]=useState({}),[_0x57ebf8,_0x5b22de]=_0x110357['hitYR'](useState,''),[_0x9f1ae6,_0x3e9035]=useState(!![]),[_0x430f25,_0x55847a]=useState({}),_0x29855a=_0x110357[_0xa6e6(0x25)](useRef,new Animated[(_0xa6e6(0x26))](0x0))[_0xa6e6(0x27)];_0x110357[_0xa6e6(0x28)](useEffect,()=>{const _0x187399={'pEedU':function(_0x10b8ab,_0x34aefb){return _0x110357[_0xa6e6(0x29)](_0x10b8ab,_0x34aefb);},'AUIUw':_0x110357[_0xa6e6(0x2a)],'xrOdC':_0xa6e6(0x2b),'BFOWr':function(_0x21272d,_0x20e19f,_0x28f543,_0x258db8){return _0x110357[_0xa6e6(0x2c)](_0x21272d,_0x20e19f,_0x28f543,_0x258db8);},'jcrFq':_0x110357[_0xa6e6(0x2d)],'pVPOV':function(_0x55b82a){return _0x110357[_0xa6e6(0x2e)](_0x55b82a);}};if(_0x110357[_0xa6e6(0x2f)](_0x110357['VWaqA'],_0x110357[_0xa6e6(0x30)])){const _0xa76859={};Object[_0xa6e6(0x31)](_0xea0b94)[_0xa6e6(0x32)](_0x196e80=>{_0x187399[_0xa6e6(0x33)](_0x187399[_0xa6e6(0x34)],_0x187399['xrOdC'])?_0x26ebdb[_0x85a412]=![]:_0xa76859[_0x196e80]=![];}),_0x110357['rxgKI'](_0x3da77b,_0xa76859);const _0x45a96a={};platforms[_0xa6e6(0x32)](_0x4dfb67=>{_0x110357['mdKqw'](_0x110357['gBZgJ'],_0x110357[_0xa6e6(0x35)])?_0x45a96a[_0x4dfb67['id']]=![]:(_0x187399[_0xa6e6(0x36)](_0x1dd30c,''+_0x4cd943[_0xa6e6(0x37)],_0x187399[_0xa6e6(0x38)],{'username':_0x541c5a,'selections':_0x326ba4,'platforms':_0x5e1a12,'error':!![]}),_0x187399['pVPOV'](_0x35be6c));}),_0x110357[_0xa6e6(0x39)](_0x55847a,_0x45a96a),_0x110357[_0xa6e6(0x2e)](_0x3b90aa),Animated['spring'](_0x29855a,{'toValue':0x1,'useNativeDriver':!![],'bounciness':0x0})['start']();}else _0x541734(_0xa6e6(0x3a)+_0x27c615);},[]);const _0x3b90aa=async()=>{try{if(__DEV__){_0x110357['VrcIu'](_0x5b22de,_0x110357[_0xa6e6(0x3b)]);return;}const _0x47a54e=await onairosApi[_0xa6e6(0x3c)](_0x110357[_0xa6e6(0x3d)],{'Info':{'username':_0xeaa29e}});if(_0x47a54e&&_0x47a54e[_0xa6e6(0x3e)]){const _0x37ad7a=_0x110357[_0xa6e6(0x29)](typeof _0x47a54e[_0xa6e6(0x3e)],_0x110357[_0xa6e6(0x3f)])&&_0x47a54e[_0xa6e6(0x3e)][_0xa6e6(0x40)]?_0x47a54e[_0xa6e6(0x3e)][_0xa6e6(0x40)]:'User:\x20'+_0xeaa29e;_0x5b22de(_0x37ad7a);}else _0x110357[_0xa6e6(0x41)](_0x5b22de,_0xa6e6(0x3a)+_0xeaa29e);}catch(_0x43db85){_0x110357[_0xa6e6(0x42)](_0x110357[_0xa6e6(0x43)],_0x110357[_0xa6e6(0x44)])?(console[_0xa6e6(0x45)](_0x110357[_0xa6e6(0x46)],_0x43db85),_0x110357[_0xa6e6(0x47)](_0x5b22de,_0xa6e6(0x3a)+_0xeaa29e)):_0x110357[_0xa6e6(0x48)](_0x599db6,_0x459354=>({..._0x459354,[_0x498938]:!_0x459354[_0x3088d9]}));}},_0x209205=useCallback(()=>{Animated[_0xa6e6(0x49)](_0x29855a,{'toValue':0x0,'duration':0xfa,'useNativeDriver':!![]})[_0xa6e6(0x4a)](()=>{const _0xdcf2d5={'Xtjnz':function(_0x88a292,_0x1f0f21){return _0x88a292(_0x1f0f21);}};_0x110357[_0xa6e6(0x2f)](_0x110357['EPenM'],_0x110357[_0xa6e6(0x4b)])?_0x110357['cGIhz'](_0x3e9035,![]):_0xdcf2d5[_0xa6e6(0x4c)](_0x4868f2,![]);});},[_0x29855a]),_0x3490ef=_0x110357['wTAkh'](useCallback,_0x3852fa=>{_0x110357[_0xa6e6(0x4d)]!==_0x110357[_0xa6e6(0x4d)]?Alert['alert'](_0x110357['CxbiV'],_0x4731ee,[{'text':'OK'}]):_0x55847a(_0x374825=>({..._0x374825,[_0x3852fa]:!_0x374825[_0x3852fa]}));},[]),_0xa2c838=useCallback(async()=>{const _0x53f2c3={'rRicL':function(_0x31d2e8,_0xfe9ed3){return _0x110357[_0xa6e6(0x4e)](_0x31d2e8,_0xfe9ed3);},'jroWA':_0xa6e6(0x6),'MtCpP':function(_0x3e0249,_0x24484e,_0x2ceee5,_0x43c846){return _0x110357[_0xa6e6(0x2c)](_0x3e0249,_0x24484e,_0x2ceee5,_0x43c846);},'aUEwv':function(_0x321b7c,_0x263378,_0xd3e605){return _0x110357[_0xa6e6(0x28)](_0x321b7c,_0x263378,_0xd3e605);}};try{const _0x53a08e=Platform[_0xa6e6(0x4f)]({'ios':_0x110357[_0xa6e6(0x50)],'android':_0x110357[_0xa6e6(0x50)],'default':_0xa6e6(0x51)});if(__DEV__){if(_0x110357['rgydY'](_0x110357['Uyiqt'],_0x110357[_0xa6e6(0x52)]))_0x3b6b71['error'](_0xa6e6(0x1a),_0xef670a),_0x32ca3d?(_0x110357[_0xa6e6(0x2c)](_0x416220,''+_0x14f9f4[_0xa6e6(0x37)],_0x110357[_0xa6e6(0x2d)],{'username':_0x24f2d1,'selections':_0x1edb7d,'platforms':_0x375411,'error':!![]}),_0x110357[_0xa6e6(0x2e)](_0x4ac02e)):_0x279f10('Failed\x20to\x20confirm\x20selection.\x20Please\x20try\x20again.');else{_0x110357[_0xa6e6(0x53)](_0x27d20f,''+API_CONFIG[_0xa6e6(0x37)],_0x110357['WriRr'],{'username':_0xeaa29e,'selections':_0x18b267,'platforms':_0x430f25}),_0x110357[_0xa6e6(0x54)](_0x209205);return;}}let _0x18c07f=_0x110357[_0xa6e6(0x55)];try{const _0x257891=await onairosApi[_0xa6e6(0x56)](_0xa6e6(0x57));_0x257891&&_0x257891[_0xa6e6(0x3e)]&&_0x110357[_0xa6e6(0x29)](typeof _0x257891[_0xa6e6(0x3e)],_0x110357[_0xa6e6(0x3f)])&&(_0x110357[_0xa6e6(0x58)](_0x110357[_0xa6e6(0x59)],_0x110357[_0xa6e6(0x5a)])?_0x5282c2=_0x110357['AYQMG'](_0x25b2fb,_0x3e1211,_0x3084fa):_0x18c07f=_0x257891[_0xa6e6(0x3e)][_0xa6e6(0x5b)]||_0xa6e6(0xe));}catch(_0xcb4a42){console['error'](_0x110357[_0xa6e6(0x5c)],_0xcb4a42);}let _0x4ea4fe=_0x3fe198;if(_0x110357['RgUAC'](typeof encryptModelKey,_0x110357[_0xa6e6(0x5d)])&&_0x18c07f)try{if(_0x110357['RgUAC'](_0x110357[_0xa6e6(0x5e)],_0xa6e6(0x5f))){_0x53f2c3['rRicL'](_0x1e6a77,_0x53f2c3[_0xa6e6(0x60)]);return;}else _0x4ea4fe=_0x110357[_0xa6e6(0x28)](encryptModelKey,_0x18c07f,_0x3fe198);}catch(_0x56f742){if(_0x110357[_0xa6e6(0x61)](_0x110357[_0xa6e6(0x62)],_0x110357[_0xa6e6(0x63)]))console[_0xa6e6(0x45)](_0x110357[_0xa6e6(0x64)],_0x56f742);else{const _0x3eb9de={};_0x12d32b[_0xa6e6(0x31)](_0x3d16cc)[_0xa6e6(0x32)](_0x45f816=>{_0x3eb9de[_0x45f816]=![];}),_0x110357[_0xa6e6(0x47)](_0x28d13b,_0x3eb9de);const _0x4ebb05={};_0x46ab54[_0xa6e6(0x32)](_0x57bd37=>{_0x4ebb05[_0x57bd37['id']]=![];}),_0x110357[_0xa6e6(0x65)](_0x247f42,_0x4ebb05),_0x110357['crerg'](_0x109c16),Animated[_0xa6e6(0x66)](_0x3eb6a7,{'toValue':0x1,'useNativeDriver':!![],'bounciness':0x0})[_0xa6e6(0x4a)]();}}const _0x13a3d8=await onairosApi[_0xa6e6(0x3c)]('getAPIUrlMobile',{'Info':{'storage':_0x110357[_0xa6e6(0x67)],'appId':_0x53a08e,'confirmations':_0x18b267,'developerURL':_0xa6e6(0x68),'EncryptedUserPin':_0x4ea4fe,'username':_0xeaa29e,'platforms':_0x430f25}});if(_0x13a3d8&&_0x13a3d8[_0xa6e6(0x3e)]&&_0x13a3d8[_0xa6e6(0x3e)][_0xa6e6(0x69)]&&_0x13a3d8[_0xa6e6(0x3e)]['token']){if(_0x110357['kEoyq'](_0x110357[_0xa6e6(0x6a)],_0x110357['HmhpE'])){_0x53f2c3[_0xa6e6(0x6b)](_0x36cede,''+_0x49e592['BASE_URL'],'mock-token',{'username':_0x574036,'selections':_0x94d2d8,'platforms':_0x40b809}),_0x5ce22a();return;}else _0x110357[_0xa6e6(0x53)](_0x27d20f,_0x13a3d8[_0xa6e6(0x3e)][_0xa6e6(0x69)],_0x13a3d8[_0xa6e6(0x3e)]['token'],{'username':_0xeaa29e,'selections':_0x18b267,'platforms':_0x430f25}),_0x110357['HuGIr'](_0x209205);}else _0x110357[_0xa6e6(0x2c)](_0x27d20f,''+API_CONFIG[_0xa6e6(0x37)],_0x110357[_0xa6e6(0x6c)],{'username':_0xeaa29e,'selections':_0x18b267,'platforms':_0x430f25}),_0x110357[_0xa6e6(0x6d)](_0x209205);}catch(_0x489b18){console[_0xa6e6(0x45)](_0x110357[_0xa6e6(0x6e)],_0x489b18);if(__DEV__)_0x27d20f(''+API_CONFIG['BASE_URL'],_0x110357[_0xa6e6(0x2d)],{'username':_0xeaa29e,'selections':_0x18b267,'platforms':_0x430f25,'error':!![]}),_0x110357[_0xa6e6(0x2e)](_0x209205);else{if(_0x110357[_0xa6e6(0x29)](_0x110357[_0xa6e6(0x6f)],_0x110357[_0xa6e6(0x70)]))try{_0x248289=_0x53f2c3[_0xa6e6(0x71)](_0x5f179e,_0x127b84,_0x42022c);}catch(_0x5c7452){_0x471cb1[_0xa6e6(0x45)](_0xa6e6(0x16),_0x5c7452);}else _0x110357['sngBm'](_0x48f631,_0x110357[_0xa6e6(0x72)]);}}},[_0x18b267,_0xeaa29e,_0x3fe198,_0x27d20f,_0x209205,_0x430f25]),_0x48f631=_0x79eefd=>{if(_0x110357[_0xa6e6(0x73)](_0x110357[_0xa6e6(0x74)],_0x110357[_0xa6e6(0x75)])){const _0x1b1b90=_0x110357[_0xa6e6(0x76)](typeof _0x162998[_0xa6e6(0x3e)],_0x110357[_0xa6e6(0x3f)])&&_0x353f90[_0xa6e6(0x3e)][_0xa6e6(0x40)]?_0x2edb82[_0xa6e6(0x3e)][_0xa6e6(0x40)]:_0xa6e6(0x3a)+_0x205f78;_0x110357['rxgKI'](_0xd3b609,_0x1b1b90);}else Alert['alert'](_0x110357[_0xa6e6(0x77)],_0x79eefd,[{'text':'OK'}]);};return React[_0xa6e6(0x78)](Modal,{'visible':_0x9f1ae6,'transparent':!![],'animationType':_0x110357['piUXz'],'statusBarTranslucent':!![],'onRequestClose':_0x209205},React['createElement'](TouchableOpacity,{'style':styles['modalOverlay'],'activeOpacity':0x1,'onPress':_0x209205},React[_0xa6e6(0x78)](TouchableWithoutFeedback,{'onPress':_0x308b4d=>_0x308b4d[_0xa6e6(0x79)]()},React[_0xa6e6(0x78)](Animated['View'],{'style':[styles['bottomSheet'],darkMode&&styles[_0xa6e6(0x7a)],{'transform':[{'translateY':_0x29855a[_0xa6e6(0x7b)]({'inputRange':[0x0,0x1],'outputRange':[SCREEN_HEIGHT,0x0]})}]}]},React[_0xa6e6(0x78)](View,{'style':styles[_0xa6e6(0x7c)]},React[_0xa6e6(0x78)](View,{'style':[styles['handle'],darkMode&&styles[_0xa6e6(0x7d)]]})),React[_0xa6e6(0x78)](SafeAreaView,{'style':[styles[_0xa6e6(0x7e)],darkMode&&styles['darkContainer']]},React[_0xa6e6(0x78)](View,{'style':[styles['header'],darkMode&&styles[_0xa6e6(0x7f)]]},React[_0xa6e6(0x78)](View,{'style':styles[_0xa6e6(0x80)]},React['createElement'](View,{'style':[styles[_0xa6e6(0x81)],darkMode&&styles[_0xa6e6(0x82)]]},React['createElement'](Text,{'style':[styles[_0xa6e6(0x83)],darkMode&&styles[_0xa6e6(0x84)]]},appName[_0xa6e6(0x85)](0x0))),React['createElement'](_0xc6f31a,{'name':_0x110357[_0xa6e6(0x86)],'size':0x18,'color':darkMode?_0xa6e6(0x87):_0x110357[_0xa6e6(0x88)],'style':styles['arrow']}),React[_0xa6e6(0x78)](View,{'style':[styles[_0xa6e6(0x89)],darkMode&&styles['darkOnairosIcon']]},React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0x8a)],darkMode&&styles[_0xa6e6(0x84)]]},'O')))),React[_0xa6e6(0x78)](ScrollView,{'style':styles[_0xa6e6(0x8b)]},React[_0xa6e6(0x78)](View,{'style':styles[_0xa6e6(0x8c)]},React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0x8d)],darkMode&&styles[_0xa6e6(0x84)]]},_0x110357['iaUOo']),React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0x8e)],darkMode&&styles[_0xa6e6(0x8f)]]},_0x110357[_0xa6e6(0x90)])),React[_0xa6e6(0x78)](View,{'style':styles[_0xa6e6(0x91)]},platforms[_0xa6e6(0x92)](_0x28a67e=>React[_0xa6e6(0x78)](View,{'key':_0x28a67e['id'],'style':[styles[_0xa6e6(0x93)],darkMode&&styles[_0xa6e6(0x94)]]},React[_0xa6e6(0x78)](View,{'style':styles[_0xa6e6(0x95)]},React['createElement'](Image,{'source':_0x28a67e[_0xa6e6(0x96)],'style':styles[_0xa6e6(0x97)],'resizeMode':_0xa6e6(0x98)}),React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0x99)],darkMode&&styles[_0xa6e6(0x84)]]},_0x28a67e[_0xa6e6(0x9a)])),React[_0xa6e6(0x78)](Switch,{'value':_0x430f25[_0x28a67e['id']],'onValueChange':()=>_0x3490ef(_0x28a67e['id']),'trackColor':{'false':_0xa6e6(0x9b),'true':_0xa6e6(0x9c)},'thumbColor':_0x430f25[_0x28a67e['id']]?_0xa6e6(0x9d):_0xa6e6(0x9e)}))))),React['createElement'](View,{'style':[styles[_0xa6e6(0x9f)],darkMode&&styles[_0xa6e6(0xa0)]]},React['createElement'](TouchableOpacity,{'style':styles[_0xa6e6(0xa1)],'onPress':_0x209205},React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0xa2)],darkMode&&styles['darkSubText']]},_0x110357[_0xa6e6(0xa3)])),React[_0xa6e6(0x78)](TouchableOpacity,{'style':[styles[_0xa6e6(0xa4)],darkMode&&styles[_0xa6e6(0xa5)]],'onPress':_0xa2c838},React[_0xa6e6(0x78)](Text,{'style':[styles[_0xa6e6(0xa6)],_0x110357['qtjqn'](darkMode,{'color':_0x110357['Ergay']})]},_0x110357['eiQqm']))))))));};const styles=StyleSheet[_0xa6e6(0xa7)]({'modalOverlay':{'flex':0x1,'backgroundColor':'rgba(0,\x200,\x200,\x200.5)','justifyContent':_0xa6e6(0xa8)},'bottomSheet':{'backgroundColor':_0xa6e6(0xa9),'borderTopLeftRadius':0x18,'borderTopRightRadius':0x18,'width':SCREEN_WIDTH,'height':SCREEN_HEIGHT*0.8,'overflow':'hidden'},'handleContainer':{'width':_0xa6e6(0xaa),'alignItems':_0xa6e6(0xab),'paddingTop':0xc,'paddingBottom':0x8},'handle':{'width':0x28,'height':0x5,'borderRadius':0x3,'backgroundColor':'#E0E0E0'},'darkHandle':{'backgroundColor':'#666'},'container':{'flex':0x1,'backgroundColor':_0xa6e6(0xa9)},'darkContainer':{'backgroundColor':_0xa6e6(0xac)},'header':{'padding':0x18,'alignItems':'center'},'darkHeader':{'backgroundColor':_0xa6e6(0xac)},'headerContent':{'flexDirection':_0xa6e6(0xad),'alignItems':_0xa6e6(0xab),'justifyContent':_0xa6e6(0xab),'marginBottom':0x10},'appIcon':{'width':0x30,'height':0x30,'borderRadius':0x10,'backgroundColor':'#F5F5F5','alignItems':_0xa6e6(0xab),'justifyContent':_0xa6e6(0xab)},'darkAppIcon':{'backgroundColor':_0xa6e6(0xae)},'appIconText':{'fontSize':0x18,'color':_0xa6e6(0x23)},'darkText':{'color':_0xa6e6(0xa9)},'arrow':{'marginHorizontal':0x10},'onairosIcon':{'width':0x30,'height':0x30,'borderRadius':0x10,'backgroundColor':'#F5F5F5','alignItems':_0xa6e6(0xab),'justifyContent':_0xa6e6(0xab)},'darkOnairosIcon':{'backgroundColor':_0xa6e6(0xae)},'onairosIconText':{'fontSize':0x18,'color':_0xa6e6(0x23)},'darkSubText':{'color':'#999'},'titleContainer':{'marginBottom':0x1e},'mainTitle':{'fontSize':0x16,'fontWeight':_0xa6e6(0xaf),'color':_0xa6e6(0x23),'textAlign':_0xa6e6(0xab),'marginBottom':0x10},'privacyMessage':{'fontSize':0xe,'color':_0xa6e6(0x20),'textAlign':_0xa6e6(0xab),'marginBottom':0x10},'content':{'flex':0x1,'paddingHorizontal':0x18},'platformsContainer':{'marginTop':0x10},'platformItem':{'flexDirection':_0xa6e6(0xad),'justifyContent':_0xa6e6(0xb0),'alignItems':'center','padding':0x10,'backgroundColor':_0xa6e6(0xa9),'borderRadius':0x10,'marginBottom':0x10,'borderWidth':0x1,'borderColor':_0xa6e6(0xb1)},'darkPlatformItem':{'backgroundColor':_0xa6e6(0xae),'borderColor':_0xa6e6(0xb2)},'platformInfo':{'flexDirection':_0xa6e6(0xad),'alignItems':'center'},'platformIcon':{'width':0x20,'height':0x20,'marginRight':0xc},'platformName':{'fontSize':0x10,'fontWeight':_0xa6e6(0xb3),'color':'#000'},'footer':{'flexDirection':_0xa6e6(0xad),'alignItems':_0xa6e6(0xab),'justifyContent':'space-between','padding':0x18,'borderTopWidth':0x1,'borderTopColor':'#eee','backgroundColor':'#fff'},'darkFooter':{'backgroundColor':_0xa6e6(0xae),'borderTopColor':_0xa6e6(0xb2)},'footerButtonCancel':{'paddingVertical':0x8,'paddingHorizontal':0x10},'darkFooterButton':{'backgroundColor':_0xa6e6(0xb4)},'footerButtonConfirm':{'paddingVertical':0x10,'paddingHorizontal':0x20,'borderRadius':0x10,'backgroundColor':'#fff','borderWidth':0x1,'borderColor':_0xa6e6(0x23)},'darkFooterButtonConfirm':{'backgroundColor':'#fff','borderColor':_0xa6e6(0xa9)},'footerButtonText':{'color':_0xa6e6(0x20),'fontSize':0x10},'footerButtonTextConfirm':{'color':'#000','fontSize':0x10,'fontWeight':'600'},'lightBackground':{'backgroundColor':_0xa6e6(0xa9)},'darkBackground':{'backgroundColor':_0xa6e6(0xac)}});function _0x1560(){const _0x4c0c84=['window','Your\x20App','YNrPP','NnbiH','error-fallback-token','qBSld','Development\x20mode\x20-\x20mock\x20account\x20info','object','SLjEb','Error','sgwdT','com.onairos.mock','pJmML','mock-token','mock-key','leCKy','QzOYy','Error\x20getting\x20server\x20public\x20key:','function','BYMtl','JAoWe','fMCMV','Error\x20encrypting\x20model\x20key:','local','NKgqE','fallback-token','Error\x20confirming\x20selection:','fRHkM','eVKEK','uKuJs','none','arrow_forward','#666','None\x20of\x20your\x20app\x20data\x20is\x20shared\x20with\x20ANYONE','Cancel','#000','Connect','WURQE','Value','current','AYQMG','mdKqw','ydxnl','ERaVA','sgyhy','gMhzy','Xgzbk','sjZTY','VWaqA','keys','forEach','pEedU','AUIUw','gBZgJ','BFOWr','BASE_URL','jcrFq','Fpbyj','User:\x20','lflMZ','post','IgbZC','data','idwaC','AccountInfo','cGIhz','zdSJk','LSJMo','SVRVN','error','NkXlm','wwMMb','fvSVB','timing','start','EPenM','Xtjnz','Npqil','VrcIu','select','xearK','unknown','hrsLb','ZJiaV','crerg','dMOJi','get','public/key','rgydY','tCZgi','dDVtn','publicKey','zHKkc','Htmdw','xvfof','fJNGF','jroWA','EVVla','zxbud','CABAM','ZikbJ','Efvtd','spring','jeavj','devURL','APIUrl','wHlIQ','MtCpP','IQPrh','rAZKu','gZrgZ','mRlwK','Vkgfw','aUEwv','RaESt','OzjxD','TiRuA','AAnkS','kEoyq','CxbiV','createElement','stopPropagation','darkContainer','interpolate','handleContainer','darkHandle','container','darkHeader','headerContent','appIcon','darkAppIcon','appIconText','darkText','charAt','ondPB','#999','PqAEm','onairosIcon','onairosIconText','content','titleContainer','mainTitle','privacyMessage','darkSubText','AGRqd','platformsContainer','map','platformItem','darkPlatformItem','platformInfo','icon','platformIcon','contain','platformName','name','#767577','#81b0ff','#2196F3','#f4f3f4','footer','darkFooter','footerButtonCancel','footerButtonText','ApCnv','footerButtonConfirm','darkFooterButtonConfirm','footerButtonTextConfirm','create','flex-end','#fff','100%','center','#1A1A1A','row','#2A2A2A','600','space-between','#eee','#333','500','transparent'];_0x1560=function(){return _0x4c0c84;};return _0x1560();}
|
|
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
|
-
|
|
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
|