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,175 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
9
|
+
import okhttp3.Call
|
|
10
|
+
import okhttp3.Callback
|
|
11
|
+
import okhttp3.OkHttpClient
|
|
12
|
+
import okhttp3.Request
|
|
13
|
+
import okhttp3.Response
|
|
14
|
+
import org.json.JSONObject
|
|
15
|
+
import java.io.IOException
|
|
16
|
+
import java.util.concurrent.TimeUnit
|
|
17
|
+
import java.util.concurrent.atomic.AtomicBoolean
|
|
18
|
+
import java.util.concurrent.atomic.AtomicInteger
|
|
19
|
+
|
|
20
|
+
class MonflowtsCrashFeedModule(reactContext: ReactApplicationContext) :
|
|
21
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
22
|
+
|
|
23
|
+
override fun getName(): String = "MonflowtsCrashFeed"
|
|
24
|
+
|
|
25
|
+
private val client: OkHttpClient = OkHttpClient.Builder()
|
|
26
|
+
.readTimeout(0, TimeUnit.MILLISECONDS)
|
|
27
|
+
.retryOnConnectionFailure(true)
|
|
28
|
+
.build()
|
|
29
|
+
|
|
30
|
+
private val stopped = AtomicBoolean(true)
|
|
31
|
+
private val generation = AtomicInteger(0)
|
|
32
|
+
private var reconnectAttempts = 0
|
|
33
|
+
private var currentUrl: String? = null
|
|
34
|
+
@Volatile private var call: Call? = null
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
fun connect(url: String) {
|
|
38
|
+
currentUrl = url
|
|
39
|
+
stopped.set(false)
|
|
40
|
+
reconnectAttempts = 0
|
|
41
|
+
val gen = generation.incrementAndGet()
|
|
42
|
+
open(gen)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@ReactMethod
|
|
46
|
+
fun disconnect() {
|
|
47
|
+
stopped.set(true)
|
|
48
|
+
generation.incrementAndGet()
|
|
49
|
+
call?.cancel()
|
|
50
|
+
call = null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@ReactMethod
|
|
54
|
+
fun addListener(eventName: String) {}
|
|
55
|
+
|
|
56
|
+
@ReactMethod
|
|
57
|
+
fun removeListeners(count: Int) {}
|
|
58
|
+
|
|
59
|
+
private fun open(gen: Int) {
|
|
60
|
+
val url = currentUrl ?: return
|
|
61
|
+
if (stopped.get() || gen != generation.get()) return
|
|
62
|
+
val request = Request.Builder()
|
|
63
|
+
.url(url)
|
|
64
|
+
.header("Accept", "text/event-stream")
|
|
65
|
+
.header("Cache-Control", "no-cache")
|
|
66
|
+
.build()
|
|
67
|
+
val newCall = client.newCall(request)
|
|
68
|
+
call = newCall
|
|
69
|
+
newCall.enqueue(object : Callback {
|
|
70
|
+
override fun onFailure(call: Call, e: IOException) {
|
|
71
|
+
emitStatus(false)
|
|
72
|
+
scheduleReconnect(gen)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
override fun onResponse(call: Call, response: Response) {
|
|
76
|
+
response.use { resp ->
|
|
77
|
+
if (!resp.isSuccessful) {
|
|
78
|
+
emitStatus(false)
|
|
79
|
+
scheduleReconnect(gen)
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
reconnectAttempts = 0
|
|
83
|
+
emitStatus(true)
|
|
84
|
+
val source = resp.body?.source() ?: return
|
|
85
|
+
val lines = ArrayList<String>()
|
|
86
|
+
try {
|
|
87
|
+
while (!stopped.get() && gen == generation.get()) {
|
|
88
|
+
val line = source.readUtf8Line() ?: break
|
|
89
|
+
if (line.isEmpty()) {
|
|
90
|
+
emitRecord(lines)
|
|
91
|
+
lines.clear()
|
|
92
|
+
} else {
|
|
93
|
+
lines.add(line)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (_: IOException) {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
emitStatus(false)
|
|
100
|
+
scheduleReconnect(gen)
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private fun scheduleReconnect(gen: Int) {
|
|
106
|
+
if (stopped.get() || gen != generation.get()) return
|
|
107
|
+
val attempt = reconnectAttempts
|
|
108
|
+
reconnectAttempts += 1
|
|
109
|
+
val delayMs = Math.min(Math.pow(2.0, attempt.toDouble()).toLong() * 1000L, 30_000L)
|
|
110
|
+
Thread {
|
|
111
|
+
try {
|
|
112
|
+
Thread.sleep(delayMs)
|
|
113
|
+
} catch (_: InterruptedException) {
|
|
114
|
+
return@Thread
|
|
115
|
+
}
|
|
116
|
+
if (!stopped.get() && gen == generation.get()) open(gen)
|
|
117
|
+
}.start()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private fun emitRecord(lines: List<String>) {
|
|
121
|
+
var event: String? = null
|
|
122
|
+
val dataLines = ArrayList<String>()
|
|
123
|
+
for (raw in lines) {
|
|
124
|
+
if (raw.startsWith(":")) continue
|
|
125
|
+
val colon = raw.indexOf(':')
|
|
126
|
+
val field: String
|
|
127
|
+
var value: String
|
|
128
|
+
if (colon >= 0) {
|
|
129
|
+
field = raw.substring(0, colon)
|
|
130
|
+
value = raw.substring(colon + 1)
|
|
131
|
+
if (value.startsWith(" ")) value = value.substring(1)
|
|
132
|
+
} else {
|
|
133
|
+
field = raw
|
|
134
|
+
value = ""
|
|
135
|
+
}
|
|
136
|
+
when (field) {
|
|
137
|
+
"event" -> event = value
|
|
138
|
+
"data" -> dataLines.add(value)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (event != "crash.cashout" || dataLines.isEmpty()) return
|
|
142
|
+
val payload = dataLines.joinToString("\n")
|
|
143
|
+
val map = jsonToMap(payload) ?: return
|
|
144
|
+
emit("MonflowtsCrashCashout", map)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private fun jsonToMap(json: String): WritableMap? {
|
|
148
|
+
return try {
|
|
149
|
+
val obj = JSONObject(json)
|
|
150
|
+
val map = Arguments.createMap()
|
|
151
|
+
map.putString("kind", obj.optString("kind", "bot"))
|
|
152
|
+
map.putString("displayName", obj.optString("displayName", "Player"))
|
|
153
|
+
map.putDouble("multiplier", obj.optDouble("multiplier", 0.0))
|
|
154
|
+
map.putDouble("amountWonKobo", obj.optDouble("amountWonKobo", 0.0))
|
|
155
|
+
map.putDouble("stakeKobo", obj.optDouble("stakeKobo", 0.0))
|
|
156
|
+
map.putDouble("at", obj.optDouble("at", 0.0))
|
|
157
|
+
map
|
|
158
|
+
} catch (_: Exception) {
|
|
159
|
+
null
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private fun emitStatus(connected: Boolean) {
|
|
164
|
+
val map = Arguments.createMap()
|
|
165
|
+
map.putBoolean("connected", connected)
|
|
166
|
+
emit("MonflowtsCrashFeedStatus", map)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private fun emit(name: String, body: WritableMap) {
|
|
170
|
+
if (!reactApplicationContext.hasActiveReactInstance()) return
|
|
171
|
+
reactApplicationContext
|
|
172
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
173
|
+
.emit(name, body)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.media.AudioAttributes
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.os.VibrationAttributes
|
|
7
|
+
import android.os.VibrationEffect
|
|
8
|
+
import android.os.Vibrator
|
|
9
|
+
import android.os.VibratorManager
|
|
10
|
+
import android.util.Log
|
|
11
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
13
|
+
import com.facebook.react.bridge.ReactMethod
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Native haptic module. Routes through the OS haptic feedback pipeline
|
|
17
|
+
* (VibrationEffect.EFFECT_* on API 29+) for crisp taps instead of a dumb
|
|
18
|
+
* timed motor burst. Falls back to duration-based vibrate() on older APIs
|
|
19
|
+
* and on devices whose HAL doesn't implement the requested predefined effect.
|
|
20
|
+
*
|
|
21
|
+
* Exposed to JS as NativeModules.MonflowtsHaptic.trigger(intensity).
|
|
22
|
+
*/
|
|
23
|
+
class MonflowtsHapticModule(reactContext: ReactApplicationContext) :
|
|
24
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
25
|
+
|
|
26
|
+
override fun getName(): String = "MonflowtsHaptic"
|
|
27
|
+
|
|
28
|
+
companion object {
|
|
29
|
+
private const val TAG = "MonflowtsHaptic"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private val vibrator: Vibrator? by lazy {
|
|
33
|
+
try {
|
|
34
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
35
|
+
val manager = reactApplicationContext
|
|
36
|
+
.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as? VibratorManager
|
|
37
|
+
manager?.defaultVibrator
|
|
38
|
+
} else {
|
|
39
|
+
@Suppress("DEPRECATION")
|
|
40
|
+
reactApplicationContext.getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator
|
|
41
|
+
}
|
|
42
|
+
} catch (e: Exception) {
|
|
43
|
+
Log.w(TAG, "Could not acquire vibrator service", e)
|
|
44
|
+
null
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// USAGE_TOUCH tells the OS this is UI haptic feedback (not a notification
|
|
49
|
+
// or alarm), so the "Touch feedback" toggle — not general Vibration — gates it.
|
|
50
|
+
// Without this, many OEM HALs (MIUI, ColorOS) classify the call as
|
|
51
|
+
// USAGE_UNKNOWN and silently drop it.
|
|
52
|
+
private val audioAttrs: AudioAttributes = AudioAttributes.Builder()
|
|
53
|
+
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
|
|
54
|
+
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
|
55
|
+
.build()
|
|
56
|
+
|
|
57
|
+
@ReactMethod
|
|
58
|
+
fun trigger(intensity: String) {
|
|
59
|
+
val v = vibrator
|
|
60
|
+
if (v == null) {
|
|
61
|
+
Log.w(TAG, "trigger($intensity): vibrator service unavailable")
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
if (!v.hasVibrator()) {
|
|
65
|
+
Log.w(TAG, "trigger($intensity): device has no vibrator")
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
when {
|
|
71
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> triggerModern(v, intensity)
|
|
72
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> triggerOneShot(v, intensity)
|
|
73
|
+
else -> triggerLegacy(v, intensity)
|
|
74
|
+
}
|
|
75
|
+
} catch (e: Exception) {
|
|
76
|
+
Log.w(TAG, "Haptic trigger failed for $intensity", e)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** API 29+ — uses OS-defined haptic primitives with supported-effect fallback. */
|
|
81
|
+
private fun triggerModern(v: Vibrator, intensity: String) {
|
|
82
|
+
val effectId = when (intensity) {
|
|
83
|
+
"selection", "light" -> VibrationEffect.EFFECT_TICK
|
|
84
|
+
"medium", "success" -> VibrationEffect.EFFECT_CLICK
|
|
85
|
+
"heavy", "warning", "error" -> VibrationEffect.EFFECT_HEAVY_CLICK
|
|
86
|
+
else -> VibrationEffect.EFFECT_CLICK
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Not every OEM's HAL implements every predefined effect. Check first
|
|
90
|
+
// on API 30+; if unsupported, route through createOneShot so we still
|
|
91
|
+
// get feedback instead of a silent no-op.
|
|
92
|
+
val supported = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
93
|
+
try {
|
|
94
|
+
val results = v.areEffectsSupported(effectId)
|
|
95
|
+
results.isNotEmpty() && results[0] == Vibrator.VIBRATION_EFFECT_SUPPORT_YES
|
|
96
|
+
} catch (e: Exception) {
|
|
97
|
+
Log.w(TAG, "areEffectsSupported threw, assuming supported", e)
|
|
98
|
+
true
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
true
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!supported) {
|
|
105
|
+
Log.d(TAG, "predefined effect $effectId unsupported on this device — using one-shot fallback")
|
|
106
|
+
triggerOneShot(v, intensity)
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
val effect = VibrationEffect.createPredefined(effectId)
|
|
111
|
+
vibrateWithAttrs(v, effect)
|
|
112
|
+
|
|
113
|
+
// "error" gets a double-tap pattern for stronger distinction
|
|
114
|
+
if (intensity == "error") {
|
|
115
|
+
try {
|
|
116
|
+
Thread.sleep(60)
|
|
117
|
+
vibrateWithAttrs(v, VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK))
|
|
118
|
+
} catch (_: InterruptedException) { /* ignore */ }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** API 26-28 (or fallback on API 29+) — one-shot with amplitude. */
|
|
123
|
+
private fun triggerOneShot(v: Vibrator, intensity: String) {
|
|
124
|
+
val (durationMs, amplitude) = when (intensity) {
|
|
125
|
+
"selection" -> Pair(20L, 120)
|
|
126
|
+
"light" -> Pair(30L, 140)
|
|
127
|
+
"medium" -> Pair(50L, 180)
|
|
128
|
+
"heavy" -> Pair(80L, 255)
|
|
129
|
+
"success" -> Pair(40L, 160)
|
|
130
|
+
"warning" -> Pair(60L, 220)
|
|
131
|
+
"error" -> Pair(100L, 255)
|
|
132
|
+
else -> Pair(30L, 140)
|
|
133
|
+
}
|
|
134
|
+
val effect = VibrationEffect.createOneShot(durationMs, amplitude)
|
|
135
|
+
vibrateWithAttrs(v, effect)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** API <26 — legacy duration-only vibrate. */
|
|
139
|
+
@Suppress("DEPRECATION")
|
|
140
|
+
private fun triggerLegacy(v: Vibrator, intensity: String) {
|
|
141
|
+
val durationMs = when (intensity) {
|
|
142
|
+
"selection" -> 20L
|
|
143
|
+
"light" -> 30L
|
|
144
|
+
"medium" -> 50L
|
|
145
|
+
"heavy" -> 80L
|
|
146
|
+
"success" -> 40L
|
|
147
|
+
"warning" -> 60L
|
|
148
|
+
"error" -> 100L
|
|
149
|
+
else -> 30L
|
|
150
|
+
}
|
|
151
|
+
v.vibrate(durationMs)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Route the vibration with USAGE_TOUCH attributes so the OS honours it as
|
|
156
|
+
* UI haptic feedback. On API 33+ use VibrationAttributes; older APIs use
|
|
157
|
+
* AudioAttributes (still supported via the legacy vibrate overload).
|
|
158
|
+
*/
|
|
159
|
+
private fun vibrateWithAttrs(v: Vibrator, effect: VibrationEffect) {
|
|
160
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
161
|
+
val vibAttrs = VibrationAttributes.Builder()
|
|
162
|
+
.setUsage(VibrationAttributes.USAGE_TOUCH)
|
|
163
|
+
.build()
|
|
164
|
+
v.vibrate(effect, vibAttrs)
|
|
165
|
+
} else {
|
|
166
|
+
@Suppress("DEPRECATION")
|
|
167
|
+
v.vibrate(effect, audioAttrs)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import android.animation.Animator
|
|
4
|
+
import android.animation.AnimatorListenerAdapter
|
|
5
|
+
import android.content.Context
|
|
6
|
+
import android.util.AttributeSet
|
|
7
|
+
import android.util.Log
|
|
8
|
+
import android.widget.FrameLayout
|
|
9
|
+
import com.facebook.react.bridge.Arguments
|
|
10
|
+
import com.facebook.react.bridge.ReactContext
|
|
11
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
12
|
+
import java.io.ByteArrayInputStream
|
|
13
|
+
|
|
14
|
+
class MonflowtsLottieView @JvmOverloads constructor(
|
|
15
|
+
context: Context,
|
|
16
|
+
attrs: AttributeSet? = null,
|
|
17
|
+
defStyleAttr: Int = 0
|
|
18
|
+
) : FrameLayout(context, attrs, defStyleAttr) {
|
|
19
|
+
|
|
20
|
+
private var animationView: com.airbnb.lottie.LottieAnimationView? = null
|
|
21
|
+
private var currentSource: String? = null
|
|
22
|
+
private var isLoop = false
|
|
23
|
+
private var isAutoPlay = false
|
|
24
|
+
private var lottieAvailable = false
|
|
25
|
+
|
|
26
|
+
init {
|
|
27
|
+
setBackgroundColor(android.graphics.Color.TRANSPARENT)
|
|
28
|
+
try {
|
|
29
|
+
val view = com.airbnb.lottie.LottieAnimationView(context).apply {
|
|
30
|
+
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
|
31
|
+
addAnimatorListener(object : AnimatorListenerAdapter() {
|
|
32
|
+
override fun onAnimationEnd(animation: Animator) {
|
|
33
|
+
sendAnimationFinish()
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
animationView = view
|
|
38
|
+
addView(view)
|
|
39
|
+
lottieAvailable = true
|
|
40
|
+
} catch (e: NoClassDefFoundError) {
|
|
41
|
+
Log.e(
|
|
42
|
+
"Monflowts",
|
|
43
|
+
"Lottie library not found. Add com.airbnb.android:lottie:6.x to your app's build.gradle.",
|
|
44
|
+
e
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private fun sendAnimationFinish() {
|
|
50
|
+
(context as? ReactContext)
|
|
51
|
+
?.getJSModule(RCTEventEmitter::class.java)
|
|
52
|
+
?.receiveEvent(id, "topMonflowtsAnimationFinish", Arguments.createMap())
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun setSourceJson(json: String?) {
|
|
56
|
+
if (!lottieAvailable) return
|
|
57
|
+
if (json.isNullOrEmpty() || json == currentSource) return
|
|
58
|
+
currentSource = json
|
|
59
|
+
|
|
60
|
+
val stream = ByteArrayInputStream(json.toByteArray(Charsets.UTF_8))
|
|
61
|
+
val task = com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStream(stream, null)
|
|
62
|
+
task.addListener { composition ->
|
|
63
|
+
animationView?.setComposition(composition)
|
|
64
|
+
animationView?.repeatCount = if (isLoop) com.airbnb.lottie.LottieDrawable.INFINITE else 0
|
|
65
|
+
if (isAutoPlay) {
|
|
66
|
+
animationView?.playAnimation()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fun setLoop(loop: Boolean) {
|
|
72
|
+
isLoop = loop
|
|
73
|
+
animationView?.repeatCount = if (loop) com.airbnb.lottie.LottieDrawable.INFINITE else 0
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fun setSpeed(speed: Float) {
|
|
77
|
+
animationView?.speed = speed
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
fun setAutoPlay(autoPlay: Boolean) {
|
|
81
|
+
isAutoPlay = autoPlay
|
|
82
|
+
if (autoPlay && animationView?.composition != null) {
|
|
83
|
+
animationView?.playAnimation()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
fun setPlaying(playing: Boolean) {
|
|
88
|
+
if (!lottieAvailable) return
|
|
89
|
+
if (playing) {
|
|
90
|
+
animationView?.playAnimation()
|
|
91
|
+
} else {
|
|
92
|
+
animationView?.cancelAnimation()
|
|
93
|
+
animationView?.progress = 0f
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.common.MapBuilder
|
|
4
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
|
+
|
|
9
|
+
@ReactModule(name = MonflowtsLottieViewManager.NAME)
|
|
10
|
+
class MonflowtsLottieViewManager : SimpleViewManager<MonflowtsLottieView>() {
|
|
11
|
+
|
|
12
|
+
companion object {
|
|
13
|
+
const val NAME = "MonflowtsLottieView"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun getName(): String = NAME
|
|
17
|
+
|
|
18
|
+
override fun createViewInstance(context: ThemedReactContext): MonflowtsLottieView {
|
|
19
|
+
return MonflowtsLottieView(context)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@ReactProp(name = "sourceJson")
|
|
23
|
+
fun setSourceJson(view: MonflowtsLottieView, json: String?) {
|
|
24
|
+
view.setSourceJson(json)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@ReactProp(name = "loop")
|
|
28
|
+
fun setLoop(view: MonflowtsLottieView, loop: Boolean) {
|
|
29
|
+
view.setLoop(loop)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@ReactProp(name = "speed", defaultFloat = 1f)
|
|
33
|
+
fun setSpeed(view: MonflowtsLottieView, speed: Float) {
|
|
34
|
+
view.setSpeed(speed)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@ReactProp(name = "autoPlay")
|
|
38
|
+
fun setAutoPlay(view: MonflowtsLottieView, autoPlay: Boolean) {
|
|
39
|
+
view.setAutoPlay(autoPlay)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@ReactProp(name = "playing")
|
|
43
|
+
fun setPlaying(view: MonflowtsLottieView, playing: Boolean) {
|
|
44
|
+
view.setPlaying(playing)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? {
|
|
48
|
+
return MapBuilder.builder<String, Any>()
|
|
49
|
+
.put("topMonflowtsAnimationFinish", MapBuilder.of("registrationName", "onMonflowtsAnimationFinish"))
|
|
50
|
+
.build()
|
|
51
|
+
.toMutableMap()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager
|
|
9
|
+
|
|
10
|
+
class MonflowtsViewPackage : BaseReactPackage() {
|
|
11
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
12
|
+
return listOf(MonflowtsWheelViewManager(), MonflowtsSvgViewManager(), MonflowtsLottieViewManager(), MonflowtsWebViewManager())
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
16
|
+
return when (name) {
|
|
17
|
+
"MonflowtsSound" -> MonflowtsSoundModule(reactContext)
|
|
18
|
+
"MonflowtsHaptic" -> MonflowtsHapticModule(reactContext)
|
|
19
|
+
"MonflowtsCrashFeed" -> MonflowtsCrashFeedModule(reactContext)
|
|
20
|
+
"MonflowtsSpeech" -> MonflowtsSpeechModule(reactContext)
|
|
21
|
+
"MonflowtsAssets" -> MonflowtsAssetsModule(reactContext)
|
|
22
|
+
else -> null
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
27
|
+
mapOf(
|
|
28
|
+
"MonflowtsSound" to ReactModuleInfo(
|
|
29
|
+
"MonflowtsSound",
|
|
30
|
+
MonflowtsSoundModule::class.java.name,
|
|
31
|
+
false, // canOverrideExistingModule
|
|
32
|
+
false, // needsEagerInit
|
|
33
|
+
false, // isCxxModule
|
|
34
|
+
false // isTurboModule
|
|
35
|
+
),
|
|
36
|
+
"MonflowtsHaptic" to ReactModuleInfo(
|
|
37
|
+
"MonflowtsHaptic",
|
|
38
|
+
MonflowtsHapticModule::class.java.name,
|
|
39
|
+
false,
|
|
40
|
+
false,
|
|
41
|
+
false,
|
|
42
|
+
false
|
|
43
|
+
),
|
|
44
|
+
"MonflowtsCrashFeed" to ReactModuleInfo(
|
|
45
|
+
"MonflowtsCrashFeed",
|
|
46
|
+
MonflowtsCrashFeedModule::class.java.name,
|
|
47
|
+
false,
|
|
48
|
+
false,
|
|
49
|
+
false,
|
|
50
|
+
false
|
|
51
|
+
),
|
|
52
|
+
"MonflowtsSpeech" to ReactModuleInfo(
|
|
53
|
+
"MonflowtsSpeech",
|
|
54
|
+
MonflowtsSpeechModule::class.java.name,
|
|
55
|
+
false,
|
|
56
|
+
false,
|
|
57
|
+
false,
|
|
58
|
+
false
|
|
59
|
+
),
|
|
60
|
+
"MonflowtsAssets" to ReactModuleInfo(
|
|
61
|
+
"MonflowtsAssets",
|
|
62
|
+
MonflowtsAssetsModule::class.java.name,
|
|
63
|
+
false,
|
|
64
|
+
false,
|
|
65
|
+
false,
|
|
66
|
+
false
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import android.media.AudioAttributes
|
|
4
|
+
import android.media.AudioFormat
|
|
5
|
+
import android.media.AudioTrack
|
|
6
|
+
import android.util.Log
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.facebook.react.bridge.ReactMethod
|
|
10
|
+
import com.facebook.react.bridge.ReadableMap
|
|
11
|
+
import java.util.concurrent.LinkedBlockingQueue
|
|
12
|
+
import java.util.concurrent.ThreadPoolExecutor
|
|
13
|
+
import java.util.concurrent.TimeUnit
|
|
14
|
+
import kotlin.math.PI
|
|
15
|
+
import kotlin.math.sin
|
|
16
|
+
|
|
17
|
+
class MonflowtsSoundModule(reactContext: ReactApplicationContext) :
|
|
18
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
19
|
+
|
|
20
|
+
override fun getName(): String = "MonflowtsSound"
|
|
21
|
+
|
|
22
|
+
companion object {
|
|
23
|
+
private const val TAG = "MonflowtsSound"
|
|
24
|
+
private const val SAMPLE_RATE = 44100
|
|
25
|
+
|
|
26
|
+
// JS `gain` values (0.05–0.14) are tuned for iOS's AVAudioEngine, which
|
|
27
|
+
// plays through the media stream at a higher apparent loudness than
|
|
28
|
+
// Android's USAGE_ASSISTANCE_SONIFICATION stream. Boost in native so
|
|
29
|
+
// callers don't need platform-specific gain tables.
|
|
30
|
+
private const val VOLUME_BOOST = 4.0f
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// USAGE_ASSISTANCE_SONIFICATION + CONTENT_TYPE_SONIFICATION tells the OS these
|
|
34
|
+
// are short UI tones that should mix with music instead of ducking or
|
|
35
|
+
// interrupting it. We deliberately never call requestAudioFocus().
|
|
36
|
+
private val audioAttrs = AudioAttributes.Builder()
|
|
37
|
+
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
|
|
38
|
+
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
|
39
|
+
.build()
|
|
40
|
+
|
|
41
|
+
private val audioFormat = AudioFormat.Builder()
|
|
42
|
+
.setSampleRate(SAMPLE_RATE)
|
|
43
|
+
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
|
|
44
|
+
.setChannelMask(AudioFormat.CHANNEL_OUT_MONO)
|
|
45
|
+
.build()
|
|
46
|
+
|
|
47
|
+
// 4 concurrent sounds max, 2 queued max — excess is silently dropped
|
|
48
|
+
private val executor = ThreadPoolExecutor(
|
|
49
|
+
4, 4, 0L, TimeUnit.MILLISECONDS,
|
|
50
|
+
LinkedBlockingQueue(2),
|
|
51
|
+
ThreadPoolExecutor.DiscardOldestPolicy()
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
@ReactMethod
|
|
55
|
+
fun play(params: ReadableMap) {
|
|
56
|
+
val waveform = params.getString("waveform") ?: "sine"
|
|
57
|
+
val f0 = params.getDouble("f0").toFloat()
|
|
58
|
+
val f1 = params.getDouble("f1").toFloat()
|
|
59
|
+
val durMs = params.getInt("durMs")
|
|
60
|
+
val gain = params.getDouble("gain").toFloat()
|
|
61
|
+
|
|
62
|
+
executor.execute {
|
|
63
|
+
try {
|
|
64
|
+
generateAndPlay(waveform, f0, f1, durMs, gain)
|
|
65
|
+
} catch (e: Exception) {
|
|
66
|
+
Log.w(TAG, "Sound playback failed", e)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private fun generateAndPlay(
|
|
72
|
+
waveform: String,
|
|
73
|
+
f0: Float,
|
|
74
|
+
f1: Float,
|
|
75
|
+
durMs: Int,
|
|
76
|
+
gain: Float
|
|
77
|
+
) {
|
|
78
|
+
val numSamples = (SAMPLE_RATE * durMs / 1000.0).toInt()
|
|
79
|
+
if (numSamples <= 0) return
|
|
80
|
+
|
|
81
|
+
val buffer = ShortArray(numSamples)
|
|
82
|
+
var phase = 0.0
|
|
83
|
+
|
|
84
|
+
for (i in 0 until numSamples) {
|
|
85
|
+
val t = i.toFloat() / numSamples
|
|
86
|
+
val freq = f0 + (f1 - f0) * t
|
|
87
|
+
val envelope = gain * (1.0f - t * t)
|
|
88
|
+
|
|
89
|
+
val sample = when (waveform) {
|
|
90
|
+
"sine" -> sin(phase).toFloat()
|
|
91
|
+
"triangle" -> (2.0f * Math.abs(2.0 * (phase / (2 * PI) - Math.floor(phase / (2 * PI) + 0.5))).toFloat() - 1.0f)
|
|
92
|
+
"square" -> if (sin(phase) >= 0) 1.0f else -1.0f
|
|
93
|
+
"sawtooth" -> (2.0f * (phase / (2 * PI) - Math.floor(phase / (2 * PI) + 0.5))).toFloat()
|
|
94
|
+
else -> sin(phase).toFloat()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
val amp = sample * envelope * VOLUME_BOOST * Short.MAX_VALUE
|
|
98
|
+
// Clip to avoid overflow if overlapping layers + boost push past Short range
|
|
99
|
+
buffer[i] = amp.coerceIn(Short.MIN_VALUE.toFloat(), Short.MAX_VALUE.toFloat()).toInt().toShort()
|
|
100
|
+
phase += 2 * PI * freq / SAMPLE_RATE
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
val bufferBytes = buffer.size * 2
|
|
104
|
+
val minBuf = AudioTrack.getMinBufferSize(
|
|
105
|
+
SAMPLE_RATE,
|
|
106
|
+
AudioFormat.CHANNEL_OUT_MONO,
|
|
107
|
+
AudioFormat.ENCODING_PCM_16BIT
|
|
108
|
+
)
|
|
109
|
+
val trackBufSize = maxOf(bufferBytes, minBuf)
|
|
110
|
+
|
|
111
|
+
val audioTrack = AudioTrack.Builder()
|
|
112
|
+
.setAudioAttributes(audioAttrs)
|
|
113
|
+
.setAudioFormat(audioFormat)
|
|
114
|
+
.setBufferSizeInBytes(trackBufSize)
|
|
115
|
+
.setTransferMode(AudioTrack.MODE_STREAM)
|
|
116
|
+
.build()
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
audioTrack.play()
|
|
120
|
+
audioTrack.write(buffer, 0, buffer.size)
|
|
121
|
+
// Wait for playback to finish
|
|
122
|
+
Thread.sleep(durMs.toLong() + 30)
|
|
123
|
+
} finally {
|
|
124
|
+
try { audioTrack.stop() } catch (_: Exception) {}
|
|
125
|
+
audioTrack.release()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
override fun onCatalystInstanceDestroy() {
|
|
130
|
+
executor.shutdownNow()
|
|
131
|
+
}
|
|
132
|
+
}
|