catalyst-core 0.3.0-beta.5 → 0.3.0-canary.2
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/changelog.md +185 -71
- package/dist/errors/generateDocs.js +100 -0
- package/dist/errors/index.js +243 -0
- package/dist/errors/registry.js +483 -0
- package/dist/errors-index.json +506 -0
- package/dist/globals.d.ts +62 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.jsx +5 -8
- package/dist/logger.js +1 -1
- package/dist/native/androidProject/app/build.gradle.kts +142 -7
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +4 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +2 -2
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +43 -8
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeUtilsTest.kt +181 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CameraUtilsTest.kt +156 -236
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileSizeRouterUtilsTest.kt +471 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileUtilsTest.kt +222 -226
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FrameworkServerUtilsTest.kt +300 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/IntentUtilsTest.kt +244 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/MetricsMonitorTest.kt +359 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NativeBridgeTest.kt +108 -63
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NotificationUtilsTest.kt +329 -385
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/OfflineCacheServiceTest.kt +302 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/PerfEventBufferTest.kt +133 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/UtilsKtTest.kt +152 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/WebCacheManagerTest.kt +145 -324
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/BarcodeDetectorTest.kt +132 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/HoldControllerTest.kt +155 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/TorchControllerTest.kt +150 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateMachineTest.kt +120 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateTest.kt +62 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ViewfinderMapperTest.kt +143 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ZoomControllerTest.kt +421 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/design/DesignTokensTest.kt +207 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +368 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/FridaDetectorTest.kt +193 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckManagerTest.kt +260 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckSchedulerTest.kt +166 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DeviceInfoUtilsTest.kt +167 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DownloadUtilsTest.kt +197 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/NetworkMonitorTest.kt +271 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/PushNotificationUtilsTest.kt +119 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/SafeAreaUtilsTest.kt +108 -0
- package/dist/native/androidProject/build.gradle.kts +1 -0
- package/dist/native/androidProject/gradle/libs.versions.toml +26 -0
- package/dist/native/androidProject/settings.gradle.kts +11 -8
- package/dist/native/androidSetup.js +2 -2
- package/dist/native/bridge/WebBridge.d.ts +98 -0
- package/dist/native/bridge/WebBridge.js +40 -6
- package/dist/native/bridge/constants/NativeInterfaces.d.ts +391 -0
- package/dist/native/bridge/errors.d.ts +67 -0
- package/dist/native/bridge/errors.js +66 -151
- package/dist/native/bridge/hooks/index.d.ts +13 -0
- package/dist/native/bridge/hooks/index.js +0 -6
- package/dist/native/bridge/hooks/useAI.d.ts +1 -0
- package/dist/native/bridge/hooks/useAI.js +3 -1
- package/dist/native/bridge/hooks/useCamera.d.ts +86 -0
- package/dist/native/bridge/hooks/useCamera.js +35 -6
- package/dist/native/bridge/hooks/useDataProtection.d.ts +17 -0
- package/dist/native/bridge/hooks/useDeviceInfo.d.ts +34 -0
- package/dist/native/bridge/hooks/useDeviceInfo.js +5 -0
- package/dist/native/bridge/hooks/useFilePicker.d.ts +53 -0
- package/dist/native/bridge/hooks/useFilePicker.js +13 -0
- package/dist/native/bridge/hooks/useGoogleSignIn.d.ts +12 -0
- package/dist/native/bridge/hooks/useHapticFeedback.d.ts +76 -0
- package/dist/native/bridge/hooks/useHapticFeedback.js +6 -1
- package/dist/native/bridge/hooks/useIntent.d.ts +33 -0
- package/dist/native/bridge/hooks/useIntent.js +2 -0
- package/dist/native/bridge/hooks/useNativeTransition.d.ts +53 -0
- package/dist/native/bridge/hooks/useNativeTransition.js +12 -5
- package/dist/native/bridge/hooks/useNetworkStatus.d.ts +22 -0
- package/dist/native/bridge/hooks/useNetworkStatus.js +7 -0
- package/dist/native/bridge/hooks/useNotification.d.ts +83 -0
- package/dist/native/bridge/hooks/useNotification.js +81 -34
- package/dist/native/bridge/hooks/useSafeArea.d.ts +12 -0
- package/dist/native/bridge/hooks/useSafeArea.js +8 -0
- package/dist/native/bridge/hooks/useVideoStream.d.ts +67 -0
- package/dist/native/bridge/hooks/useVideoStream.js +38 -52
- package/dist/native/bridge/hooks/utils.d.ts +4 -0
- package/dist/native/bridge/hooks.d.ts +1 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.d.ts +43 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/HookCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/HookCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.d.ts +103 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.d.ts +53 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.d.ts +47 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.js +8 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.d.ts +29 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.d.ts +31 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +4 -0
- package/dist/native/bridge/perf/core/constants.d.ts +76 -0
- package/dist/native/bridge/perf/core/measure.d.ts +39 -0
- package/dist/native/bridge/perf/core/measure.js +4 -0
- package/dist/native/bridge/perf/core/session.d.ts +49 -0
- package/dist/native/bridge/perf/core/session.js +4 -0
- package/dist/native/bridge/perf/core/store.d.ts +37 -0
- package/dist/native/bridge/perf/core/store.js +4 -0
- package/dist/native/bridge/perf/core/summary.d.ts +60 -0
- package/dist/native/bridge/perf/core/traceExport.d.ts +10 -0
- package/dist/native/bridge/perf/core/waterfalls.d.ts +2 -0
- package/dist/native/bridge/perf/index.d.ts +63 -0
- package/dist/native/bridge/perf/index.js +4 -0
- package/dist/native/bridge/safeArea.d.ts +11 -0
- package/dist/native/bridge/safeArea.js +2 -0
- package/dist/native/bridge/useBaseHook.d.ts +137 -0
- package/dist/native/bridge/useBaseHook.js +34 -4
- package/dist/native/bridge/utils/CameraUtils.d.ts +94 -0
- package/dist/native/bridge/utils/CameraUtils.js +4 -0
- package/dist/native/bridge/utils/FileObjectConverter.d.ts +36 -0
- package/dist/native/bridge/utils/NativeBridge.d.ts +270 -0
- package/dist/native/bridge/utils/NativeBridge.js +10 -0
- package/dist/native/buildAndroid/index.js +1 -1
- package/dist/native/buildAppAndroid.js +9 -0
- package/dist/native/buildAppIos.js +16 -1
- package/dist/native/buildErrorFormat.js +57 -0
- package/dist/native/buildIos/config.js +15 -1
- package/dist/native/buildIos/index.js +1 -1
- package/dist/native/buildIos/plugins.js +10 -1
- package/dist/native/iosnativeWebView/CoreLogic/Package.swift +36 -0
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamState.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamStateMachine.swift +6 -4
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/BootTimingUtility.swift +3 -3
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/FrameworkServerUtils.swift +14 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NetworkMonitor.swift +11 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NotificationHandlerProvider.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/URLWhitelistManager.swift +7 -7
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/AnyCodableTests.swift +154 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/BootTimingUtilityTests.swift +23 -5
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/CatalystConstantsTests.swift +192 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/ConfigMappingTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsErrorPathTests.swift +106 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsLoopbackTests.swift +243 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/FrameworkServerUtilsTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NetworkMonitorTests.swift +119 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NotificationHandlerProviderTests.swift +59 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/NotificationHandlerTests.swift +1 -1
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/URLWhitelistManagerTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateMachineTests.swift +171 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateTests.swift +91 -0
- package/dist/native/iosnativeWebView/Package.swift +10 -9
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +7 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +1 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +5 -4
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +31 -30
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +1 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +22 -19
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +40 -39
- package/dist/native/iosnativeWebView/Sources/Core/Utils/PerfEventBuffer.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +15 -15
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +4 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +6 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +3 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +20 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +14 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +3 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +9 -8
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +7 -6
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +24 -25
- package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +6 -1
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +4 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +2 -22
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/BridgeMessageValidatorTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/CacheManagerTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/FilePickerHandlerTests.swift +2 -1
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/NativeBridgeTests.swift +15 -9
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/WebViewTests.swift +1 -0
- package/dist/native/setupEmulatorIos.js +2 -2
- package/dist/native/terminalProgress.js +17 -17
- package/dist/router/ClientRouter.d.ts +8 -0
- package/dist/router/ClientRouter.js +13 -11
- package/dist/router/ServerRouter.d.ts +13 -0
- package/dist/router/ServerRouter.js +19 -7
- package/dist/scripts/build.js +14 -2
- package/dist/scripts/loadEnvironmentVariables.js +3 -2
- package/dist/scripts/plugins.js +1 -1
- package/dist/scripts/preServerInit.js +49 -3
- package/dist/scripts/preflight.js +111 -0
- package/dist/scripts/scriptUtils.js +46 -1
- package/dist/scripts/serve.js +7 -3
- package/dist/scripts/start.js +8 -3
- package/dist/server/expressServer.d.ts +1 -0
- package/dist/server/expressServer.js +247 -271
- package/dist/server/manifestCache.d.ts +2 -0
- package/dist/server/manifestCache.js +25 -33
- package/dist/server/renderer/ChunkExtractor.d.ts +44 -0
- package/dist/server/renderer/ChunkExtractor.js +113 -125
- package/dist/server/renderer/document/Body.d.ts +21 -0
- package/dist/server/renderer/document/Body.jsx +45 -45
- package/dist/server/renderer/document/FastRefresh.d.ts +3 -0
- package/dist/server/renderer/document/FastRefresh.jsx +7 -13
- package/dist/server/renderer/document/Head.d.ts +20 -0
- package/dist/server/renderer/document/Head.jsx +32 -32
- package/dist/server/renderer/document/index.d.ts +2 -0
- package/dist/server/renderer/document/index.jsx +2 -2
- package/dist/server/renderer/extract.d.ts +67 -0
- package/dist/server/renderer/extract.js +92 -89
- package/dist/server/renderer/handler.d.ts +2 -0
- package/dist/server/renderer/handler.jsx +401 -404
- package/dist/server/renderer/index.d.ts +2 -0
- package/dist/server/renderer/index.js +5 -8
- package/dist/server/renderer/render.d.ts +35 -0
- package/dist/server/renderer/render.js +25 -32
- package/dist/server/utils/botDetectionMiddleware.d.ts +1 -0
- package/dist/server/utils/botDetectionMiddleware.js +33 -23
- package/dist/server/utils/cjsRequire.d.ts +8 -0
- package/dist/server/utils/cjsRequire.js +2 -2
- package/dist/server/utils/userAgentUtil.d.ts +7 -0
- package/dist/server/utils/userAgentUtil.js +68 -71
- package/dist/server/utils/validator.d.ts +31 -0
- package/dist/server/utils/validator.js +133 -158
- package/dist/vite/inject-cache-key-plugin.js +3 -27
- package/dist/vite/moduleAliases.js +36 -0
- package/dist/vite/node-loader.mjs +2 -29
- package/dist/vite/resolveDevServerConfig.js +4 -1
- package/dist/vite/vite.config.js +2 -29
- package/dist/web-router/components/MetaTag.d.ts +4 -0
- package/dist/web-router/components/MetaTag.jsx +26 -28
- package/dist/web-router/components/MetaTag.test.jsx +100 -0
- package/dist/web-router/components/RouterDataProvider.d.ts +96 -0
- package/dist/web-router/components/RouterDataProvider.jsx +260 -259
- package/dist/web-router/components/RouterDataProvider.server.test.jsx +98 -0
- package/dist/web-router/components/RouterDataProvider.test.jsx +310 -0
- package/dist/web-router/components/Split.d.ts +74 -0
- package/dist/web-router/components/Split.jsx +147 -156
- package/dist/web-router/components/Split.server.test.jsx +52 -0
- package/dist/web-router/components/Split.test.jsx +167 -0
- package/dist/web-router/components/SplitInview.d.ts +22 -0
- package/dist/web-router/components/SplitInview.jsx +78 -89
- package/dist/web-router/components/SplitInview.test.jsx +112 -0
- package/dist/web-router/components/SsrRequestContext.d.ts +20 -0
- package/dist/web-router/components/SsrRequestContext.jsx +17 -7
- package/dist/web-router/components/SsrRequestContext.test.jsx +53 -0
- package/dist/web-router/context.d.ts +15 -0
- package/dist/web-router/context.jsx +5 -5
- package/dist/web-router/context.test.jsx +10 -0
- package/dist/web-router/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +86 -86
- package/dist/web-router/utils/metaDataUtils.test.jsx +188 -0
- package/dist/web-router/vitest.setup.js +12 -0
- package/mcp_v2/knowledge-base.json +115 -17
- package/mcp_v2/mcp.js +141 -3
- package/mcp_v2/package-lock.json +2031 -0
- package/mcp_v2/package.json +13 -2
- package/mcp_v2/scripts/copyErrorsIndex.cjs +34 -0
- package/mcp_v2/test/errors.test.ts +123 -0
- package/mcp_v2/test/github.test.ts +177 -0
- package/mcp_v2/tools/errors.d.ts +20 -0
- package/mcp_v2/tools/errors.js +63 -0
- package/mcp_v2/tools/github.d.ts +41 -0
- package/mcp_v2/tools/github.js +231 -0
- package/mcp_v2/vitest.config.mjs +22 -0
- package/package.json +60 -11
- package/test/errors/docsDrift.test.ts +113 -0
- package/test/errors/index.test.ts +200 -0
- package/test/errors/registry.test.ts +108 -0
- package/test/scripts/preflight.test.ts +118 -0
- package/test/server/ChunkExtractor.test.ts +97 -0
- package/test/server/extract.test.ts +128 -0
- package/test/server/fixtures/template/server/document.jsx +19 -0
- package/test/server/fixtures/template/server/index.js +10 -0
- package/test/server/fixtures/template/src/js/containers/App/index.jsx +33 -0
- package/test/server/fixtures/template/src/js/routes/index.jsx +72 -0
- package/test/server/fixtures/template/src/js/routes/utils.jsx +39 -0
- package/test/server/fixtures/template/src/js/store/index.js +19 -0
- package/test/server/handler.assets.test.ts +330 -0
- package/test/server/handler.test.ts +208 -0
- package/test/server/manifestCache.test.ts +71 -0
- package/test/server/render.test.ts +71 -0
- package/test/server/scriptUtils.test.ts +103 -0
- package/test/server/userAgentUtil.test.ts +48 -0
- package/test/server/validator.test.ts +225 -0
- package/test/vite/resolveDevServerConfig.test.js +4 -1
- package/tsconfig.test.json +23 -0
- package/vitest.config.ts +93 -0
- package/dist/caching.js +0 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/DeviceInfoUtilsTest.kt +0 -187
- package/dist/native/bridge/standardizedHooks.js +0 -611
- package/dist/router.js +0 -1
- package/dist/scripts/validator.js +0 -149
- package/dist/web-router/hooks.jsx +0 -72
- package/dist/web-router/types/components/MetaTag.d.ts +0 -2
- package/dist/web-router/types/components/RouterDataProvider.d.ts +0 -95
- package/dist/web-router/types/context.d.ts +0 -14
- package/dist/web-router/types/hooks.d.ts +0 -1
- package/dist/web-router/types/index.d.ts +0 -3
- package/dist/web-router/types/utils/metaDataUtils.d.ts +0 -40
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/CatalystConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/ConfigConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Notifications/NotificationModels.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Protocols/NotificationHandlerProtocol.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NullNotificationHandler.swift +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import CatalystCoreLogic
|
|
3
|
+
|
|
4
|
+
/// A minimal, test-local stub used only to prove NotificationHandlerProvider
|
|
5
|
+
/// actually stores and returns whatever is injected — distinct from
|
|
6
|
+
/// NullNotificationHandler so identity comparison is meaningful.
|
|
7
|
+
private final class StubNotificationHandler: NotificationHandlerProtocol {
|
|
8
|
+
func requestPermission() async -> Bool { true }
|
|
9
|
+
func getPermissionStatusString() async -> String { "GRANTED" }
|
|
10
|
+
func scheduleLocal(_ config: NotificationConfig) -> String { "stub-id" }
|
|
11
|
+
func cancelLocal(_ notificationId: String) -> Bool { true }
|
|
12
|
+
func cancelAllLocal() {}
|
|
13
|
+
func initializePush() async -> (token: String?, error: String?) { ("stub-token", nil) }
|
|
14
|
+
func subscribeToTopic(_ topic: String) async -> Bool { true }
|
|
15
|
+
func unsubscribeFromTopic(_ topic: String) async -> Bool { true }
|
|
16
|
+
func getSubscribedTopics() async -> [String] { ["stub-topic"] }
|
|
17
|
+
func updateBadge(_ count: Int) {}
|
|
18
|
+
func setNavigationHandler(_ handler: @escaping (URL) -> Void) {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Unit tests for NotificationHandlerProvider
|
|
23
|
+
*
|
|
24
|
+
* Covers the default (NullNotificationHandler) value and inject() replacing
|
|
25
|
+
* it — the two lines of real logic in this 3-line file.
|
|
26
|
+
*/
|
|
27
|
+
final class NotificationHandlerProviderTests: XCTestCase {
|
|
28
|
+
|
|
29
|
+
override func tearDown() {
|
|
30
|
+
// Restore the default so other tests / files aren't affected by
|
|
31
|
+
// this file's injection (NotificationHandlerProvider.shared is
|
|
32
|
+
// process-global mutable state).
|
|
33
|
+
NotificationHandlerProvider.shared = NullNotificationHandler.shared
|
|
34
|
+
super.tearDown()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
func testDefaultShared_IsNullNotificationHandler() {
|
|
38
|
+
NotificationHandlerProvider.shared = NullNotificationHandler.shared
|
|
39
|
+
XCTAssertTrue(NotificationHandlerProvider.shared as AnyObject === NullNotificationHandler.shared)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
func testInject_ReplacesSharedHandler() {
|
|
43
|
+
let stub = StubNotificationHandler()
|
|
44
|
+
|
|
45
|
+
NotificationHandlerProvider.inject(stub)
|
|
46
|
+
|
|
47
|
+
XCTAssertTrue(NotificationHandlerProvider.shared as AnyObject === stub)
|
|
48
|
+
XCTAssertFalse(NotificationHandlerProvider.shared as AnyObject === NullNotificationHandler.shared)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func testInject_InjectedHandlerBehavesAsProvided() async {
|
|
52
|
+
let stub = StubNotificationHandler()
|
|
53
|
+
NotificationHandlerProvider.inject(stub)
|
|
54
|
+
|
|
55
|
+
let granted = await NotificationHandlerProvider.shared.requestPermission()
|
|
56
|
+
|
|
57
|
+
XCTAssertTrue(granted)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import CatalystCoreLogic
|
|
3
|
+
|
|
4
|
+
/// A test-local listener that records every callback it receives, and can
|
|
5
|
+
/// be used to exercise both the notification path and the weak-reference
|
|
6
|
+
/// compaction path (by letting it deallocate while still registered).
|
|
7
|
+
private final class RecordingListener: VideoStreamStateListener {
|
|
8
|
+
struct Event: Equatable {
|
|
9
|
+
let prev: String
|
|
10
|
+
let next: String
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private(set) var events: [Event] = []
|
|
14
|
+
|
|
15
|
+
func onStateChanged(prev: VideoStreamState, next: VideoStreamState) {
|
|
16
|
+
events.append(Event(prev: describe(prev), next: describe(next)))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private func describe(_ state: VideoStreamState) -> String {
|
|
20
|
+
switch state {
|
|
21
|
+
case .idle: return "idle"
|
|
22
|
+
case .starting: return "starting"
|
|
23
|
+
case .streaming: return "streaming"
|
|
24
|
+
case .hold: return "hold"
|
|
25
|
+
case .flipping: return "flipping"
|
|
26
|
+
case .stopping: return "stopping"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Unit tests for VideoStreamStateMachine
|
|
33
|
+
*
|
|
34
|
+
* Covers: initial state, valid/invalid transitions, isActive derivation,
|
|
35
|
+
* listener add/remove/notify, and weak-listener compaction on dealloc.
|
|
36
|
+
*/
|
|
37
|
+
final class VideoStreamStateMachineTests: XCTestCase {
|
|
38
|
+
|
|
39
|
+
func testInitialState_IsIdle() {
|
|
40
|
+
let machine = VideoStreamStateMachine()
|
|
41
|
+
XCTAssertEqual(machine.state, .idle)
|
|
42
|
+
XCTAssertFalse(machine.isActive)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
func testValidTransition_UpdatesStateAndReturnsTrue() {
|
|
46
|
+
let machine = VideoStreamStateMachine()
|
|
47
|
+
|
|
48
|
+
let result = machine.transition(to: .starting)
|
|
49
|
+
|
|
50
|
+
XCTAssertTrue(result)
|
|
51
|
+
XCTAssertEqual(machine.state, .starting)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
func testInvalidTransition_LeavesStateUnchangedAndReturnsFalse() {
|
|
55
|
+
let machine = VideoStreamStateMachine()
|
|
56
|
+
|
|
57
|
+
// idle -> streaming is not a valid direct transition
|
|
58
|
+
let result = machine.transition(to: .streaming)
|
|
59
|
+
|
|
60
|
+
XCTAssertFalse(result)
|
|
61
|
+
XCTAssertEqual(machine.state, .idle)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
func testIsActive_TrueWhileStreamingHoldOrFlipping() {
|
|
65
|
+
let machine = VideoStreamStateMachine()
|
|
66
|
+
|
|
67
|
+
machine.transition(to: .starting)
|
|
68
|
+
machine.transition(to: .streaming)
|
|
69
|
+
XCTAssertTrue(machine.isActive)
|
|
70
|
+
|
|
71
|
+
machine.transition(to: .hold)
|
|
72
|
+
XCTAssertTrue(machine.isActive)
|
|
73
|
+
|
|
74
|
+
machine.transition(to: .streaming)
|
|
75
|
+
machine.transition(to: .flipping)
|
|
76
|
+
XCTAssertTrue(machine.isActive)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func testIsActive_FalseOnceStopped() {
|
|
80
|
+
let machine = VideoStreamStateMachine()
|
|
81
|
+
|
|
82
|
+
machine.transition(to: .starting)
|
|
83
|
+
machine.transition(to: .streaming)
|
|
84
|
+
machine.transition(to: .stopping)
|
|
85
|
+
XCTAssertFalse(machine.isActive)
|
|
86
|
+
|
|
87
|
+
machine.transition(to: .idle)
|
|
88
|
+
XCTAssertFalse(machine.isActive)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
func testListener_ReceivesNotificationOnValidTransition() {
|
|
92
|
+
let machine = VideoStreamStateMachine()
|
|
93
|
+
let listener = RecordingListener()
|
|
94
|
+
machine.addListener(listener)
|
|
95
|
+
|
|
96
|
+
machine.transition(to: .starting)
|
|
97
|
+
|
|
98
|
+
XCTAssertEqual(listener.events, [.init(prev: "idle", next: "starting")])
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func testListener_DoesNotFireOnInvalidTransition() {
|
|
102
|
+
let machine = VideoStreamStateMachine()
|
|
103
|
+
let listener = RecordingListener()
|
|
104
|
+
machine.addListener(listener)
|
|
105
|
+
|
|
106
|
+
let result = machine.transition(to: .streaming) // idle -> streaming is invalid
|
|
107
|
+
|
|
108
|
+
XCTAssertFalse(result)
|
|
109
|
+
XCTAssertTrue(listener.events.isEmpty)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
func testListener_ReceivesMultipleSequentialTransitions() {
|
|
113
|
+
let machine = VideoStreamStateMachine()
|
|
114
|
+
let listener = RecordingListener()
|
|
115
|
+
machine.addListener(listener)
|
|
116
|
+
|
|
117
|
+
machine.transition(to: .starting)
|
|
118
|
+
machine.transition(to: .streaming)
|
|
119
|
+
machine.transition(to: .stopping)
|
|
120
|
+
machine.transition(to: .idle)
|
|
121
|
+
|
|
122
|
+
XCTAssertEqual(listener.events, [
|
|
123
|
+
.init(prev: "idle", next: "starting"),
|
|
124
|
+
.init(prev: "starting", next: "streaming"),
|
|
125
|
+
.init(prev: "streaming", next: "stopping"),
|
|
126
|
+
.init(prev: "stopping", next: "idle"),
|
|
127
|
+
])
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
func testRemoveListener_StopsFurtherNotifications() {
|
|
131
|
+
let machine = VideoStreamStateMachine()
|
|
132
|
+
let listener = RecordingListener()
|
|
133
|
+
machine.addListener(listener)
|
|
134
|
+
|
|
135
|
+
machine.transition(to: .starting)
|
|
136
|
+
machine.removeListener(listener)
|
|
137
|
+
machine.transition(to: .streaming)
|
|
138
|
+
|
|
139
|
+
XCTAssertEqual(listener.events, [.init(prev: "idle", next: "starting")])
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
func testWeakListener_DeallocatedListenerDoesNotCrashOnNextTransition() {
|
|
143
|
+
let machine = VideoStreamStateMachine()
|
|
144
|
+
|
|
145
|
+
// Register a listener that immediately goes out of scope; the
|
|
146
|
+
// WeakListenerBox holding it should be compacted away on the next
|
|
147
|
+
// transition rather than crash on a dangling reference.
|
|
148
|
+
autoreleasepool {
|
|
149
|
+
let shortLived = RecordingListener()
|
|
150
|
+
machine.addListener(shortLived)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Should not crash, and should still perform the transition normally.
|
|
154
|
+
let result = machine.transition(to: .starting)
|
|
155
|
+
XCTAssertTrue(result)
|
|
156
|
+
XCTAssertEqual(machine.state, .starting)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
func testMultipleListeners_AllReceiveNotification() {
|
|
160
|
+
let machine = VideoStreamStateMachine()
|
|
161
|
+
let listenerA = RecordingListener()
|
|
162
|
+
let listenerB = RecordingListener()
|
|
163
|
+
machine.addListener(listenerA)
|
|
164
|
+
machine.addListener(listenerB)
|
|
165
|
+
|
|
166
|
+
machine.transition(to: .starting)
|
|
167
|
+
|
|
168
|
+
XCTAssertEqual(listenerA.events, [.init(prev: "idle", next: "starting")])
|
|
169
|
+
XCTAssertEqual(listenerB.events, [.init(prev: "idle", next: "starting")])
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import CatalystCoreLogic
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Unit tests for VideoStreamState
|
|
6
|
+
*
|
|
7
|
+
* Exhaustive truth-table coverage of the state transition rules documented
|
|
8
|
+
* directly in VideoStreamState.swift:
|
|
9
|
+
*
|
|
10
|
+
* IDLE → STARTING (start() called)
|
|
11
|
+
* STARTING → STREAMING (session running)
|
|
12
|
+
* STARTING → IDLE (permission denied or bind failure)
|
|
13
|
+
* STREAMING → HOLD (QR detected)
|
|
14
|
+
* HOLD → STREAMING (hold expired)
|
|
15
|
+
* STREAMING → FLIPPING (flip() called)
|
|
16
|
+
* FLIPPING → STREAMING (rebind complete)
|
|
17
|
+
* STREAMING → STOPPING (stop() called)
|
|
18
|
+
* FLIPPING → STOPPING (stop() called mid-flip)
|
|
19
|
+
* HOLD → STOPPING (stop() called during hold)
|
|
20
|
+
* STOPPING → IDLE (session torn down)
|
|
21
|
+
*
|
|
22
|
+
* Every other (from, to) pair among the 6 states must be rejected.
|
|
23
|
+
*/
|
|
24
|
+
final class VideoStreamStateTests: XCTestCase {
|
|
25
|
+
|
|
26
|
+
private static let allStates: [VideoStreamState] = [
|
|
27
|
+
.idle, .starting, .streaming, .hold, .flipping, .stopping,
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
/// The exact set of valid transitions, mirroring the doc comment above.
|
|
31
|
+
private static let validTransitions: Set<[String]> = [
|
|
32
|
+
["idle", "starting"],
|
|
33
|
+
["starting", "streaming"],
|
|
34
|
+
["starting", "idle"],
|
|
35
|
+
["streaming", "hold"],
|
|
36
|
+
["hold", "streaming"],
|
|
37
|
+
["streaming", "flipping"],
|
|
38
|
+
["flipping", "streaming"],
|
|
39
|
+
["streaming", "stopping"],
|
|
40
|
+
["flipping", "stopping"],
|
|
41
|
+
["hold", "stopping"],
|
|
42
|
+
["stopping", "idle"],
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
private func name(_ state: VideoStreamState) -> String {
|
|
46
|
+
switch state {
|
|
47
|
+
case .idle: return "idle"
|
|
48
|
+
case .starting: return "starting"
|
|
49
|
+
case .streaming: return "streaming"
|
|
50
|
+
case .hold: return "hold"
|
|
51
|
+
case .flipping: return "flipping"
|
|
52
|
+
case .stopping: return "stopping"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func testCanTransitionTo_ExhaustiveTruthTable() {
|
|
57
|
+
for from in Self.allStates {
|
|
58
|
+
for to in Self.allStates {
|
|
59
|
+
let expected = Self.validTransitions.contains([name(from), name(to)])
|
|
60
|
+
let actual = from.canTransitionTo(to)
|
|
61
|
+
XCTAssertEqual(
|
|
62
|
+
actual, expected,
|
|
63
|
+
"canTransitionTo mismatch: \(name(from)) -> \(name(to)), expected \(expected), got \(actual)"
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
func testIsActive_StreamingHoldFlippingAreActive() {
|
|
70
|
+
XCTAssertTrue(VideoStreamState.streaming.isActive)
|
|
71
|
+
XCTAssertTrue(VideoStreamState.hold.isActive)
|
|
72
|
+
XCTAssertTrue(VideoStreamState.flipping.isActive)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
func testIsActive_IdleStartingStoppingAreNotActive() {
|
|
76
|
+
XCTAssertFalse(VideoStreamState.idle.isActive)
|
|
77
|
+
XCTAssertFalse(VideoStreamState.starting.isActive)
|
|
78
|
+
XCTAssertFalse(VideoStreamState.stopping.isActive)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
func testIsActive_AllStatesCoveredExactlyOnce() {
|
|
82
|
+
// Sanity check that the two tests above between them cover every
|
|
83
|
+
// case in the enum — guards against silently missing a case if the
|
|
84
|
+
// enum ever grows.
|
|
85
|
+
let activeCount = Self.allStates.filter { $0.isActive }.count
|
|
86
|
+
let inactiveCount = Self.allStates.filter { !$0.isActive }.count
|
|
87
|
+
XCTAssertEqual(activeCount, 3)
|
|
88
|
+
XCTAssertEqual(inactiveCount, 3)
|
|
89
|
+
XCTAssertEqual(activeCount + inactiveCount, Self.allStates.count)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -6,11 +6,12 @@ import PackageDescription
|
|
|
6
6
|
// TODO: haven't made this conditional yet
|
|
7
7
|
let package = Package(
|
|
8
8
|
name: "iosnativeWebView",
|
|
9
|
-
platforms: [.iOS(.v17)],
|
|
9
|
+
platforms: [.iOS(.v17), .macOS(.v13)],
|
|
10
10
|
products: [
|
|
11
11
|
.library(name: "CatalystCore", targets: ["CatalystCore"])
|
|
12
12
|
],
|
|
13
13
|
dependencies: [
|
|
14
|
+
.package(path: "CoreLogic"),
|
|
14
15
|
.package(url: "https://github.com/kylef/JSONSchema.swift", from: "0.6.0"),
|
|
15
16
|
.package(url: "https://github.com/google/GoogleSignIn-iOS", from: "7.0.0")
|
|
16
17
|
],
|
|
@@ -20,18 +21,18 @@ let package = Package(
|
|
|
20
21
|
.target(
|
|
21
22
|
name: "CatalystCore",
|
|
22
23
|
dependencies: [
|
|
24
|
+
.product(name: "CatalystCoreLogic", package: "CoreLogic"),
|
|
23
25
|
.product(name: "JSONSchema", package: "JSONSchema.swift"),
|
|
24
26
|
.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")
|
|
25
27
|
],
|
|
26
28
|
path: "Sources/Core"
|
|
27
|
-
),
|
|
28
|
-
// Test target for CatalystCore
|
|
29
|
-
// Tests are excluded from npm package via .npmignore
|
|
30
|
-
// Run with: swift test (from iosnativeWebView directory)
|
|
31
|
-
.testTarget(
|
|
32
|
-
name: "CatalystCoreTests",
|
|
33
|
-
dependencies: ["CatalystCore"],
|
|
34
|
-
path: "Tests/CatalystCoreTests"
|
|
35
29
|
)
|
|
30
|
+
// Note: no .testTarget here for CatalystCore's own simulator-based tests
|
|
31
|
+
// (iosnativeWebViewTests) — those are declared and run via the Xcode
|
|
32
|
+
// project/scheme, not `swift test` at this package root. The
|
|
33
|
+
// CatalystCoreLogicTests test target lives in the nested CoreLogic/
|
|
34
|
+
// package (see CoreLogic/Package.swift) so `swift test --package-path
|
|
35
|
+
// CoreLogic` can run with zero simulator, zero remote dependency
|
|
36
|
+
// resolution.
|
|
36
37
|
]
|
|
37
38
|
)
|
package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift
CHANGED
|
@@ -3,6 +3,7 @@ import UserNotifications
|
|
|
3
3
|
import UIKit
|
|
4
4
|
import os
|
|
5
5
|
import CatalystCore
|
|
6
|
+
import CatalystCoreLogic
|
|
6
7
|
|
|
7
8
|
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "com.app", category: "LocalNotificationHandler")
|
|
8
9
|
|
|
@@ -194,7 +195,11 @@ class LocalNotificationHandler: NSObject, UNUserNotificationCenterDelegate {
|
|
|
194
195
|
completionHandler()
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
func userNotificationCenter(
|
|
198
|
+
func userNotificationCenter(
|
|
199
|
+
_ center: UNUserNotificationCenter,
|
|
200
|
+
willPresent notification: UNNotification,
|
|
201
|
+
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
|
|
202
|
+
) {
|
|
198
203
|
|
|
199
204
|
// Show notification even when app is in foreground
|
|
200
205
|
// Check if notification has sound (vibrate enabled)
|
|
@@ -290,4 +295,4 @@ class LocalNotificationHandler: NSObject, UNUserNotificationCenterDelegate {
|
|
|
290
295
|
return url
|
|
291
296
|
}
|
|
292
297
|
|
|
293
|
-
}
|
|
298
|
+
}
|
package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift
CHANGED
|
@@ -3,6 +3,7 @@ import UserNotifications
|
|
|
3
3
|
import UIKit
|
|
4
4
|
import os
|
|
5
5
|
import CatalystCore
|
|
6
|
+
import CatalystCoreLogic
|
|
6
7
|
import FirebaseCore
|
|
7
8
|
import FirebaseMessaging
|
|
8
9
|
|
|
@@ -16,7 +17,6 @@ public final class NotificationManager: ObservableObject, NotificationHandlerPro
|
|
|
16
17
|
private var navigationHandler: ((URL) -> Void)?
|
|
17
18
|
private var baseURL: String = ""
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
private init() {
|
|
21
21
|
self.localHandler = LocalNotificationHandler(baseURL: "")
|
|
22
22
|
self.pushHandler = PushNotificationHandler()
|
|
@@ -62,7 +62,6 @@ public final class NotificationManager: ObservableObject, NotificationHandlerPro
|
|
|
62
62
|
NotificationChannelManager.setupChannels()
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
65
|
// MARK: - Permission Management
|
|
67
66
|
|
|
68
67
|
public func requestPermission() async -> Bool {
|
package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift
CHANGED
|
@@ -2,6 +2,7 @@ import Foundation
|
|
|
2
2
|
import UIKit
|
|
3
3
|
import os
|
|
4
4
|
import CatalystCore
|
|
5
|
+
import CatalystCoreLogic
|
|
5
6
|
import FirebaseMessaging
|
|
6
7
|
import FirebaseCore
|
|
7
8
|
|
|
@@ -66,19 +67,19 @@ class PushNotificationHandler: NSObject {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
// Task 2: Timeout after 30 seconds
|
|
71
72
|
group.addTask {
|
|
72
73
|
try? await Task.sleep(nanoseconds: 30_000_000_000) // 30 seconds
|
|
73
74
|
return (nil, "FCM token request timed out after 30 seconds. Check network connectivity and Firebase configuration.")
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
|
|
76
77
|
// Return the first result (either token or timeout)
|
|
77
78
|
if let result = await group.next() {
|
|
78
79
|
group.cancelAll()
|
|
79
80
|
return result
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
return (nil, "Unknown error getting FCM token")
|
|
83
84
|
}
|
|
84
85
|
#endif
|
|
@@ -196,4 +197,4 @@ extension PushNotificationHandler: MessagingDelegate {
|
|
|
196
197
|
self.fcmToken = fcmToken
|
|
197
198
|
onTokenRefresh?(fcmToken)
|
|
198
199
|
}
|
|
199
|
-
}
|
|
200
|
+
}
|
|
@@ -2,6 +2,7 @@ import Foundation
|
|
|
2
2
|
import AVFoundation
|
|
3
3
|
import UIKit
|
|
4
4
|
import os
|
|
5
|
+
import CatalystCoreLogic
|
|
5
6
|
|
|
6
7
|
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "com.app", category: "NativeCameraManager")
|
|
7
8
|
|
|
@@ -76,8 +77,8 @@ public class NativeCameraManager: ObservableObject {
|
|
|
76
77
|
onZoomChanged: { zoomLevel, minZoom, maxZoom in
|
|
77
78
|
let payload: [String: Any] = [
|
|
78
79
|
"zoomLevel": round(Double(zoomLevel) * 10) / 10,
|
|
79
|
-
"minZoom":
|
|
80
|
-
"maxZoom":
|
|
80
|
+
"minZoom": round(Double(minZoom) * 10) / 10,
|
|
81
|
+
"maxZoom": round(Double(maxZoom) * 10) / 10
|
|
81
82
|
]
|
|
82
83
|
eBox.call("ON_ZOOM_CHANGED", payload)
|
|
83
84
|
}
|
|
@@ -96,15 +97,15 @@ public class NativeCameraManager: ObservableObject {
|
|
|
96
97
|
zoomController: zoomController,
|
|
97
98
|
torchController: torchController,
|
|
98
99
|
barcodeDetector: barcodeDetector,
|
|
99
|
-
onReady:
|
|
100
|
+
onReady: { eBox.call("ON_VIDEO_STREAM_READY", nil) },
|
|
100
101
|
onStopped: { eBox.call("ON_VIDEO_STREAM_STOPPED", nil) },
|
|
101
|
-
onError:
|
|
102
|
+
onError: { msg in errBox.call(msg) }
|
|
102
103
|
)
|
|
103
104
|
|
|
104
105
|
holdController = HoldController(stateMachine: sm, barcodeDetector: barcodeDetector)
|
|
105
106
|
|
|
106
107
|
// Wire detection handler now that holdController exists
|
|
107
|
-
barcodeDetector.detectionHandler = { [weak holdController, weak sm] value, type,
|
|
108
|
+
barcodeDetector.detectionHandler = { [weak holdController, weak sm] value, type, _ in
|
|
108
109
|
guard sm?.state != .hold else { return }
|
|
109
110
|
guard let hc = holdController else { return }
|
|
110
111
|
if hc.isNewValue(value) {
|