react-native-monflowts 0.0.0-stage → 0.5.0
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/LICENSE +20 -0
- package/Monflowts.podspec +22 -0
- package/README.md +229 -2
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/com/monflowts/MonflowtsAssetsModule.kt +219 -0
- package/android/src/main/java/com/monflowts/MonflowtsCrashFeedModule.kt +175 -0
- package/android/src/main/java/com/monflowts/MonflowtsHapticModule.kt +170 -0
- package/android/src/main/java/com/monflowts/MonflowtsLottieView.kt +96 -0
- package/android/src/main/java/com/monflowts/MonflowtsLottieViewManager.kt +53 -0
- package/android/src/main/java/com/monflowts/MonflowtsPackage.kt +70 -0
- package/android/src/main/java/com/monflowts/MonflowtsSoundModule.kt +132 -0
- package/android/src/main/java/com/monflowts/MonflowtsSpeechModule.kt +81 -0
- package/android/src/main/java/com/monflowts/MonflowtsSvgView.kt +355 -0
- package/android/src/main/java/com/monflowts/MonflowtsSvgViewManager.kt +59 -0
- package/android/src/main/java/com/monflowts/MonflowtsWebView.kt +86 -0
- package/android/src/main/java/com/monflowts/MonflowtsWebViewManager.kt +33 -0
- package/android/src/main/java/com/monflowts/MonflowtsWheelView.kt +98 -0
- package/android/src/main/java/com/monflowts/MonflowtsWheelViewManager.kt +46 -0
- package/ios/Monflowts-Bridging-Header.h +5 -0
- package/ios/MonflowtsAssetsBridge.m +14 -0
- package/ios/MonflowtsAssetsModule.swift +217 -0
- package/ios/MonflowtsCrashFeedBridge.m +9 -0
- package/ios/MonflowtsCrashFeedModule.swift +88 -0
- package/ios/MonflowtsHTTP1EventSource.swift +296 -0
- package/ios/MonflowtsHapticBridge.m +8 -0
- package/ios/MonflowtsHapticModule.swift +55 -0
- package/ios/MonflowtsLottieBridge.m +12 -0
- package/ios/MonflowtsLottieUIView.swift +95 -0
- package/ios/MonflowtsLottieViewManager.swift +13 -0
- package/ios/MonflowtsSSEParser.swift +58 -0
- package/ios/MonflowtsSoundBridge.m +8 -0
- package/ios/MonflowtsSoundModule.swift +100 -0
- package/ios/MonflowtsSpeechBridge.m +9 -0
- package/ios/MonflowtsSpeechModule.swift +61 -0
- package/ios/MonflowtsSvgBridge.m +11 -0
- package/ios/MonflowtsSvgUIView.swift +431 -0
- package/ios/MonflowtsSvgViewManager.swift +13 -0
- package/ios/MonflowtsWebBridge.m +8 -0
- package/ios/MonflowtsWebUIView.swift +92 -0
- package/ios/MonflowtsWebViewManager.swift +14 -0
- package/ios/MonflowtsWheelBridge.m +7 -0
- package/ios/MonflowtsWheelUIView.swift +126 -0
- package/ios/MonflowtsWheelViewManager.swift +14 -0
- package/lib/module/HapticsManager.js +93 -0
- package/lib/module/HapticsManager.js.map +1 -0
- package/lib/module/HubContent.js +642 -0
- package/lib/module/HubContent.js.map +1 -0
- package/lib/module/Icons.js +64 -0
- package/lib/module/Icons.js.map +1 -0
- package/lib/module/MonflowtsHub.js +233 -0
- package/lib/module/MonflowtsHub.js.map +1 -0
- package/lib/module/NativeLottieView.js +6 -0
- package/lib/module/NativeLottieView.js.map +1 -0
- package/lib/module/NativeSvgView.js +6 -0
- package/lib/module/NativeSvgView.js.map +1 -0
- package/lib/module/NativeWebView.js +14 -0
- package/lib/module/NativeWebView.js.map +1 -0
- package/lib/module/NativeWheelView.js +6 -0
- package/lib/module/NativeWheelView.js.map +1 -0
- package/lib/module/SoundManager.js +120 -0
- package/lib/module/SoundManager.js.map +1 -0
- package/lib/module/SpeechManager.js +40 -0
- package/lib/module/SpeechManager.js.map +1 -0
- package/lib/module/api/client.js +109 -0
- package/lib/module/api/client.js.map +1 -0
- package/lib/module/api/gameTypes.js +2 -0
- package/lib/module/api/gameTypes.js.map +1 -0
- package/lib/module/api/http.js +252 -0
- package/lib/module/api/http.js.map +1 -0
- package/lib/module/api/mutations.js +359 -0
- package/lib/module/api/mutations.js.map +1 -0
- package/lib/module/api/playerTypes.js +2 -0
- package/lib/module/api/playerTypes.js.map +1 -0
- package/lib/module/api/queries.js +403 -0
- package/lib/module/api/queries.js.map +1 -0
- package/lib/module/api/sdkTypes.js +2 -0
- package/lib/module/api/sdkTypes.js.map +1 -0
- package/lib/module/assets/assetKeys.js +4 -0
- package/lib/module/assets/assetKeys.js.map +1 -0
- package/lib/module/assets/assetSync.js +61 -0
- package/lib/module/assets/assetSync.js.map +1 -0
- package/lib/module/assets/nativeAssets.js +25 -0
- package/lib/module/assets/nativeAssets.js.map +1 -0
- package/lib/module/assets/remote.js +47 -0
- package/lib/module/assets/remote.js.map +1 -0
- package/lib/module/components/AbandonPolicyNotice.js +200 -0
- package/lib/module/components/AbandonPolicyNotice.js.map +1 -0
- package/lib/module/components/AnimatedAmount.js +39 -0
- package/lib/module/components/AnimatedAmount.js.map +1 -0
- package/lib/module/components/CoinFlyOverlay.js +157 -0
- package/lib/module/components/CoinFlyOverlay.js.map +1 -0
- package/lib/module/components/GameCharacter.js +45 -0
- package/lib/module/components/GameCharacter.js.map +1 -0
- package/lib/module/components/GameRulesModal.js +279 -0
- package/lib/module/components/GameRulesModal.js.map +1 -0
- package/lib/module/components/HypeCallout.js +103 -0
- package/lib/module/components/HypeCallout.js.map +1 -0
- package/lib/module/components/InsufficientFundsOverlay.js +285 -0
- package/lib/module/components/InsufficientFundsOverlay.js.map +1 -0
- package/lib/module/components/JackpotNearMiss.js +89 -0
- package/lib/module/components/JackpotNearMiss.js.map +1 -0
- package/lib/module/components/JackpotTeaser.js +341 -0
- package/lib/module/components/JackpotTeaser.js.map +1 -0
- package/lib/module/components/MonflowtsButton.js +129 -0
- package/lib/module/components/MonflowtsButton.js.map +1 -0
- package/lib/module/components/MonflowtsChipGroup.js +40 -0
- package/lib/module/components/MonflowtsChipGroup.js.map +1 -0
- package/lib/module/components/MonflowtsPressable.js +42 -0
- package/lib/module/components/MonflowtsPressable.js.map +1 -0
- package/lib/module/components/QuitConfirmModal.js +180 -0
- package/lib/module/components/QuitConfirmModal.js.map +1 -0
- package/lib/module/components/SessionTimer.js +77 -0
- package/lib/module/components/SessionTimer.js.map +1 -0
- package/lib/module/components/SideDemoTab.js +110 -0
- package/lib/module/components/SideDemoTab.js.map +1 -0
- package/lib/module/components/StakeInput.js +138 -0
- package/lib/module/components/StakeInput.js.map +1 -0
- package/lib/module/constants.js +50 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/content.js +21 -0
- package/lib/module/content.js.map +1 -0
- package/lib/module/effects/EffectBurst.js +56 -0
- package/lib/module/effects/EffectBurst.js.map +1 -0
- package/lib/module/effects/beaverStates.js +11 -0
- package/lib/module/effects/beaverStates.js.map +1 -0
- package/lib/module/effects/hypePhrases.js +67 -0
- package/lib/module/effects/hypePhrases.js.map +1 -0
- package/lib/module/effects/particleAnims.js +17 -0
- package/lib/module/effects/particleAnims.js.map +1 -0
- package/lib/module/hooks/useAvailableGames.js +29 -0
- package/lib/module/hooks/useAvailableGames.js.map +1 -0
- package/lib/module/hooks/useCrash.js +137 -0
- package/lib/module/hooks/useCrash.js.map +1 -0
- package/lib/module/hooks/useCrashFeed.js +49 -0
- package/lib/module/hooks/useCrashFeed.js.map +1 -0
- package/lib/module/hooks/useCurrency.js +13 -0
- package/lib/module/hooks/useCurrency.js.map +1 -0
- package/lib/module/hooks/useFairSeed.js +55 -0
- package/lib/module/hooks/useFairSeed.js.map +1 -0
- package/lib/module/hooks/useGameEvents.js +186 -0
- package/lib/module/hooks/useGameEvents.js.map +1 -0
- package/lib/module/hooks/useGameHistory.js +55 -0
- package/lib/module/hooks/useGameHistory.js.map +1 -0
- package/lib/module/hooks/useLeaderboard.js +83 -0
- package/lib/module/hooks/useLeaderboard.js.map +1 -0
- package/lib/module/hooks/useMines.js +166 -0
- package/lib/module/hooks/useMines.js.map +1 -0
- package/lib/module/hooks/useNotifications.js +66 -0
- package/lib/module/hooks/useNotifications.js.map +1 -0
- package/lib/module/hooks/usePlayGame.js +408 -0
- package/lib/module/hooks/usePlayGame.js.map +1 -0
- package/lib/module/hooks/usePlinko.js +75 -0
- package/lib/module/hooks/usePlinko.js.map +1 -0
- package/lib/module/hooks/useRaffleDrawState.js +57 -0
- package/lib/module/hooks/useRaffleDrawState.js.map +1 -0
- package/lib/module/hooks/useRefreshWallet.js +24 -0
- package/lib/module/hooks/useRefreshWallet.js.map +1 -0
- package/lib/module/hooks/useResponsive.js +16 -0
- package/lib/module/hooks/useResponsive.js.map +1 -0
- package/lib/module/hooks/useRevealWin.js +120 -0
- package/lib/module/hooks/useRevealWin.js.map +1 -0
- package/lib/module/hooks/useScreenShake.js +32 -0
- package/lib/module/hooks/useScreenShake.js.map +1 -0
- package/lib/module/hooks/useWallet.js +77 -0
- package/lib/module/hooks/useWallet.js.map +1 -0
- package/lib/module/i18n.js +104 -0
- package/lib/module/i18n.js.map +1 -0
- package/lib/module/index.js +22 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/lottieAnimations.js +15 -0
- package/lib/module/lottieAnimations.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/stores/assetStore.js +140 -0
- package/lib/module/stores/assetStore.js.map +1 -0
- package/lib/module/stores/authStore.js +47 -0
- package/lib/module/stores/authStore.js.map +1 -0
- package/lib/module/stores/gameStore.js +23 -0
- package/lib/module/stores/gameStore.js.map +1 -0
- package/lib/module/stores/sdkInitStore.js +155 -0
- package/lib/module/stores/sdkInitStore.js.map +1 -0
- package/lib/module/stores/settingsStore.js +40 -0
- package/lib/module/stores/settingsStore.js.map +1 -0
- package/lib/module/theme.js +160 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/apolloError.js +69 -0
- package/lib/module/utils/apolloError.js.map +1 -0
- package/lib/module/utils/crashMultiplier.js +8 -0
- package/lib/module/utils/crashMultiplier.js.map +1 -0
- package/lib/module/utils/crashMultiplier.test.js +34 -0
- package/lib/module/utils/crashMultiplier.test.js.map +1 -0
- package/lib/module/utils/deviceAnalytics.js +51 -0
- package/lib/module/utils/deviceAnalytics.js.map +1 -0
- package/lib/module/utils/idempotency.js +66 -0
- package/lib/module/utils/idempotency.js.map +1 -0
- package/lib/module/utils/layout.js +14 -0
- package/lib/module/utils/layout.js.map +1 -0
- package/lib/module/utils/safeInlineScript.js +12 -0
- package/lib/module/utils/safeInlineScript.js.map +1 -0
- package/lib/module/utils/sseClient.js +40 -0
- package/lib/module/utils/sseClient.js.map +1 -0
- package/lib/module/views/DepositSelect.js +275 -0
- package/lib/module/views/DepositSelect.js.map +1 -0
- package/lib/module/views/Dice.js +111 -0
- package/lib/module/views/Dice.js.map +1 -0
- package/lib/module/views/DiceBattle.js +815 -0
- package/lib/module/views/DiceBattle.js.map +1 -0
- package/lib/module/views/DiceLobby.js +577 -0
- package/lib/module/views/DiceLobby.js.map +1 -0
- package/lib/module/views/FortuneWheel.js +892 -0
- package/lib/module/views/FortuneWheel.js.map +1 -0
- package/lib/module/views/Freefall.js +808 -0
- package/lib/module/views/Freefall.js.map +1 -0
- package/lib/module/views/History.js +366 -0
- package/lib/module/views/History.js.map +1 -0
- package/lib/module/views/Home.js +554 -0
- package/lib/module/views/Home.js.map +1 -0
- package/lib/module/views/Jetstream.js +889 -0
- package/lib/module/views/Jetstream.js.map +1 -0
- package/lib/module/views/Leaderboard.js +1206 -0
- package/lib/module/views/Leaderboard.js.map +1 -0
- package/lib/module/views/MillionaireHunter.js +1697 -0
- package/lib/module/views/MillionaireHunter.js.map +1 -0
- package/lib/module/views/Minefield.js +826 -0
- package/lib/module/views/Minefield.js.map +1 -0
- package/lib/module/views/PaymentWebView.js +546 -0
- package/lib/module/views/PaymentWebView.js.map +1 -0
- package/lib/module/views/PlayerCard.js +184 -0
- package/lib/module/views/PlayerCard.js.map +1 -0
- package/lib/module/views/Profile.js +531 -0
- package/lib/module/views/Profile.js.map +1 -0
- package/lib/module/views/RaffleDraw.js +1242 -0
- package/lib/module/views/RaffleDraw.js.map +1 -0
- package/lib/module/views/RevealWin.js +1267 -0
- package/lib/module/views/RevealWin.js.map +1 -0
- package/lib/module/views/Splash.js +363 -0
- package/lib/module/views/Splash.js.map +1 -0
- package/lib/module/views/Success.js +363 -0
- package/lib/module/views/Success.js.map +1 -0
- package/lib/module/views/TicketShop.js +372 -0
- package/lib/module/views/TicketShop.js.map +1 -0
- package/lib/module/views/TriviaLobby.js +582 -0
- package/lib/module/views/TriviaLobby.js.map +1 -0
- package/lib/module/views/TriviaMaster.js +884 -0
- package/lib/module/views/TriviaMaster.js.map +1 -0
- package/lib/module/views/Wallet.js +622 -0
- package/lib/module/views/Wallet.js.map +1 -0
- package/lib/module/views/WithdrawFlow.js +445 -0
- package/lib/module/views/WithdrawFlow.js.map +1 -0
- package/lib/module/views/gridGeometry.js +26 -0
- package/lib/module/views/gridGeometry.js.map +1 -0
- package/lib/module/views/revealWinHelpers.js +29 -0
- package/lib/module/views/revealWinHelpers.js.map +1 -0
- package/lib/module/views/ticketBundlePresets.js +29 -0
- package/lib/module/views/ticketBundlePresets.js.map +1 -0
- package/lib/module/views/triviaHelpers.js +78 -0
- package/lib/module/views/triviaHelpers.js.map +1 -0
- package/lib/module/voiceClips.js +16 -0
- package/lib/module/voiceClips.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/HapticsManager.d.ts +28 -0
- package/lib/typescript/src/HapticsManager.d.ts.map +1 -0
- package/lib/typescript/src/HubContent.d.ts +7 -0
- package/lib/typescript/src/HubContent.d.ts.map +1 -0
- package/lib/typescript/src/Icons.d.ts +14 -0
- package/lib/typescript/src/Icons.d.ts.map +1 -0
- package/lib/typescript/src/MonflowtsHub.d.ts +5 -0
- package/lib/typescript/src/MonflowtsHub.d.ts.map +1 -0
- package/lib/typescript/src/NativeLottieView.d.ts +13 -0
- package/lib/typescript/src/NativeLottieView.d.ts.map +1 -0
- package/lib/typescript/src/NativeSvgView.d.ts +12 -0
- package/lib/typescript/src/NativeSvgView.d.ts.map +1 -0
- package/lib/typescript/src/NativeWebView.d.ts +22 -0
- package/lib/typescript/src/NativeWebView.d.ts.map +1 -0
- package/lib/typescript/src/NativeWheelView.d.ts +9 -0
- package/lib/typescript/src/NativeWheelView.d.ts.map +1 -0
- package/lib/typescript/src/SoundManager.d.ts +29 -0
- package/lib/typescript/src/SoundManager.d.ts.map +1 -0
- package/lib/typescript/src/SpeechManager.d.ts +10 -0
- package/lib/typescript/src/SpeechManager.d.ts.map +1 -0
- package/lib/typescript/src/api/client.d.ts +7 -0
- package/lib/typescript/src/api/client.d.ts.map +1 -0
- package/lib/typescript/src/api/gameTypes.d.ts +326 -0
- package/lib/typescript/src/api/gameTypes.d.ts.map +1 -0
- package/lib/typescript/src/api/http.d.ts +61 -0
- package/lib/typescript/src/api/http.d.ts.map +1 -0
- package/lib/typescript/src/api/mutations.d.ts +22 -0
- package/lib/typescript/src/api/mutations.d.ts.map +1 -0
- package/lib/typescript/src/api/playerTypes.d.ts +53 -0
- package/lib/typescript/src/api/playerTypes.d.ts.map +1 -0
- package/lib/typescript/src/api/queries.d.ts +21 -0
- package/lib/typescript/src/api/queries.d.ts.map +1 -0
- package/lib/typescript/src/api/sdkTypes.d.ts +87 -0
- package/lib/typescript/src/api/sdkTypes.d.ts.map +1 -0
- package/lib/typescript/src/assets/assetKeys.d.ts +3 -0
- package/lib/typescript/src/assets/assetKeys.d.ts.map +1 -0
- package/lib/typescript/src/assets/assetSync.d.ts +41 -0
- package/lib/typescript/src/assets/assetSync.d.ts.map +1 -0
- package/lib/typescript/src/assets/nativeAssets.d.ts +30 -0
- package/lib/typescript/src/assets/nativeAssets.d.ts.map +1 -0
- package/lib/typescript/src/assets/remote.d.ts +8 -0
- package/lib/typescript/src/assets/remote.d.ts.map +1 -0
- package/lib/typescript/src/components/AbandonPolicyNotice.d.ts +16 -0
- package/lib/typescript/src/components/AbandonPolicyNotice.d.ts.map +1 -0
- package/lib/typescript/src/components/AnimatedAmount.d.ts +12 -0
- package/lib/typescript/src/components/AnimatedAmount.d.ts.map +1 -0
- package/lib/typescript/src/components/CoinFlyOverlay.d.ts +17 -0
- package/lib/typescript/src/components/CoinFlyOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GameCharacter.d.ts +14 -0
- package/lib/typescript/src/components/GameCharacter.d.ts.map +1 -0
- package/lib/typescript/src/components/GameRulesModal.d.ts +10 -0
- package/lib/typescript/src/components/GameRulesModal.d.ts.map +1 -0
- package/lib/typescript/src/components/HypeCallout.d.ts +11 -0
- package/lib/typescript/src/components/HypeCallout.d.ts.map +1 -0
- package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts +12 -0
- package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/JackpotNearMiss.d.ts +8 -0
- package/lib/typescript/src/components/JackpotNearMiss.d.ts.map +1 -0
- package/lib/typescript/src/components/JackpotTeaser.d.ts +13 -0
- package/lib/typescript/src/components/JackpotTeaser.d.ts.map +1 -0
- package/lib/typescript/src/components/MonflowtsButton.d.ts +21 -0
- package/lib/typescript/src/components/MonflowtsButton.d.ts.map +1 -0
- package/lib/typescript/src/components/MonflowtsChipGroup.d.ts +18 -0
- package/lib/typescript/src/components/MonflowtsChipGroup.d.ts.map +1 -0
- package/lib/typescript/src/components/MonflowtsPressable.d.ts +39 -0
- package/lib/typescript/src/components/MonflowtsPressable.d.ts.map +1 -0
- package/lib/typescript/src/components/QuitConfirmModal.d.ts +11 -0
- package/lib/typescript/src/components/QuitConfirmModal.d.ts.map +1 -0
- package/lib/typescript/src/components/SessionTimer.d.ts +14 -0
- package/lib/typescript/src/components/SessionTimer.d.ts.map +1 -0
- package/lib/typescript/src/components/SideDemoTab.d.ts +18 -0
- package/lib/typescript/src/components/SideDemoTab.d.ts.map +1 -0
- package/lib/typescript/src/components/StakeInput.d.ts +16 -0
- package/lib/typescript/src/components/StakeInput.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +21 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/content.d.ts +53 -0
- package/lib/typescript/src/content.d.ts.map +1 -0
- package/lib/typescript/src/effects/EffectBurst.d.ts +20 -0
- package/lib/typescript/src/effects/EffectBurst.d.ts.map +1 -0
- package/lib/typescript/src/effects/beaverStates.d.ts +4 -0
- package/lib/typescript/src/effects/beaverStates.d.ts.map +1 -0
- package/lib/typescript/src/effects/hypePhrases.d.ts +11 -0
- package/lib/typescript/src/effects/hypePhrases.d.ts.map +1 -0
- package/lib/typescript/src/effects/particleAnims.d.ts +9 -0
- package/lib/typescript/src/effects/particleAnims.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAvailableGames.d.ts +14 -0
- package/lib/typescript/src/hooks/useAvailableGames.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCrash.d.ts +13 -0
- package/lib/typescript/src/hooks/useCrash.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCrashFeed.d.ts +22 -0
- package/lib/typescript/src/hooks/useCrashFeed.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCurrency.d.ts +6 -0
- package/lib/typescript/src/hooks/useCurrency.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useFairSeed.d.ts +8 -0
- package/lib/typescript/src/hooks/useFairSeed.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useGameEvents.d.ts +50 -0
- package/lib/typescript/src/hooks/useGameEvents.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useGameHistory.d.ts +14 -0
- package/lib/typescript/src/hooks/useGameHistory.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useLeaderboard.d.ts +71 -0
- package/lib/typescript/src/hooks/useLeaderboard.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMines.d.ts +11 -0
- package/lib/typescript/src/hooks/useMines.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNotifications.d.ts +26 -0
- package/lib/typescript/src/hooks/useNotifications.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePlayGame.d.ts +62 -0
- package/lib/typescript/src/hooks/usePlayGame.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePlinko.d.ts +8 -0
- package/lib/typescript/src/hooks/usePlinko.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRaffleDrawState.d.ts +50 -0
- package/lib/typescript/src/hooks/useRaffleDrawState.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRefreshWallet.d.ts +8 -0
- package/lib/typescript/src/hooks/useRefreshWallet.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useResponsive.d.ts +8 -0
- package/lib/typescript/src/hooks/useResponsive.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRevealWin.d.ts +10 -0
- package/lib/typescript/src/hooks/useRevealWin.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScreenShake.d.ts +14 -0
- package/lib/typescript/src/hooks/useScreenShake.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useWallet.d.ts +23 -0
- package/lib/typescript/src/hooks/useWallet.d.ts.map +1 -0
- package/lib/typescript/src/i18n.d.ts +29 -0
- package/lib/typescript/src/i18n.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +12 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/lottieAnimations.d.ts +2 -0
- package/lib/typescript/src/lottieAnimations.d.ts.map +1 -0
- package/lib/typescript/src/stores/assetStore.d.ts +17 -0
- package/lib/typescript/src/stores/assetStore.d.ts.map +1 -0
- package/lib/typescript/src/stores/authStore.d.ts +25 -0
- package/lib/typescript/src/stores/authStore.d.ts.map +1 -0
- package/lib/typescript/src/stores/gameStore.d.ts +14 -0
- package/lib/typescript/src/stores/gameStore.d.ts.map +1 -0
- package/lib/typescript/src/stores/sdkInitStore.d.ts +38 -0
- package/lib/typescript/src/stores/sdkInitStore.d.ts.map +1 -0
- package/lib/typescript/src/stores/settingsStore.d.ts +23 -0
- package/lib/typescript/src/stores/settingsStore.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +149 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +49 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/apolloError.d.ts +12 -0
- package/lib/typescript/src/utils/apolloError.d.ts.map +1 -0
- package/lib/typescript/src/utils/crashMultiplier.d.ts +2 -0
- package/lib/typescript/src/utils/crashMultiplier.d.ts.map +1 -0
- package/lib/typescript/src/utils/crashMultiplier.test.d.ts +2 -0
- package/lib/typescript/src/utils/crashMultiplier.test.d.ts.map +1 -0
- package/lib/typescript/src/utils/deviceAnalytics.d.ts +3 -0
- package/lib/typescript/src/utils/deviceAnalytics.d.ts.map +1 -0
- package/lib/typescript/src/utils/idempotency.d.ts +14 -0
- package/lib/typescript/src/utils/idempotency.d.ts.map +1 -0
- package/lib/typescript/src/utils/layout.d.ts +10 -0
- package/lib/typescript/src/utils/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/safeInlineScript.d.ts +5 -0
- package/lib/typescript/src/utils/safeInlineScript.d.ts.map +1 -0
- package/lib/typescript/src/utils/sseClient.d.ts +5 -0
- package/lib/typescript/src/utils/sseClient.d.ts.map +1 -0
- package/lib/typescript/src/views/DepositSelect.d.ts +9 -0
- package/lib/typescript/src/views/DepositSelect.d.ts.map +1 -0
- package/lib/typescript/src/views/Dice.d.ts +10 -0
- package/lib/typescript/src/views/Dice.d.ts.map +1 -0
- package/lib/typescript/src/views/DiceBattle.d.ts +15 -0
- package/lib/typescript/src/views/DiceBattle.d.ts.map +1 -0
- package/lib/typescript/src/views/DiceLobby.d.ts +12 -0
- package/lib/typescript/src/views/DiceLobby.d.ts.map +1 -0
- package/lib/typescript/src/views/FortuneWheel.d.ts +13 -0
- package/lib/typescript/src/views/FortuneWheel.d.ts.map +1 -0
- package/lib/typescript/src/views/Freefall.d.ts +13 -0
- package/lib/typescript/src/views/Freefall.d.ts.map +1 -0
- package/lib/typescript/src/views/History.d.ts +7 -0
- package/lib/typescript/src/views/History.d.ts.map +1 -0
- package/lib/typescript/src/views/Home.d.ts +13 -0
- package/lib/typescript/src/views/Home.d.ts.map +1 -0
- package/lib/typescript/src/views/Jetstream.d.ts +14 -0
- package/lib/typescript/src/views/Jetstream.d.ts.map +1 -0
- package/lib/typescript/src/views/Leaderboard.d.ts +8 -0
- package/lib/typescript/src/views/Leaderboard.d.ts.map +1 -0
- package/lib/typescript/src/views/MillionaireHunter.d.ts +13 -0
- package/lib/typescript/src/views/MillionaireHunter.d.ts.map +1 -0
- package/lib/typescript/src/views/Minefield.d.ts +13 -0
- package/lib/typescript/src/views/Minefield.d.ts.map +1 -0
- package/lib/typescript/src/views/PaymentWebView.d.ts +29 -0
- package/lib/typescript/src/views/PaymentWebView.d.ts.map +1 -0
- package/lib/typescript/src/views/PlayerCard.d.ts +15 -0
- package/lib/typescript/src/views/PlayerCard.d.ts.map +1 -0
- package/lib/typescript/src/views/Profile.d.ts +9 -0
- package/lib/typescript/src/views/Profile.d.ts.map +1 -0
- package/lib/typescript/src/views/RaffleDraw.d.ts +12 -0
- package/lib/typescript/src/views/RaffleDraw.d.ts.map +1 -0
- package/lib/typescript/src/views/RevealWin.d.ts +13 -0
- package/lib/typescript/src/views/RevealWin.d.ts.map +1 -0
- package/lib/typescript/src/views/Splash.d.ts +10 -0
- package/lib/typescript/src/views/Splash.d.ts.map +1 -0
- package/lib/typescript/src/views/Success.d.ts +12 -0
- package/lib/typescript/src/views/Success.d.ts.map +1 -0
- package/lib/typescript/src/views/TicketShop.d.ts +15 -0
- package/lib/typescript/src/views/TicketShop.d.ts.map +1 -0
- package/lib/typescript/src/views/TriviaLobby.d.ts +12 -0
- package/lib/typescript/src/views/TriviaLobby.d.ts.map +1 -0
- package/lib/typescript/src/views/TriviaMaster.d.ts +16 -0
- package/lib/typescript/src/views/TriviaMaster.d.ts.map +1 -0
- package/lib/typescript/src/views/Wallet.d.ts +10 -0
- package/lib/typescript/src/views/Wallet.d.ts.map +1 -0
- package/lib/typescript/src/views/WithdrawFlow.d.ts +9 -0
- package/lib/typescript/src/views/WithdrawFlow.d.ts.map +1 -0
- package/lib/typescript/src/views/gridGeometry.d.ts +19 -0
- package/lib/typescript/src/views/gridGeometry.d.ts.map +1 -0
- package/lib/typescript/src/views/revealWinHelpers.d.ts +15 -0
- package/lib/typescript/src/views/revealWinHelpers.d.ts.map +1 -0
- package/lib/typescript/src/views/ticketBundlePresets.d.ts +18 -0
- package/lib/typescript/src/views/ticketBundlePresets.d.ts.map +1 -0
- package/lib/typescript/src/views/triviaHelpers.d.ts +31 -0
- package/lib/typescript/src/views/triviaHelpers.d.ts.map +1 -0
- package/lib/typescript/src/voiceClips.d.ts +4 -0
- package/lib/typescript/src/voiceClips.d.ts.map +1 -0
- package/package.json +160 -4
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Canvas
|
|
5
|
+
import android.graphics.Color
|
|
6
|
+
import android.graphics.Paint
|
|
7
|
+
import android.graphics.RectF
|
|
8
|
+
import android.util.AttributeSet
|
|
9
|
+
import android.view.View
|
|
10
|
+
import kotlin.math.PI
|
|
11
|
+
import kotlin.math.cos
|
|
12
|
+
import kotlin.math.sin
|
|
13
|
+
|
|
14
|
+
class MonflowtsWheelView @JvmOverloads constructor(
|
|
15
|
+
context: Context,
|
|
16
|
+
attrs: AttributeSet? = null,
|
|
17
|
+
defStyleAttr: Int = 0
|
|
18
|
+
) : View(context, attrs, defStyleAttr) {
|
|
19
|
+
|
|
20
|
+
data class Segment(val label: String, val value: Int, val color: Int)
|
|
21
|
+
|
|
22
|
+
private var segments: List<Segment> = emptyList()
|
|
23
|
+
private val segmentPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
24
|
+
private val textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
25
|
+
color = Color.WHITE
|
|
26
|
+
textAlign = Paint.Align.CENTER
|
|
27
|
+
isFakeBoldText = true
|
|
28
|
+
}
|
|
29
|
+
private val borderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
30
|
+
style = Paint.Style.STROKE
|
|
31
|
+
color = Color.argb(25, 255, 255, 255)
|
|
32
|
+
strokeWidth = 2f
|
|
33
|
+
}
|
|
34
|
+
private val rectF = RectF()
|
|
35
|
+
|
|
36
|
+
fun setSegments(newSegments: List<Segment>) {
|
|
37
|
+
segments = newSegments
|
|
38
|
+
invalidate()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onDraw(canvas: Canvas) {
|
|
42
|
+
super.onDraw(canvas)
|
|
43
|
+
if (segments.isEmpty()) return
|
|
44
|
+
|
|
45
|
+
val cx = width / 2f
|
|
46
|
+
val cy = height / 2f
|
|
47
|
+
val radius = minOf(cx, cy) - 8f
|
|
48
|
+
val segmentAngle = 360f / segments.size
|
|
49
|
+
|
|
50
|
+
rectF.set(cx - radius, cy - radius, cx + radius, cy + radius)
|
|
51
|
+
|
|
52
|
+
// Draw segments
|
|
53
|
+
segments.forEachIndexed { i, segment ->
|
|
54
|
+
val startAngle = i * segmentAngle - 90f
|
|
55
|
+
|
|
56
|
+
// Fill
|
|
57
|
+
segmentPaint.style = Paint.Style.FILL
|
|
58
|
+
segmentPaint.color = segment.color
|
|
59
|
+
canvas.drawArc(rectF, startAngle, segmentAngle, true, segmentPaint)
|
|
60
|
+
|
|
61
|
+
// Border
|
|
62
|
+
canvas.drawArc(rectF, startAngle, segmentAngle, true, borderPaint)
|
|
63
|
+
|
|
64
|
+
// Text
|
|
65
|
+
val textAngle = startAngle + segmentAngle / 2f
|
|
66
|
+
val textRadius = radius * 0.65f
|
|
67
|
+
val textX = cx + textRadius * cos(textAngle * PI.toFloat() / 180f)
|
|
68
|
+
val textY = cy + textRadius * sin(textAngle * PI.toFloat() / 180f)
|
|
69
|
+
textPaint.textSize = radius * 0.08f
|
|
70
|
+
|
|
71
|
+
canvas.save()
|
|
72
|
+
canvas.rotate(textAngle + 90f, textX, textY)
|
|
73
|
+
canvas.drawText(segment.label, textX, textY + textPaint.textSize / 3f, textPaint)
|
|
74
|
+
canvas.restore()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Outer ring
|
|
78
|
+
val outerPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
79
|
+
style = Paint.Style.STROKE
|
|
80
|
+
color = Color.argb(40, 255, 255, 255)
|
|
81
|
+
strokeWidth = 4f
|
|
82
|
+
}
|
|
83
|
+
canvas.drawCircle(cx, cy, radius, outerPaint)
|
|
84
|
+
|
|
85
|
+
// Center hub
|
|
86
|
+
val hubPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
87
|
+
style = Paint.Style.FILL
|
|
88
|
+
color = Color.parseColor("#0f172a")
|
|
89
|
+
}
|
|
90
|
+
val hubBorder = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
91
|
+
style = Paint.Style.STROKE
|
|
92
|
+
color = Color.parseColor("#1e293b")
|
|
93
|
+
strokeWidth = 6f
|
|
94
|
+
}
|
|
95
|
+
canvas.drawCircle(cx, cy, radius * 0.12f, hubPaint)
|
|
96
|
+
canvas.drawCircle(cx, cy, radius * 0.12f, hubBorder)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import com.facebook.react.bridge.ReadableArray
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
+
|
|
10
|
+
@ReactModule(name = MonflowtsWheelViewManager.NAME)
|
|
11
|
+
class MonflowtsWheelViewManager : SimpleViewManager<MonflowtsWheelView>() {
|
|
12
|
+
|
|
13
|
+
companion object {
|
|
14
|
+
const val NAME = "MonflowtsWheelView"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun getName(): String = NAME
|
|
18
|
+
|
|
19
|
+
override fun createViewInstance(context: ThemedReactContext): MonflowtsWheelView {
|
|
20
|
+
return MonflowtsWheelView(context)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@ReactProp(name = "segments")
|
|
24
|
+
fun setSegments(view: MonflowtsWheelView, segments: ReadableArray?) {
|
|
25
|
+
if (segments == null) return
|
|
26
|
+
|
|
27
|
+
val segmentList = mutableListOf<MonflowtsWheelView.Segment>()
|
|
28
|
+
for (i in 0 until segments.size()) {
|
|
29
|
+
val map = segments.getMap(i) ?: continue
|
|
30
|
+
val label = map.getString("label") ?: ""
|
|
31
|
+
val value = map.getInt("value")
|
|
32
|
+
// Canonical segment-color fallback shared with the JS SDK and the iOS wheel
|
|
33
|
+
// (FortuneWheel.tsx → SEGMENT_COLORS ultimate fallback). Keeps an un-coloured
|
|
34
|
+
// segment identical across web, iOS and Android instead of a platform-specific shade.
|
|
35
|
+
val colorStr = map.getString("color") ?: "#4f46e5"
|
|
36
|
+
val color = try {
|
|
37
|
+
Color.parseColor(colorStr)
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
Color.parseColor("#4f46e5")
|
|
40
|
+
}
|
|
41
|
+
segmentList.add(MonflowtsWheelView.Segment(label, value, color))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
view.setSegments(segmentList)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
|
+
|
|
4
|
+
@interface RCT_EXTERN_MODULE(MonflowtsAssets, RCTEventEmitter)
|
|
5
|
+
|
|
6
|
+
RCT_EXTERN_METHOD(getBaseUri:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
7
|
+
RCT_EXTERN_METHOD(download:(NSArray *)files resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
8
|
+
RCT_EXTERN_METHOD(readText:(NSString *)name resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
9
|
+
RCT_EXTERN_METHOD(missing:(NSArray *)names resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
10
|
+
RCT_EXTERN_METHOD(saveIndex:(NSString *)json resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
11
|
+
RCT_EXTERN_METHOD(loadIndex:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
+
RCT_EXTERN_METHOD(removeExcept:(NSArray *)names resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
13
|
+
|
|
14
|
+
@end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import CryptoKit
|
|
3
|
+
import React
|
|
4
|
+
|
|
5
|
+
@objc(MonflowtsAssets)
|
|
6
|
+
class MonflowtsAssetsModule: RCTEventEmitter {
|
|
7
|
+
|
|
8
|
+
private let session: URLSession = {
|
|
9
|
+
let configuration = URLSessionConfiguration.default
|
|
10
|
+
configuration.httpMaximumConnectionsPerHost = 4
|
|
11
|
+
configuration.requestCachePolicy = .reloadIgnoringLocalCacheData
|
|
12
|
+
return URLSession(configuration: configuration)
|
|
13
|
+
}()
|
|
14
|
+
private let indexName = "index.json"
|
|
15
|
+
private var hasListeners = false
|
|
16
|
+
|
|
17
|
+
@objc override static func requiresMainQueueSetup() -> Bool { return false }
|
|
18
|
+
|
|
19
|
+
override func supportedEvents() -> [String]! { return ["MonflowtsAssetsProgress"] }
|
|
20
|
+
override func startObserving() { hasListeners = true }
|
|
21
|
+
override func stopObserving() { hasListeners = false }
|
|
22
|
+
|
|
23
|
+
private func baseDirectory() throws -> URL {
|
|
24
|
+
let support = try FileManager.default.url(
|
|
25
|
+
for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
26
|
+
var directory = support.appendingPathComponent("monflowts-assets", isDirectory: true)
|
|
27
|
+
if !FileManager.default.fileExists(atPath: directory.path) {
|
|
28
|
+
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
|
|
29
|
+
var values = URLResourceValues()
|
|
30
|
+
values.isExcludedFromBackup = true
|
|
31
|
+
try directory.setResourceValues(values)
|
|
32
|
+
}
|
|
33
|
+
return directory
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc func getBaseUri(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
37
|
+
do {
|
|
38
|
+
let uri = try baseDirectory().absoluteString
|
|
39
|
+
resolve(uri.hasSuffix("/") ? uri : uri + "/")
|
|
40
|
+
} catch {
|
|
41
|
+
reject("E_ASSETS_DIR", error.localizedDescription, error)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@objc func download(_ files: NSArray, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
46
|
+
let directory: URL
|
|
47
|
+
do { directory = try baseDirectory() } catch {
|
|
48
|
+
reject("E_ASSETS_DIR", error.localizedDescription, error)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
var malformed: [[String: String]] = []
|
|
52
|
+
let items: [(url: URL, sha256: String, ext: String, size: Int64)] = files.compactMap { entry -> (url: URL, sha256: String, ext: String, size: Int64)? in
|
|
53
|
+
guard let file = entry as? [String: Any],
|
|
54
|
+
let urlString = file["url"] as? String,
|
|
55
|
+
let url = URL(string: urlString),
|
|
56
|
+
let sha256 = file["sha256"] as? String,
|
|
57
|
+
let ext = file["ext"] as? String else {
|
|
58
|
+
let sha256 = (entry as? [String: Any])?["sha256"] as? String ?? ""
|
|
59
|
+
malformed.append(["sha256": sha256, "reason": "NETWORK"])
|
|
60
|
+
return nil
|
|
61
|
+
}
|
|
62
|
+
let size = (file["size"] as? NSNumber)?.int64Value ?? 0
|
|
63
|
+
return (url, sha256, ext, size)
|
|
64
|
+
}
|
|
65
|
+
let bytesTotal = items.reduce(Int64(0)) { $0 + $1.size }
|
|
66
|
+
let lock = NSLock()
|
|
67
|
+
var bytesDone: Int64 = 0
|
|
68
|
+
var filesDone = 0
|
|
69
|
+
var failed: [[String: String]] = malformed
|
|
70
|
+
let group = DispatchGroup()
|
|
71
|
+
|
|
72
|
+
for item in items {
|
|
73
|
+
let target = directory.appendingPathComponent("\(item.sha256).\(item.ext)")
|
|
74
|
+
if FileManager.default.fileExists(atPath: target.path) {
|
|
75
|
+
lock.lock()
|
|
76
|
+
bytesDone += item.size
|
|
77
|
+
filesDone += 1
|
|
78
|
+
lock.unlock()
|
|
79
|
+
continue
|
|
80
|
+
}
|
|
81
|
+
group.enter()
|
|
82
|
+
fetch(item.url, sha256: item.sha256, to: target) { [weak self] reason in
|
|
83
|
+
lock.lock()
|
|
84
|
+
if let reason = reason {
|
|
85
|
+
failed.append(["sha256": item.sha256, "reason": reason])
|
|
86
|
+
} else {
|
|
87
|
+
bytesDone += item.size
|
|
88
|
+
}
|
|
89
|
+
filesDone += 1
|
|
90
|
+
let progress: [String: Any] = [
|
|
91
|
+
"bytesDone": bytesDone, "bytesTotal": bytesTotal, "filesDone": filesDone, "filesTotal": items.count,
|
|
92
|
+
]
|
|
93
|
+
lock.unlock()
|
|
94
|
+
self?.emitProgress(progress)
|
|
95
|
+
group.leave()
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
group.notify(queue: .global(qos: .utility)) {
|
|
100
|
+
lock.lock()
|
|
101
|
+
let result: [String: Any] = ["failed": failed]
|
|
102
|
+
lock.unlock()
|
|
103
|
+
resolve(result)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private func fetch(_ url: URL, sha256: String, to target: URL, completion: @escaping (String?) -> Void) {
|
|
108
|
+
session.downloadTask(with: url) { temporary, response, error in
|
|
109
|
+
if let error = error {
|
|
110
|
+
completion(MonflowtsAssetsModule.isOutOfSpace(error) ? "NO_SPACE" : "NETWORK")
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
let status = (response as? HTTPURLResponse)?.statusCode ?? 0
|
|
114
|
+
if status == 403 {
|
|
115
|
+
completion("EXPIRED")
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
guard (200..<300).contains(status), let temporary = temporary else {
|
|
119
|
+
completion("NETWORK")
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
do {
|
|
123
|
+
let data = try Data(contentsOf: temporary)
|
|
124
|
+
let digest = SHA256.hash(data: data).map { String(format: "%02x", $0) }.joined()
|
|
125
|
+
guard digest == sha256 else {
|
|
126
|
+
completion("HASH_MISMATCH")
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
if FileManager.default.fileExists(atPath: target.path) {
|
|
130
|
+
completion(nil)
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
try FileManager.default.moveItem(at: temporary, to: target)
|
|
134
|
+
completion(nil)
|
|
135
|
+
} catch {
|
|
136
|
+
completion(MonflowtsAssetsModule.isOutOfSpace(error) ? "NO_SPACE" : "NETWORK")
|
|
137
|
+
}
|
|
138
|
+
}.resume()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private static func isOutOfSpace(_ error: Error) -> Bool {
|
|
142
|
+
let nsError = error as NSError
|
|
143
|
+
if nsError.domain == NSURLErrorDomain,
|
|
144
|
+
nsError.code == NSURLErrorCannotWriteToFile || nsError.code == NSURLErrorCannotCreateFile {
|
|
145
|
+
return true
|
|
146
|
+
}
|
|
147
|
+
if nsError.domain == NSCocoaErrorDomain && nsError.code == NSFileWriteOutOfSpaceError {
|
|
148
|
+
return true
|
|
149
|
+
}
|
|
150
|
+
let underlying = nsError.userInfo[NSUnderlyingErrorKey] as? NSError
|
|
151
|
+
return (nsError.domain == NSPOSIXErrorDomain && nsError.code == Int(ENOSPC))
|
|
152
|
+
|| (underlying?.domain == NSPOSIXErrorDomain && underlying?.code == Int(ENOSPC))
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private func emitProgress(_ body: [String: Any]) {
|
|
156
|
+
guard hasListeners else { return }
|
|
157
|
+
sendEvent(withName: "MonflowtsAssetsProgress", body: body)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@objc func readText(_ name: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
161
|
+
do {
|
|
162
|
+
let url = try baseDirectory().appendingPathComponent(name as String)
|
|
163
|
+
resolve(try String(contentsOf: url, encoding: .utf8))
|
|
164
|
+
} catch {
|
|
165
|
+
reject("E_ASSETS_READ", error.localizedDescription, error)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@objc func missing(_ names: NSArray, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
170
|
+
do {
|
|
171
|
+
let directory = try baseDirectory()
|
|
172
|
+
let absent = names.compactMap { $0 as? String }.filter {
|
|
173
|
+
!FileManager.default.fileExists(atPath: directory.appendingPathComponent($0).path)
|
|
174
|
+
}
|
|
175
|
+
resolve(absent)
|
|
176
|
+
} catch {
|
|
177
|
+
reject("E_ASSETS_DIR", error.localizedDescription, error)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@objc func saveIndex(_ json: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
182
|
+
do {
|
|
183
|
+
let url = try baseDirectory().appendingPathComponent(indexName)
|
|
184
|
+
try (json as String).write(to: url, atomically: true, encoding: .utf8)
|
|
185
|
+
resolve(nil)
|
|
186
|
+
} catch {
|
|
187
|
+
reject("E_ASSETS_WRITE", error.localizedDescription, error)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@objc func loadIndex(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
192
|
+
do {
|
|
193
|
+
let url = try baseDirectory().appendingPathComponent(indexName)
|
|
194
|
+
guard FileManager.default.fileExists(atPath: url.path) else {
|
|
195
|
+
resolve(nil)
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
resolve(try String(contentsOf: url, encoding: .utf8))
|
|
199
|
+
} catch {
|
|
200
|
+
reject("E_ASSETS_READ", error.localizedDescription, error)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@objc func removeExcept(_ names: NSArray, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
205
|
+
do {
|
|
206
|
+
let directory = try baseDirectory()
|
|
207
|
+
var keep = Set(names.compactMap { $0 as? String })
|
|
208
|
+
keep.insert(indexName)
|
|
209
|
+
for name in try FileManager.default.contentsOfDirectory(atPath: directory.path) where !keep.contains(name) {
|
|
210
|
+
try? FileManager.default.removeItem(at: directory.appendingPathComponent(name))
|
|
211
|
+
}
|
|
212
|
+
resolve(nil)
|
|
213
|
+
} catch {
|
|
214
|
+
reject("E_ASSETS_DIR", error.localizedDescription, error)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(MonflowtsCrashFeed)
|
|
5
|
+
class MonflowtsCrashFeedModule: RCTEventEmitter {
|
|
6
|
+
|
|
7
|
+
private let queue = DispatchQueue(label: "com.monflowts.crashfeed", qos: .utility)
|
|
8
|
+
private var source: MonflowtsHTTP1EventSource?
|
|
9
|
+
private var hasListeners = false
|
|
10
|
+
private var reconnectAttempts = 0
|
|
11
|
+
private var currentURL: URL?
|
|
12
|
+
private var generation = 0
|
|
13
|
+
private var stopped = true
|
|
14
|
+
|
|
15
|
+
@objc override static func requiresMainQueueSetup() -> Bool { return false }
|
|
16
|
+
|
|
17
|
+
override func supportedEvents() -> [String]! {
|
|
18
|
+
return ["MonflowtsCrashCashout", "MonflowtsCrashFeedStatus"]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override func startObserving() { hasListeners = true }
|
|
22
|
+
override func stopObserving() { hasListeners = false }
|
|
23
|
+
|
|
24
|
+
@objc func connect(_ urlString: NSString) {
|
|
25
|
+
queue.async { [weak self] in
|
|
26
|
+
guard let self = self, let url = URL(string: urlString as String) else { return }
|
|
27
|
+
self.currentURL = url
|
|
28
|
+
self.stopped = false
|
|
29
|
+
self.reconnectAttempts = 0
|
|
30
|
+
self.generation += 1
|
|
31
|
+
self.openConnection(generation: self.generation)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@objc func disconnect() {
|
|
36
|
+
queue.async { [weak self] in
|
|
37
|
+
guard let self = self else { return }
|
|
38
|
+
self.stopped = true
|
|
39
|
+
self.generation += 1
|
|
40
|
+
self.source?.disconnect()
|
|
41
|
+
self.source = nil
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private func openConnection(generation: Int) {
|
|
46
|
+
guard !stopped, generation == self.generation, let url = currentURL else { return }
|
|
47
|
+
guard #available(iOS 13.0, *) else { return }
|
|
48
|
+
let src = MonflowtsHTTP1EventSource(url: url, headers: ["Accept": "text/event-stream"], queue: queue)
|
|
49
|
+
self.source = src
|
|
50
|
+
src.onOpen = { [weak self] in
|
|
51
|
+
self?.reconnectAttempts = 0
|
|
52
|
+
self?.emit(name: "MonflowtsCrashFeedStatus", body: ["connected": true])
|
|
53
|
+
}
|
|
54
|
+
src.onEvent = { [weak self] event, _, data in
|
|
55
|
+
guard let self = self, event == "crash.cashout", let data = data else { return }
|
|
56
|
+
if let parsed = self.jsonObject(from: data) {
|
|
57
|
+
self.emit(name: "MonflowtsCrashCashout", body: parsed)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
src.onComplete = { [weak self] _, _ in
|
|
61
|
+
guard let self = self else { return }
|
|
62
|
+
self.source = nil
|
|
63
|
+
self.emit(name: "MonflowtsCrashFeedStatus", body: ["connected": false])
|
|
64
|
+
self.scheduleReconnect(generation: generation)
|
|
65
|
+
}
|
|
66
|
+
src.connect()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private func scheduleReconnect(generation: Int) {
|
|
70
|
+
guard !stopped, generation == self.generation else { return }
|
|
71
|
+
let attempt = reconnectAttempts
|
|
72
|
+
reconnectAttempts += 1
|
|
73
|
+
let delay = min(pow(2.0, Double(attempt)), 30.0)
|
|
74
|
+
queue.asyncAfter(deadline: .now() + delay) { [weak self] in
|
|
75
|
+
self?.openConnection(generation: generation)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private func emit(name: String, body: Any) {
|
|
80
|
+
guard hasListeners else { return }
|
|
81
|
+
sendEvent(withName: name, body: body)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private func jsonObject(from string: String) -> [String: Any]? {
|
|
85
|
+
guard let data = string.data(using: .utf8) else { return nil }
|
|
86
|
+
return (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
|
|
87
|
+
}
|
|
88
|
+
}
|