@use-voltra/ios-client 1.4.1 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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 +105 -19
- package/src/VoltraModule.ts +2 -0
- package/src/components/VoltraLiveActivityPreview.tsx +29 -0
- package/src/components/VoltraView.tsx +49 -0
- package/src/components/VoltraWidgetPreview.tsx +38 -0
- package/src/events.ts +70 -0
- package/src/helpers.ts +21 -0
- package/src/index.ts +52 -0
- package/src/live-activity/api.ts +224 -0
- package/src/logger.ts +35 -0
- package/src/native/NativeVoltra.ts +118 -0
- package/src/native/VoltraRNNativeComponent.ts +9 -0
- package/src/preload.ts +50 -0
- package/src/types.ts +12 -0
- package/src/utils/assertRunningOnApple.ts +10 -0
- package/src/utils/helpers.ts +1 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/useUpdateOnHMR.ts +25 -0
- package/src/widgets/server-credentials.ts +16 -0
- package/src/widgets/widget-api.ts +65 -0
- 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,224 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { renderLiveActivityToString, type DismissalPolicy, type LiveActivityVariants } from '@use-voltra/ios'
|
|
4
|
+
|
|
5
|
+
import { addVoltraListener } from '../events.js'
|
|
6
|
+
import { logger } from '../logger.js'
|
|
7
|
+
import { assertRunningOnApple, useUpdateOnHMR } from '../utils/index.js'
|
|
8
|
+
import { getNativeVoltra } from '../VoltraModule.js'
|
|
9
|
+
|
|
10
|
+
export type SharedLiveActivityOptions = {
|
|
11
|
+
staleDate?: number
|
|
12
|
+
relevanceScore?: number
|
|
13
|
+
dismissalPolicy?: DismissalPolicy
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type StartLiveActivityOptions = {
|
|
17
|
+
activityName?: string
|
|
18
|
+
deepLinkUrl?: string
|
|
19
|
+
channelId?: string
|
|
20
|
+
} & SharedLiveActivityOptions
|
|
21
|
+
|
|
22
|
+
export type UpdateLiveActivityOptions = SharedLiveActivityOptions
|
|
23
|
+
|
|
24
|
+
export type EndLiveActivityOptions = {
|
|
25
|
+
dismissalPolicy?: DismissalPolicy
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type UseLiveActivityOptions = {
|
|
29
|
+
activityName?: string
|
|
30
|
+
autoStart?: boolean
|
|
31
|
+
autoUpdate?: boolean
|
|
32
|
+
deepLinkUrl?: string
|
|
33
|
+
channelId?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type UseLiveActivityResult = {
|
|
37
|
+
start: (options?: StartLiveActivityOptions) => Promise<void>
|
|
38
|
+
update: (options?: UpdateLiveActivityOptions) => Promise<void>
|
|
39
|
+
end: (options?: EndLiveActivityOptions) => Promise<void>
|
|
40
|
+
isActive: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const normalizeSharedLiveActivityOptions = (
|
|
44
|
+
options?: SharedLiveActivityOptions
|
|
45
|
+
): SharedLiveActivityOptions | undefined => {
|
|
46
|
+
if (!options) return undefined
|
|
47
|
+
|
|
48
|
+
const normalizedOptions: SharedLiveActivityOptions = {}
|
|
49
|
+
|
|
50
|
+
if (options.staleDate !== undefined) {
|
|
51
|
+
if (options.staleDate < Date.now()) {
|
|
52
|
+
logger.warn('Ignoring staleDate because it is in the past, the Live Activity would be dismissed immediately.')
|
|
53
|
+
} else {
|
|
54
|
+
normalizedOptions.staleDate = options.staleDate
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const relevanceScore = options.relevanceScore ?? 0.0
|
|
59
|
+
if (relevanceScore < 0 || relevanceScore > 1) {
|
|
60
|
+
logger.warn('Ignoring relevanceScore because it is out of range [0.0, 1.0], using default 0.0')
|
|
61
|
+
normalizedOptions.relevanceScore = 0.0
|
|
62
|
+
} else {
|
|
63
|
+
normalizedOptions.relevanceScore = relevanceScore
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return Object.keys(normalizedOptions).length > 0 ? normalizedOptions : undefined
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const normalizeEndLiveActivityOptions = (
|
|
70
|
+
options?: EndLiveActivityOptions
|
|
71
|
+
): { dismissalPolicy?: { type: 'immediate' | 'after'; date?: number } } | undefined => {
|
|
72
|
+
if (!options?.dismissalPolicy) return undefined
|
|
73
|
+
|
|
74
|
+
if (typeof options.dismissalPolicy === 'string') {
|
|
75
|
+
if (options.dismissalPolicy === 'immediate') {
|
|
76
|
+
return { dismissalPolicy: { type: 'immediate' } }
|
|
77
|
+
}
|
|
78
|
+
} else if (typeof options.dismissalPolicy === 'object' && 'after' in options.dismissalPolicy) {
|
|
79
|
+
return { dismissalPolicy: { type: 'after', date: options.dismissalPolicy.after } }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return { dismissalPolicy: { type: 'immediate' } }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const useLiveActivity = (
|
|
86
|
+
variants: LiveActivityVariants,
|
|
87
|
+
options?: UseLiveActivityOptions
|
|
88
|
+
): UseLiveActivityResult => {
|
|
89
|
+
const [targetId, setTargetId] = useState<string | null>(() => {
|
|
90
|
+
if (options?.activityName) {
|
|
91
|
+
return isLiveActivityActive(options.activityName) ? options.activityName : null
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null
|
|
95
|
+
})
|
|
96
|
+
const isActive = targetId !== null
|
|
97
|
+
const optionsRef = useRef(options)
|
|
98
|
+
const variantsRef = useRef(variants)
|
|
99
|
+
const lastUpdateOptionsRef = useRef<UpdateLiveActivityOptions | undefined>(undefined)
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
optionsRef.current = options
|
|
103
|
+
}, [options])
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
variantsRef.current = variants
|
|
107
|
+
}, [variants])
|
|
108
|
+
|
|
109
|
+
useUpdateOnHMR()
|
|
110
|
+
|
|
111
|
+
const start = useCallback(async (options?: StartLiveActivityOptions) => {
|
|
112
|
+
const id = await startLiveActivity(variantsRef.current, { ...optionsRef.current, ...options })
|
|
113
|
+
setTargetId(id)
|
|
114
|
+
}, [])
|
|
115
|
+
|
|
116
|
+
const update = useCallback(
|
|
117
|
+
async (options?: UpdateLiveActivityOptions) => {
|
|
118
|
+
if (!targetId) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const updateOptions = { ...optionsRef.current, ...options }
|
|
123
|
+
lastUpdateOptionsRef.current = updateOptions
|
|
124
|
+
await updateLiveActivity(targetId, variantsRef.current, updateOptions)
|
|
125
|
+
},
|
|
126
|
+
[targetId]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
const end = useCallback(
|
|
130
|
+
async (options?: EndLiveActivityOptions) => {
|
|
131
|
+
if (!targetId) {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
await stopLiveActivity(targetId, options)
|
|
136
|
+
setTargetId(null)
|
|
137
|
+
},
|
|
138
|
+
[targetId]
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!options?.autoStart) {
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
start()
|
|
147
|
+
}, [options?.autoStart, start])
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (!options?.autoUpdate) return
|
|
151
|
+
update(lastUpdateOptionsRef.current)
|
|
152
|
+
}, [options?.autoUpdate, update, variants])
|
|
153
|
+
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (!targetId) return
|
|
156
|
+
|
|
157
|
+
const subscription = addVoltraListener('stateChange', (event) => {
|
|
158
|
+
if (event.activityName !== targetId) return
|
|
159
|
+
|
|
160
|
+
if (event.activityState === 'dismissed' || event.activityState === 'ended') {
|
|
161
|
+
setTargetId(null)
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
return () => subscription.remove()
|
|
166
|
+
}, [targetId])
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
start,
|
|
170
|
+
update,
|
|
171
|
+
end,
|
|
172
|
+
isActive,
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const startLiveActivity = async (
|
|
177
|
+
variants: LiveActivityVariants,
|
|
178
|
+
options?: StartLiveActivityOptions
|
|
179
|
+
): Promise<string> => {
|
|
180
|
+
if (!assertRunningOnApple()) return Promise.resolve('')
|
|
181
|
+
|
|
182
|
+
const payload = renderLiveActivityToString(variants)
|
|
183
|
+
|
|
184
|
+
const normalizedSharedOptions = normalizeSharedLiveActivityOptions(options)
|
|
185
|
+
const targetId = await getNativeVoltra().startLiveActivity(payload, {
|
|
186
|
+
target: 'liveActivity',
|
|
187
|
+
deepLinkUrl: options?.deepLinkUrl,
|
|
188
|
+
activityName: options?.activityName,
|
|
189
|
+
channelId: options?.channelId,
|
|
190
|
+
...normalizedSharedOptions,
|
|
191
|
+
})
|
|
192
|
+
return targetId
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const updateLiveActivity = async (
|
|
196
|
+
targetId: string,
|
|
197
|
+
variants: LiveActivityVariants,
|
|
198
|
+
options?: UpdateLiveActivityOptions
|
|
199
|
+
): Promise<void> => {
|
|
200
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
201
|
+
|
|
202
|
+
const payload = renderLiveActivityToString(variants)
|
|
203
|
+
|
|
204
|
+
const normalizedSharedOptions = normalizeSharedLiveActivityOptions(options)
|
|
205
|
+
return getNativeVoltra().updateLiveActivity(targetId, payload, normalizedSharedOptions ?? {})
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export const stopLiveActivity = async (targetId: string, options?: EndLiveActivityOptions): Promise<void> => {
|
|
209
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
210
|
+
|
|
211
|
+
const normalizedOptions = normalizeEndLiveActivityOptions(options)
|
|
212
|
+
return getNativeVoltra().endLiveActivity(targetId, normalizedOptions ?? { dismissalPolicy: { type: 'immediate' } })
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export const isLiveActivityActive = (activityName: string): boolean => {
|
|
216
|
+
if (!assertRunningOnApple()) return false
|
|
217
|
+
|
|
218
|
+
return getNativeVoltra().isLiveActivityActive(activityName)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export async function endAllLiveActivities(): Promise<void> {
|
|
222
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
223
|
+
return getNativeVoltra().endAllLiveActivities()
|
|
224
|
+
}
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const LEVELS = {
|
|
2
|
+
debug: 0,
|
|
3
|
+
info: 1,
|
|
4
|
+
warn: 2,
|
|
5
|
+
error: 3,
|
|
6
|
+
} as const
|
|
7
|
+
export type VoltraLogLevel = keyof typeof LEVELS
|
|
8
|
+
|
|
9
|
+
let currentLevel: VoltraLogLevel = __DEV__ ? 'debug' : 'info'
|
|
10
|
+
|
|
11
|
+
export const logger = {
|
|
12
|
+
debug: (message: string) => {
|
|
13
|
+
if (LEVELS.debug >= LEVELS[currentLevel]) {
|
|
14
|
+
console.log(`[Voltra] ${message}`)
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
info: (message: string) => {
|
|
18
|
+
if (LEVELS.info >= LEVELS[currentLevel]) {
|
|
19
|
+
console.info(`[Voltra] ${message}`)
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
warn: (message: string) => {
|
|
23
|
+
if (LEVELS.warn >= LEVELS[currentLevel]) {
|
|
24
|
+
console.warn(`[Voltra] ${message}`)
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
error: (message: string) => {
|
|
28
|
+
if (LEVELS.error >= LEVELS[currentLevel]) {
|
|
29
|
+
console.error(`[Voltra] ${message}`)
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setLevel: (level: VoltraLogLevel) => {
|
|
33
|
+
currentLevel = level
|
|
34
|
+
},
|
|
35
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { CodegenTypes, TurboModule } from 'react-native'
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native'
|
|
3
|
+
|
|
4
|
+
type VoltraActivityTokenReceivedEvent = Readonly<{
|
|
5
|
+
source: string
|
|
6
|
+
timestamp: number
|
|
7
|
+
type: 'activityTokenReceived'
|
|
8
|
+
activityName: string
|
|
9
|
+
pushToken: string
|
|
10
|
+
}>
|
|
11
|
+
|
|
12
|
+
type VoltraActivityPushToStartTokenReceivedEvent = Readonly<{
|
|
13
|
+
source: string
|
|
14
|
+
timestamp: number
|
|
15
|
+
type: 'activityPushToStartTokenReceived'
|
|
16
|
+
pushToStartToken: string
|
|
17
|
+
}>
|
|
18
|
+
|
|
19
|
+
type VoltraActivityUpdateEvent = Readonly<{
|
|
20
|
+
source: string
|
|
21
|
+
timestamp: number
|
|
22
|
+
type: 'stateChange'
|
|
23
|
+
activityName: string
|
|
24
|
+
activityState: string
|
|
25
|
+
}>
|
|
26
|
+
|
|
27
|
+
type VoltraInteractionEvent = Readonly<{
|
|
28
|
+
source: string
|
|
29
|
+
timestamp: number
|
|
30
|
+
type: 'interaction'
|
|
31
|
+
identifier: string
|
|
32
|
+
payload: string
|
|
33
|
+
}>
|
|
34
|
+
|
|
35
|
+
type StartVoltraOptions = Readonly<{
|
|
36
|
+
target?: string
|
|
37
|
+
deepLinkUrl?: string
|
|
38
|
+
activityName?: string
|
|
39
|
+
staleDate?: number
|
|
40
|
+
relevanceScore?: number
|
|
41
|
+
channelId?: string
|
|
42
|
+
}>
|
|
43
|
+
|
|
44
|
+
type UpdateVoltraOptions = Readonly<{
|
|
45
|
+
staleDate?: number
|
|
46
|
+
relevanceScore?: number
|
|
47
|
+
}>
|
|
48
|
+
|
|
49
|
+
type DismissalPolicyOptions = Readonly<{
|
|
50
|
+
type: string
|
|
51
|
+
date?: number
|
|
52
|
+
}>
|
|
53
|
+
|
|
54
|
+
type EndVoltraOptions = Readonly<{
|
|
55
|
+
dismissalPolicy?: DismissalPolicyOptions
|
|
56
|
+
}>
|
|
57
|
+
|
|
58
|
+
type UpdateWidgetOptions = Readonly<{
|
|
59
|
+
deepLinkUrl?: string
|
|
60
|
+
}>
|
|
61
|
+
|
|
62
|
+
type PreloadImageOptions = Readonly<{
|
|
63
|
+
url: string
|
|
64
|
+
key: string
|
|
65
|
+
method?: string
|
|
66
|
+
headers?: Readonly<{ [key: string]: string }>
|
|
67
|
+
}>
|
|
68
|
+
|
|
69
|
+
type PreloadImageFailure = Readonly<{
|
|
70
|
+
key: string
|
|
71
|
+
error: string
|
|
72
|
+
}>
|
|
73
|
+
|
|
74
|
+
type PreloadImagesResult = Readonly<{
|
|
75
|
+
succeeded: string[]
|
|
76
|
+
failed: PreloadImageFailure[]
|
|
77
|
+
}>
|
|
78
|
+
|
|
79
|
+
type WidgetServerCredentials = Readonly<{
|
|
80
|
+
token: string
|
|
81
|
+
headers?: Readonly<{ [key: string]: string }>
|
|
82
|
+
}>
|
|
83
|
+
|
|
84
|
+
export interface Spec extends TurboModule {
|
|
85
|
+
readonly onInteraction: CodegenTypes.EventEmitter<VoltraInteractionEvent>
|
|
86
|
+
readonly onStateChanged: CodegenTypes.EventEmitter<VoltraActivityUpdateEvent>
|
|
87
|
+
readonly onActivityTokenReceived: CodegenTypes.EventEmitter<VoltraActivityTokenReceivedEvent>
|
|
88
|
+
readonly onActivityPushToStartTokenReceived: CodegenTypes.EventEmitter<VoltraActivityPushToStartTokenReceivedEvent>
|
|
89
|
+
startLiveActivity(jsonString: string, options: StartVoltraOptions): Promise<string>
|
|
90
|
+
updateLiveActivity(activityId: string, jsonString: string, options: UpdateVoltraOptions): Promise<void>
|
|
91
|
+
endLiveActivity(activityId: string, options: EndVoltraOptions): Promise<void>
|
|
92
|
+
endAllLiveActivities(): Promise<void>
|
|
93
|
+
getLatestVoltraActivityId(): Promise<string | null>
|
|
94
|
+
listVoltraActivityIds(): Promise<string[]>
|
|
95
|
+
isLiveActivityActive(activityName: string): boolean
|
|
96
|
+
isHeadless(): boolean
|
|
97
|
+
preloadImages(images: PreloadImageOptions[]): Promise<PreloadImagesResult>
|
|
98
|
+
reloadLiveActivities(activityNames?: string[] | null): Promise<void>
|
|
99
|
+
clearPreloadedImages(keys?: string[] | null): Promise<void>
|
|
100
|
+
updateWidget(widgetId: string, jsonString: string, options: UpdateWidgetOptions): Promise<void>
|
|
101
|
+
scheduleWidget(widgetId: string, timelineJson: string): Promise<void>
|
|
102
|
+
reloadWidgets(widgetIds?: string[] | null): Promise<void>
|
|
103
|
+
clearWidget(widgetId: string): Promise<void>
|
|
104
|
+
clearAllWidgets(): Promise<void>
|
|
105
|
+
getActiveWidgets<T = unknown>(): Promise<T[]>
|
|
106
|
+
setWidgetServerCredentials(credentials: WidgetServerCredentials): Promise<void>
|
|
107
|
+
clearWidgetServerCredentials(): Promise<void>
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function getNativeVoltra(): Spec {
|
|
111
|
+
const voltraModule = TurboModuleRegistry.get<Spec>('NativeVoltra')
|
|
112
|
+
|
|
113
|
+
if (voltraModule == null) {
|
|
114
|
+
throw new Error('NativeVoltra is not available')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return voltraModule
|
|
118
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native'
|
|
2
|
+
import { codegenNativeComponent } from 'react-native'
|
|
3
|
+
|
|
4
|
+
export interface NativeProps extends ViewProps {
|
|
5
|
+
payload: string
|
|
6
|
+
viewId: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default codegenNativeComponent<NativeProps>('VoltraView') as HostComponent<NativeProps>
|
package/src/preload.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import type { PreloadImageOptions, PreloadImagesResult } from './types.js'
|
|
4
|
+
import { getNativeVoltra } from './VoltraModule.js'
|
|
5
|
+
|
|
6
|
+
export type { PreloadImageOptions, PreloadImagesResult } from './types.js'
|
|
7
|
+
|
|
8
|
+
function assertIOS(name: string): boolean {
|
|
9
|
+
const isIOS = Platform.OS === 'ios'
|
|
10
|
+
if (!isIOS) console.error(`${name} is only available on iOS`)
|
|
11
|
+
return isIOS
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function preloadImages(images: PreloadImageOptions[]): Promise<PreloadImagesResult> {
|
|
15
|
+
if (!assertIOS('preloadImages')) {
|
|
16
|
+
return { succeeded: [], failed: images.map((img) => ({ key: img.key, error: 'Not available on this platform' })) }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
return await getNativeVoltra().preloadImages(images)
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
succeeded: [],
|
|
24
|
+
failed: images.map((img) => ({
|
|
25
|
+
key: img.key,
|
|
26
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
27
|
+
})),
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function reloadLiveActivities(activityNames?: string[]): Promise<void> {
|
|
33
|
+
if (!assertIOS('reloadLiveActivities')) return
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
await getNativeVoltra().reloadLiveActivities(activityNames ?? null)
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Failed to reload Live Activities:', error)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function clearPreloadedImages(keys?: string[]): Promise<void> {
|
|
43
|
+
if (!assertIOS('clearPreloadedImages')) return
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
await getNativeVoltra().clearPreloadedImages(keys ?? null)
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Failed to clear preloaded images:', error)
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
EventSubscription,
|
|
3
|
+
PreloadImageFailure,
|
|
4
|
+
PreloadImageOptions,
|
|
5
|
+
PreloadImagesResult,
|
|
6
|
+
UpdateWidgetOptions,
|
|
7
|
+
VoltraElementJson,
|
|
8
|
+
VoltraElementRef,
|
|
9
|
+
VoltraNodeJson,
|
|
10
|
+
VoltraPropValue,
|
|
11
|
+
WidgetServerCredentials,
|
|
12
|
+
} from '@use-voltra/ios'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isGlassSupported, isHeadless } from '../helpers.js'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var __accept: (...args: unknown[]) => void
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const useUpdateOnHMR = () => {
|
|
8
|
+
const [, forceUpdate] = useState(0)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!__DEV__) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const oldAccept = global['__accept']
|
|
16
|
+
global['__accept'] = (...args) => {
|
|
17
|
+
forceUpdate((prev) => prev + 1)
|
|
18
|
+
oldAccept?.(...args)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
global['__accept'] = oldAccept
|
|
23
|
+
}
|
|
24
|
+
}, [])
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WidgetServerCredentials } from '../types.js'
|
|
2
|
+
import { getNativeVoltra } from '../VoltraModule.js'
|
|
3
|
+
|
|
4
|
+
export type { WidgetServerCredentials } from '../types.js'
|
|
5
|
+
|
|
6
|
+
export async function setWidgetServerCredentials(credentials: WidgetServerCredentials): Promise<void> {
|
|
7
|
+
if (!credentials.token) {
|
|
8
|
+
throw new Error('[Voltra][iOS] setWidgetServerCredentials: token is required')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return getNativeVoltra().setWidgetServerCredentials(credentials)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function clearWidgetServerCredentials(): Promise<void> {
|
|
15
|
+
return getNativeVoltra().clearWidgetServerCredentials()
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { renderWidgetToString, type ScheduledWidgetEntry, type WidgetInfo, type WidgetVariants } from '@use-voltra/ios'
|
|
2
|
+
|
|
3
|
+
import type { UpdateWidgetOptions } from '../types.js'
|
|
4
|
+
import { assertRunningOnApple } from '../utils/assertRunningOnApple.js'
|
|
5
|
+
import { getNativeVoltra } from '../VoltraModule.js'
|
|
6
|
+
|
|
7
|
+
export type { UpdateWidgetOptions } from '../types.js'
|
|
8
|
+
export type { ScheduledWidgetEntry, WidgetInfo } from '@use-voltra/ios'
|
|
9
|
+
|
|
10
|
+
export const updateWidget = async (
|
|
11
|
+
widgetId: string,
|
|
12
|
+
variants: WidgetVariants,
|
|
13
|
+
options?: UpdateWidgetOptions
|
|
14
|
+
): Promise<void> => {
|
|
15
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
16
|
+
|
|
17
|
+
const payload = renderWidgetToString(variants)
|
|
18
|
+
|
|
19
|
+
return getNativeVoltra().updateWidget(widgetId, payload, {
|
|
20
|
+
deepLinkUrl: options?.deepLinkUrl,
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const reloadWidgets = async (widgetIds?: string[]): Promise<void> => {
|
|
25
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
26
|
+
|
|
27
|
+
return getNativeVoltra().reloadWidgets(widgetIds ?? null)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const clearWidget = async (widgetId: string): Promise<void> => {
|
|
31
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
32
|
+
|
|
33
|
+
return getNativeVoltra().clearWidget(widgetId)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const clearAllWidgets = async (): Promise<void> => {
|
|
37
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
38
|
+
|
|
39
|
+
return getNativeVoltra().clearAllWidgets()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const scheduleWidget = async (widgetId: string, entries: ScheduledWidgetEntry[]): Promise<void> => {
|
|
43
|
+
if (!assertRunningOnApple()) return Promise.resolve()
|
|
44
|
+
|
|
45
|
+
const renderedEntries = entries.map((entry) => ({
|
|
46
|
+
date: entry.date.getTime(),
|
|
47
|
+
json: renderWidgetToString(entry.variants),
|
|
48
|
+
deepLinkUrl: entry.deepLinkUrl,
|
|
49
|
+
}))
|
|
50
|
+
|
|
51
|
+
const timelineData = {
|
|
52
|
+
entries: renderedEntries,
|
|
53
|
+
policy: { type: 'never' },
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const timelineJson = JSON.stringify(timelineData)
|
|
57
|
+
|
|
58
|
+
return getNativeVoltra().scheduleWidget(widgetId, timelineJson)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const getActiveWidgets = async (): Promise<WidgetInfo[]> => {
|
|
62
|
+
if (!assertRunningOnApple()) return []
|
|
63
|
+
|
|
64
|
+
return getNativeVoltra().getActiveWidgets()
|
|
65
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VoltraModule.js","sourceRoot":"","sources":["../../src/VoltraModule.ts"],"names":[],"mappings":";;AAAA,+BAA0C;AAsD1C,MAAM,YAAY,GAAG,IAAA,0BAAmB,EAAsB,cAAc,CAAC,CAAA;AAE7E,kBAAe,YAAY,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VoltraLiveActivityPreview = VoltraLiveActivityPreview;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const VoltraView_js_1 = require("./VoltraView.js");
|
|
6
|
-
const LOCK_SCREEN_DIMENSIONS = {
|
|
7
|
-
width: 364,
|
|
8
|
-
height: 160,
|
|
9
|
-
};
|
|
10
|
-
function VoltraLiveActivityPreview({ style, children, ...voltraViewProps }) {
|
|
11
|
-
const previewStyle = [
|
|
12
|
-
{
|
|
13
|
-
width: LOCK_SCREEN_DIMENSIONS.width,
|
|
14
|
-
height: LOCK_SCREEN_DIMENSIONS.height,
|
|
15
|
-
},
|
|
16
|
-
style,
|
|
17
|
-
];
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(VoltraView_js_1.VoltraView, { ...voltraViewProps, style: previewStyle, children: children }));
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=VoltraLiveActivityPreview.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VoltraLiveActivityPreview.js","sourceRoot":"","sources":["../../../src/components/VoltraLiveActivityPreview.tsx"],"names":[],"mappings":";;AAcA,8DAcC;;AAzBD,mDAAkE;AAElE,MAAM,sBAAsB,GAAG;IAC7B,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;CACZ,CAAA;AAMD,SAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,eAAe,EAAkC;IAC/G,MAAM,YAAY,GAAyB;QACzC;YACE,KAAK,EAAE,sBAAsB,CAAC,KAAK;YACnC,MAAM,EAAE,sBAAsB,CAAC,MAAM;SACtC;QACD,KAAK;KACN,CAAA;IAED,OAAO,CACL,uBAAC,0BAAU,OAAK,eAAe,EAAE,KAAK,EAAE,YAAY,YACjD,QAAQ,GACE,CACd,CAAA;AACH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VoltraView = VoltraView;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const expo_1 = require("expo");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const ios_1 = require("@use-voltra/ios");
|
|
9
|
-
const events_js_1 = require("../events.js");
|
|
10
|
-
const NativeVoltraView = (0, expo_1.requireNativeView)('VoltraModule');
|
|
11
|
-
const generateViewId = () => `voltra-view-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
12
|
-
const voltraViewStyle = {
|
|
13
|
-
flex: 1,
|
|
14
|
-
};
|
|
15
|
-
function VoltraView({ id, children, style, onInteraction, testID }) {
|
|
16
|
-
const viewId = (0, react_1.useMemo)(() => id || generateViewId(), [id]);
|
|
17
|
-
const json = (0, ios_1.renderVoltraVariantToJson)(children);
|
|
18
|
-
const payload = JSON.stringify(json);
|
|
19
|
-
(0, react_1.useEffect)(() => {
|
|
20
|
-
if (!onInteraction)
|
|
21
|
-
return;
|
|
22
|
-
const subscription = (0, events_js_1.addVoltraListener)('interaction', (event) => {
|
|
23
|
-
if (event.source === viewId) {
|
|
24
|
-
onInteraction({
|
|
25
|
-
type: 'interaction',
|
|
26
|
-
source: event.source,
|
|
27
|
-
timestamp: event.timestamp,
|
|
28
|
-
identifier: event.identifier,
|
|
29
|
-
payload: event.payload,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return () => subscription.remove();
|
|
34
|
-
}, [viewId, onInteraction]);
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { testID: testID, style: style, children: (0, jsx_runtime_1.jsx)(NativeVoltraView, { payload: payload, viewId: viewId, style: voltraViewStyle }) }));
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=VoltraView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VoltraView.js","sourceRoot":"","sources":["../../../src/components/VoltraView.tsx"],"names":[],"mappings":";;AAwBA,gCA6BC;;AArDD,+BAAwC;AACxC,iCAAiE;AACjE,+CAAmE;AAEnE,yCAA2D;AAE3D,4CAA6E;AAE7E,MAAM,gBAAgB,GAAG,IAAA,wBAAiB,EAAC,cAAc,CAAC,CAAA;AAE1D,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,eAAe,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;AAEtG,MAAM,eAAe,GAAc;IACjC,IAAI,EAAE,CAAC;CACR,CAAA;AAUD,SAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAmB;IACxF,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,EAAE,IAAI,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAE1D,MAAM,IAAI,GAAG,IAAA,+BAAyB,EAAC,QAAQ,CAAC,CAAA;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,YAAY,GAAG,IAAA,6BAAiB,EAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC5B,aAAa,CAAC;oBACZ,IAAI,EAAE,aAAa;oBACnB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;IACpC,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;IAE3B,OAAO,CACL,uBAAC,mBAAI,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,YAChC,uBAAC,gBAAgB,IAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAI,GACzE,CACR,CAAA;AACH,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VoltraWidgetPreview = VoltraWidgetPreview;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const VoltraView_js_1 = require("./VoltraView.js");
|
|
6
|
-
const WIDGET_DIMENSIONS = {
|
|
7
|
-
systemSmall: { width: 170, height: 170 },
|
|
8
|
-
systemMedium: { width: 364, height: 170 },
|
|
9
|
-
systemLarge: { width: 364, height: 382 },
|
|
10
|
-
systemExtraLarge: { width: 364, height: 768 },
|
|
11
|
-
accessoryCircular: { width: 76, height: 76 },
|
|
12
|
-
accessoryRectangular: { width: 172, height: 76 },
|
|
13
|
-
accessoryInline: { width: 172, height: 40 },
|
|
14
|
-
};
|
|
15
|
-
function VoltraWidgetPreview({ family, style, children, ...voltraViewProps }) {
|
|
16
|
-
const dimensions = WIDGET_DIMENSIONS[family];
|
|
17
|
-
const previewStyle = [
|
|
18
|
-
{
|
|
19
|
-
width: dimensions.width,
|
|
20
|
-
height: dimensions.height,
|
|
21
|
-
},
|
|
22
|
-
style,
|
|
23
|
-
];
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(VoltraView_js_1.VoltraView, { ...voltraViewProps, style: previewStyle, children: children }));
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=VoltraWidgetPreview.js.map
|