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,61 @@
|
|
|
1
|
+
import AVFoundation
|
|
2
|
+
|
|
3
|
+
@objc(MonflowtsSpeech)
|
|
4
|
+
class MonflowtsSpeechModule: NSObject {
|
|
5
|
+
|
|
6
|
+
private let synth = AVSpeechSynthesizer()
|
|
7
|
+
private var player: AVPlayer?
|
|
8
|
+
private lazy var voice: AVSpeechSynthesisVoice? = Self.bestVoice(languagePrefix: "en")
|
|
9
|
+
|
|
10
|
+
@objc static func requiresMainQueueSetup() -> Bool { return false }
|
|
11
|
+
|
|
12
|
+
private static func bestVoice(languagePrefix: String) -> AVSpeechSynthesisVoice? {
|
|
13
|
+
let candidates = AVSpeechSynthesisVoice.speechVoices().filter { $0.language.hasPrefix(languagePrefix) }
|
|
14
|
+
if #available(iOS 16.0, *), let premium = candidates.first(where: { $0.quality == .premium }) {
|
|
15
|
+
return premium
|
|
16
|
+
}
|
|
17
|
+
if let enhanced = candidates.first(where: { $0.quality == .enhanced }) {
|
|
18
|
+
return enhanced
|
|
19
|
+
}
|
|
20
|
+
return candidates.first(where: { $0.language == AVSpeechSynthesisVoice.currentLanguageCode() }) ?? candidates.first
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@objc func speak(_ params: NSDictionary) {
|
|
24
|
+
guard let text = params["text"] as? String, !text.isEmpty else { return }
|
|
25
|
+
let utterance = AVSpeechUtterance(string: text)
|
|
26
|
+
utterance.rate = Float(params["rate"] as? Double ?? 0.5)
|
|
27
|
+
utterance.pitchMultiplier = Float(params["pitch"] as? Double ?? 1.03)
|
|
28
|
+
utterance.volume = Float(params["volume"] as? Double ?? 0.9)
|
|
29
|
+
if let lang = params["language"] as? String, let requested = AVSpeechSynthesisVoice(language: lang) {
|
|
30
|
+
utterance.voice = requested
|
|
31
|
+
} else if let voice {
|
|
32
|
+
utterance.voice = voice
|
|
33
|
+
}
|
|
34
|
+
if synth.isSpeaking {
|
|
35
|
+
synth.stopSpeaking(at: .immediate)
|
|
36
|
+
}
|
|
37
|
+
synth.speak(utterance)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc func playClip(_ urlString: NSString) {
|
|
41
|
+
guard let url = URL(string: urlString as String) else { return }
|
|
42
|
+
DispatchQueue.main.async { [weak self] in
|
|
43
|
+
guard let self = self else { return }
|
|
44
|
+
if self.synth.isSpeaking {
|
|
45
|
+
self.synth.stopSpeaking(at: .immediate)
|
|
46
|
+
}
|
|
47
|
+
let next = AVPlayer(playerItem: AVPlayerItem(url: url))
|
|
48
|
+
next.volume = 1.0
|
|
49
|
+
self.player = next
|
|
50
|
+
next.play()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@objc func stop() {
|
|
55
|
+
synth.stopSpeaking(at: .immediate)
|
|
56
|
+
DispatchQueue.main.async { [weak self] in
|
|
57
|
+
self?.player?.pause()
|
|
58
|
+
self?.player = nil
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(MonflowtsSvgViewManager, RCTViewManager)
|
|
4
|
+
|
|
5
|
+
RCT_EXPORT_VIEW_PROPERTY(d, NSString)
|
|
6
|
+
RCT_EXPORT_VIEW_PROPERTY(fill, NSString)
|
|
7
|
+
RCT_EXPORT_VIEW_PROPERTY(stroke, NSString)
|
|
8
|
+
RCT_EXPORT_VIEW_PROPERTY(strokeWidth, float)
|
|
9
|
+
RCT_EXPORT_VIEW_PROPERTY(svgViewBox, NSString)
|
|
10
|
+
|
|
11
|
+
@end
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
class MonflowtsSvgUIView: UIView {
|
|
4
|
+
|
|
5
|
+
private var pathData: String = ""
|
|
6
|
+
private var fillColor: UIColor = .clear
|
|
7
|
+
private var strokeColor: UIColor = .clear
|
|
8
|
+
private var lineWidth: CGFloat = 0
|
|
9
|
+
private var vbX: CGFloat = 0
|
|
10
|
+
private var vbY: CGFloat = 0
|
|
11
|
+
private var vbW: CGFloat = 24
|
|
12
|
+
private var vbH: CGFloat = 24
|
|
13
|
+
|
|
14
|
+
override init(frame: CGRect) {
|
|
15
|
+
super.init(frame: frame)
|
|
16
|
+
backgroundColor = .clear
|
|
17
|
+
isOpaque = false
|
|
18
|
+
contentMode = .redraw
|
|
19
|
+
clipsToBounds = true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
required init?(coder: NSCoder) {
|
|
23
|
+
fatalError("init(coder:) not implemented")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// MARK: - React props
|
|
27
|
+
|
|
28
|
+
@objc func setD(_ value: NSString) {
|
|
29
|
+
pathData = value as String
|
|
30
|
+
setNeedsDisplay()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@objc func setFill(_ value: NSString?) {
|
|
34
|
+
fillColor = MonflowtsSvgUIView.colorFromHex(value as String?) ?? .clear
|
|
35
|
+
setNeedsDisplay()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc func setStroke(_ value: NSString?) {
|
|
39
|
+
strokeColor = MonflowtsSvgUIView.colorFromHex(value as String?) ?? .clear
|
|
40
|
+
setNeedsDisplay()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@objc func setStrokeWidth(_ value: Float) {
|
|
44
|
+
lineWidth = CGFloat(value)
|
|
45
|
+
setNeedsDisplay()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc func setSvgViewBox(_ value: NSString?) {
|
|
49
|
+
guard let str = value as String? else { return }
|
|
50
|
+
let parts = str.split(separator: " ").compactMap { Double($0) }
|
|
51
|
+
if parts.count == 4 {
|
|
52
|
+
vbX = CGFloat(parts[0])
|
|
53
|
+
vbY = CGFloat(parts[1])
|
|
54
|
+
vbW = CGFloat(parts[2])
|
|
55
|
+
vbH = CGFloat(parts[3])
|
|
56
|
+
}
|
|
57
|
+
setNeedsDisplay()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// MARK: - Drawing
|
|
61
|
+
|
|
62
|
+
override func draw(_ rect: CGRect) {
|
|
63
|
+
guard let ctx = UIGraphicsGetCurrentContext(), !pathData.isEmpty else { return }
|
|
64
|
+
|
|
65
|
+
let path = parseSvgPath(pathData)
|
|
66
|
+
|
|
67
|
+
// Compute transform from viewBox to bounds (aspect-fit, centered)
|
|
68
|
+
let scaleX = rect.width / vbW
|
|
69
|
+
let scaleY = rect.height / vbH
|
|
70
|
+
let scale = min(scaleX, scaleY)
|
|
71
|
+
let tx = (rect.width - vbW * scale) / 2.0 - vbX * scale
|
|
72
|
+
let ty = (rect.height - vbH * scale) / 2.0 - vbY * scale
|
|
73
|
+
|
|
74
|
+
ctx.saveGState()
|
|
75
|
+
ctx.translateBy(x: tx, y: ty)
|
|
76
|
+
ctx.scaleBy(x: scale, y: scale)
|
|
77
|
+
|
|
78
|
+
if fillColor != .clear {
|
|
79
|
+
ctx.addPath(path)
|
|
80
|
+
ctx.setFillColor(fillColor.cgColor)
|
|
81
|
+
ctx.fillPath(using: .evenOdd)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if strokeColor != .clear && lineWidth > 0 {
|
|
85
|
+
ctx.addPath(path)
|
|
86
|
+
ctx.setStrokeColor(strokeColor.cgColor)
|
|
87
|
+
ctx.setLineWidth(lineWidth)
|
|
88
|
+
ctx.setLineCap(.round)
|
|
89
|
+
ctx.setLineJoin(.round)
|
|
90
|
+
ctx.strokePath()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
ctx.restoreGState()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// MARK: - SVG Path Parser
|
|
97
|
+
|
|
98
|
+
private func parseSvgPath(_ d: String) -> CGPath {
|
|
99
|
+
let path = CGMutablePath()
|
|
100
|
+
let tokens = tokenize(d)
|
|
101
|
+
var i = 0
|
|
102
|
+
var curX: CGFloat = 0
|
|
103
|
+
var curY: CGFloat = 0
|
|
104
|
+
var lastCmd: Character = " "
|
|
105
|
+
var lastCX: CGFloat = 0
|
|
106
|
+
var lastCY: CGFloat = 0
|
|
107
|
+
|
|
108
|
+
func nextNum() -> CGFloat {
|
|
109
|
+
guard i < tokens.count else { return 0 }
|
|
110
|
+
let val = CGFloat(Double(tokens[i]) ?? 0)
|
|
111
|
+
i += 1
|
|
112
|
+
return val
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
func nextFlag() -> CGFloat {
|
|
116
|
+
guard i < tokens.count else { return 0 }
|
|
117
|
+
let s = tokens[i]
|
|
118
|
+
// Flags in arc can be "0" or "1" possibly concatenated
|
|
119
|
+
if s == "0" || s == "1" {
|
|
120
|
+
i += 1
|
|
121
|
+
return CGFloat(Double(s) ?? 0)
|
|
122
|
+
}
|
|
123
|
+
let val = CGFloat(Double(s) ?? 0)
|
|
124
|
+
i += 1
|
|
125
|
+
return val
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
while i < tokens.count {
|
|
129
|
+
let token = tokens[i]
|
|
130
|
+
guard let first = token.first else { i += 1; continue }
|
|
131
|
+
|
|
132
|
+
if first.isLetter {
|
|
133
|
+
lastCmd = first
|
|
134
|
+
i += 1
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
switch lastCmd {
|
|
138
|
+
case "M":
|
|
139
|
+
let x = nextNum(); let y = nextNum()
|
|
140
|
+
path.move(to: CGPoint(x: x, y: y))
|
|
141
|
+
curX = x; curY = y
|
|
142
|
+
lastCmd = "L" // subsequent coords are implicit LineTo
|
|
143
|
+
case "m":
|
|
144
|
+
let dx = nextNum(); let dy = nextNum()
|
|
145
|
+
curX += dx; curY += dy
|
|
146
|
+
path.move(to: CGPoint(x: curX, y: curY))
|
|
147
|
+
lastCmd = "l"
|
|
148
|
+
case "L":
|
|
149
|
+
let x = nextNum(); let y = nextNum()
|
|
150
|
+
path.addLine(to: CGPoint(x: x, y: y))
|
|
151
|
+
curX = x; curY = y
|
|
152
|
+
case "l":
|
|
153
|
+
let dx = nextNum(); let dy = nextNum()
|
|
154
|
+
curX += dx; curY += dy
|
|
155
|
+
path.addLine(to: CGPoint(x: curX, y: curY))
|
|
156
|
+
case "H":
|
|
157
|
+
let x = nextNum()
|
|
158
|
+
path.addLine(to: CGPoint(x: x, y: curY))
|
|
159
|
+
curX = x
|
|
160
|
+
case "h":
|
|
161
|
+
let dx = nextNum()
|
|
162
|
+
curX += dx
|
|
163
|
+
path.addLine(to: CGPoint(x: curX, y: curY))
|
|
164
|
+
case "V":
|
|
165
|
+
let y = nextNum()
|
|
166
|
+
path.addLine(to: CGPoint(x: curX, y: y))
|
|
167
|
+
curY = y
|
|
168
|
+
case "v":
|
|
169
|
+
let dy = nextNum()
|
|
170
|
+
curY += dy
|
|
171
|
+
path.addLine(to: CGPoint(x: curX, y: curY))
|
|
172
|
+
case "C":
|
|
173
|
+
let x1 = nextNum(); let y1 = nextNum()
|
|
174
|
+
let x2 = nextNum(); let y2 = nextNum()
|
|
175
|
+
let x = nextNum(); let y = nextNum()
|
|
176
|
+
path.addCurve(to: CGPoint(x: x, y: y),
|
|
177
|
+
control1: CGPoint(x: x1, y: y1),
|
|
178
|
+
control2: CGPoint(x: x2, y: y2))
|
|
179
|
+
lastCX = x2; lastCY = y2
|
|
180
|
+
curX = x; curY = y
|
|
181
|
+
case "c":
|
|
182
|
+
let dx1 = nextNum(); let dy1 = nextNum()
|
|
183
|
+
let dx2 = nextNum(); let dy2 = nextNum()
|
|
184
|
+
let dx = nextNum(); let dy = nextNum()
|
|
185
|
+
let x1 = curX + dx1; let y1 = curY + dy1
|
|
186
|
+
let x2 = curX + dx2; let y2 = curY + dy2
|
|
187
|
+
curX += dx; curY += dy
|
|
188
|
+
path.addCurve(to: CGPoint(x: curX, y: curY),
|
|
189
|
+
control1: CGPoint(x: x1, y: y1),
|
|
190
|
+
control2: CGPoint(x: x2, y: y2))
|
|
191
|
+
lastCX = x2; lastCY = y2
|
|
192
|
+
case "S":
|
|
193
|
+
let cx1 = 2 * curX - lastCX
|
|
194
|
+
let cy1 = 2 * curY - lastCY
|
|
195
|
+
let x2 = nextNum(); let y2 = nextNum()
|
|
196
|
+
let x = nextNum(); let y = nextNum()
|
|
197
|
+
path.addCurve(to: CGPoint(x: x, y: y),
|
|
198
|
+
control1: CGPoint(x: cx1, y: cy1),
|
|
199
|
+
control2: CGPoint(x: x2, y: y2))
|
|
200
|
+
lastCX = x2; lastCY = y2
|
|
201
|
+
curX = x; curY = y
|
|
202
|
+
case "s":
|
|
203
|
+
let cx1 = 2 * curX - lastCX
|
|
204
|
+
let cy1 = 2 * curY - lastCY
|
|
205
|
+
let dx2 = nextNum(); let dy2 = nextNum()
|
|
206
|
+
let dx = nextNum(); let dy = nextNum()
|
|
207
|
+
let x2 = curX + dx2; let y2 = curY + dy2
|
|
208
|
+
curX += dx; curY += dy
|
|
209
|
+
path.addCurve(to: CGPoint(x: curX, y: curY),
|
|
210
|
+
control1: CGPoint(x: cx1, y: cy1),
|
|
211
|
+
control2: CGPoint(x: x2, y: y2))
|
|
212
|
+
lastCX = x2; lastCY = y2
|
|
213
|
+
case "Q":
|
|
214
|
+
let cx = nextNum(); let cy = nextNum()
|
|
215
|
+
let x = nextNum(); let y = nextNum()
|
|
216
|
+
path.addQuadCurve(to: CGPoint(x: x, y: y),
|
|
217
|
+
control: CGPoint(x: cx, y: cy))
|
|
218
|
+
lastCX = cx; lastCY = cy
|
|
219
|
+
curX = x; curY = y
|
|
220
|
+
case "q":
|
|
221
|
+
let dcx = nextNum(); let dcy = nextNum()
|
|
222
|
+
let dx = nextNum(); let dy = nextNum()
|
|
223
|
+
let cx = curX + dcx; let cy = curY + dcy
|
|
224
|
+
curX += dx; curY += dy
|
|
225
|
+
path.addQuadCurve(to: CGPoint(x: curX, y: curY),
|
|
226
|
+
control: CGPoint(x: cx, y: cy))
|
|
227
|
+
lastCX = cx; lastCY = cy
|
|
228
|
+
case "T":
|
|
229
|
+
let cx = 2 * curX - lastCX
|
|
230
|
+
let cy = 2 * curY - lastCY
|
|
231
|
+
let x = nextNum(); let y = nextNum()
|
|
232
|
+
path.addQuadCurve(to: CGPoint(x: x, y: y),
|
|
233
|
+
control: CGPoint(x: cx, y: cy))
|
|
234
|
+
lastCX = cx; lastCY = cy
|
|
235
|
+
curX = x; curY = y
|
|
236
|
+
case "t":
|
|
237
|
+
let cx = 2 * curX - lastCX
|
|
238
|
+
let cy = 2 * curY - lastCY
|
|
239
|
+
let dx = nextNum(); let dy = nextNum()
|
|
240
|
+
curX += dx; curY += dy
|
|
241
|
+
path.addQuadCurve(to: CGPoint(x: curX, y: curY),
|
|
242
|
+
control: CGPoint(x: cx, y: cy))
|
|
243
|
+
lastCX = cx; lastCY = cy
|
|
244
|
+
case "A", "a":
|
|
245
|
+
let isRel = lastCmd == "a"
|
|
246
|
+
let rx = nextNum(); let ry = nextNum()
|
|
247
|
+
let xRot = nextNum()
|
|
248
|
+
let largeArc = nextFlag()
|
|
249
|
+
let sweep = nextFlag()
|
|
250
|
+
var ex = nextNum(); var ey = nextNum()
|
|
251
|
+
if isRel { ex += curX; ey += curY }
|
|
252
|
+
addArc(to: path, rx: rx, ry: ry, xRotation: xRot,
|
|
253
|
+
largeArc: largeArc != 0, sweep: sweep != 0,
|
|
254
|
+
fromX: curX, fromY: curY, toX: ex, toY: ey)
|
|
255
|
+
curX = ex; curY = ey
|
|
256
|
+
case "Z", "z":
|
|
257
|
+
path.closeSubpath()
|
|
258
|
+
default:
|
|
259
|
+
i += 1
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return path
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private func tokenize(_ d: String) -> [String] {
|
|
267
|
+
var tokens: [String] = []
|
|
268
|
+
var current = ""
|
|
269
|
+
|
|
270
|
+
// SVG path tokenizer: split on commands and numbers
|
|
271
|
+
let chars = Array(d)
|
|
272
|
+
var idx = 0
|
|
273
|
+
while idx < chars.count {
|
|
274
|
+
let ch = chars[idx]
|
|
275
|
+
|
|
276
|
+
if ch == " " || ch == "," || ch == "\n" || ch == "\r" || ch == "\t" {
|
|
277
|
+
if !current.isEmpty { tokens.append(current); current = "" }
|
|
278
|
+
idx += 1
|
|
279
|
+
continue
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if ch.isLetter {
|
|
283
|
+
if !current.isEmpty { tokens.append(current); current = "" }
|
|
284
|
+
tokens.append(String(ch))
|
|
285
|
+
idx += 1
|
|
286
|
+
continue
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Start of a number
|
|
290
|
+
if ch == "-" || ch == "+" || ch == "." || ch.isNumber {
|
|
291
|
+
// If we already have a number in current built, a new sign or dot means a new number
|
|
292
|
+
if !current.isEmpty {
|
|
293
|
+
if ch == "-" || ch == "+" {
|
|
294
|
+
tokens.append(current); current = ""
|
|
295
|
+
} else if ch == "." && current.contains(".") {
|
|
296
|
+
tokens.append(current); current = ""
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
current.append(ch)
|
|
300
|
+
idx += 1
|
|
301
|
+
continue
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
idx += 1
|
|
305
|
+
}
|
|
306
|
+
if !current.isEmpty { tokens.append(current) }
|
|
307
|
+
|
|
308
|
+
return tokens
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// MARK: - SVG Arc to Bezier
|
|
312
|
+
|
|
313
|
+
private func addArc(to path: CGMutablePath, rx inputRx: CGFloat, ry inputRy: CGFloat,
|
|
314
|
+
xRotation: CGFloat, largeArc: Bool, sweep: Bool,
|
|
315
|
+
fromX x1: CGFloat, fromY y1: CGFloat,
|
|
316
|
+
toX x2: CGFloat, toY y2: CGFloat) {
|
|
317
|
+
var rx = abs(inputRx)
|
|
318
|
+
var ry = abs(inputRy)
|
|
319
|
+
|
|
320
|
+
if rx == 0 || ry == 0 {
|
|
321
|
+
path.addLine(to: CGPoint(x: x2, y: y2))
|
|
322
|
+
return
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
let phi = xRotation * .pi / 180.0
|
|
326
|
+
let cosPhi = cos(phi)
|
|
327
|
+
let sinPhi = sin(phi)
|
|
328
|
+
|
|
329
|
+
let dx = (x1 - x2) / 2.0
|
|
330
|
+
let dy = (y1 - y2) / 2.0
|
|
331
|
+
let x1p = cosPhi * dx + sinPhi * dy
|
|
332
|
+
let y1p = -sinPhi * dx + cosPhi * dy
|
|
333
|
+
|
|
334
|
+
// Correct radii
|
|
335
|
+
var lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry)
|
|
336
|
+
if lambda > 1.0 {
|
|
337
|
+
lambda = sqrt(lambda)
|
|
338
|
+
rx *= lambda
|
|
339
|
+
ry *= lambda
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
let num = max(rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p, 0)
|
|
343
|
+
let den = rx * rx * y1p * y1p + ry * ry * x1p * x1p
|
|
344
|
+
var sq = sqrt(num / max(den, 1e-10))
|
|
345
|
+
if largeArc == sweep { sq = -sq }
|
|
346
|
+
|
|
347
|
+
let cxp = sq * rx * y1p / ry
|
|
348
|
+
let cyp = -sq * ry * x1p / rx
|
|
349
|
+
|
|
350
|
+
let cx = cosPhi * cxp - sinPhi * cyp + (x1 + x2) / 2.0
|
|
351
|
+
let cy = sinPhi * cxp + cosPhi * cyp + (y1 + y2) / 2.0
|
|
352
|
+
|
|
353
|
+
func angle(_ ux: CGFloat, _ uy: CGFloat, _ vx: CGFloat, _ vy: CGFloat) -> CGFloat {
|
|
354
|
+
let dot = ux * vx + uy * vy
|
|
355
|
+
let len = sqrt(ux * ux + uy * uy) * sqrt(vx * vx + vy * vy)
|
|
356
|
+
var a = acos(max(-1, min(1, dot / max(len, 1e-10))))
|
|
357
|
+
if ux * vy - uy * vx < 0 { a = -a }
|
|
358
|
+
return a
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
let theta1 = angle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry)
|
|
362
|
+
var dtheta = angle((x1p - cxp) / rx, (y1p - cyp) / ry,
|
|
363
|
+
(-x1p - cxp) / rx, (-y1p - cyp) / ry)
|
|
364
|
+
|
|
365
|
+
if !sweep && dtheta > 0 { dtheta -= 2 * .pi }
|
|
366
|
+
if sweep && dtheta < 0 { dtheta += 2 * .pi }
|
|
367
|
+
|
|
368
|
+
// Approximate arc with cubic bezier segments
|
|
369
|
+
let segments = max(1, Int(ceil(abs(dtheta) / (.pi / 2.0))))
|
|
370
|
+
let delta = dtheta / CGFloat(segments)
|
|
371
|
+
let t = 4.0 / 3.0 * tan(delta / 4.0)
|
|
372
|
+
|
|
373
|
+
var th = theta1
|
|
374
|
+
for _ in 0..<segments {
|
|
375
|
+
let costh = cos(th)
|
|
376
|
+
let sinth = sin(th)
|
|
377
|
+
let costh2 = cos(th + delta)
|
|
378
|
+
let sinth2 = sin(th + delta)
|
|
379
|
+
|
|
380
|
+
let ep1x = cosPhi * rx * costh - sinPhi * ry * sinth + cx
|
|
381
|
+
let ep1y = sinPhi * rx * costh + cosPhi * ry * sinth + cy
|
|
382
|
+
let ep2x = cosPhi * rx * costh2 - sinPhi * ry * sinth2 + cx
|
|
383
|
+
let ep2y = sinPhi * rx * costh2 + cosPhi * ry * sinth2 + cy
|
|
384
|
+
|
|
385
|
+
let cp1x = ep1x + t * (-cosPhi * rx * sinth - sinPhi * ry * costh)
|
|
386
|
+
let cp1y = ep1y + t * (-sinPhi * rx * sinth + cosPhi * ry * costh)
|
|
387
|
+
let cp2x = ep2x - t * (-cosPhi * rx * sinth2 - sinPhi * ry * costh2)
|
|
388
|
+
let cp2y = ep2y - t * (-sinPhi * rx * sinth2 + cosPhi * ry * costh2)
|
|
389
|
+
|
|
390
|
+
path.addCurve(to: CGPoint(x: ep2x, y: ep2y),
|
|
391
|
+
control1: CGPoint(x: cp1x, y: cp1y),
|
|
392
|
+
control2: CGPoint(x: cp2x, y: cp2y))
|
|
393
|
+
|
|
394
|
+
th += delta
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// MARK: - Color Utility
|
|
399
|
+
|
|
400
|
+
private static func colorFromHex(_ hex: String?) -> UIColor? {
|
|
401
|
+
guard let hex = hex, !hex.isEmpty else { return nil }
|
|
402
|
+
var hexStr = hex.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
403
|
+
if hexStr.hasPrefix("#") { hexStr.removeFirst() }
|
|
404
|
+
|
|
405
|
+
if hexStr == "none" || hexStr == "transparent" { return .clear }
|
|
406
|
+
|
|
407
|
+
var rgb: UInt64 = 0
|
|
408
|
+
Scanner(string: hexStr).scanHexInt64(&rgb)
|
|
409
|
+
|
|
410
|
+
switch hexStr.count {
|
|
411
|
+
case 3:
|
|
412
|
+
let r = CGFloat((rgb >> 8) & 0xF) / 15.0
|
|
413
|
+
let g = CGFloat((rgb >> 4) & 0xF) / 15.0
|
|
414
|
+
let b = CGFloat(rgb & 0xF) / 15.0
|
|
415
|
+
return UIColor(red: r, green: g, blue: b, alpha: 1.0)
|
|
416
|
+
case 6:
|
|
417
|
+
let r = CGFloat((rgb >> 16) & 0xFF) / 255.0
|
|
418
|
+
let g = CGFloat((rgb >> 8) & 0xFF) / 255.0
|
|
419
|
+
let b = CGFloat(rgb & 0xFF) / 255.0
|
|
420
|
+
return UIColor(red: r, green: g, blue: b, alpha: 1.0)
|
|
421
|
+
case 8:
|
|
422
|
+
let r = CGFloat((rgb >> 24) & 0xFF) / 255.0
|
|
423
|
+
let g = CGFloat((rgb >> 16) & 0xFF) / 255.0
|
|
424
|
+
let b = CGFloat((rgb >> 8) & 0xFF) / 255.0
|
|
425
|
+
let a = CGFloat(rgb & 0xFF) / 255.0
|
|
426
|
+
return UIColor(red: r, green: g, blue: b, alpha: a)
|
|
427
|
+
default:
|
|
428
|
+
return nil
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React
|
|
2
|
+
|
|
3
|
+
@objc(MonflowtsSvgViewManager)
|
|
4
|
+
class MonflowtsSvgViewManager: RCTViewManager {
|
|
5
|
+
|
|
6
|
+
override func view() -> UIView! {
|
|
7
|
+
return MonflowtsSvgUIView()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import WebKit
|
|
3
|
+
import React
|
|
4
|
+
|
|
5
|
+
class MonflowtsWebUIView: UIView, WKNavigationDelegate, WKScriptMessageHandler {
|
|
6
|
+
|
|
7
|
+
// MARK: - React Native callback
|
|
8
|
+
@objc var onMessage: RCTDirectEventBlock?
|
|
9
|
+
|
|
10
|
+
// MARK: - HTML prop
|
|
11
|
+
@objc var html: String = "" {
|
|
12
|
+
didSet {
|
|
13
|
+
if html != oldValue && !html.isEmpty {
|
|
14
|
+
webView.loadHTMLString(html, baseURL: URL(string: "https://localhost"))
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: - WKWebView
|
|
20
|
+
private lazy var webView: WKWebView = {
|
|
21
|
+
let config = WKWebViewConfiguration()
|
|
22
|
+
config.allowsInlineMediaPlayback = true
|
|
23
|
+
|
|
24
|
+
// Register JS → Native bridge: window.webkit.messageHandlers.monflowtsBridge.postMessage(...)
|
|
25
|
+
let controller = WKUserContentController()
|
|
26
|
+
controller.add(self, name: "monflowtsBridge")
|
|
27
|
+
config.userContentController = controller
|
|
28
|
+
|
|
29
|
+
let wv = WKWebView(frame: .zero, configuration: config)
|
|
30
|
+
wv.navigationDelegate = self
|
|
31
|
+
wv.scrollView.bounces = false
|
|
32
|
+
wv.isOpaque = false
|
|
33
|
+
wv.backgroundColor = .clear
|
|
34
|
+
wv.scrollView.backgroundColor = .clear
|
|
35
|
+
return wv
|
|
36
|
+
}()
|
|
37
|
+
|
|
38
|
+
// MARK: - Init
|
|
39
|
+
override init(frame: CGRect) {
|
|
40
|
+
super.init(frame: frame)
|
|
41
|
+
addSubview(webView)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
required init?(coder: NSCoder) {
|
|
45
|
+
fatalError("init(coder:) has not been implemented")
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override func layoutSubviews() {
|
|
49
|
+
super.layoutSubviews()
|
|
50
|
+
webView.frame = bounds
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// MARK: - WKScriptMessageHandler
|
|
54
|
+
func userContentController(
|
|
55
|
+
_ userContentController: WKUserContentController,
|
|
56
|
+
didReceive message: WKScriptMessage
|
|
57
|
+
) {
|
|
58
|
+
guard message.name == "monflowtsBridge",
|
|
59
|
+
message.frameInfo.isMainFrame,
|
|
60
|
+
message.frameInfo.securityOrigin.protocol == "https",
|
|
61
|
+
message.frameInfo.securityOrigin.host == "localhost" else { return }
|
|
62
|
+
|
|
63
|
+
if let body = message.body as? String {
|
|
64
|
+
onMessage?(["data": body])
|
|
65
|
+
} else if let body = message.body as? [String: Any],
|
|
66
|
+
let jsonData = try? JSONSerialization.data(withJSONObject: body),
|
|
67
|
+
let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
68
|
+
onMessage?(["data": jsonString])
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// MARK: - WKNavigationDelegate — open external links in Safari
|
|
73
|
+
func webView(
|
|
74
|
+
_ webView: WKWebView,
|
|
75
|
+
decidePolicyFor navigationAction: WKNavigationAction,
|
|
76
|
+
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void
|
|
77
|
+
) {
|
|
78
|
+
if navigationAction.navigationType == .linkActivated,
|
|
79
|
+
let url = navigationAction.request.url,
|
|
80
|
+
UIApplication.shared.canOpenURL(url) {
|
|
81
|
+
UIApplication.shared.open(url)
|
|
82
|
+
decisionHandler(.cancel)
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
decisionHandler(.allow)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// MARK: - Cleanup
|
|
89
|
+
deinit {
|
|
90
|
+
webView.configuration.userContentController.removeScriptMessageHandler(forName: "monflowtsBridge")
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(MonflowtsWebViewManager)
|
|
5
|
+
class MonflowtsWebViewManager: RCTViewManager {
|
|
6
|
+
|
|
7
|
+
override func view() -> UIView! {
|
|
8
|
+
return MonflowtsWebUIView()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
}
|