@use-voltra/ios-client 1.4.0 → 2.0.0-rc.1
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/README.md +113 -0
- package/Voltra.podspec +28 -0
- package/build/commonjs/VoltraModule.js +13 -0
- package/build/commonjs/VoltraModule.js.map +1 -0
- package/build/commonjs/components/VoltraLiveActivityPreview.js +30 -0
- package/build/commonjs/components/VoltraLiveActivityPreview.js.map +1 -0
- package/build/commonjs/components/VoltraView.js +50 -0
- package/build/commonjs/components/VoltraView.js.map +1 -0
- package/build/commonjs/components/VoltraWidgetPreview.js +58 -0
- package/build/commonjs/components/VoltraWidgetPreview.js.map +1 -0
- package/build/commonjs/events.js +32 -0
- package/build/commonjs/events.js.map +1 -0
- package/build/commonjs/helpers.js +26 -0
- package/build/commonjs/helpers.js.map +1 -0
- package/build/commonjs/index.js +226 -0
- package/build/commonjs/index.js.map +1 -0
- package/build/commonjs/live-activity/api.js +168 -0
- package/build/commonjs/live-activity/api.js.map +1 -0
- package/build/commonjs/logger.js +39 -0
- package/build/commonjs/logger.js.map +1 -0
- package/build/commonjs/native/NativeVoltra.js +15 -0
- package/build/commonjs/native/NativeVoltra.js.map +1 -0
- package/build/commonjs/native/VoltraRNNativeComponent.ts +9 -0
- package/build/commonjs/package.json +1 -0
- package/build/commonjs/preload.js +54 -0
- package/build/commonjs/preload.js.map +1 -0
- package/build/commonjs/types.js +2 -0
- package/build/commonjs/types.js.map +1 -0
- package/build/commonjs/utils/assertRunningOnApple.js +16 -0
- package/build/commonjs/utils/assertRunningOnApple.js.map +1 -0
- package/build/commonjs/utils/helpers.js +19 -0
- package/build/commonjs/utils/helpers.js.map +1 -0
- package/build/commonjs/utils/index.js +28 -0
- package/build/commonjs/utils/index.js.map +1 -0
- package/build/commonjs/utils/useUpdateOnHMR.js +25 -0
- package/build/commonjs/utils/useUpdateOnHMR.js.map +1 -0
- package/build/commonjs/widgets/server-credentials.js +18 -0
- package/build/commonjs/widgets/server-credentials.js.map +1 -0
- package/build/commonjs/widgets/widget-api.js +55 -0
- package/build/commonjs/widgets/widget-api.js.map +1 -0
- package/build/module/VoltraModule.js +4 -0
- package/build/module/VoltraModule.js.map +1 -0
- package/build/module/components/VoltraLiveActivityPreview.js +25 -0
- package/build/module/components/VoltraLiveActivityPreview.js.map +1 -0
- package/build/module/components/VoltraView.js +44 -0
- package/build/module/components/VoltraView.js.map +1 -0
- package/build/module/components/VoltraWidgetPreview.js +53 -0
- package/build/module/components/VoltraWidgetPreview.js.map +1 -0
- package/build/module/events.js +28 -0
- package/build/module/events.js.map +1 -0
- package/build/module/helpers.js +21 -0
- package/build/module/helpers.js.map +1 -0
- package/build/module/index.js +17 -0
- package/build/module/index.js.map +1 -0
- package/build/module/live-activity/api.js +158 -0
- package/build/module/live-activity/api.js.map +1 -0
- package/build/module/logger.js +35 -0
- package/build/module/logger.js.map +1 -0
- package/build/module/native/NativeVoltra.js +11 -0
- package/build/module/native/NativeVoltra.js.map +1 -0
- package/build/module/native/VoltraRNNativeComponent.ts +9 -0
- package/build/module/package.json +1 -0
- package/build/module/preload.js +48 -0
- package/build/module/preload.js.map +1 -0
- package/build/module/types.js +2 -0
- package/build/module/types.js.map +1 -0
- package/build/module/utils/assertRunningOnApple.js +11 -0
- package/build/module/utils/assertRunningOnApple.js.map +1 -0
- package/build/module/utils/helpers.js +4 -0
- package/build/module/utils/helpers.js.map +1 -0
- package/build/module/utils/index.js +5 -0
- package/build/module/utils/index.js.map +1 -0
- package/build/module/utils/useUpdateOnHMR.js +20 -0
- package/build/module/utils/useUpdateOnHMR.js.map +1 -0
- package/build/module/widgets/server-credentials.js +13 -0
- package/build/module/widgets/server-credentials.js.map +1 -0
- package/build/module/widgets/widget-api.js +45 -0
- package/build/module/widgets/widget-api.js.map +1 -0
- package/build/typescript/commonjs/VoltraModule.d.ts +3 -0
- package/build/typescript/commonjs/VoltraModule.d.ts.map +1 -0
- package/build/typescript/commonjs/components/VoltraLiveActivityPreview.d.ts.map +1 -0
- package/build/typescript/commonjs/components/VoltraView.d.ts.map +1 -0
- package/build/typescript/commonjs/components/VoltraWidgetPreview.d.ts.map +1 -0
- package/build/typescript/commonjs/events.d.ts.map +1 -0
- package/build/typescript/commonjs/helpers.d.ts.map +1 -0
- package/build/{types → typescript/commonjs}/index.d.ts +5 -0
- package/build/typescript/commonjs/index.d.ts.map +1 -0
- package/build/typescript/commonjs/live-activity/api.d.ts.map +1 -0
- package/build/typescript/commonjs/logger.d.ts.map +1 -0
- package/build/typescript/commonjs/native/NativeVoltra.d.ts +100 -0
- package/build/typescript/commonjs/native/NativeVoltra.d.ts.map +1 -0
- package/build/typescript/commonjs/native/VoltraRNNativeComponent.d.ts +8 -0
- package/build/typescript/commonjs/native/VoltraRNNativeComponent.d.ts.map +1 -0
- package/build/typescript/commonjs/package.json +1 -0
- package/build/typescript/commonjs/preload.d.ts.map +1 -0
- package/build/typescript/commonjs/types.d.ts.map +1 -0
- package/build/typescript/commonjs/utils/assertRunningOnApple.d.ts.map +1 -0
- package/build/typescript/commonjs/utils/helpers.d.ts.map +1 -0
- package/build/typescript/commonjs/utils/index.d.ts.map +1 -0
- package/build/typescript/commonjs/utils/useUpdateOnHMR.d.ts.map +1 -0
- package/build/typescript/commonjs/widgets/server-credentials.d.ts.map +1 -0
- package/build/typescript/commonjs/widgets/widget-api.d.ts.map +1 -0
- package/build/typescript/module/VoltraModule.d.ts +3 -0
- package/build/typescript/module/VoltraModule.d.ts.map +1 -0
- package/build/typescript/module/components/VoltraLiveActivityPreview.d.ts +7 -0
- package/build/typescript/module/components/VoltraLiveActivityPreview.d.ts.map +1 -0
- package/build/typescript/module/components/VoltraView.d.ts +12 -0
- package/build/typescript/module/components/VoltraView.d.ts.map +1 -0
- package/build/typescript/module/components/VoltraWidgetPreview.d.ts +9 -0
- package/build/typescript/module/components/VoltraWidgetPreview.d.ts.map +1 -0
- package/build/typescript/module/events.d.ts +33 -0
- package/build/typescript/module/events.d.ts.map +1 -0
- package/build/typescript/module/helpers.d.ts +3 -0
- package/build/typescript/module/helpers.d.ts.map +1 -0
- package/build/typescript/module/index.d.ts +18 -0
- package/build/typescript/module/index.d.ts.map +1 -0
- package/build/typescript/module/live-activity/api.d.ts +35 -0
- package/build/typescript/module/live-activity/api.d.ts.map +1 -0
- package/build/typescript/module/logger.d.ts +16 -0
- package/build/typescript/module/logger.d.ts.map +1 -0
- package/build/typescript/module/native/NativeVoltra.d.ts +100 -0
- package/build/typescript/module/native/NativeVoltra.d.ts.map +1 -0
- package/build/typescript/module/native/VoltraRNNativeComponent.d.ts +8 -0
- package/build/typescript/module/native/VoltraRNNativeComponent.d.ts.map +1 -0
- package/build/typescript/module/package.json +1 -0
- package/build/typescript/module/preload.d.ts +6 -0
- package/build/typescript/module/preload.d.ts.map +1 -0
- package/build/typescript/module/types.d.ts +2 -0
- package/build/typescript/module/types.d.ts.map +1 -0
- package/build/typescript/module/utils/assertRunningOnApple.d.ts +2 -0
- package/build/typescript/module/utils/assertRunningOnApple.d.ts.map +1 -0
- package/build/{esm/utils/helpers.js → typescript/module/utils/helpers.d.ts} +1 -1
- package/build/typescript/module/utils/helpers.d.ts.map +1 -0
- package/build/{esm/utils/index.js → typescript/module/utils/index.d.ts} +1 -1
- package/build/typescript/module/utils/index.d.ts.map +1 -0
- package/build/typescript/module/utils/useUpdateOnHMR.d.ts +5 -0
- package/build/typescript/module/utils/useUpdateOnHMR.d.ts.map +1 -0
- package/build/typescript/module/widgets/server-credentials.d.ts +5 -0
- package/build/typescript/module/widgets/server-credentials.d.ts.map +1 -0
- package/build/typescript/module/widgets/widget-api.d.ts +11 -0
- package/build/typescript/module/widgets/widget-api.d.ts.map +1 -0
- package/expo-plugin/app.plugin.js +3 -0
- package/expo-plugin/build/cjs/constants.js +23 -0
- package/expo-plugin/build/cjs/constants.js.map +1 -0
- package/expo-plugin/build/cjs/index.js +51 -0
- package/expo-plugin/build/cjs/index.js.map +1 -0
- package/expo-plugin/build/cjs/ios/eas.js +28 -0
- package/expo-plugin/build/cjs/ios/eas.js.map +1 -0
- package/expo-plugin/build/cjs/ios/entitlements.js +46 -0
- package/expo-plugin/build/cjs/ios/entitlements.js.map +1 -0
- package/expo-plugin/build/cjs/ios/index.js +39 -0
- package/expo-plugin/build/cjs/ios/index.js.map +1 -0
- package/expo-plugin/build/cjs/ios/infoPlist.js +51 -0
- package/expo-plugin/build/cjs/ios/infoPlist.js.map +1 -0
- package/expo-plugin/build/cjs/ios/pushNotifications.js +22 -0
- package/expo-plugin/build/cjs/ios/pushNotifications.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/eas.js +66 -0
- package/expo-plugin/build/cjs/ios-widget/eas.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/files/assets.js +199 -0
- package/expo-plugin/build/cjs/ios-widget/files/assets.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/files/entitlements.js +77 -0
- package/expo-plugin/build/cjs/ios-widget/files/entitlements.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/files/index.js +92 -0
- package/expo-plugin/build/cjs/ios-widget/files/index.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/files/infoPlist.js +91 -0
- package/expo-plugin/build/cjs/ios-widget/files/infoPlist.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/files/swift.js +443 -0
- package/expo-plugin/build/cjs/ios-widget/files/swift.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/fonts.js +151 -0
- package/expo-plugin/build/cjs/ios-widget/fonts.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/index.js +46 -0
- package/expo-plugin/build/cjs/ios-widget/index.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/podfile.js +41 -0
- package/expo-plugin/build/cjs/ios-widget/podfile.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/widgetPlist.js +99 -0
- package/expo-plugin/build/cjs/ios-widget/widgetPlist.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/buildPhases.js +247 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/buildPhases.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/configurationList.js +91 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/configurationList.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/groups.js +79 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/groups.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/index.js +155 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/index.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/mainAppSettings.js +71 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/mainAppSettings.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/productFile.js +74 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/productFile.js.map +1 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/target.js +113 -0
- package/expo-plugin/build/cjs/ios-widget/xcode/target.js.map +1 -0
- package/expo-plugin/build/cjs/utils/fileDiscovery.js +120 -0
- package/expo-plugin/build/cjs/utils/fileDiscovery.js.map +1 -0
- package/expo-plugin/build/cjs/utils/urlScheme.js +40 -0
- package/expo-plugin/build/cjs/utils/urlScheme.js.map +1 -0
- package/expo-plugin/build/cjs/validation.js +55 -0
- package/expo-plugin/build/cjs/validation.js.map +1 -0
- package/expo-plugin/build/esm/constants.js +20 -0
- package/expo-plugin/build/esm/constants.js.map +1 -0
- package/expo-plugin/build/esm/index.js +49 -0
- package/expo-plugin/build/esm/index.js.map +1 -0
- package/expo-plugin/build/esm/ios/eas.js +24 -0
- package/expo-plugin/build/esm/ios/eas.js.map +1 -0
- package/expo-plugin/build/esm/ios/entitlements.js +42 -0
- package/expo-plugin/build/esm/ios/entitlements.js.map +1 -0
- package/expo-plugin/build/esm/ios/index.js +34 -0
- package/expo-plugin/build/esm/ios/index.js.map +1 -0
- package/expo-plugin/build/esm/ios/infoPlist.js +47 -0
- package/expo-plugin/build/esm/ios/infoPlist.js.map +1 -0
- package/expo-plugin/build/esm/ios/pushNotifications.js +18 -0
- package/expo-plugin/build/esm/ios/pushNotifications.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/eas.js +62 -0
- package/expo-plugin/build/esm/ios-widget/eas.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/files/assets.js +163 -0
- package/expo-plugin/build/esm/ios-widget/files/assets.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/files/entitlements.js +37 -0
- package/expo-plugin/build/esm/ios-widget/files/entitlements.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/files/index.js +55 -0
- package/expo-plugin/build/esm/ios-widget/files/index.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/files/infoPlist.js +55 -0
- package/expo-plugin/build/esm/ios-widget/files/infoPlist.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/files/swift.js +403 -0
- package/expo-plugin/build/esm/ios-widget/files/swift.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/fonts.js +111 -0
- package/expo-plugin/build/esm/ios-widget/fonts.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/index.js +42 -0
- package/expo-plugin/build/esm/ios-widget/index.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/podfile.js +37 -0
- package/expo-plugin/build/esm/ios-widget/podfile.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/widgetPlist.js +92 -0
- package/expo-plugin/build/esm/ios-widget/widgetPlist.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/buildPhases.js +210 -0
- package/expo-plugin/build/esm/ios-widget/xcode/buildPhases.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/configurationList.js +87 -0
- package/expo-plugin/build/esm/ios-widget/xcode/configurationList.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/groups.js +75 -0
- package/expo-plugin/build/esm/ios-widget/xcode/groups.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/index.js +118 -0
- package/expo-plugin/build/esm/ios-widget/xcode/index.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/mainAppSettings.js +68 -0
- package/expo-plugin/build/esm/ios-widget/xcode/mainAppSettings.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/productFile.js +70 -0
- package/expo-plugin/build/esm/ios-widget/xcode/productFile.js.map +1 -0
- package/expo-plugin/build/esm/ios-widget/xcode/target.js +108 -0
- package/expo-plugin/build/esm/ios-widget/xcode/target.js.map +1 -0
- package/expo-plugin/build/esm/utils/fileDiscovery.js +83 -0
- package/expo-plugin/build/esm/utils/fileDiscovery.js.map +1 -0
- package/expo-plugin/build/esm/utils/urlScheme.js +37 -0
- package/expo-plugin/build/esm/utils/urlScheme.js.map +1 -0
- package/expo-plugin/build/esm/validation.js +51 -0
- package/expo-plugin/build/esm/validation.js.map +1 -0
- package/expo-plugin/build/types/constants.d.ts +13 -0
- package/expo-plugin/build/types/constants.d.ts.map +1 -0
- package/expo-plugin/build/types/index.d.ts +10 -0
- package/expo-plugin/build/types/index.d.ts.map +1 -0
- package/expo-plugin/build/types/ios/eas.d.ts +12 -0
- package/expo-plugin/build/types/ios/eas.d.ts.map +1 -0
- package/expo-plugin/build/types/ios/entitlements.d.ts +14 -0
- package/expo-plugin/build/types/ios/entitlements.d.ts.map +1 -0
- package/expo-plugin/build/types/ios/index.d.ts +19 -0
- package/expo-plugin/build/types/ios/index.d.ts.map +1 -0
- package/expo-plugin/build/types/ios/infoPlist.d.ts +21 -0
- package/expo-plugin/build/types/ios/infoPlist.d.ts.map +1 -0
- package/expo-plugin/build/types/ios/pushNotifications.d.ts +10 -0
- package/expo-plugin/build/types/ios/pushNotifications.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/eas.d.ts +15 -0
- package/expo-plugin/build/types/ios-widget/eas.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/files/assets.d.ts +13 -0
- package/expo-plugin/build/types/ios-widget/files/assets.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/files/entitlements.d.ts +17 -0
- package/expo-plugin/build/types/ios-widget/files/entitlements.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/files/index.d.ts +24 -0
- package/expo-plugin/build/types/ios-widget/files/index.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/files/infoPlist.d.ts +10 -0
- package/expo-plugin/build/types/ios-widget/files/infoPlist.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/files/swift.d.ts +24 -0
- package/expo-plugin/build/types/ios-widget/files/swift.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/fonts.d.ts +22 -0
- package/expo-plugin/build/types/ios-widget/fonts.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/index.d.ts +31 -0
- package/expo-plugin/build/types/ios-widget/index.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/podfile.d.ts +9 -0
- package/expo-plugin/build/types/ios-widget/podfile.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/widgetPlist.d.ts +20 -0
- package/expo-plugin/build/types/ios-widget/widgetPlist.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/buildPhases.d.ts +25 -0
- package/expo-plugin/build/types/ios-widget/xcode/buildPhases.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/configurationList.d.ts +20 -0
- package/expo-plugin/build/types/ios-widget/xcode/configurationList.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/groups.d.ts +15 -0
- package/expo-plugin/build/types/ios-widget/xcode/groups.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/index.d.ts +20 -0
- package/expo-plugin/build/types/ios-widget/xcode/index.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/mainAppSettings.d.ts +15 -0
- package/expo-plugin/build/types/ios-widget/xcode/mainAppSettings.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/productFile.d.ts +14 -0
- package/expo-plugin/build/types/ios-widget/xcode/productFile.d.ts.map +1 -0
- package/expo-plugin/build/types/ios-widget/xcode/target.d.ts +42 -0
- package/expo-plugin/build/types/ios-widget/xcode/target.d.ts.map +1 -0
- package/expo-plugin/build/types/types.d.ts +74 -0
- package/expo-plugin/build/types/types.d.ts.map +1 -0
- package/expo-plugin/build/types/utils/fileDiscovery.d.ts +15 -0
- package/expo-plugin/build/types/utils/fileDiscovery.d.ts.map +1 -0
- package/expo-plugin/build/types/utils/urlScheme.d.ts +10 -0
- package/expo-plugin/build/types/utils/urlScheme.d.ts.map +1 -0
- package/expo-plugin/build/types/validation.d.ts +4 -0
- package/expo-plugin/build/types/validation.d.ts.map +1 -0
- package/expo-plugin/jest.config.js +18 -0
- package/expo-plugin/src/constants.ts +25 -0
- package/expo-plugin/src/index.ts +72 -0
- package/expo-plugin/src/ios/eas.ts +33 -0
- package/expo-plugin/src/ios/entitlements.ts +59 -0
- package/expo-plugin/src/ios/index.ts +47 -0
- package/expo-plugin/src/ios/infoPlist.ts +63 -0
- package/expo-plugin/src/ios/pushNotifications.ts +22 -0
- package/expo-plugin/src/ios-widget/eas.ts +79 -0
- package/expo-plugin/src/ios-widget/files/assets.ts +201 -0
- package/expo-plugin/src/ios-widget/files/entitlements.ts +48 -0
- package/expo-plugin/src/ios-widget/files/index.ts +74 -0
- package/expo-plugin/src/ios-widget/files/infoPlist.ts +57 -0
- package/expo-plugin/src/ios-widget/files/swift.node.test.ts +22 -0
- package/expo-plugin/src/ios-widget/files/swift.ts +476 -0
- package/expo-plugin/src/ios-widget/fonts.ts +132 -0
- package/expo-plugin/src/ios-widget/index.ts +73 -0
- package/expo-plugin/src/ios-widget/podfile.ts +44 -0
- package/expo-plugin/src/ios-widget/widgetPlist.ts +115 -0
- package/expo-plugin/src/ios-widget/xcode/buildPhases.ts +301 -0
- package/expo-plugin/src/ios-widget/xcode/configurationList.ts +127 -0
- package/expo-plugin/src/ios-widget/xcode/groups.ts +101 -0
- package/expo-plugin/src/ios-widget/xcode/index.ts +149 -0
- package/expo-plugin/src/ios-widget/xcode/mainAppSettings.ts +95 -0
- package/expo-plugin/src/ios-widget/xcode/productFile.ts +91 -0
- package/expo-plugin/src/ios-widget/xcode/target.ts +148 -0
- package/expo-plugin/src/types.ts +89 -0
- package/expo-plugin/src/utils/fileDiscovery.ts +96 -0
- package/expo-plugin/src/utils/urlScheme.ts +45 -0
- package/expo-plugin/src/validation.node.test.ts +19 -0
- package/expo-plugin/src/validation.ts +63 -0
- package/expo-plugin/tsconfig.base.json +17 -0
- package/expo-plugin/tsconfig.cjs.json +9 -0
- package/expo-plugin/tsconfig.esm.json +9 -0
- package/expo-plugin/tsconfig.jest.json +8 -0
- package/expo-plugin/tsconfig.typecheck.json +12 -0
- package/expo-plugin/tsconfig.types.json +10 -0
- package/ios/Package.swift +68 -0
- package/ios/Tests/JSGradientParserTests.swift +201 -0
- package/ios/Tests/VoltraSharedTests/SmokeTests.swift +8 -0
- package/ios/VoltraWidget.podspec +30 -0
- package/ios/app/NativeVoltra.h +5 -0
- package/ios/app/NativeVoltra.mm +211 -0
- package/ios/app/VoltraActivity.swift +5 -0
- package/ios/app/VoltraImagePreload.swift +154 -0
- package/ios/app/VoltraLiveActivityManager.swift +228 -0
- package/ios/app/VoltraLiveActivityService.swift +306 -0
- package/ios/app/VoltraModule.swift +215 -0
- package/ios/app/VoltraModuleImpl.swift +331 -0
- package/ios/app/VoltraOptions.swift +27 -0
- package/ios/app/VoltraViewComponentView.h +10 -0
- package/ios/app/VoltraViewComponentView.mm +67 -0
- package/ios/app/VoltraViewRoot.swift +63 -0
- package/ios/app/VoltraWidgetService.swift +154 -0
- package/ios/shared/BrotliCompression.swift +81 -0
- package/ios/shared/ComponentTypeID.swift +117 -0
- package/ios/shared/Data+hexString.swift +8 -0
- package/ios/shared/Date+toTimerInterval.swift +25 -0
- package/ios/shared/JSONValue.swift +128 -0
- package/ios/shared/ShortNames.swift +180 -0
- package/ios/shared/VoltraAttributes.swift +58 -0
- package/ios/shared/VoltraConfig.swift +18 -0
- package/ios/shared/VoltraConstants.swift +45 -0
- package/ios/shared/VoltraElement.swift +153 -0
- package/ios/shared/VoltraEvent.swift +72 -0
- package/ios/shared/VoltraEventBus.swift +80 -0
- package/ios/shared/VoltraImageStore.swift +119 -0
- package/ios/shared/VoltraInitialStateLocale.swift +54 -0
- package/ios/shared/VoltraInteractionIntent.swift +39 -0
- package/ios/shared/VoltraKeychainHelper.swift +178 -0
- package/ios/shared/VoltraLiveActivityPayload.swift +113 -0
- package/ios/shared/VoltraLogger.swift +30 -0
- package/ios/shared/VoltraNode.swift +194 -0
- package/ios/shared/VoltraPayloadMigrator.swift +63 -0
- package/ios/shared/VoltraPersistentEventQueue.swift +67 -0
- package/ios/shared/VoltraRefreshIntent.swift +29 -0
- package/ios/shared/VoltraRegion.swift +37 -0
- package/ios/shared/VoltraWidgetDefaults.swift +114 -0
- package/ios/shared/VoltraWidgetServerFetcher.swift +166 -0
- package/ios/target/VoltraHomeWidget.swift +508 -0
- package/ios/target/VoltraWidget.swift +158 -0
- package/ios/ui/Extensions/View.modifiers.swift +28 -0
- package/ios/ui/Extensions/VoltraNode+Parameters.swift +18 -0
- package/ios/ui/Generated/Parameters/.generated +8 -0
- package/ios/ui/Generated/Parameters/ButtonParameters.swift +15 -0
- package/ios/ui/Generated/Parameters/ChartParameters.swift +33 -0
- package/ios/ui/Generated/Parameters/CircularProgressViewParameters.swift +59 -0
- package/ios/ui/Generated/Parameters/ComponentParameters.swift +12 -0
- package/ios/ui/Generated/Parameters/DividerParameters.swift +12 -0
- package/ios/ui/Generated/Parameters/GaugeParameters.swift +54 -0
- package/ios/ui/Generated/Parameters/GlassContainerParameters.swift +15 -0
- package/ios/ui/Generated/Parameters/GroupBoxParameters.swift +12 -0
- package/ios/ui/Generated/Parameters/HStackParameters.swift +34 -0
- package/ios/ui/Generated/Parameters/ImageParameters.swift +29 -0
- package/ios/ui/Generated/Parameters/LabelParameters.swift +18 -0
- package/ios/ui/Generated/Parameters/LinearGradientParameters.swift +27 -0
- package/ios/ui/Generated/Parameters/LinearProgressViewParameters.swift +64 -0
- package/ios/ui/Generated/Parameters/LinkParameters.swift +15 -0
- package/ios/ui/Generated/Parameters/MaskParameters.swift +12 -0
- package/ios/ui/Generated/Parameters/SpacerParameters.swift +15 -0
- package/ios/ui/Generated/Parameters/SymbolParameters.swift +59 -0
- package/ios/ui/Generated/Parameters/TextParameters.swift +18 -0
- package/ios/ui/Generated/Parameters/TimerParameters.swift +54 -0
- package/ios/ui/Generated/Parameters/ToggleParameters.swift +24 -0
- package/ios/ui/Generated/Parameters/VStackParameters.swift +34 -0
- package/ios/ui/Generated/Parameters/ViewParameters.swift +12 -0
- package/ios/ui/Generated/Parameters/ZStackParameters.swift +15 -0
- package/ios/ui/Helpers/VoltraDeepLinkResolver.swift +43 -0
- package/ios/ui/Helpers/VoltraProgressDriver.swift +52 -0
- package/ios/ui/Layout/FlexContainerHelper.swift +114 -0
- package/ios/ui/Layout/VoltraFlexStackLayout.swift +417 -0
- package/ios/ui/Protocols/VoltraView.swift +29 -0
- package/ios/ui/Style/BackgroundValue.swift +27 -0
- package/ios/ui/Style/CompositeStyle.swift +81 -0
- package/ios/ui/Style/DecorationStyle.swift +207 -0
- package/ios/ui/Style/FlexEnvironment.swift +35 -0
- package/ios/ui/Style/FontVariant.swift +4 -0
- package/ios/ui/Style/GlassEffect.swift +6 -0
- package/ios/ui/Style/JSColorParser.swift +517 -0
- package/ios/ui/Style/JSGradientParser.swift +674 -0
- package/ios/ui/Style/JSStyleParser.swift +223 -0
- package/ios/ui/Style/LayoutStyle.swift +184 -0
- package/ios/ui/Style/Overflow.swift +4 -0
- package/ios/ui/Style/RenderingStyle.swift +33 -0
- package/ios/ui/Style/StyleConverter.swift +202 -0
- package/ios/ui/Style/TextDecoration.swift +6 -0
- package/ios/ui/Style/TextStyle.swift +50 -0
- package/ios/ui/Style/View+applyStyle.swift +38 -0
- package/ios/ui/Views/VoltraButton.swift +57 -0
- package/ios/ui/Views/VoltraChart.swift +840 -0
- package/ios/ui/Views/VoltraCircularProgressView.swift +103 -0
- package/ios/ui/Views/VoltraDivider.swift +16 -0
- package/ios/ui/Views/VoltraFlexView.swift +33 -0
- package/ios/ui/Views/VoltraGauge.swift +65 -0
- package/ios/ui/Views/VoltraGlassContainer.swift +29 -0
- package/ios/ui/Views/VoltraGroupBox.swift +26 -0
- package/ios/ui/Views/VoltraHStack.swift +70 -0
- package/ios/ui/Views/VoltraImage.swift +109 -0
- package/ios/ui/Views/VoltraLabel.swift +24 -0
- package/ios/ui/Views/VoltraLinearGradient.swift +115 -0
- package/ios/ui/Views/VoltraLinearProgressView.swift +118 -0
- package/ios/ui/Views/VoltraLink.swift +25 -0
- package/ios/ui/Views/VoltraMask.swift +23 -0
- package/ios/ui/Views/VoltraSpacer.swift +16 -0
- package/ios/ui/Views/VoltraSymbol.swift +160 -0
- package/ios/ui/Views/VoltraText.swift +87 -0
- package/ios/ui/Views/VoltraTimer.swift +131 -0
- package/ios/ui/Views/VoltraToggle.swift +39 -0
- package/ios/ui/Views/VoltraVStack.swift +68 -0
- package/ios/ui/Views/VoltraZStack.swift +33 -0
- package/ios/ui/Voltra.swift +86 -0
- package/package.json +91 -18
- package/build/cjs/VoltraModule.js +0 -6
- package/build/cjs/VoltraModule.js.map +0 -1
- package/build/cjs/components/VoltraLiveActivityPreview.js +0 -20
- package/build/cjs/components/VoltraLiveActivityPreview.js.map +0 -1
- package/build/cjs/components/VoltraView.js +0 -37
- package/build/cjs/components/VoltraView.js.map +0 -1
- package/build/cjs/components/VoltraWidgetPreview.js +0 -26
- package/build/cjs/components/VoltraWidgetPreview.js.map +0 -1
- package/build/cjs/events.js +0 -19
- package/build/cjs/events.js.map +0 -1
- package/build/cjs/helpers.js +0 -30
- package/build/cjs/helpers.js.map +0 -1
- package/build/cjs/index.js +0 -49
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/live-activity/api.js +0 -158
- package/build/cjs/live-activity/api.js.map +0 -1
- package/build/cjs/logger.js +0 -36
- package/build/cjs/logger.js.map +0 -1
- package/build/cjs/preload.js +0 -54
- package/build/cjs/preload.js.map +0 -1
- package/build/cjs/utils/assertRunningOnApple.js +0 -13
- package/build/cjs/utils/assertRunningOnApple.js.map +0 -1
- package/build/cjs/utils/helpers.js +0 -7
- package/build/cjs/utils/helpers.js.map +0 -1
- package/build/cjs/utils/index.js +0 -19
- package/build/cjs/utils/index.js.map +0 -1
- package/build/cjs/utils/useUpdateOnHMR.js +0 -22
- package/build/cjs/utils/useUpdateOnHMR.js.map +0 -1
- package/build/cjs/widgets/server-credentials.js +0 -18
- package/build/cjs/widgets/server-credentials.js.map +0 -1
- package/build/cjs/widgets/widget-api.js +0 -59
- package/build/cjs/widgets/widget-api.js.map +0 -1
- package/build/esm/VoltraModule.js +0 -4
- package/build/esm/VoltraModule.js.map +0 -1
- package/build/esm/components/VoltraLiveActivityPreview.js +0 -17
- package/build/esm/components/VoltraLiveActivityPreview.js.map +0 -1
- package/build/esm/components/VoltraView.js +0 -34
- package/build/esm/components/VoltraView.js.map +0 -1
- package/build/esm/components/VoltraWidgetPreview.js +0 -23
- package/build/esm/components/VoltraWidgetPreview.js.map +0 -1
- package/build/esm/events.js +0 -13
- package/build/esm/events.js.map +0 -1
- package/build/esm/helpers.js +0 -23
- package/build/esm/helpers.js.map +0 -1
- package/build/esm/index.js +0 -10
- package/build/esm/index.js.map +0 -1
- package/build/esm/live-activity/api.js +0 -146
- package/build/esm/live-activity/api.js.map +0 -1
- package/build/esm/logger.js +0 -33
- package/build/esm/logger.js.map +0 -1
- package/build/esm/preload.js +0 -46
- package/build/esm/preload.js.map +0 -1
- package/build/esm/utils/assertRunningOnApple.js +0 -9
- package/build/esm/utils/assertRunningOnApple.js.map +0 -1
- package/build/esm/utils/helpers.js.map +0 -1
- package/build/esm/utils/index.js.map +0 -1
- package/build/esm/utils/useUpdateOnHMR.js +0 -18
- package/build/esm/utils/useUpdateOnHMR.js.map +0 -1
- package/build/esm/widgets/server-credentials.js +0 -11
- package/build/esm/widgets/server-credentials.js.map +0 -1
- package/build/esm/widgets/widget-api.js +0 -47
- package/build/esm/widgets/widget-api.js.map +0 -1
- package/build/types/VoltraModule.d.ts +0 -44
- package/build/types/VoltraModule.d.ts.map +0 -1
- package/build/types/components/VoltraLiveActivityPreview.d.ts.map +0 -1
- package/build/types/components/VoltraView.d.ts.map +0 -1
- package/build/types/components/VoltraWidgetPreview.d.ts.map +0 -1
- package/build/types/events.d.ts.map +0 -1
- package/build/types/helpers.d.ts.map +0 -1
- package/build/types/index.d.ts.map +0 -1
- package/build/types/live-activity/api.d.ts.map +0 -1
- package/build/types/logger.d.ts.map +0 -1
- package/build/types/preload.d.ts.map +0 -1
- package/build/types/types.d.ts.map +0 -1
- package/build/types/utils/assertRunningOnApple.d.ts.map +0 -1
- package/build/types/utils/helpers.d.ts.map +0 -1
- package/build/types/utils/index.d.ts.map +0 -1
- package/build/types/utils/useUpdateOnHMR.d.ts.map +0 -1
- package/build/types/widgets/server-credentials.d.ts.map +0 -1
- package/build/types/widgets/widget-api.d.ts.map +0 -1
- /package/build/{types → typescript/commonjs}/components/VoltraLiveActivityPreview.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/components/VoltraView.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/components/VoltraWidgetPreview.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/events.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/helpers.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/live-activity/api.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/logger.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/preload.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/types.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/utils/assertRunningOnApple.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/utils/helpers.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/utils/index.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/utils/useUpdateOnHMR.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/widgets/server-credentials.d.ts +0 -0
- /package/build/{types → typescript/commonjs}/widgets/widget-api.d.ts +0 -0
- /package/{build → expo-plugin/build}/cjs/package.json +0 -0
- /package/{build → expo-plugin/build}/cjs/types.js +0 -0
- /package/{build → expo-plugin/build}/cjs/types.js.map +0 -0
- /package/{build → expo-plugin/build}/esm/package.json +0 -0
- /package/{build → expo-plugin/build}/esm/types.js +0 -0
- /package/{build → expo-plugin/build}/esm/types.js.map +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
#import "NativeVoltra.h"
|
|
2
|
+
|
|
3
|
+
#if __has_include("Voltra/Voltra-Swift.h")
|
|
4
|
+
#import "Voltra/Voltra-Swift.h"
|
|
5
|
+
#else
|
|
6
|
+
#import "Voltra-Swift.h"
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
@interface NativeVoltra () {
|
|
10
|
+
VoltraModule *_module;
|
|
11
|
+
}
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@implementation NativeVoltra
|
|
15
|
+
|
|
16
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *_Nonnull)eventEmitterCallbackWrapper
|
|
17
|
+
{
|
|
18
|
+
[super setEventEmitterCallback:eventEmitterCallbackWrapper];
|
|
19
|
+
|
|
20
|
+
[self.module startMonitoringWithEventHandler:^(NSString *eventName, NSDictionary *eventData) {
|
|
21
|
+
if ([eventName isEqualToString:@"interaction"]) {
|
|
22
|
+
[self emitOnInteraction:eventData];
|
|
23
|
+
} else if ([eventName isEqualToString:@"stateChange"]) {
|
|
24
|
+
[self emitOnStateChanged:eventData];
|
|
25
|
+
} else if ([eventName isEqualToString:@"activityTokenReceived"]) {
|
|
26
|
+
[self emitOnActivityTokenReceived:eventData];
|
|
27
|
+
} else if ([eventName isEqualToString:@"activityPushToStartTokenReceived"]) {
|
|
28
|
+
[self emitOnActivityPushToStartTokenReceived:eventData];
|
|
29
|
+
}
|
|
30
|
+
}];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (VoltraModule *)module
|
|
34
|
+
{
|
|
35
|
+
if (!_module) {
|
|
36
|
+
_module = [VoltraModule new];
|
|
37
|
+
}
|
|
38
|
+
return _module;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
42
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
43
|
+
{
|
|
44
|
+
return std::make_shared<facebook::react::NativeVoltraSpecJSI>(params);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
+ (NSString *)moduleName
|
|
48
|
+
{
|
|
49
|
+
return @"NativeVoltra";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#pragma mark - NativeVoltraSpec
|
|
53
|
+
|
|
54
|
+
- (void)startLiveActivity:(NSString *)jsonString
|
|
55
|
+
options:(JS::NativeVoltra::StartVoltraOptions &)options
|
|
56
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
57
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
58
|
+
{
|
|
59
|
+
StartVoltraOptions *opts = [StartVoltraOptions new];
|
|
60
|
+
opts.activityName = options.activityName();
|
|
61
|
+
opts.deepLinkUrl = options.deepLinkUrl();
|
|
62
|
+
opts.channelId = options.channelId();
|
|
63
|
+
if (auto v = options.staleDate()) opts.staleDate = @(v.value());
|
|
64
|
+
if (auto v = options.relevanceScore()) opts.relevanceScore = @(v.value());
|
|
65
|
+
[self.module startLiveActivity:jsonString options:opts completion:^(NSString *activityId, NSError *error) {
|
|
66
|
+
if (error) { reject(@"startLiveActivity", error.localizedDescription, error); } else { resolve(activityId); }
|
|
67
|
+
}];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)updateLiveActivity:(NSString *)activityId
|
|
71
|
+
jsonString:(NSString *)jsonString
|
|
72
|
+
options:(JS::NativeVoltra::UpdateVoltraOptions &)options
|
|
73
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
74
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
75
|
+
{
|
|
76
|
+
UpdateVoltraOptions *opts = [UpdateVoltraOptions new];
|
|
77
|
+
if (auto v = options.staleDate()) opts.staleDate = @(v.value());
|
|
78
|
+
if (auto v = options.relevanceScore()) opts.relevanceScore = @(v.value());
|
|
79
|
+
[self.module updateLiveActivity:activityId jsonString:jsonString options:opts completion:^(NSError *error) {
|
|
80
|
+
if (error) { reject(@"updateLiveActivity", error.localizedDescription, error); } else { resolve(nil); }
|
|
81
|
+
}];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void)endLiveActivity:(NSString *)activityId
|
|
85
|
+
options:(JS::NativeVoltra::EndVoltraOptions &)options
|
|
86
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
87
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
88
|
+
{
|
|
89
|
+
EndVoltraOptions *opts = [EndVoltraOptions new];
|
|
90
|
+
if (auto dismissal = options.dismissalPolicy()) {
|
|
91
|
+
DismissalPolicyOptions *policy = [DismissalPolicyOptions new];
|
|
92
|
+
policy.type = dismissal->type();
|
|
93
|
+
if (auto date = dismissal->date()) policy.date = @(date.value());
|
|
94
|
+
opts.dismissalPolicy = policy;
|
|
95
|
+
}
|
|
96
|
+
[self.module endLiveActivity:activityId options:opts completion:^(NSError *error) {
|
|
97
|
+
if (error) { reject(@"endLiveActivity", error.localizedDescription, error); } else { resolve(nil); }
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (void)endAllLiveActivities:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
102
|
+
{
|
|
103
|
+
[self.module endAllLiveActivities:^(NSError *error) {
|
|
104
|
+
if (error) { reject(@"endAllLiveActivities", error.localizedDescription, error); } else { resolve(nil); }
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)getLatestVoltraActivityId:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
109
|
+
{
|
|
110
|
+
resolve([self.module getLatestVoltraActivityId]);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (void)listVoltraActivityIds:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
114
|
+
{
|
|
115
|
+
resolve([self.module listVoltraActivityIds]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
- (NSNumber *)isLiveActivityActive:(NSString *)activityName
|
|
119
|
+
{
|
|
120
|
+
return @([self.module isLiveActivityActive:activityName]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
- (NSNumber *)isHeadless
|
|
124
|
+
{
|
|
125
|
+
return @([self.module isHeadless]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
- (void)preloadImages:(NSArray *)images resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
129
|
+
{
|
|
130
|
+
[self.module preloadImages:images completion:^(NSDictionary *result, NSError *error) {
|
|
131
|
+
if (error) { reject(@"preloadImages", error.localizedDescription, error); } else { resolve(result); }
|
|
132
|
+
}];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (void)reloadLiveActivities:(NSArray *)activityNames resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
136
|
+
{
|
|
137
|
+
[self.module reloadLiveActivities:activityNames completion:^(NSError *error) {
|
|
138
|
+
if (error) { reject(@"reloadLiveActivities", error.localizedDescription, error); } else { resolve(nil); }
|
|
139
|
+
}];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
- (void)clearPreloadedImages:(NSArray *)keys resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
143
|
+
{
|
|
144
|
+
[self.module clearPreloadedImages:keys completion:^{ resolve(nil); }];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
- (void)updateWidget:(NSString *)widgetId
|
|
148
|
+
jsonString:(NSString *)jsonString
|
|
149
|
+
options:(JS::NativeVoltra::UpdateWidgetOptions &)options
|
|
150
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
151
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
152
|
+
{
|
|
153
|
+
UpdateWidgetOptions *opts = [UpdateWidgetOptions new];
|
|
154
|
+
opts.deepLinkUrl = options.deepLinkUrl();
|
|
155
|
+
[self.module updateWidget:widgetId jsonString:jsonString options:opts completion:^(NSError *error) {
|
|
156
|
+
if (error) { reject(@"updateWidget", error.localizedDescription, error); } else { resolve(nil); }
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- (void)scheduleWidget:(NSString *)widgetId
|
|
161
|
+
timelineJson:(NSString *)timelineJson
|
|
162
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
163
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
164
|
+
{
|
|
165
|
+
[self.module scheduleWidget:widgetId timelineJson:timelineJson completion:^(NSError *error) {
|
|
166
|
+
if (error) { reject(@"scheduleWidget", error.localizedDescription, error); } else { resolve(nil); }
|
|
167
|
+
}];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
- (void)reloadWidgets:(NSArray *)widgetIds resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
171
|
+
{
|
|
172
|
+
[self.module reloadWidgets:widgetIds completion:^{ resolve(nil); }];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
- (void)clearWidget:(NSString *)widgetId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
176
|
+
{
|
|
177
|
+
[self.module clearWidget:widgetId completion:^{ resolve(nil); }];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
- (void)clearAllWidgets:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
181
|
+
{
|
|
182
|
+
[self.module clearAllWidgets:^{ resolve(nil); }];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
- (void)getActiveWidgets:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
186
|
+
{
|
|
187
|
+
[self.module getActiveWidgets:^(NSArray *result, NSError *error) {
|
|
188
|
+
if (error) { reject(@"getActiveWidgets", error.localizedDescription, error); } else { resolve(result); }
|
|
189
|
+
}];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
- (void)setWidgetServerCredentials:(JS::NativeVoltra::WidgetServerCredentials &)credentials
|
|
193
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
194
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
195
|
+
{
|
|
196
|
+
[self.module setWidgetServerCredentials:credentials.token() headers:(NSDictionary *)credentials.headers()];
|
|
197
|
+
resolve(nil);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
- (void)clearWidgetServerCredentials:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
201
|
+
{
|
|
202
|
+
[self.module clearWidgetServerCredentials];
|
|
203
|
+
resolve(nil);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (void)dealloc
|
|
207
|
+
{
|
|
208
|
+
[self.module stopMonitoring];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import os
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
// MARK: - Types
|
|
6
|
+
|
|
7
|
+
public struct PreloadImageOptions {
|
|
8
|
+
public var url: String
|
|
9
|
+
public var key: String
|
|
10
|
+
public var method: String?
|
|
11
|
+
public var headers: [String: String]?
|
|
12
|
+
|
|
13
|
+
public init(_ dict: NSDictionary) {
|
|
14
|
+
url = dict["url"] as? String ?? ""
|
|
15
|
+
key = dict["key"] as? String ?? ""
|
|
16
|
+
method = dict["method"] as? String
|
|
17
|
+
headers = dict["headers"] as? [String: String]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public struct PreloadImageFailure {
|
|
22
|
+
public var key: String
|
|
23
|
+
public var error: String
|
|
24
|
+
|
|
25
|
+
public init(key: String, error: String) {
|
|
26
|
+
self.key = key
|
|
27
|
+
self.error = error
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public func toDictionary() -> NSDictionary {
|
|
31
|
+
["key": key, "error": error]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public struct PreloadImagesResult {
|
|
36
|
+
public var succeeded: [String]
|
|
37
|
+
public var failed: [PreloadImageFailure]
|
|
38
|
+
|
|
39
|
+
public init(succeeded: [String], failed: [PreloadImageFailure]) {
|
|
40
|
+
self.succeeded = succeeded
|
|
41
|
+
self.failed = failed
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public func toDictionary() -> NSDictionary {
|
|
45
|
+
["succeeded": succeeded, "failed": failed.map { $0.toDictionary() }]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// MARK: - Errors
|
|
50
|
+
|
|
51
|
+
/// Errors that can occur during image preloading
|
|
52
|
+
enum PreloadError: Error, LocalizedError {
|
|
53
|
+
case invalidURL(String)
|
|
54
|
+
case invalidResponse
|
|
55
|
+
case httpError(statusCode: Int)
|
|
56
|
+
case imageTooLarge(key: String, size: Int)
|
|
57
|
+
case invalidImageData(key: String)
|
|
58
|
+
case appGroupNotConfigured
|
|
59
|
+
|
|
60
|
+
var errorDescription: String? {
|
|
61
|
+
switch self {
|
|
62
|
+
case let .invalidURL(url):
|
|
63
|
+
return "Invalid URL: \(url)"
|
|
64
|
+
case .invalidResponse:
|
|
65
|
+
return "Invalid response from server"
|
|
66
|
+
case let .httpError(statusCode):
|
|
67
|
+
return "HTTP error: \(statusCode)"
|
|
68
|
+
case let .imageTooLarge(key, size):
|
|
69
|
+
return "Image '\(key)' is too large: \(size) bytes (max \(VoltraImagePreload.maxImageSizeInBytes) bytes for Live Activities)"
|
|
70
|
+
case let .invalidImageData(key):
|
|
71
|
+
return "Invalid image data for '\(key)'"
|
|
72
|
+
case .appGroupNotConfigured:
|
|
73
|
+
return "App Group not configured. Set 'groupIdentifier' in the Voltra config plugin."
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// MARK: - Namespace
|
|
79
|
+
|
|
80
|
+
enum VoltraImagePreload {
|
|
81
|
+
static let maxImageSizeInBytes = 4096
|
|
82
|
+
|
|
83
|
+
static func preloadImages(images: [PreloadImageOptions]) async throws -> PreloadImagesResult {
|
|
84
|
+
var succeeded: [String] = []
|
|
85
|
+
var failed: [PreloadImageFailure] = []
|
|
86
|
+
|
|
87
|
+
for imageOptions in images {
|
|
88
|
+
do {
|
|
89
|
+
try await downloadAndSaveImage(imageOptions)
|
|
90
|
+
succeeded.append(imageOptions.key)
|
|
91
|
+
} catch {
|
|
92
|
+
failed.append(PreloadImageFailure(key: imageOptions.key, error: error.localizedDescription))
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return PreloadImagesResult(succeeded: succeeded, failed: failed)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static func clearPreloadedImages(keys: [String]?) async {
|
|
100
|
+
if let keys = keys, !keys.isEmpty {
|
|
101
|
+
VoltraImageStore.removeImages(keys: keys)
|
|
102
|
+
VoltraLogger.image.info("Cleared preloaded images: \(keys.joined(separator: ", "))")
|
|
103
|
+
} else {
|
|
104
|
+
VoltraImageStore.clearAll()
|
|
105
|
+
VoltraLogger.image.info("Cleared all preloaded images")
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// MARK: - Private
|
|
110
|
+
|
|
111
|
+
private static func downloadAndSaveImage(_ options: PreloadImageOptions) async throws {
|
|
112
|
+
guard let url = URL(string: options.url) else {
|
|
113
|
+
throw PreloadError.invalidURL(options.url)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var request = URLRequest(url: url)
|
|
117
|
+
request.httpMethod = options.method ?? "GET"
|
|
118
|
+
|
|
119
|
+
if let headers = options.headers {
|
|
120
|
+
for (key, value) in headers {
|
|
121
|
+
request.setValue(value, forHTTPHeaderField: key)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let (data, response) = try await URLSession.shared.data(for: request)
|
|
126
|
+
|
|
127
|
+
guard let httpResponse = response as? HTTPURLResponse else {
|
|
128
|
+
throw PreloadError.invalidResponse
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
guard (200 ... 299).contains(httpResponse.statusCode) else {
|
|
132
|
+
throw PreloadError.httpError(statusCode: httpResponse.statusCode)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if let contentLengthString = httpResponse.value(forHTTPHeaderField: "Content-Length"),
|
|
136
|
+
let contentLength = Int(contentLengthString)
|
|
137
|
+
{
|
|
138
|
+
if contentLength >= maxImageSizeInBytes {
|
|
139
|
+
throw PreloadError.imageTooLarge(key: options.key, size: contentLength)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if data.count >= maxImageSizeInBytes {
|
|
144
|
+
throw PreloadError.imageTooLarge(key: options.key, size: data.count)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
guard UIImage(data: data) != nil else {
|
|
148
|
+
throw PreloadError.invalidImageData(key: options.key)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
try VoltraImageStore.saveImage(data, key: options.key)
|
|
152
|
+
VoltraLogger.image.info("Preloaded '\(options.key)' (\(data.count) bytes)")
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import ActivityKit
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
// The underlying ActivityKit APIs deliver updates via async for-await loops that
|
|
5
|
+
// run on arbitrary tasks. Without synchronization, dictionaries and sets mutated
|
|
6
|
+
// from those tasks are data races. Making this type an `actor` ensures every read
|
|
7
|
+
// and write to its stored properties is serialized automatically by the Swift
|
|
8
|
+
// concurrency runtime -- no locks required.
|
|
9
|
+
|
|
10
|
+
public actor VoltraLiveActivityManager {
|
|
11
|
+
// MARK: - Callbacks
|
|
12
|
+
|
|
13
|
+
// Callbacks are `let` + `@Sendable` so they are immutable after init and safe
|
|
14
|
+
// to call from any concurrency context without capturing `self`.
|
|
15
|
+
|
|
16
|
+
/// Called when a push token is received or rotated for a specific activity.
|
|
17
|
+
/// Parameters: (activityName, hexToken)
|
|
18
|
+
private let onTokenUpdated: (@Sendable (String, String) -> Void)?
|
|
19
|
+
|
|
20
|
+
/// Called when the push-to-start token is received or rotated (iOS 17.2+).
|
|
21
|
+
/// Parameter: hexToken
|
|
22
|
+
private let onPushToStartUpdated: (@Sendable (String) -> Void)?
|
|
23
|
+
|
|
24
|
+
/// Called when an activity transitions to a new lifecycle state.
|
|
25
|
+
/// Parameters: (activityName, stateDescription)
|
|
26
|
+
private let onStateChanged: (@Sendable (String, String) -> Void)?
|
|
27
|
+
|
|
28
|
+
// MARK: - Internal Task State
|
|
29
|
+
|
|
30
|
+
/// Drives the main `Activity.activityUpdates` loop. When this task is cancelled,
|
|
31
|
+
/// the loop exits and no new per-activity observers are created.
|
|
32
|
+
private var activityUpdatesTask: Task<Void, Never>?
|
|
33
|
+
|
|
34
|
+
/// Drives the `Activity.pushToStartTokenUpdates` loop (iOS 17.2+ only).
|
|
35
|
+
private var pushToStartTask: Task<Void, Never>?
|
|
36
|
+
|
|
37
|
+
/// One push-token observer task per live activity, keyed by `activity.id`.
|
|
38
|
+
/// Using a dictionary (rather than a flat array) lets us deduplicate and cancel
|
|
39
|
+
/// individual tasks when an activity ends.
|
|
40
|
+
private var tokenTasks: [String: Task<Void, Never>] = [:]
|
|
41
|
+
|
|
42
|
+
/// One lifecycle-state observer task per live activity, keyed by `activity.id`.
|
|
43
|
+
private var stateTasks: [String: Task<Void, Never>] = [:]
|
|
44
|
+
|
|
45
|
+
/// The last push-to-start token we forwarded to the callback.
|
|
46
|
+
/// ActivityKit re-delivers the current token whenever a live activity starts or
|
|
47
|
+
/// ends (the push-to-start eligibility state has changed), even if the token
|
|
48
|
+
/// itself hasn't rotated. We track the last value so we only forward genuine
|
|
49
|
+
/// token changes and suppress duplicate deliveries.
|
|
50
|
+
private var lastPushToStartToken: String?
|
|
51
|
+
|
|
52
|
+
// MARK: - Init
|
|
53
|
+
|
|
54
|
+
public init(
|
|
55
|
+
onTokenUpdated: (@Sendable (String, String) -> Void)? = nil,
|
|
56
|
+
onPushToStartUpdated: (@Sendable (String) -> Void)? = nil,
|
|
57
|
+
onStateChanged: (@Sendable (String, String) -> Void)? = nil
|
|
58
|
+
) {
|
|
59
|
+
self.onTokenUpdated = onTokenUpdated
|
|
60
|
+
self.onPushToStartUpdated = onPushToStartUpdated
|
|
61
|
+
self.onStateChanged = onStateChanged
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// MARK: - Public API
|
|
65
|
+
|
|
66
|
+
/// Begin observing all live activities and tokens.
|
|
67
|
+
///
|
|
68
|
+
/// This method is idempotent: calling it while already observing is a no-op.
|
|
69
|
+
/// To restart observation, call `stopObserving()` first.
|
|
70
|
+
public func startObserving() {
|
|
71
|
+
guard activityUpdatesTask == nil else { return }
|
|
72
|
+
|
|
73
|
+
startActivityUpdatesObservation()
|
|
74
|
+
startPushToStartObservation()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Stop all observation and cancel every outstanding task.
|
|
78
|
+
///
|
|
79
|
+
/// Safe to call from any context. After this returns the actor holds no running
|
|
80
|
+
/// tasks; calling `startObserving()` again creates a fresh set.
|
|
81
|
+
public func stopObserving() {
|
|
82
|
+
activityUpdatesTask?.cancel()
|
|
83
|
+
activityUpdatesTask = nil
|
|
84
|
+
|
|
85
|
+
pushToStartTask?.cancel()
|
|
86
|
+
pushToStartTask = nil
|
|
87
|
+
|
|
88
|
+
lastPushToStartToken = nil
|
|
89
|
+
|
|
90
|
+
cancelAllPerActivityTasks()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// MARK: - deinit
|
|
94
|
+
|
|
95
|
+
/// Safety net: if the manager is deallocated without stopObserving() being called
|
|
96
|
+
/// (e.g. during app shutdown), cancel every task so no coroutine keeps running as
|
|
97
|
+
/// an orphan. SE-0371 (Swift 5.9) allows actors to access their stored properties
|
|
98
|
+
/// in deinit because no other reference can exist at that point.
|
|
99
|
+
deinit {
|
|
100
|
+
activityUpdatesTask?.cancel()
|
|
101
|
+
pushToStartTask?.cancel()
|
|
102
|
+
for task in tokenTasks.values {
|
|
103
|
+
task.cancel()
|
|
104
|
+
}
|
|
105
|
+
for task in stateTasks.values {
|
|
106
|
+
task.cancel()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// MARK: - Activity Updates Loop
|
|
111
|
+
|
|
112
|
+
private func startActivityUpdatesObservation() {
|
|
113
|
+
activityUpdatesTask = Task { [weak self] in
|
|
114
|
+
// Observe activities that were already running when we started --
|
|
115
|
+
// `Activity.activityUpdates` only yields *newly created* activities,
|
|
116
|
+
// so we must handle pre-existing ones explicitly.
|
|
117
|
+
for activity in Activity<VoltraAttributes>.activities {
|
|
118
|
+
await self?.observe(activity)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Then listen for any activities created from this point onward.
|
|
122
|
+
for await activity in Activity<VoltraAttributes>.activityUpdates {
|
|
123
|
+
await self?.observe(activity)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// MARK: - Push-to-Start Token Loop (iOS 17.2+)
|
|
129
|
+
|
|
130
|
+
private func startPushToStartObservation() {
|
|
131
|
+
guard #available(iOS 17.2, *), let onPushToStartUpdated else { return }
|
|
132
|
+
|
|
133
|
+
// Read the token that may already be available before the async stream fires.
|
|
134
|
+
if let existingTokenData = Activity<VoltraAttributes>.pushToStartToken {
|
|
135
|
+
deliverPushToStartToken(existingTokenData.hexString, via: onPushToStartUpdated)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Capture the callback locally so the task does not need to hop back to the
|
|
139
|
+
// actor on every token delivery -- callbacks are @Sendable and safe to call
|
|
140
|
+
// from any context.
|
|
141
|
+
let callback = onPushToStartUpdated
|
|
142
|
+
|
|
143
|
+
pushToStartTask = Task { [weak self] in
|
|
144
|
+
for await tokenData in Activity<VoltraAttributes>.pushToStartTokenUpdates {
|
|
145
|
+
await self?.deliverPushToStartToken(tokenData.hexString, via: callback)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Forward `token` to `callback` only if it differs from the last token we sent.
|
|
151
|
+
/// ActivityKit re-delivers the same token when a live activity starts or ends,
|
|
152
|
+
/// so this guard prevents spurious duplicate events on the JS side.
|
|
153
|
+
private func deliverPushToStartToken(
|
|
154
|
+
_ token: String,
|
|
155
|
+
via callback: @Sendable (String) -> Void
|
|
156
|
+
) {
|
|
157
|
+
guard token != lastPushToStartToken else { return }
|
|
158
|
+
lastPushToStartToken = token
|
|
159
|
+
callback(token)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// MARK: - Per-Activity Observation
|
|
163
|
+
|
|
164
|
+
/// Start observing a single activity's push token and state changes.
|
|
165
|
+
///
|
|
166
|
+
/// Deduplication: if we are already watching this activity (same `id`), this
|
|
167
|
+
/// is a no-op. `activityUpdates` can re-yield the same activity after updates,
|
|
168
|
+
/// so deduplication here prevents duplicate concurrent observers.
|
|
169
|
+
private func observe(_ activity: Activity<VoltraAttributes>) {
|
|
170
|
+
let activityId = activity.id
|
|
171
|
+
let activityName = activity.attributes.name
|
|
172
|
+
|
|
173
|
+
// Token observation
|
|
174
|
+
if let onTokenUpdated, tokenTasks[activityId] == nil {
|
|
175
|
+
// Capture the callback locally to avoid an actor hop on every token delivery.
|
|
176
|
+
let callback = onTokenUpdated
|
|
177
|
+
|
|
178
|
+
let tokenTask = Task { [weak self] in
|
|
179
|
+
for await tokenData in activity.pushTokenUpdates {
|
|
180
|
+
callback(activityName, tokenData.hexString)
|
|
181
|
+
}
|
|
182
|
+
// The async sequence ends when the activity is dismissed or ended.
|
|
183
|
+
// Clean up our entry so we don't hold a reference to the finished task.
|
|
184
|
+
await self?.removeTokenTask(for: activityId)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
tokenTasks[activityId] = tokenTask
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// State observation
|
|
191
|
+
if let onStateChanged, stateTasks[activityId] == nil {
|
|
192
|
+
let callback = onStateChanged
|
|
193
|
+
|
|
194
|
+
let stateTask = Task { [weak self] in
|
|
195
|
+
for await state in activity.activityStateUpdates {
|
|
196
|
+
callback(activityName, String(describing: state))
|
|
197
|
+
}
|
|
198
|
+
await self?.removeStateTask(for: activityId)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
stateTasks[activityId] = stateTask
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// MARK: - Task Cleanup Helpers
|
|
206
|
+
|
|
207
|
+
private func removeTokenTask(for activityId: String) {
|
|
208
|
+
tokenTasks[activityId]?.cancel()
|
|
209
|
+
tokenTasks.removeValue(forKey: activityId)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private func removeStateTask(for activityId: String) {
|
|
213
|
+
stateTasks[activityId]?.cancel()
|
|
214
|
+
stateTasks.removeValue(forKey: activityId)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private func cancelAllPerActivityTasks() {
|
|
218
|
+
for task in tokenTasks.values {
|
|
219
|
+
task.cancel()
|
|
220
|
+
}
|
|
221
|
+
tokenTasks.removeAll()
|
|
222
|
+
|
|
223
|
+
for task in stateTasks.values {
|
|
224
|
+
task.cancel()
|
|
225
|
+
}
|
|
226
|
+
stateTasks.removeAll()
|
|
227
|
+
}
|
|
228
|
+
}
|