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,296 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Network
|
|
3
|
+
import Security
|
|
4
|
+
|
|
5
|
+
@available(iOS 13.0, *)
|
|
6
|
+
final class MonflowtsHTTP1EventSource {
|
|
7
|
+
|
|
8
|
+
let url: URL
|
|
9
|
+
private(set) var headers: [String: String]
|
|
10
|
+
|
|
11
|
+
var onOpen: (() -> Void)?
|
|
12
|
+
var onEvent: ((_ event: String?, _ id: String?, _ data: String?) -> Void)?
|
|
13
|
+
var onComplete: ((_ statusCode: Int?, _ error: Error?) -> Void)?
|
|
14
|
+
|
|
15
|
+
private let queue: DispatchQueue
|
|
16
|
+
private var connection: NWConnection?
|
|
17
|
+
private var completed = false
|
|
18
|
+
private var disconnected = false
|
|
19
|
+
|
|
20
|
+
init(url: URL, headers: [String: String], queue: DispatchQueue) {
|
|
21
|
+
self.url = url
|
|
22
|
+
self.headers = headers
|
|
23
|
+
self.queue = queue
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private enum Stage {
|
|
27
|
+
case waitingHeaders
|
|
28
|
+
case streamingChunked
|
|
29
|
+
case streamingIdentity(remaining: Int?)
|
|
30
|
+
case closed
|
|
31
|
+
}
|
|
32
|
+
private var stage: Stage = .waitingHeaders
|
|
33
|
+
private var status: Int?
|
|
34
|
+
private var headerBuffer = Data()
|
|
35
|
+
private var chunkedBuffer = Data()
|
|
36
|
+
private var chunkedRemaining: Int = -1
|
|
37
|
+
private let parser = MonflowtsSSEParser()
|
|
38
|
+
|
|
39
|
+
func connect() {
|
|
40
|
+
guard let host = url.host, !host.isEmpty else {
|
|
41
|
+
finish(error: URLError(.badURL))
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
let port: NWEndpoint.Port
|
|
45
|
+
if let p = url.port {
|
|
46
|
+
port = NWEndpoint.Port(integerLiteral: UInt16(p))
|
|
47
|
+
} else if url.scheme == "https" {
|
|
48
|
+
port = .https
|
|
49
|
+
} else if url.scheme == "http" {
|
|
50
|
+
port = .http
|
|
51
|
+
} else {
|
|
52
|
+
finish(error: URLError(.unsupportedURL))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let endpoint = NWEndpoint.hostPort(host: NWEndpoint.Host(host), port: port)
|
|
57
|
+
let parameters: NWParameters
|
|
58
|
+
let tcpOpts = NWProtocolTCP.Options()
|
|
59
|
+
tcpOpts.noDelay = true
|
|
60
|
+
tcpOpts.connectionTimeout = 30
|
|
61
|
+
if url.scheme == "https" {
|
|
62
|
+
let tls = NWProtocolTLS.Options()
|
|
63
|
+
sec_protocol_options_add_tls_application_protocol(tls.securityProtocolOptions, "http/1.1")
|
|
64
|
+
parameters = NWParameters(tls: tls, tcp: tcpOpts)
|
|
65
|
+
} else {
|
|
66
|
+
parameters = NWParameters(tls: nil, tcp: tcpOpts)
|
|
67
|
+
}
|
|
68
|
+
parameters.allowFastOpen = true
|
|
69
|
+
|
|
70
|
+
let connection = NWConnection(to: endpoint, using: parameters)
|
|
71
|
+
self.connection = connection
|
|
72
|
+
connection.stateUpdateHandler = { [weak self] state in
|
|
73
|
+
self?.handleConnectionState(state)
|
|
74
|
+
}
|
|
75
|
+
connection.start(queue: queue)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
func disconnect() {
|
|
79
|
+
if disconnected { return }
|
|
80
|
+
disconnected = true
|
|
81
|
+
stage = .closed
|
|
82
|
+
connection?.cancel()
|
|
83
|
+
connection = nil
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private func handleConnectionState(_ state: NWConnection.State) {
|
|
87
|
+
switch state {
|
|
88
|
+
case .ready:
|
|
89
|
+
sendRequest()
|
|
90
|
+
receiveLoop()
|
|
91
|
+
case .failed(let error):
|
|
92
|
+
finish(error: error)
|
|
93
|
+
case .cancelled:
|
|
94
|
+
finish(error: nil)
|
|
95
|
+
default:
|
|
96
|
+
break
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private func sendRequest() {
|
|
101
|
+
guard let host = url.host else { return }
|
|
102
|
+
var path = url.path.isEmpty ? "/" : url.path
|
|
103
|
+
if let q = url.query { path += "?" + q }
|
|
104
|
+
|
|
105
|
+
var lines: [String] = []
|
|
106
|
+
lines.append("GET \(path) HTTP/1.1")
|
|
107
|
+
lines.append("Host: \(host)")
|
|
108
|
+
lines.append("Connection: close")
|
|
109
|
+
|
|
110
|
+
var hasAccept = false
|
|
111
|
+
var hasCacheControl = false
|
|
112
|
+
for (k, v) in headers {
|
|
113
|
+
let lower = k.lowercased()
|
|
114
|
+
if lower == "accept" { hasAccept = true }
|
|
115
|
+
if lower == "cache-control" { hasCacheControl = true }
|
|
116
|
+
if lower == "host" || lower == "connection" { continue }
|
|
117
|
+
lines.append("\(k): \(v)")
|
|
118
|
+
}
|
|
119
|
+
if !hasAccept { lines.append("Accept: text/event-stream") }
|
|
120
|
+
if !hasCacheControl { lines.append("Cache-Control: no-cache") }
|
|
121
|
+
lines.append("Accept-Encoding: identity")
|
|
122
|
+
|
|
123
|
+
lines.append("")
|
|
124
|
+
lines.append("")
|
|
125
|
+
guard let data = lines.joined(separator: "\r\n").data(using: .utf8) else { return }
|
|
126
|
+
connection?.send(content: data, completion: .contentProcessed { [weak self] error in
|
|
127
|
+
if let error { self?.finish(error: error) }
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private func receiveLoop() {
|
|
132
|
+
connection?.receive(minimumIncompleteLength: 1, maximumLength: 65_536) { [weak self] data, _, isComplete, error in
|
|
133
|
+
guard let self else { return }
|
|
134
|
+
if let data, !data.isEmpty {
|
|
135
|
+
self.handleIncoming(data)
|
|
136
|
+
}
|
|
137
|
+
if let error {
|
|
138
|
+
self.finish(error: error)
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
if isComplete {
|
|
142
|
+
self.finish(error: nil)
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
if !self.isClosed {
|
|
146
|
+
self.receiveLoop()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private var isClosed: Bool {
|
|
152
|
+
if case .closed = stage { return true }
|
|
153
|
+
return completed
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private func handleIncoming(_ data: Data) {
|
|
157
|
+
switch stage {
|
|
158
|
+
case .waitingHeaders:
|
|
159
|
+
headerBuffer.append(data)
|
|
160
|
+
if headerBuffer.count > 64 * 1024 {
|
|
161
|
+
finish(error: URLError(.cannotParseResponse))
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
tryParseHeaders()
|
|
165
|
+
case .streamingChunked:
|
|
166
|
+
handleChunkedBody(data)
|
|
167
|
+
case .streamingIdentity(let remaining):
|
|
168
|
+
for event in parser.append(data) {
|
|
169
|
+
onEvent?(event.event, event.id, event.data)
|
|
170
|
+
}
|
|
171
|
+
if let remaining {
|
|
172
|
+
let after = remaining - data.count
|
|
173
|
+
if after <= 0 {
|
|
174
|
+
stage = .closed
|
|
175
|
+
finish(error: nil)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
case .closed:
|
|
179
|
+
break
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private func tryParseHeaders() {
|
|
184
|
+
let separator = Data([0x0D, 0x0A, 0x0D, 0x0A])
|
|
185
|
+
guard let range = headerBuffer.range(of: separator) else { return }
|
|
186
|
+
let headerPart = headerBuffer.subdata(in: 0..<range.lowerBound)
|
|
187
|
+
let leftover = headerBuffer.subdata(in: range.upperBound..<headerBuffer.count)
|
|
188
|
+
headerBuffer = Data()
|
|
189
|
+
|
|
190
|
+
guard let raw = String(data: headerPart, encoding: .utf8) else {
|
|
191
|
+
finish(error: URLError(.cannotParseResponse))
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
let lines = raw.components(separatedBy: "\r\n")
|
|
195
|
+
guard let statusLine = lines.first else {
|
|
196
|
+
finish(error: URLError(.cannotParseResponse))
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
let parts = statusLine.split(separator: " ", maxSplits: 2, omittingEmptySubsequences: false)
|
|
200
|
+
guard parts.count >= 2, let code = Int(parts[1]) else {
|
|
201
|
+
finish(error: URLError(.cannotParseResponse))
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
status = code
|
|
205
|
+
guard (200...299).contains(code) else {
|
|
206
|
+
finish(error: nil)
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var transferEncoding: String?
|
|
211
|
+
var contentLength: Int?
|
|
212
|
+
for line in lines.dropFirst() where !line.isEmpty {
|
|
213
|
+
guard let colon = line.firstIndex(of: ":") else { continue }
|
|
214
|
+
let name = String(line[..<colon]).lowercased().trimmingCharacters(in: .whitespaces)
|
|
215
|
+
let value = String(line[line.index(after: colon)...]).trimmingCharacters(in: .whitespaces)
|
|
216
|
+
switch name {
|
|
217
|
+
case "transfer-encoding": transferEncoding = value.lowercased()
|
|
218
|
+
case "content-length": contentLength = Int(value)
|
|
219
|
+
default: break
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
onOpen?()
|
|
224
|
+
|
|
225
|
+
if transferEncoding?.contains("chunked") == true {
|
|
226
|
+
stage = .streamingChunked
|
|
227
|
+
} else if let length = contentLength {
|
|
228
|
+
stage = .streamingIdentity(remaining: length)
|
|
229
|
+
} else {
|
|
230
|
+
stage = .streamingIdentity(remaining: nil)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if !leftover.isEmpty {
|
|
234
|
+
handleIncoming(leftover)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
private func handleChunkedBody(_ data: Data) {
|
|
239
|
+
chunkedBuffer.append(data)
|
|
240
|
+
while true {
|
|
241
|
+
if chunkedRemaining < 0 {
|
|
242
|
+
let crlf = Data([0x0D, 0x0A])
|
|
243
|
+
guard let range = chunkedBuffer.range(of: crlf) else { return }
|
|
244
|
+
let sizeData = chunkedBuffer.subdata(in: 0..<range.lowerBound)
|
|
245
|
+
chunkedBuffer = chunkedBuffer.subdata(in: range.upperBound..<chunkedBuffer.count)
|
|
246
|
+
guard let sizeLine = String(data: sizeData, encoding: .utf8) else {
|
|
247
|
+
finish(error: URLError(.cannotParseResponse))
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
let hexPart = sizeLine.split(separator: ";").first.map(String.init) ?? sizeLine
|
|
251
|
+
let trimmed = hexPart.trimmingCharacters(in: .whitespaces)
|
|
252
|
+
guard let size = Int(trimmed, radix: 16) else {
|
|
253
|
+
finish(error: URLError(.cannotParseResponse))
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
chunkedRemaining = size
|
|
257
|
+
if size == 0 {
|
|
258
|
+
stage = .closed
|
|
259
|
+
finish(error: nil)
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if chunkedBuffer.count >= chunkedRemaining + 2 {
|
|
265
|
+
let chunk = chunkedBuffer.subdata(in: 0..<chunkedRemaining)
|
|
266
|
+
let dropTo = chunkedRemaining + 2
|
|
267
|
+
chunkedBuffer = chunkedBuffer.subdata(in: dropTo..<chunkedBuffer.count)
|
|
268
|
+
for event in parser.append(chunk) {
|
|
269
|
+
onEvent?(event.event, event.id, event.data)
|
|
270
|
+
}
|
|
271
|
+
chunkedRemaining = -1
|
|
272
|
+
} else {
|
|
273
|
+
let take = min(chunkedRemaining, chunkedBuffer.count)
|
|
274
|
+
if take > 0 {
|
|
275
|
+
let chunk = chunkedBuffer.subdata(in: 0..<take)
|
|
276
|
+
chunkedBuffer = chunkedBuffer.subdata(in: take..<chunkedBuffer.count)
|
|
277
|
+
chunkedRemaining -= take
|
|
278
|
+
for event in parser.append(chunk) {
|
|
279
|
+
onEvent?(event.event, event.id, event.data)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
private func finish(error: Error?) {
|
|
288
|
+
if completed { return }
|
|
289
|
+
completed = true
|
|
290
|
+
let s = status
|
|
291
|
+
stage = .closed
|
|
292
|
+
connection?.cancel()
|
|
293
|
+
connection = nil
|
|
294
|
+
onComplete?(s, error)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native haptic module for iOS. Uses UIKit's haptic feedback generators
|
|
5
|
+
* (UIImpactFeedbackGenerator / UISelectionFeedbackGenerator /
|
|
6
|
+
* UINotificationFeedbackGenerator) for proper Apple-tuned haptic taps
|
|
7
|
+
* instead of a legacy AudioServicesPlaySystemSound vibration.
|
|
8
|
+
*
|
|
9
|
+
* Exposed to JS as NativeModules.MonflowtsHaptic.trigger(intensity).
|
|
10
|
+
*/
|
|
11
|
+
@objc(MonflowtsHaptic)
|
|
12
|
+
class MonflowtsHapticModule: NSObject {
|
|
13
|
+
|
|
14
|
+
@objc static func requiresMainQueueSetup() -> Bool { return true }
|
|
15
|
+
|
|
16
|
+
// Retain generators so prepare() doesn't get garbage-collected before use.
|
|
17
|
+
// `prepared` generators produce noticeably snappier feedback.
|
|
18
|
+
private let lightImpact = UIImpactFeedbackGenerator(style: .light)
|
|
19
|
+
private let mediumImpact = UIImpactFeedbackGenerator(style: .medium)
|
|
20
|
+
private let heavyImpact = UIImpactFeedbackGenerator(style: .heavy)
|
|
21
|
+
private let selectionGen = UISelectionFeedbackGenerator()
|
|
22
|
+
private let notificationGen = UINotificationFeedbackGenerator()
|
|
23
|
+
|
|
24
|
+
@objc func trigger(_ intensity: NSString) {
|
|
25
|
+
DispatchQueue.main.async { [weak self] in
|
|
26
|
+
guard let self = self else { return }
|
|
27
|
+
switch intensity as String {
|
|
28
|
+
case "light":
|
|
29
|
+
self.lightImpact.prepare()
|
|
30
|
+
self.lightImpact.impactOccurred()
|
|
31
|
+
case "medium":
|
|
32
|
+
self.mediumImpact.prepare()
|
|
33
|
+
self.mediumImpact.impactOccurred()
|
|
34
|
+
case "heavy":
|
|
35
|
+
self.heavyImpact.prepare()
|
|
36
|
+
self.heavyImpact.impactOccurred()
|
|
37
|
+
case "selection":
|
|
38
|
+
self.selectionGen.prepare()
|
|
39
|
+
self.selectionGen.selectionChanged()
|
|
40
|
+
case "success":
|
|
41
|
+
self.notificationGen.prepare()
|
|
42
|
+
self.notificationGen.notificationOccurred(.success)
|
|
43
|
+
case "warning":
|
|
44
|
+
self.notificationGen.prepare()
|
|
45
|
+
self.notificationGen.notificationOccurred(.warning)
|
|
46
|
+
case "error":
|
|
47
|
+
self.notificationGen.prepare()
|
|
48
|
+
self.notificationGen.notificationOccurred(.error)
|
|
49
|
+
default:
|
|
50
|
+
self.lightImpact.prepare()
|
|
51
|
+
self.lightImpact.impactOccurred()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(MonflowtsLottieViewManager, RCTViewManager)
|
|
4
|
+
|
|
5
|
+
RCT_EXPORT_VIEW_PROPERTY(sourceJson, NSString)
|
|
6
|
+
RCT_EXPORT_VIEW_PROPERTY(loop, BOOL)
|
|
7
|
+
RCT_EXPORT_VIEW_PROPERTY(speed, CGFloat)
|
|
8
|
+
RCT_EXPORT_VIEW_PROPERTY(autoPlay, BOOL)
|
|
9
|
+
RCT_EXPORT_VIEW_PROPERTY(playing, BOOL)
|
|
10
|
+
RCT_EXPORT_VIEW_PROPERTY(onMonflowtsAnimationFinish, RCTDirectEventBlock)
|
|
11
|
+
|
|
12
|
+
@end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import Lottie
|
|
3
|
+
import React
|
|
4
|
+
|
|
5
|
+
class MonflowtsLottieUIView: UIView {
|
|
6
|
+
|
|
7
|
+
@objc var onMonflowtsAnimationFinish: RCTDirectEventBlock?
|
|
8
|
+
|
|
9
|
+
private var animationView: LottieAnimationView?
|
|
10
|
+
private var currentSource: String?
|
|
11
|
+
private var loop = false
|
|
12
|
+
private var speed: CGFloat = 1
|
|
13
|
+
private var autoPlay = false
|
|
14
|
+
private var playing = false
|
|
15
|
+
|
|
16
|
+
override init(frame: CGRect) {
|
|
17
|
+
super.init(frame: frame)
|
|
18
|
+
backgroundColor = .clear
|
|
19
|
+
isUserInteractionEnabled = false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
required init?(coder: NSCoder) {
|
|
23
|
+
super.init(coder: coder)
|
|
24
|
+
backgroundColor = .clear
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: - Props set from RN
|
|
28
|
+
|
|
29
|
+
@objc func setSourceJson(_ json: NSString?) {
|
|
30
|
+
guard let json = json as String?, !json.isEmpty else { return }
|
|
31
|
+
if json == currentSource { return }
|
|
32
|
+
currentSource = json
|
|
33
|
+
|
|
34
|
+
animationView?.removeFromSuperview()
|
|
35
|
+
animationView = nil
|
|
36
|
+
|
|
37
|
+
guard let data = json.data(using: .utf8) else { return }
|
|
38
|
+
do {
|
|
39
|
+
let animation = try LottieAnimation.from(data: data)
|
|
40
|
+
let view = LottieAnimationView(animation: animation)
|
|
41
|
+
view.contentMode = .scaleAspectFit
|
|
42
|
+
view.backgroundBehavior = .pauseAndRestore
|
|
43
|
+
view.loopMode = loop ? .loop : .playOnce
|
|
44
|
+
view.animationSpeed = speed
|
|
45
|
+
view.translatesAutoresizingMaskIntoConstraints = false
|
|
46
|
+
addSubview(view)
|
|
47
|
+
NSLayoutConstraint.activate([
|
|
48
|
+
view.topAnchor.constraint(equalTo: topAnchor),
|
|
49
|
+
view.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
50
|
+
view.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
51
|
+
view.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
52
|
+
])
|
|
53
|
+
animationView = view
|
|
54
|
+
if autoPlay || playing {
|
|
55
|
+
play()
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
// Silently fail if JSON is invalid
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@objc func setLoop(_ loop: Bool) {
|
|
63
|
+
self.loop = loop
|
|
64
|
+
animationView?.loopMode = loop ? .loop : .playOnce
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@objc func setSpeed(_ speed: CGFloat) {
|
|
68
|
+
self.speed = speed
|
|
69
|
+
animationView?.animationSpeed = speed
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@objc func setAutoPlay(_ autoPlay: Bool) {
|
|
73
|
+
self.autoPlay = autoPlay
|
|
74
|
+
if autoPlay {
|
|
75
|
+
play()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@objc func setPlaying(_ playing: Bool) {
|
|
80
|
+
self.playing = playing
|
|
81
|
+
if playing {
|
|
82
|
+
play()
|
|
83
|
+
} else {
|
|
84
|
+
animationView?.stop()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private func play() {
|
|
89
|
+
animationView?.play { [weak self] finished in
|
|
90
|
+
if finished {
|
|
91
|
+
self?.onMonflowtsAnimationFinish?([:])
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React
|
|
2
|
+
|
|
3
|
+
@objc(MonflowtsLottieViewManager)
|
|
4
|
+
class MonflowtsLottieViewManager: RCTViewManager {
|
|
5
|
+
|
|
6
|
+
override func view() -> UIView! {
|
|
7
|
+
return MonflowtsLottieUIView()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
struct MonflowtsSSERecord {
|
|
4
|
+
let event: String?
|
|
5
|
+
let id: String?
|
|
6
|
+
let data: String?
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
final class MonflowtsSSEParser {
|
|
10
|
+
private var buffer = Data()
|
|
11
|
+
|
|
12
|
+
func append(_ incoming: Data) -> [MonflowtsSSERecord] {
|
|
13
|
+
buffer.append(incoming)
|
|
14
|
+
var records: [MonflowtsSSERecord] = []
|
|
15
|
+
let separator = Data([0x0A, 0x0A])
|
|
16
|
+
while let range = buffer.range(of: separator) {
|
|
17
|
+
let recordData = buffer.subdata(in: 0..<range.lowerBound)
|
|
18
|
+
buffer.removeSubrange(0..<range.upperBound)
|
|
19
|
+
if let record = parseRecord(recordData) {
|
|
20
|
+
records.append(record)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return records
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private func parseRecord(_ data: Data) -> MonflowtsSSERecord? {
|
|
27
|
+
guard let text = String(data: data, encoding: .utf8) else { return nil }
|
|
28
|
+
var event: String?
|
|
29
|
+
var id: String?
|
|
30
|
+
var dataLines: [String] = []
|
|
31
|
+
|
|
32
|
+
for rawLine in text.split(separator: "\n", omittingEmptySubsequences: false) {
|
|
33
|
+
let line = rawLine.hasSuffix("\r") ? String(rawLine.dropLast()) : String(rawLine)
|
|
34
|
+
if line.isEmpty || line.hasPrefix(":") { continue }
|
|
35
|
+
|
|
36
|
+
let field: String
|
|
37
|
+
var value: String
|
|
38
|
+
if let colon = line.firstIndex(of: ":") {
|
|
39
|
+
field = String(line[..<colon])
|
|
40
|
+
value = String(line[line.index(after: colon)...])
|
|
41
|
+
if value.hasPrefix(" ") { value.removeFirst() }
|
|
42
|
+
} else {
|
|
43
|
+
field = line
|
|
44
|
+
value = ""
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
switch field {
|
|
48
|
+
case "event": event = value
|
|
49
|
+
case "id": id = value
|
|
50
|
+
case "data": dataLines.append(value)
|
|
51
|
+
default: break
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if event == nil && id == nil && dataLines.isEmpty { return nil }
|
|
56
|
+
return MonflowtsSSERecord(event: event, id: id, data: dataLines.isEmpty ? nil : dataLines.joined(separator: "\n"))
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import AVFoundation
|
|
2
|
+
|
|
3
|
+
@objc(MonflowtsSound)
|
|
4
|
+
class MonflowtsSoundModule: NSObject {
|
|
5
|
+
|
|
6
|
+
private var engine: AVAudioEngine?
|
|
7
|
+
private let queue = DispatchQueue(label: "com.monflowts.sound", qos: .userInteractive)
|
|
8
|
+
|
|
9
|
+
override init() {
|
|
10
|
+
super.init()
|
|
11
|
+
engine = AVAudioEngine()
|
|
12
|
+
configureAudioSession()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private func configureAudioSession() {
|
|
16
|
+
// Use .ambient so our short UI/game tones mix with music/podcasts playing
|
|
17
|
+
// in other apps instead of interrupting or ducking them.
|
|
18
|
+
let session = AVAudioSession.sharedInstance()
|
|
19
|
+
do {
|
|
20
|
+
try session.setCategory(.ambient, mode: .default, options: [.mixWithOthers])
|
|
21
|
+
try session.setActive(true, options: [])
|
|
22
|
+
} catch {
|
|
23
|
+
// If the session can't be configured, fall through — sound will still play
|
|
24
|
+
// but may interrupt other audio on some devices.
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@objc static func requiresMainQueueSetup() -> Bool { return false }
|
|
29
|
+
|
|
30
|
+
@objc func play(_ params: NSDictionary) {
|
|
31
|
+
let waveform = params["waveform"] as? String ?? "sine"
|
|
32
|
+
let f0 = params["f0"] as? Double ?? 440.0
|
|
33
|
+
let f1 = params["f1"] as? Double ?? 440.0
|
|
34
|
+
let durMs = params["durMs"] as? Int ?? 100
|
|
35
|
+
let gain = params["gain"] as? Float ?? 0.1
|
|
36
|
+
|
|
37
|
+
queue.async { [weak self] in
|
|
38
|
+
self?.generateAndPlay(waveform: waveform, f0: Float(f0), f1: Float(f1), durMs: durMs, gain: gain)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private func generateAndPlay(waveform: String, f0: Float, f1: Float, durMs: Int, gain: Float) {
|
|
43
|
+
guard let engine = engine else { return }
|
|
44
|
+
|
|
45
|
+
let sampleRate: Double = 44100
|
|
46
|
+
let numSamples = Int(sampleRate * Double(durMs) / 1000.0)
|
|
47
|
+
var phase: Float = 0.0
|
|
48
|
+
|
|
49
|
+
let format = AVAudioFormat(standardFormatWithSampleRate: sampleRate, channels: 1)!
|
|
50
|
+
let buffer = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: AVAudioFrameCount(numSamples))!
|
|
51
|
+
buffer.frameLength = AVAudioFrameCount(numSamples)
|
|
52
|
+
|
|
53
|
+
let floatData = buffer.floatChannelData![0]
|
|
54
|
+
|
|
55
|
+
for i in 0..<numSamples {
|
|
56
|
+
let t = Float(i) / Float(numSamples)
|
|
57
|
+
let freq = f0 + (f1 - f0) * t
|
|
58
|
+
let envelope = gain * (1.0 - t * t)
|
|
59
|
+
|
|
60
|
+
let sample: Float
|
|
61
|
+
switch waveform {
|
|
62
|
+
case "sine":
|
|
63
|
+
sample = sin(phase)
|
|
64
|
+
case "triangle":
|
|
65
|
+
let triPhase: Float = phase / (2.0 * Float.pi)
|
|
66
|
+
let triVal: Float = triPhase - floor(triPhase + 0.5)
|
|
67
|
+
sample = 2.0 * abs(2.0 * triVal) - 1.0
|
|
68
|
+
case "square":
|
|
69
|
+
sample = sin(phase) >= 0 ? 1.0 : -1.0
|
|
70
|
+
case "sawtooth":
|
|
71
|
+
let sawPhase: Float = phase / (2.0 * Float.pi)
|
|
72
|
+
let sawVal: Float = sawPhase - floor(sawPhase + 0.5)
|
|
73
|
+
sample = 2.0 * sawVal
|
|
74
|
+
default:
|
|
75
|
+
sample = sin(phase)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
floatData[i] = sample * envelope
|
|
79
|
+
phase += 2 * .pi * freq / Float(sampleRate)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let playerNode = AVAudioPlayerNode()
|
|
83
|
+
engine.attach(playerNode)
|
|
84
|
+
engine.connect(playerNode, to: engine.mainMixerNode, format: format)
|
|
85
|
+
|
|
86
|
+
do {
|
|
87
|
+
if !engine.isRunning {
|
|
88
|
+
try engine.start()
|
|
89
|
+
}
|
|
90
|
+
playerNode.scheduleBuffer(buffer, completionHandler: { [weak engine] in
|
|
91
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
|
92
|
+
engine?.detach(playerNode)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
playerNode.play()
|
|
96
|
+
} catch {
|
|
97
|
+
// Silently ignore audio errors
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|