@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,306 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VoltraLiveActivityService.swift
|
|
3
|
+
// Voltra
|
|
4
|
+
//
|
|
5
|
+
// Service for managing Voltra Live Activities
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import ActivityKit
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
// MARK: - Request Types
|
|
12
|
+
|
|
13
|
+
/// Parameters for creating a Live Activity
|
|
14
|
+
public struct CreateActivityRequest {
|
|
15
|
+
/// Unique identifier for the activity (will be generated if nil)
|
|
16
|
+
public let activityId: String?
|
|
17
|
+
|
|
18
|
+
/// URL to open when the Live Activity is tapped
|
|
19
|
+
public let deepLinkUrl: String?
|
|
20
|
+
|
|
21
|
+
/// UI JSON data
|
|
22
|
+
public let jsonString: String
|
|
23
|
+
|
|
24
|
+
/// Optional date when content becomes stale
|
|
25
|
+
public let staleDate: Date?
|
|
26
|
+
|
|
27
|
+
/// Score between 0.0 and 1.0 for prioritization (defaults to 0.0)
|
|
28
|
+
public let relevanceScore: Double
|
|
29
|
+
|
|
30
|
+
/// Whether to request push token
|
|
31
|
+
public let pushType: PushType?
|
|
32
|
+
|
|
33
|
+
/// If true, ends any existing activities with the same name (defaults to true)
|
|
34
|
+
public let endExistingWithSameName: Bool
|
|
35
|
+
|
|
36
|
+
public init(
|
|
37
|
+
activityId: String? = nil,
|
|
38
|
+
deepLinkUrl: String? = nil,
|
|
39
|
+
jsonString: String,
|
|
40
|
+
staleDate: Date? = nil,
|
|
41
|
+
relevanceScore: Double = 0.0,
|
|
42
|
+
pushType: PushType? = nil,
|
|
43
|
+
endExistingWithSameName: Bool = true
|
|
44
|
+
) {
|
|
45
|
+
self.activityId = activityId
|
|
46
|
+
self.deepLinkUrl = deepLinkUrl
|
|
47
|
+
self.jsonString = jsonString
|
|
48
|
+
self.staleDate = staleDate
|
|
49
|
+
self.relevanceScore = relevanceScore
|
|
50
|
+
self.pushType = pushType
|
|
51
|
+
self.endExistingWithSameName = endExistingWithSameName
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// Parameters for updating a Live Activity
|
|
56
|
+
public struct UpdateActivityRequest {
|
|
57
|
+
/// New UI JSON data
|
|
58
|
+
public let jsonString: String
|
|
59
|
+
|
|
60
|
+
/// Optional date when content becomes stale
|
|
61
|
+
public let staleDate: Date?
|
|
62
|
+
|
|
63
|
+
/// Score between 0.0 and 1.0 for prioritization (defaults to 0.0)
|
|
64
|
+
public let relevanceScore: Double
|
|
65
|
+
|
|
66
|
+
public init(
|
|
67
|
+
jsonString: String,
|
|
68
|
+
staleDate: Date? = nil,
|
|
69
|
+
relevanceScore: Double = 0.0
|
|
70
|
+
) {
|
|
71
|
+
self.jsonString = jsonString
|
|
72
|
+
self.staleDate = staleDate
|
|
73
|
+
self.relevanceScore = relevanceScore
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// MARK: - Service
|
|
78
|
+
|
|
79
|
+
/// Service for managing Voltra Live Activities
|
|
80
|
+
public class VoltraLiveActivityService {
|
|
81
|
+
// MARK: - Availability Checks
|
|
82
|
+
|
|
83
|
+
/// Check if Live Activities are supported on this OS version
|
|
84
|
+
public static func isSupported() -> Bool {
|
|
85
|
+
guard #available(iOS 16.2, *) else { return false }
|
|
86
|
+
return true
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// Check if Live Activities are enabled for this app
|
|
90
|
+
public static func areActivitiesEnabled() -> Bool {
|
|
91
|
+
guard #available(iOS 16.2, *) else { return false }
|
|
92
|
+
return ActivityAuthorizationInfo().areActivitiesEnabled
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// MARK: - Query Operations
|
|
96
|
+
|
|
97
|
+
/// Find an activity by its name (activityId)
|
|
98
|
+
public func findActivity(byName name: String) -> Activity<VoltraAttributes>? {
|
|
99
|
+
guard Self.isSupported() else { return nil }
|
|
100
|
+
let trimmedName = name.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
101
|
+
return Activity<VoltraAttributes>.activities.first { $0.attributes.name == trimmedName }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// Find all activities with the same name
|
|
105
|
+
public func findActivities(byName name: String) -> [Activity<VoltraAttributes>] {
|
|
106
|
+
guard Self.isSupported() else { return [] }
|
|
107
|
+
return Activity<VoltraAttributes>.activities.filter { $0.attributes.name == name }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Get all active Voltra activities
|
|
111
|
+
public func getAllActivities() -> [Activity<VoltraAttributes>] {
|
|
112
|
+
guard Self.isSupported() else { return [] }
|
|
113
|
+
return Array(Activity<VoltraAttributes>.activities)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/// Get the latest (most recently created) activity across both types
|
|
117
|
+
public func getLatestActivity() -> VoltraActivity? {
|
|
118
|
+
guard Self.isSupported() else { return nil }
|
|
119
|
+
let allActivities = getAllActivities()
|
|
120
|
+
return allActivities.last
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// Check if an activity with the given name exists across both types
|
|
124
|
+
public func isActivityActive(name: String) -> Bool {
|
|
125
|
+
findActivity(byName: name) != nil
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// MARK: - Create Operations
|
|
129
|
+
|
|
130
|
+
/// Create a new Live Activity
|
|
131
|
+
/// - Parameter request: Parameters for creating the activity
|
|
132
|
+
/// - Returns: The created activity's name (activityId)
|
|
133
|
+
/// - Throws: Error if creation fails
|
|
134
|
+
public func createActivity(_ request: CreateActivityRequest) async throws -> String {
|
|
135
|
+
guard Self.isSupported() else {
|
|
136
|
+
throw VoltraLiveActivityError.unsupportedOS
|
|
137
|
+
}
|
|
138
|
+
guard Self.areActivitiesEnabled() else {
|
|
139
|
+
throw VoltraLiveActivityError.liveActivitiesNotEnabled
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Generate activityId if not provided
|
|
143
|
+
let finalActivityId = request.activityId?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false
|
|
144
|
+
? request.activityId!.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
145
|
+
: UUID().uuidString
|
|
146
|
+
|
|
147
|
+
// End existing activities with the same name if requested
|
|
148
|
+
if request.endExistingWithSameName {
|
|
149
|
+
try await endActivities(byName: finalActivityId)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Create attributes and initial state
|
|
153
|
+
let attributes = VoltraAttributes(name: finalActivityId, deepLinkUrl: request.deepLinkUrl)
|
|
154
|
+
let initialState = try VoltraAttributes.ContentState(uiJsonData: request.jsonString)
|
|
155
|
+
|
|
156
|
+
// Request the activity
|
|
157
|
+
_ = try Activity.request(
|
|
158
|
+
attributes: attributes,
|
|
159
|
+
content: .init(
|
|
160
|
+
state: initialState,
|
|
161
|
+
staleDate: request.staleDate,
|
|
162
|
+
relevanceScore: request.relevanceScore
|
|
163
|
+
),
|
|
164
|
+
pushType: request.pushType
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
return finalActivityId
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// MARK: - Update Operations
|
|
171
|
+
|
|
172
|
+
/// Update an existing Live Activity
|
|
173
|
+
/// - Parameters:
|
|
174
|
+
/// - activity: The activity to update
|
|
175
|
+
/// - request: Parameters for updating the activity
|
|
176
|
+
/// - Throws: Error if update fails
|
|
177
|
+
public func updateActivity(
|
|
178
|
+
_ activity: VoltraActivity,
|
|
179
|
+
request: UpdateActivityRequest
|
|
180
|
+
) async throws {
|
|
181
|
+
guard Self.isSupported() else {
|
|
182
|
+
throw VoltraLiveActivityError.unsupportedOS
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let newState = try VoltraAttributes.ContentState(uiJsonData: request.jsonString)
|
|
186
|
+
await activity.update(
|
|
187
|
+
ActivityContent(
|
|
188
|
+
state: newState,
|
|
189
|
+
staleDate: request.staleDate,
|
|
190
|
+
relevanceScore: request.relevanceScore
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/// Update an activity by name
|
|
196
|
+
/// - Parameters:
|
|
197
|
+
/// - name: The activity name (activityId)
|
|
198
|
+
/// - request: Parameters for updating the activity
|
|
199
|
+
/// - Throws: Error if activity not found or update fails
|
|
200
|
+
public func updateActivity(
|
|
201
|
+
byName name: String,
|
|
202
|
+
request: UpdateActivityRequest
|
|
203
|
+
) async throws {
|
|
204
|
+
guard let activity = findActivity(byName: name) else {
|
|
205
|
+
throw VoltraLiveActivityError.notFound
|
|
206
|
+
}
|
|
207
|
+
try await updateActivity(activity, request: request)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// MARK: - End Operations
|
|
211
|
+
|
|
212
|
+
/// End a specific activity
|
|
213
|
+
/// - Parameter activity: The activity to end
|
|
214
|
+
/// - Parameter dismissalPolicy: How the activity should be dismissed
|
|
215
|
+
public func endActivity(
|
|
216
|
+
_ activity: VoltraActivity,
|
|
217
|
+
dismissalPolicy: ActivityUIDismissalPolicy = .immediate
|
|
218
|
+
) async {
|
|
219
|
+
guard Self.isSupported() else { return }
|
|
220
|
+
await activity.end(
|
|
221
|
+
ActivityContent(state: activity.content.state, staleDate: nil),
|
|
222
|
+
dismissalPolicy: dismissalPolicy
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/// End an activity by name
|
|
227
|
+
/// - Parameter name: The activity name (activityId)
|
|
228
|
+
/// - Parameter dismissalPolicy: How the activity should be dismissed
|
|
229
|
+
/// - Throws: Error if activity not found
|
|
230
|
+
public func endActivity(
|
|
231
|
+
byName name: String,
|
|
232
|
+
dismissalPolicy: ActivityUIDismissalPolicy = .immediate
|
|
233
|
+
) async throws {
|
|
234
|
+
guard let activity = findActivity(byName: name) else {
|
|
235
|
+
throw VoltraLiveActivityError.notFound
|
|
236
|
+
}
|
|
237
|
+
await endActivity(activity, dismissalPolicy: dismissalPolicy)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/// End all activities with the same name
|
|
241
|
+
/// - Parameter name: The activity name (activityId)
|
|
242
|
+
public func endActivities(byName name: String) async throws {
|
|
243
|
+
guard Self.isSupported() else { return }
|
|
244
|
+
let activities = findActivities(byName: name)
|
|
245
|
+
for activity in activities {
|
|
246
|
+
await endActivity(activity)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/// End all Voltra Live Activities
|
|
251
|
+
public func endAllActivities() async {
|
|
252
|
+
guard Self.isSupported() else { return }
|
|
253
|
+
let activities = getAllActivities()
|
|
254
|
+
for activity in activities {
|
|
255
|
+
await endActivity(activity)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// MARK: - Monitoring
|
|
260
|
+
|
|
261
|
+
private var activityManager: VoltraLiveActivityManager?
|
|
262
|
+
|
|
263
|
+
/// Start monitoring all Live Activities, push tokens, and lifecycle state changes.
|
|
264
|
+
public func startMonitoring(enablePush: Bool) {
|
|
265
|
+
let onTokenUpdated: (@Sendable (String, String) -> Void)?
|
|
266
|
+
let onPushToStartUpdated: (@Sendable (String) -> Void)?
|
|
267
|
+
|
|
268
|
+
if enablePush {
|
|
269
|
+
onTokenUpdated = { activityName, token in
|
|
270
|
+
VoltraEventBus.shared.send(.tokenReceived(activityName: activityName, pushToken: token))
|
|
271
|
+
}
|
|
272
|
+
onPushToStartUpdated = { token in
|
|
273
|
+
VoltraEventBus.shared.send(.pushToStartTokenReceived(token: token))
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
onTokenUpdated = nil
|
|
277
|
+
onPushToStartUpdated = nil
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let manager = VoltraLiveActivityManager(
|
|
281
|
+
onTokenUpdated: onTokenUpdated,
|
|
282
|
+
onPushToStartUpdated: onPushToStartUpdated,
|
|
283
|
+
onStateChanged: { activityName, state in
|
|
284
|
+
VoltraEventBus.shared.send(.stateChange(activityName: activityName, state: state))
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
activityManager = manager
|
|
289
|
+
Task { await manager.startObserving() }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/// Stop all monitoring and cancel every outstanding observation task.
|
|
293
|
+
public func stopMonitoring() {
|
|
294
|
+
let manager = activityManager
|
|
295
|
+
activityManager = nil
|
|
296
|
+
Task { await manager?.stopObserving() }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// MARK: - Errors
|
|
301
|
+
|
|
302
|
+
public enum VoltraLiveActivityError: Error {
|
|
303
|
+
case unsupportedOS
|
|
304
|
+
case notFound
|
|
305
|
+
case liveActivitiesNotEnabled
|
|
306
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public enum VoltraErrors: Error {
|
|
4
|
+
case unsupportedOS
|
|
5
|
+
case notFound
|
|
6
|
+
case liveActivitiesNotEnabled
|
|
7
|
+
case unexpectedError(Error)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@objc public final class VoltraModule: NSObject {
|
|
11
|
+
private let impl: VoltraModuleImpl
|
|
12
|
+
|
|
13
|
+
@objc override public init() {
|
|
14
|
+
impl = VoltraModuleImpl()
|
|
15
|
+
super.init()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@objc public func startMonitoringWithEventHandler(
|
|
19
|
+
_ handler: @escaping (NSString, NSDictionary) -> Void
|
|
20
|
+
) {
|
|
21
|
+
impl.startMonitoring { eventName, eventData in
|
|
22
|
+
handler(eventName as NSString, eventData as NSDictionary)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@objc public func stopMonitoring() {
|
|
27
|
+
impl.stopMonitoring()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// MARK: - Live Activity
|
|
31
|
+
|
|
32
|
+
@objc public func startLiveActivity(
|
|
33
|
+
_ jsonString: String,
|
|
34
|
+
options: StartVoltraOptions?,
|
|
35
|
+
completion: @escaping (String?, Error?) -> Void
|
|
36
|
+
) {
|
|
37
|
+
Task {
|
|
38
|
+
do {
|
|
39
|
+
try completion(await impl.startLiveActivity(jsonString: jsonString, options: options), nil)
|
|
40
|
+
} catch {
|
|
41
|
+
completion(nil, error)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@objc public func updateLiveActivity(
|
|
47
|
+
_ activityId: String,
|
|
48
|
+
jsonString: String,
|
|
49
|
+
options: UpdateVoltraOptions?,
|
|
50
|
+
completion: @escaping (Error?) -> Void
|
|
51
|
+
) {
|
|
52
|
+
Task {
|
|
53
|
+
do {
|
|
54
|
+
try await impl.updateLiveActivity(activityId: activityId, jsonString: jsonString, options: options)
|
|
55
|
+
completion(nil)
|
|
56
|
+
} catch {
|
|
57
|
+
completion(error)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@objc public func endLiveActivity(
|
|
63
|
+
_ activityId: String,
|
|
64
|
+
options: EndVoltraOptions?,
|
|
65
|
+
completion: @escaping (Error?) -> Void
|
|
66
|
+
) {
|
|
67
|
+
Task {
|
|
68
|
+
do {
|
|
69
|
+
try await impl.endLiveActivity(activityId: activityId, options: options)
|
|
70
|
+
completion(nil)
|
|
71
|
+
} catch {
|
|
72
|
+
completion(error)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@objc public func endAllLiveActivities(_ completion: @escaping (Error?) -> Void) {
|
|
78
|
+
Task {
|
|
79
|
+
do {
|
|
80
|
+
try await impl.endAllLiveActivities()
|
|
81
|
+
completion(nil)
|
|
82
|
+
} catch {
|
|
83
|
+
completion(error)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@objc public func getLatestVoltraActivityId() -> String? {
|
|
89
|
+
impl.getLatestVoltraActivityId()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@objc public func listVoltraActivityIds() -> [String] {
|
|
93
|
+
impl.listVoltraActivityIds()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@objc public func isLiveActivityActive(_ activityName: String) -> Bool {
|
|
97
|
+
impl.isLiveActivityActive(name: activityName)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@objc public func isHeadless() -> Bool {
|
|
101
|
+
impl.isHeadless()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// MARK: - Images
|
|
105
|
+
|
|
106
|
+
@objc public func preloadImages(
|
|
107
|
+
_ images: NSArray,
|
|
108
|
+
completion: @escaping (NSDictionary?, Error?) -> Void
|
|
109
|
+
) {
|
|
110
|
+
let opts = images.compactMap { $0 as? NSDictionary }.map(PreloadImageOptions.init)
|
|
111
|
+
Task {
|
|
112
|
+
do {
|
|
113
|
+
try completion(await impl.preloadImages(images: opts).toDictionary(), nil)
|
|
114
|
+
} catch {
|
|
115
|
+
completion(nil, error)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@objc public func reloadLiveActivities(
|
|
121
|
+
_ activityNames: NSArray?,
|
|
122
|
+
completion: @escaping (Error?) -> Void
|
|
123
|
+
) {
|
|
124
|
+
let names = activityNames?.compactMap { $0 as? String }
|
|
125
|
+
Task {
|
|
126
|
+
do {
|
|
127
|
+
try await impl.reloadLiveActivities(activityNames: names)
|
|
128
|
+
completion(nil)
|
|
129
|
+
} catch {
|
|
130
|
+
completion(error)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@objc public func clearPreloadedImages(_ keys: NSArray?, completion: @escaping () -> Void) {
|
|
136
|
+
Task {
|
|
137
|
+
await impl.clearPreloadedImages(keys: keys?.compactMap { $0 as? String })
|
|
138
|
+
completion()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// MARK: - Home Screen Widgets
|
|
143
|
+
|
|
144
|
+
@objc public func updateWidget(
|
|
145
|
+
_ widgetId: String,
|
|
146
|
+
jsonString: String,
|
|
147
|
+
options: UpdateWidgetOptions?,
|
|
148
|
+
completion: @escaping (Error?) -> Void
|
|
149
|
+
) {
|
|
150
|
+
Task {
|
|
151
|
+
do {
|
|
152
|
+
try await impl.updateWidget(widgetId: widgetId, jsonString: jsonString, options: options)
|
|
153
|
+
completion(nil)
|
|
154
|
+
} catch {
|
|
155
|
+
completion(error)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@objc public func scheduleWidget(
|
|
161
|
+
_ widgetId: String,
|
|
162
|
+
timelineJson: String,
|
|
163
|
+
completion: @escaping (Error?) -> Void
|
|
164
|
+
) {
|
|
165
|
+
Task {
|
|
166
|
+
do {
|
|
167
|
+
try await impl.scheduleWidget(widgetId: widgetId, timelineJson: timelineJson)
|
|
168
|
+
completion(nil)
|
|
169
|
+
} catch {
|
|
170
|
+
completion(error)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@objc public func reloadWidgets(_ widgetIds: NSArray?, completion: @escaping () -> Void) {
|
|
176
|
+
Task {
|
|
177
|
+
await impl.reloadWidgets(widgetIds: widgetIds?.compactMap { $0 as? String })
|
|
178
|
+
completion()
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@objc public func clearWidget(_ widgetId: String, completion: @escaping () -> Void) {
|
|
183
|
+
Task {
|
|
184
|
+
await impl.clearWidget(widgetId: widgetId)
|
|
185
|
+
completion()
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@objc public func clearAllWidgets(_ completion: @escaping () -> Void) {
|
|
190
|
+
Task {
|
|
191
|
+
await impl.clearAllWidgets()
|
|
192
|
+
completion()
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@objc public func getActiveWidgets(_ completion: @escaping (NSArray?, Error?) -> Void) {
|
|
197
|
+
Task {
|
|
198
|
+
do {
|
|
199
|
+
try completion(await impl.getActiveWidgets() as NSArray, nil)
|
|
200
|
+
} catch {
|
|
201
|
+
completion(nil, error)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// MARK: - Widget Server Credentials
|
|
207
|
+
|
|
208
|
+
@objc public func setWidgetServerCredentials(_ token: String, headers: NSDictionary?) {
|
|
209
|
+
impl.setWidgetServerCredentials(token: token, headers: headers as? [String: String])
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@objc public func clearWidgetServerCredentials() {
|
|
213
|
+
impl.clearWidgetServerCredentials()
|
|
214
|
+
}
|
|
215
|
+
}
|