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
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lawrence
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "Monflowts"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://gitlab.com/vetrix2/vetrix-games-sdk.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
s.dependency 'lottie-ios', '~> 4.0'
|
|
20
|
+
|
|
21
|
+
install_modules_dependencies(s)
|
|
22
|
+
end
|
package/README.md
CHANGED
|
@@ -1,3 +1,230 @@
|
|
|
1
|
-
#
|
|
1
|
+
# react-native-monflowts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
SDK for Monflowts Hub — a collection of interactive mini-games (Millionaire Hunter, Fortune Wheel, Dice, Trivia, Raffle Draw, and more) for React Native apps.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install react-native-monflowts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### iOS
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
cd ios && pod install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The SDK depends on **lottie-ios 4.x** (declared in the podspec as `~> 4.0`). CocoaPods resolves this automatically. If your app already uses `lottie-ios` or `lottie-react-native`, it will share the same copy — no conflicts as long as you're on lottie-ios 4.x.
|
|
18
|
+
|
|
19
|
+
### Android
|
|
20
|
+
|
|
21
|
+
No extra setup required. The SDK ships with **Lottie 6.6.2** by default.
|
|
22
|
+
|
|
23
|
+
#### Overriding the Lottie version
|
|
24
|
+
|
|
25
|
+
If your app already uses a different version of Lottie (e.g. via `lottie-react-native` or a direct dependency), you can override the version used by the SDK. Add this to your **root** `build.gradle` (or `build.gradle.kts`):
|
|
26
|
+
|
|
27
|
+
```groovy
|
|
28
|
+
// android/build.gradle
|
|
29
|
+
ext {
|
|
30
|
+
lottieVersion = "6.4.0" // your preferred version (must be 6.x)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The SDK reads `rootProject.ext.lottieVersion` at build time. If not set, it falls back to its built-in default (`6.6.2`). This follows the same pattern used for `kotlinVersion`, `compileSdkVersion`, and other overridable properties.
|
|
35
|
+
|
|
36
|
+
> **Note:** The SDK requires Lottie **6.x** APIs. Versions below 6.0.0 are not supported.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Basic
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { MonflowtsHub } from 'react-native-monflowts';
|
|
44
|
+
|
|
45
|
+
export default function App() {
|
|
46
|
+
return (
|
|
47
|
+
<MonflowtsHub
|
|
48
|
+
apiUrl="https://your-api.example.com/service"
|
|
49
|
+
externalToken={userAuthToken}
|
|
50
|
+
projectId="monflowts"
|
|
51
|
+
language="en"
|
|
52
|
+
realtimeUrl="https://games-api.example.com"
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### With all options
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { MonflowtsHub } from 'react-native-monflowts';
|
|
62
|
+
|
|
63
|
+
export default function App() {
|
|
64
|
+
return (
|
|
65
|
+
<MonflowtsHub
|
|
66
|
+
apiUrl="https://your-api.example.com/service"
|
|
67
|
+
externalToken={userAuthToken}
|
|
68
|
+
projectId="monflowts"
|
|
69
|
+
language="en"
|
|
70
|
+
onExit={() => navigation.goBack()}
|
|
71
|
+
onError={(error) => console.error('Session error:', error)}
|
|
72
|
+
disableSound={false}
|
|
73
|
+
enableHaptic={true}
|
|
74
|
+
theme={{
|
|
75
|
+
colors: {
|
|
76
|
+
primary: '#6C63FF',
|
|
77
|
+
accent: '#FFD700',
|
|
78
|
+
background: '#0A0A2E',
|
|
79
|
+
},
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Props
|
|
87
|
+
|
|
88
|
+
| Prop | Type | Required | Default | Description |
|
|
89
|
+
|------|------|----------|---------|-------------|
|
|
90
|
+
| `apiUrl` | `string` | Yes | — | API endpoint URL. |
|
|
91
|
+
| `externalToken` | `string` | Yes | — | Auth token from the host app, used to initialize a player session. |
|
|
92
|
+
| `projectId` | `string` | Yes | — | SDK project configured in the admin dashboard; selects the loading screen and project configuration. |
|
|
93
|
+
| `language` | `string` | Yes | — | ISO 639 code of a language enabled in the admin dashboard (`en`, `ar`, `de`, `es`, `fr`, `ha`, `he`, `ig`, `it`, `pcm`, `yo`, `zh`, or any language added later). All text comes from the server; `ar` and `he` render right-to-left. An unavailable language calls `onError` with `code: 'LANGUAGE_UNAVAILABLE'` instead of falling back. |
|
|
94
|
+
| `mToken` | `string` | No | — | MoniFlow token passed to the NetApps Pay checkout when the player tops up their wallet. |
|
|
95
|
+
| `realtimeUrl` | `string` | No | — | REST API base URL for one-time-ticket-authenticated realtime wallet and game events. |
|
|
96
|
+
| `onExit` | `() => void` | No | — | Called when the user taps "Logout" on the Profile screen. Use this to navigate away from the hub. |
|
|
97
|
+
| `onError` | `(error: Error \| string) => void` | No | — | Called when session initialization fails. Receives the error. |
|
|
98
|
+
| `onDepositRequested` | `() => void` | No | — | Called when the user initiates a deposit. |
|
|
99
|
+
| `onWithdrawRequested` | `() => void` | No | — | Called when the user initiates a withdrawal. |
|
|
100
|
+
| `disableSound` | `boolean` | No | `false` | Suppress all button/UI sound effects across the SDK. |
|
|
101
|
+
| `enableHaptic` | `boolean` | No | `true` | Whether haptic feedback fires on press across the SDK. |
|
|
102
|
+
| `theme` | `Partial<MonflowtsTheme>` | No | — | Theme color overrides. |
|
|
103
|
+
|
|
104
|
+
> **Note:** Device analytics (OS, version, screen resolution, timezone, etc.) are collected automatically by the SDK — no configuration needed.
|
|
105
|
+
|
|
106
|
+
## Server-driven content
|
|
107
|
+
|
|
108
|
+
The SDK ships no game content. The only things compiled in are the bootstrap screen shown before content arrives (a blank screen, then the server-defined loading screen, plus a retry/exit fallback that uses three icons and no text). Everything else comes from the server and lives in one folder, `remote-assets/`:
|
|
109
|
+
|
|
110
|
+
| Folder | What it holds | How it reaches the app |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| `i18n/<code>.json` | One flat `{ "key": "text" }` dictionary per ISO 639 language (`en`, `ar`, `pcm`, …). `en` defines the keys every language must have. | Translations API; served per language at launch |
|
|
113
|
+
| `lottie/*.json` | Animations, including visual effects (`fx_*`) | Game assets |
|
|
114
|
+
| `images/*.png` | Images | Game assets |
|
|
115
|
+
| `voice/*.mp3` | Voice clips. English uses `voice/<clip>`, other languages `voice/<lang>-<clip>`; a language without clips plays none. | Game assets |
|
|
116
|
+
| `data/*.json` | Colour palette, icons, sound definitions, visual-effect variants and per-game/wallet configuration | Game assets |
|
|
117
|
+
|
|
118
|
+
To publish: open the admin dashboard, go to **Game Content → Folder upload**, pick the `remote-assets` folder, review the changes (new languages, added or changed keys, added or changed assets) and press **Publish**. Complete languages go live immediately; new SDK releases are not needed for new languages, translations or content changes.
|
|
119
|
+
|
|
120
|
+
After adding asset or data files, run `npm run assets:keys` to regenerate `src/assets/assetKeys.ts` (keys listed there are required on the device).
|
|
121
|
+
|
|
122
|
+
## Game assets
|
|
123
|
+
|
|
124
|
+
Game animations, images and voice clips are no longer bundled in the package. On first launch the SDK downloads them (about 5 MB) during the splash screen, using short-lived links returned at sign-in, and stores them in the app's private storage. Later launches start from the stored files, even offline, and pick up asset updates in the background.
|
|
125
|
+
|
|
126
|
+
- The SDK includes a new native module, `MonflowtsAssets`. After upgrading, rebuild the app once (`pod install` for iOS, a Gradle build for Android). A JavaScript reload alone is not enough.
|
|
127
|
+
- If the first download fails, the splash shows the reason with Retry and Exit.
|
|
128
|
+
- Assets are published from gql-server with `npm run assets:publish -- --dir <path to this repo>/remote-assets`. Publish before releasing an SDK version that needs new assets.
|
|
129
|
+
- After adding files to `remote-assets/`, run `npm run assets:keys` to regenerate `src/assets/assetKeys.ts`.
|
|
130
|
+
|
|
131
|
+
## Sound & Haptics
|
|
132
|
+
|
|
133
|
+
Every clickable surface inside the SDK plays a short click sound and fires a light haptic tap by default. You can control this at three levels.
|
|
134
|
+
|
|
135
|
+
### 1. SDK-wide (via `MonflowtsHub` props)
|
|
136
|
+
|
|
137
|
+
Simplest — flip the flags on the host component:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<MonflowtsHub
|
|
141
|
+
apiUrl="..."
|
|
142
|
+
externalToken={token}
|
|
143
|
+
projectId="monflowts"
|
|
144
|
+
language="en"
|
|
145
|
+
disableSound // all SDK buttons stay silent
|
|
146
|
+
enableHaptic={false} // all SDK buttons skip haptic
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
These map onto the `sounds` and `haptics` singletons (see below), so the effect is immediate and global.
|
|
151
|
+
|
|
152
|
+
### 2. Programmatic (singletons)
|
|
153
|
+
|
|
154
|
+
The SDK exports two singletons for runtime control — e.g. reacting to the user's "Sound Off" toggle in your own settings screen:
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { sounds, haptics } from 'react-native-monflowts';
|
|
158
|
+
|
|
159
|
+
sounds.setMute(true); // mute all SDK sounds
|
|
160
|
+
haptics.setMute(true); // mute all SDK haptics
|
|
161
|
+
|
|
162
|
+
// Fire haptic manually (e.g. on your own custom button outside the SDK):
|
|
163
|
+
haptics.light(); // also: medium, heavy, selection, success, warning, error
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 3. Per-element (via `MonflowtsPressable`)
|
|
167
|
+
|
|
168
|
+
When you build your own clickable surfaces alongside the SDK, use the `MonflowtsPressable` primitive instead of `TouchableOpacity` — it inherits the SDK's sound + haptic behavior automatically.
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { MonflowtsPressable } from 'react-native-monflowts';
|
|
172
|
+
|
|
173
|
+
<MonflowtsPressable onPress={handlePress}>
|
|
174
|
+
<Text>Tap me</Text>
|
|
175
|
+
</MonflowtsPressable>
|
|
176
|
+
|
|
177
|
+
// Override per-instance:
|
|
178
|
+
<MonflowtsPressable
|
|
179
|
+
onPress={handleSelect}
|
|
180
|
+
sound="select" // 'click' (default) | 'select'
|
|
181
|
+
haptic="selection" // 'light' (default) | 'medium' | 'heavy' | 'selection' | 'success' | 'warning' | 'error'
|
|
182
|
+
disableSound={disabled} // skip sound while in a disabled state
|
|
183
|
+
enableHaptic={false} // suppress haptic without touching sound
|
|
184
|
+
>
|
|
185
|
+
<Text>Select option</Text>
|
|
186
|
+
</MonflowtsPressable>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
For text buttons, use `MonflowtsButton` — it's built on top of `MonflowtsPressable`, so the same sound/haptic props apply:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
import { MonflowtsButton } from 'react-native-monflowts';
|
|
193
|
+
|
|
194
|
+
<MonflowtsButton
|
|
195
|
+
title="Continue"
|
|
196
|
+
variant="primary"
|
|
197
|
+
onPress={handleContinue}
|
|
198
|
+
loading={submitting}
|
|
199
|
+
/>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Platform notes
|
|
203
|
+
|
|
204
|
+
- **iOS** uses `UIImpactFeedbackGenerator` / `UISelectionFeedbackGenerator` / `UINotificationFeedbackGenerator` for native haptic feedback.
|
|
205
|
+
- **Android** uses `VibrationEffect.EFFECT_TICK` / `EFFECT_CLICK` / `EFFECT_HEAVY_CLICK` on API 29+, with an amplitude-controlled `createOneShot` fallback on older devices or devices whose HAL doesn't implement a given predefined effect.
|
|
206
|
+
- The `android.permission.VIBRATE` permission is declared in the SDK's `AndroidManifest.xml` and is auto-merged into the host app's manifest — no action required.
|
|
207
|
+
- On Android, haptic feedback additionally respects the system-level **Settings → Sound & vibration → Touch feedback** toggle. If the user has disabled it, the SDK won't vibrate even with `enableHaptic={true}`.
|
|
208
|
+
- Sound effects on Android route through `USAGE_ASSISTANCE_SONIFICATION` so they mix with background media (Spotify, podcasts, etc.) instead of ducking it.
|
|
209
|
+
|
|
210
|
+
### `MonflowtsTheme`
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
{
|
|
214
|
+
colors: Partial<{
|
|
215
|
+
background: string;
|
|
216
|
+
surface: string;
|
|
217
|
+
primary: string;
|
|
218
|
+
secondary: string;
|
|
219
|
+
accent: string;
|
|
220
|
+
success: string;
|
|
221
|
+
error: string;
|
|
222
|
+
warning: string;
|
|
223
|
+
textPrimary: string;
|
|
224
|
+
textSecondary: string;
|
|
225
|
+
textMuted: string;
|
|
226
|
+
border: string;
|
|
227
|
+
gold: string;
|
|
228
|
+
}>;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.Monflowts = [
|
|
3
|
+
minSdkVersion: 24,
|
|
4
|
+
compileSdkVersion: 36,
|
|
5
|
+
targetSdkVersion: 36,
|
|
6
|
+
lottieVersion: "6.6.2"
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
ext.getExtOrDefault = { prop ->
|
|
10
|
+
if (rootProject.ext.has(prop)) {
|
|
11
|
+
return rootProject.ext.get(prop)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return Monflowts[prop]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
|
|
24
|
+
android {
|
|
25
|
+
namespace "com.monflowts"
|
|
26
|
+
|
|
27
|
+
compileSdk getExtOrDefault("compileSdkVersion")
|
|
28
|
+
|
|
29
|
+
defaultConfig {
|
|
30
|
+
minSdk getExtOrDefault("minSdkVersion")
|
|
31
|
+
targetSdk getExtOrDefault("targetSdkVersion")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
buildFeatures {
|
|
35
|
+
buildConfig true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildTypes {
|
|
39
|
+
release {
|
|
40
|
+
minifyEnabled false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
lint {
|
|
45
|
+
disable "GradleCompatible"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compileOptions {
|
|
49
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
50
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dependencies {
|
|
55
|
+
implementation "com.facebook.react:react-android"
|
|
56
|
+
implementation "com.airbnb.android:lottie:${getExtOrDefault('lottieVersion')}"
|
|
57
|
+
implementation "com.squareup.okhttp3:okhttp:4.9.2"
|
|
58
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
<!--
|
|
3
|
+
Required for HapticsManager (react-native Vibration). Declared here so any
|
|
4
|
+
app consuming the SDK inherits it via manifest merging without having to
|
|
5
|
+
add it themselves. Harmless on devices without a vibrator.
|
|
6
|
+
-->
|
|
7
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
8
|
+
</manifest>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
package com.monflowts
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
|
+
import com.facebook.react.bridge.ReactMethod
|
|
8
|
+
import com.facebook.react.bridge.ReadableArray
|
|
9
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
10
|
+
import okhttp3.OkHttpClient
|
|
11
|
+
import okhttp3.Request
|
|
12
|
+
import java.io.File
|
|
13
|
+
import java.io.IOException
|
|
14
|
+
import java.security.MessageDigest
|
|
15
|
+
import java.util.Collections
|
|
16
|
+
import java.util.concurrent.Executors
|
|
17
|
+
import java.util.concurrent.atomic.AtomicInteger
|
|
18
|
+
import java.util.concurrent.atomic.AtomicLong
|
|
19
|
+
|
|
20
|
+
class MonflowtsAssetsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
21
|
+
|
|
22
|
+
private data class Item(val url: String, val sha256: String, val ext: String, val size: Long)
|
|
23
|
+
|
|
24
|
+
private val client = OkHttpClient()
|
|
25
|
+
private val executor = Executors.newFixedThreadPool(4)
|
|
26
|
+
private val indexName = "index.json"
|
|
27
|
+
|
|
28
|
+
override fun getName(): String = "MonflowtsAssets"
|
|
29
|
+
|
|
30
|
+
private fun baseDir(): File {
|
|
31
|
+
val dir = File(reactApplicationContext.filesDir, "monflowts-assets")
|
|
32
|
+
if (!dir.exists()) dir.mkdirs()
|
|
33
|
+
return dir
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
fun addListener(eventName: String) {}
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
fun removeListeners(count: Int) {}
|
|
41
|
+
|
|
42
|
+
@ReactMethod
|
|
43
|
+
fun getBaseUri(promise: Promise) {
|
|
44
|
+
promise.resolve("file://" + baseDir().absolutePath + "/")
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun download(files: ReadableArray, promise: Promise) {
|
|
49
|
+
val dir = baseDir()
|
|
50
|
+
val items = (0 until files.size()).mapNotNull { i -> files.getMap(i) }.map { file ->
|
|
51
|
+
Item(
|
|
52
|
+
file.getString("url") ?: "",
|
|
53
|
+
file.getString("sha256") ?: "",
|
|
54
|
+
file.getString("ext") ?: "",
|
|
55
|
+
if (file.hasKey("size")) file.getDouble("size").toLong() else 0L,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
val bytesTotal = items.sumOf { it.size }
|
|
59
|
+
val bytesDone = AtomicLong(0)
|
|
60
|
+
val filesDone = AtomicInteger(0)
|
|
61
|
+
val failed = Collections.synchronizedList(mutableListOf<Pair<String, String>>())
|
|
62
|
+
val pending = items.filter { item ->
|
|
63
|
+
val present = File(dir, "${item.sha256}.${item.ext}").exists()
|
|
64
|
+
if (present) {
|
|
65
|
+
bytesDone.addAndGet(item.size)
|
|
66
|
+
filesDone.incrementAndGet()
|
|
67
|
+
}
|
|
68
|
+
!present
|
|
69
|
+
}
|
|
70
|
+
if (pending.isEmpty()) {
|
|
71
|
+
promise.resolve(result(failed))
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
val remaining = AtomicInteger(pending.size)
|
|
75
|
+
for (item in pending) {
|
|
76
|
+
executor.execute {
|
|
77
|
+
try {
|
|
78
|
+
val reason = try {
|
|
79
|
+
fetch(item, dir)
|
|
80
|
+
} catch (e: Exception) {
|
|
81
|
+
"NETWORK"
|
|
82
|
+
}
|
|
83
|
+
if (reason == null) bytesDone.addAndGet(item.size) else failed.add(item.sha256 to reason)
|
|
84
|
+
val done = filesDone.incrementAndGet()
|
|
85
|
+
try {
|
|
86
|
+
emitProgress(bytesDone.get(), bytesTotal, done, items.size)
|
|
87
|
+
} catch (e: Exception) {
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
if (remaining.decrementAndGet() == 0) promise.resolve(result(failed))
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private fun result(failed: List<Pair<String, String>>) = Arguments.createMap().apply {
|
|
97
|
+
val list = Arguments.createArray()
|
|
98
|
+
synchronized(failed) {
|
|
99
|
+
for ((sha256, reason) in failed) {
|
|
100
|
+
list.pushMap(Arguments.createMap().apply {
|
|
101
|
+
putString("sha256", sha256)
|
|
102
|
+
putString("reason", reason)
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
putArray("failed", list)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private fun fetch(item: Item, dir: File): String? {
|
|
110
|
+
val target = File(dir, "${item.sha256}.${item.ext}")
|
|
111
|
+
val temp = File.createTempFile("${item.sha256}.", ".part", dir)
|
|
112
|
+
return try {
|
|
113
|
+
client.newCall(Request.Builder().url(item.url).build()).execute().use { response ->
|
|
114
|
+
if (response.code == 403) return "EXPIRED"
|
|
115
|
+
if (!response.isSuccessful) return "NETWORK"
|
|
116
|
+
val body = response.body ?: return "NETWORK"
|
|
117
|
+
val digest = MessageDigest.getInstance("SHA-256")
|
|
118
|
+
temp.outputStream().use { out ->
|
|
119
|
+
body.byteStream().use { input ->
|
|
120
|
+
val buffer = ByteArray(16 * 1024)
|
|
121
|
+
while (true) {
|
|
122
|
+
val read = input.read(buffer)
|
|
123
|
+
if (read < 0) break
|
|
124
|
+
digest.update(buffer, 0, read)
|
|
125
|
+
out.write(buffer, 0, read)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
val hex = digest.digest().joinToString("") { "%02x".format(it) }
|
|
130
|
+
if (hex != item.sha256) {
|
|
131
|
+
temp.delete()
|
|
132
|
+
return "HASH_MISMATCH"
|
|
133
|
+
}
|
|
134
|
+
if (target.exists()) {
|
|
135
|
+
temp.delete()
|
|
136
|
+
return null
|
|
137
|
+
}
|
|
138
|
+
if (!temp.renameTo(target)) {
|
|
139
|
+
temp.delete()
|
|
140
|
+
return "NETWORK"
|
|
141
|
+
}
|
|
142
|
+
null
|
|
143
|
+
}
|
|
144
|
+
} catch (e: IOException) {
|
|
145
|
+
temp.delete()
|
|
146
|
+
val message = e.message ?: ""
|
|
147
|
+
if (message.contains("ENOSPC") || message.contains("No space left")) "NO_SPACE" else "NETWORK"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private fun emitProgress(done: Long, total: Long, filesDone: Int, filesTotal: Int) {
|
|
152
|
+
if (!reactApplicationContext.hasActiveReactInstance()) return
|
|
153
|
+
val map = Arguments.createMap()
|
|
154
|
+
map.putDouble("bytesDone", done.toDouble())
|
|
155
|
+
map.putDouble("bytesTotal", total.toDouble())
|
|
156
|
+
map.putInt("filesDone", filesDone)
|
|
157
|
+
map.putInt("filesTotal", filesTotal)
|
|
158
|
+
reactApplicationContext
|
|
159
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
160
|
+
.emit("MonflowtsAssetsProgress", map)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@ReactMethod
|
|
164
|
+
fun readText(name: String, promise: Promise) {
|
|
165
|
+
try {
|
|
166
|
+
promise.resolve(File(baseDir(), name).readText())
|
|
167
|
+
} catch (e: IOException) {
|
|
168
|
+
promise.reject("E_ASSETS_READ", e)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@ReactMethod
|
|
173
|
+
fun missing(names: ReadableArray, promise: Promise) {
|
|
174
|
+
val dir = baseDir()
|
|
175
|
+
val absent = Arguments.createArray()
|
|
176
|
+
for (i in 0 until names.size()) {
|
|
177
|
+
val name = names.getString(i) ?: continue
|
|
178
|
+
if (!File(dir, name).exists()) absent.pushString(name)
|
|
179
|
+
}
|
|
180
|
+
promise.resolve(absent)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@ReactMethod
|
|
184
|
+
fun saveIndex(json: String, promise: Promise) {
|
|
185
|
+
try {
|
|
186
|
+
val dir = baseDir()
|
|
187
|
+
val temp = File(dir, "$indexName.part")
|
|
188
|
+
temp.writeText(json)
|
|
189
|
+
if (!temp.renameTo(File(dir, indexName))) throw IOException("Could not save the asset index")
|
|
190
|
+
promise.resolve(null)
|
|
191
|
+
} catch (e: IOException) {
|
|
192
|
+
promise.reject("E_ASSETS_WRITE", e)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@ReactMethod
|
|
197
|
+
fun loadIndex(promise: Promise) {
|
|
198
|
+
try {
|
|
199
|
+
val file = File(baseDir(), indexName)
|
|
200
|
+
promise.resolve(if (file.exists()) file.readText() else null)
|
|
201
|
+
} catch (e: IOException) {
|
|
202
|
+
promise.reject("E_ASSETS_READ", e)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@ReactMethod
|
|
207
|
+
fun removeExcept(names: ReadableArray, promise: Promise) {
|
|
208
|
+
val keep = HashSet<String>()
|
|
209
|
+
for (i in 0 until names.size()) names.getString(i)?.let { keep.add(it) }
|
|
210
|
+
keep.add(indexName)
|
|
211
|
+
baseDir().listFiles()?.forEach { file -> if (!keep.contains(file.name)) file.delete() }
|
|
212
|
+
promise.resolve(null)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
override fun invalidate() {
|
|
216
|
+
executor.shutdownNow()
|
|
217
|
+
super.invalidate()
|
|
218
|
+
}
|
|
219
|
+
}
|