@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,44 @@
|
|
|
1
|
+
import { ConfigPlugin, withPodfile as withExpoPodfile } from '@expo/config-plugins'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates the Podfile target content for the widget extension.
|
|
5
|
+
*/
|
|
6
|
+
function getTargetContent(targetName: string): string {
|
|
7
|
+
return `
|
|
8
|
+
# Voltra Widget Extension Target
|
|
9
|
+
# DO NOT MODIFY THIS FILE - IT IS AUTO-GENERATED BY THE VOLTRA PLUGIN
|
|
10
|
+
target '${targetName}' do
|
|
11
|
+
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
12
|
+
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
13
|
+
|
|
14
|
+
require 'pathname'
|
|
15
|
+
project_root = "#{Pod::Config.instance.installation_root}/.."
|
|
16
|
+
voltra_client_root = \`node --print "require.resolve('@use-voltra/ios-client/package.json', {paths: ['#{project_root}']})" 2>/dev/null\`.strip.gsub('/package.json', '')
|
|
17
|
+
voltra_widget_podspec_root = File.join(voltra_client_root, 'ios')
|
|
18
|
+
podspec_dir_path = Pathname.new(voltra_widget_podspec_root).relative_path_from(Pathname.new(__dir__)).to_path
|
|
19
|
+
|
|
20
|
+
pod 'VoltraWidget', :path => podspec_dir_path
|
|
21
|
+
end`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ConfigurePodfileProps {
|
|
25
|
+
targetName: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Plugin step that adds the Podfile target for the widget extension.
|
|
30
|
+
*/
|
|
31
|
+
export const configurePodfile: ConfigPlugin<ConfigurePodfileProps> = (config, { targetName }) => {
|
|
32
|
+
return withExpoPodfile(config, (podfile) => {
|
|
33
|
+
const targetContent = getTargetContent(targetName)
|
|
34
|
+
|
|
35
|
+
// Check if target already exists (avoid duplicates)
|
|
36
|
+
const targetMarker = "target '" + targetName + "'"
|
|
37
|
+
if (podfile.modResults.contents.includes(targetMarker)) {
|
|
38
|
+
return podfile
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
podfile.modResults.contents = podfile.modResults.contents + '\n' + targetContent
|
|
42
|
+
return podfile
|
|
43
|
+
})
|
|
44
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ConfigPlugin, InfoPlist, withDangerousMod } from '@expo/config-plugins'
|
|
2
|
+
import plist from '@expo/plist'
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs'
|
|
4
|
+
import { join as joinPath } from 'path'
|
|
5
|
+
|
|
6
|
+
import type { IOSWidgetConfig } from '../types'
|
|
7
|
+
import { logger } from '@use-voltra/expo-plugin'
|
|
8
|
+
|
|
9
|
+
export interface ConfigureMainAppPlistProps {
|
|
10
|
+
targetName: string
|
|
11
|
+
groupIdentifier?: string
|
|
12
|
+
widgets?: IOSWidgetConfig[]
|
|
13
|
+
keychainGroup?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Plugin step that configures the Info.plist files.
|
|
18
|
+
*
|
|
19
|
+
* This:
|
|
20
|
+
* - Updates the widget extension's Info.plist with URL schemes
|
|
21
|
+
* - Removes incompatible NSExtension keys for WidgetKit
|
|
22
|
+
* - Adds group identifier if configured
|
|
23
|
+
* - Adds server update URLs and intervals for server-driven widgets
|
|
24
|
+
* - Adds Keychain group for shared credential access
|
|
25
|
+
*/
|
|
26
|
+
export const configureWidgetExtensionPlist: ConfigPlugin<ConfigureMainAppPlistProps> = (
|
|
27
|
+
expoConfig,
|
|
28
|
+
{ targetName, groupIdentifier, widgets, keychainGroup }
|
|
29
|
+
) =>
|
|
30
|
+
withDangerousMod(expoConfig, [
|
|
31
|
+
'ios',
|
|
32
|
+
async (config) => {
|
|
33
|
+
if (config.modRequest.introspect) {
|
|
34
|
+
return config
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const scheme = typeof expoConfig.scheme === 'string' ? expoConfig.scheme : expoConfig.ios?.bundleIdentifier
|
|
38
|
+
|
|
39
|
+
if (scheme) {
|
|
40
|
+
const targetPath = joinPath(config.modRequest.platformProjectRoot, targetName)
|
|
41
|
+
const filePath = joinPath(targetPath, 'Info.plist')
|
|
42
|
+
if (!existsSync(filePath)) {
|
|
43
|
+
logger.warn(`Widget Info.plist not found at ${filePath}, skipping widget plist updates`)
|
|
44
|
+
return config
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const content = plist.parse(readFileSync(filePath, 'utf8')) as InfoPlist
|
|
48
|
+
|
|
49
|
+
// WidgetKit extensions must NOT declare NSExtensionPrincipalClass/MainStoryboard.
|
|
50
|
+
// The @main WidgetBundle in Swift is the entry point.
|
|
51
|
+
const ext = (content as any).NSExtension as Record<string, any> | undefined
|
|
52
|
+
if (ext) {
|
|
53
|
+
delete ext.NSExtensionPrincipalClass
|
|
54
|
+
delete ext.NSExtensionMainStoryboard
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Keep URL schemes in the widget extension so Live Activity links can be resolved
|
|
58
|
+
// from relative to absolute URLs (see VoltraDeepLinkResolver.swift).
|
|
59
|
+
const existingTypes = (content.CFBundleURLTypes as any[]) || []
|
|
60
|
+
const hasScheme = existingTypes.some(
|
|
61
|
+
(t) => Array.isArray(t?.CFBundleURLSchemes) && t.CFBundleURLSchemes.includes(scheme)
|
|
62
|
+
)
|
|
63
|
+
if (!hasScheme) {
|
|
64
|
+
content.CFBundleURLTypes = [
|
|
65
|
+
...existingTypes,
|
|
66
|
+
{
|
|
67
|
+
CFBundleURLSchemes: [scheme],
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
} else {
|
|
71
|
+
content.CFBundleURLTypes = existingTypes
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Only set group identifier if provided
|
|
75
|
+
if (groupIdentifier) {
|
|
76
|
+
;(content as any)['Voltra_AppGroupIdentifier'] = groupIdentifier
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Configure server update URLs and intervals for widgets with serverUpdate
|
|
80
|
+
if (widgets && widgets.length > 0) {
|
|
81
|
+
const serverUrls: Record<string, string> = {}
|
|
82
|
+
const serverIntervals: Record<string, number> = {}
|
|
83
|
+
const serverRefresh: Record<string, boolean> = {}
|
|
84
|
+
|
|
85
|
+
for (const widget of widgets) {
|
|
86
|
+
if (widget.serverUpdate) {
|
|
87
|
+
serverUrls[widget.id] = widget.serverUpdate.url
|
|
88
|
+
serverIntervals[widget.id] = widget.serverUpdate.intervalMinutes ?? 15
|
|
89
|
+
if (widget.serverUpdate.refresh) {
|
|
90
|
+
serverRefresh[widget.id] = true
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (Object.keys(serverUrls).length > 0) {
|
|
96
|
+
;(content as any)['Voltra_WidgetServerUrls'] = serverUrls
|
|
97
|
+
;(content as any)['Voltra_WidgetServerIntervals'] = serverIntervals
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (Object.keys(serverRefresh).length > 0) {
|
|
101
|
+
;(content as any)['Voltra_WidgetServerRefresh'] = serverRefresh
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Add Keychain group for shared credential access
|
|
106
|
+
if (keychainGroup) {
|
|
107
|
+
;(content as any)['Voltra_KeychainGroup'] = keychainGroup
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
writeFileSync(filePath, plist.build(content))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return config
|
|
114
|
+
},
|
|
115
|
+
])
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
+
import * as util from 'util'
|
|
3
|
+
|
|
4
|
+
import type { IOSWidgetExtensionFiles } from '../../types'
|
|
5
|
+
|
|
6
|
+
const pbxFile = require('xcode/lib/pbxFile')
|
|
7
|
+
|
|
8
|
+
export interface AddBuildPhasesOptions {
|
|
9
|
+
targetUuid: string
|
|
10
|
+
groupName: string
|
|
11
|
+
productFile: {
|
|
12
|
+
uuid: string
|
|
13
|
+
target?: string
|
|
14
|
+
basename: string
|
|
15
|
+
group: string
|
|
16
|
+
}
|
|
17
|
+
widgetFiles: IOSWidgetExtensionFiles
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface EnsureBuildPhasesOptions extends AddBuildPhasesOptions {
|
|
21
|
+
mainTargetUuid?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds all required build phases for the widget extension target.
|
|
26
|
+
*/
|
|
27
|
+
export function addBuildPhases(xcodeProject: XcodeProject, options: AddBuildPhasesOptions): void {
|
|
28
|
+
const { targetUuid, groupName, productFile, widgetFiles } = options
|
|
29
|
+
const buildPath = `""`
|
|
30
|
+
const folderType = 'app_extension'
|
|
31
|
+
|
|
32
|
+
const { swiftFiles, intentFiles, assetDirectories, localizedStringResources } = widgetFiles
|
|
33
|
+
const resourcePaths = [...assetDirectories, ...localizedStringResources]
|
|
34
|
+
|
|
35
|
+
// Sources build phase
|
|
36
|
+
xcodeProject.addBuildPhase(
|
|
37
|
+
[...swiftFiles, ...intentFiles],
|
|
38
|
+
'PBXSourcesBuildPhase',
|
|
39
|
+
'Sources',
|
|
40
|
+
targetUuid,
|
|
41
|
+
folderType,
|
|
42
|
+
buildPath
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// Copy files build phase
|
|
46
|
+
xcodeProject.addBuildPhase(
|
|
47
|
+
[],
|
|
48
|
+
'PBXCopyFilesBuildPhase',
|
|
49
|
+
groupName,
|
|
50
|
+
xcodeProject.getFirstTarget().uuid,
|
|
51
|
+
folderType,
|
|
52
|
+
buildPath
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
xcodeProject.buildPhaseObject('PBXCopyFilesBuildPhase', groupName, productFile.target).files.push({
|
|
56
|
+
value: productFile.uuid,
|
|
57
|
+
comment: util.format('%s in %s', productFile.basename, productFile.group),
|
|
58
|
+
})
|
|
59
|
+
xcodeProject.addToPbxBuildFileSection(productFile)
|
|
60
|
+
|
|
61
|
+
// Frameworks build phase
|
|
62
|
+
xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', targetUuid, folderType, buildPath)
|
|
63
|
+
|
|
64
|
+
// Resources build phase
|
|
65
|
+
xcodeProject.addBuildPhase([...resourcePaths], 'PBXResourcesBuildPhase', 'Resources', targetUuid)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Ensures all required build phases and files exist for the widget extension target.
|
|
70
|
+
*/
|
|
71
|
+
export function ensureBuildPhases(xcodeProject: XcodeProject, options: EnsureBuildPhasesOptions): void {
|
|
72
|
+
const { targetUuid, groupName, productFile, widgetFiles } = options
|
|
73
|
+
const buildPath = `""`
|
|
74
|
+
const folderType = 'app_extension'
|
|
75
|
+
const mainTargetUuid = options.mainTargetUuid ?? xcodeProject.getFirstTarget().uuid
|
|
76
|
+
|
|
77
|
+
const { swiftFiles, intentFiles, assetDirectories, localizedStringResources } = widgetFiles
|
|
78
|
+
const resourcePaths = [...assetDirectories, ...localizedStringResources]
|
|
79
|
+
|
|
80
|
+
dedupeBuildPhasesForTarget(xcodeProject, targetUuid, 'PBXSourcesBuildPhase', 'Sources')
|
|
81
|
+
dedupeBuildPhasesForTarget(xcodeProject, targetUuid, 'PBXFrameworksBuildPhase', 'Frameworks')
|
|
82
|
+
dedupeBuildPhasesByComment(xcodeProject, mainTargetUuid, 'PBXCopyFilesBuildPhase', groupName)
|
|
83
|
+
|
|
84
|
+
// Sources build phase
|
|
85
|
+
let sourcesPhase = xcodeProject.buildPhaseObject('PBXSourcesBuildPhase', 'Sources', targetUuid)
|
|
86
|
+
if (!sourcesPhase) {
|
|
87
|
+
xcodeProject.addBuildPhase(
|
|
88
|
+
[...swiftFiles, ...intentFiles],
|
|
89
|
+
'PBXSourcesBuildPhase',
|
|
90
|
+
'Sources',
|
|
91
|
+
targetUuid,
|
|
92
|
+
folderType,
|
|
93
|
+
buildPath
|
|
94
|
+
)
|
|
95
|
+
sourcesPhase = xcodeProject.buildPhaseObject('PBXSourcesBuildPhase', 'Sources', targetUuid)
|
|
96
|
+
}
|
|
97
|
+
if (sourcesPhase) {
|
|
98
|
+
ensureBuildPhaseFiles(xcodeProject, sourcesPhase, [...swiftFiles, ...intentFiles])
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Copy files build phase (embed extension into main app)
|
|
102
|
+
let copyFilesPhase = xcodeProject.buildPhaseObject('PBXCopyFilesBuildPhase', groupName, mainTargetUuid)
|
|
103
|
+
if (!copyFilesPhase) {
|
|
104
|
+
xcodeProject.addBuildPhase([], 'PBXCopyFilesBuildPhase', groupName, mainTargetUuid, folderType, buildPath)
|
|
105
|
+
copyFilesPhase = xcodeProject.buildPhaseObject('PBXCopyFilesBuildPhase', groupName, mainTargetUuid)
|
|
106
|
+
}
|
|
107
|
+
if (copyFilesPhase) {
|
|
108
|
+
ensureCopyFilesPhaseProduct(xcodeProject, copyFilesPhase, productFile)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Frameworks build phase
|
|
112
|
+
const frameworksPhase = xcodeProject.buildPhaseObject('PBXFrameworksBuildPhase', 'Frameworks', targetUuid)
|
|
113
|
+
if (!frameworksPhase) {
|
|
114
|
+
xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', targetUuid, folderType, buildPath)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Resources build phase
|
|
118
|
+
let resourcesPhase = xcodeProject.buildPhaseObject('PBXResourcesBuildPhase', 'Resources', targetUuid)
|
|
119
|
+
if (!resourcesPhase) {
|
|
120
|
+
xcodeProject.addBuildPhase([...resourcePaths], 'PBXResourcesBuildPhase', 'Resources', targetUuid)
|
|
121
|
+
resourcesPhase = xcodeProject.buildPhaseObject('PBXResourcesBuildPhase', 'Resources', targetUuid)
|
|
122
|
+
}
|
|
123
|
+
if (resourcesPhase) {
|
|
124
|
+
ensureBuildPhaseFiles(xcodeProject, resourcesPhase, [...resourcePaths])
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function dedupeBuildPhasesForTarget(
|
|
129
|
+
xcodeProject: XcodeProject,
|
|
130
|
+
targetUuid: string,
|
|
131
|
+
phaseType: string,
|
|
132
|
+
preferredComment: string
|
|
133
|
+
): void {
|
|
134
|
+
const nativeTargets = xcodeProject.pbxNativeTargetSection()
|
|
135
|
+
const target = nativeTargets[targetUuid]
|
|
136
|
+
if (!target?.buildPhases) {
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const phaseSection = xcodeProject.hash.project.objects[phaseType] || {}
|
|
141
|
+
const matching = target.buildPhases.filter((entry: any) => phaseSection[entry.value])
|
|
142
|
+
if (matching.length <= 1) {
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const keep = matching.find((entry: any) => entry.comment === preferredComment) ?? matching[0]
|
|
147
|
+
keep.comment = preferredComment
|
|
148
|
+
|
|
149
|
+
target.buildPhases = target.buildPhases.filter((entry: any) => {
|
|
150
|
+
if (!phaseSection[entry.value]) {
|
|
151
|
+
return true
|
|
152
|
+
}
|
|
153
|
+
return entry.value === keep.value
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function dedupeBuildPhasesByComment(
|
|
158
|
+
xcodeProject: XcodeProject,
|
|
159
|
+
targetUuid: string,
|
|
160
|
+
phaseType: string,
|
|
161
|
+
comment: string
|
|
162
|
+
): void {
|
|
163
|
+
const nativeTargets = xcodeProject.pbxNativeTargetSection()
|
|
164
|
+
const target = nativeTargets[targetUuid]
|
|
165
|
+
if (!target?.buildPhases) {
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const phaseSection = xcodeProject.hash.project.objects[phaseType] || {}
|
|
170
|
+
const matching = target.buildPhases.filter((entry: any) => phaseSection[entry.value] && entry.comment === comment)
|
|
171
|
+
if (matching.length <= 1) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const keep = matching[0]
|
|
176
|
+
target.buildPhases = target.buildPhases.filter((entry: any) => {
|
|
177
|
+
if (!phaseSection[entry.value] || entry.comment !== comment) {
|
|
178
|
+
return true
|
|
179
|
+
}
|
|
180
|
+
return entry.value === keep.value
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function normalizePath(value: string | undefined): string {
|
|
185
|
+
if (!value) {
|
|
186
|
+
return ''
|
|
187
|
+
}
|
|
188
|
+
return value.replace(/^"|"$/g, '')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function findFileReferenceKey(xcodeProject: XcodeProject, filePath: string): string | null {
|
|
192
|
+
const fileReferenceSection = xcodeProject.pbxFileReferenceSection()
|
|
193
|
+
const normalizedPath = normalizePath(filePath)
|
|
194
|
+
|
|
195
|
+
for (const key of Object.keys(fileReferenceSection)) {
|
|
196
|
+
if (/_comment$/.test(key)) {
|
|
197
|
+
continue
|
|
198
|
+
}
|
|
199
|
+
const entry = fileReferenceSection[key]
|
|
200
|
+
const entryPath = normalizePath(entry?.path)
|
|
201
|
+
if (entryPath === normalizedPath) {
|
|
202
|
+
return key
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return null
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function findBuildFileKeyByFileRef(xcodeProject: XcodeProject, fileRef: string): string | null {
|
|
210
|
+
const buildFileSection = xcodeProject.pbxBuildFileSection()
|
|
211
|
+
for (const key of Object.keys(buildFileSection)) {
|
|
212
|
+
if (/_comment$/.test(key)) {
|
|
213
|
+
continue
|
|
214
|
+
}
|
|
215
|
+
const entry = buildFileSection[key]
|
|
216
|
+
if (entry?.fileRef === fileRef) {
|
|
217
|
+
return key
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return null
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function ensureFileReference(xcodeProject: XcodeProject, filePath: string) {
|
|
224
|
+
const existingFileRef = findFileReferenceKey(xcodeProject, filePath)
|
|
225
|
+
const file = new pbxFile(filePath)
|
|
226
|
+
|
|
227
|
+
if (existingFileRef) {
|
|
228
|
+
return { fileRef: existingFileRef, basename: file.basename, group: file.group }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
file.fileRef = xcodeProject.generateUuid()
|
|
232
|
+
xcodeProject.addToPbxFileReferenceSection(file)
|
|
233
|
+
return { fileRef: file.fileRef, basename: file.basename, group: file.group }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function ensureBuildFile(xcodeProject: XcodeProject, filePath: string) {
|
|
237
|
+
const fileReference = ensureFileReference(xcodeProject, filePath)
|
|
238
|
+
const existingBuildFile = findBuildFileKeyByFileRef(xcodeProject, fileReference.fileRef)
|
|
239
|
+
|
|
240
|
+
if (existingBuildFile) {
|
|
241
|
+
return { uuid: existingBuildFile, ...fileReference }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const file = new pbxFile(filePath)
|
|
245
|
+
file.uuid = xcodeProject.generateUuid()
|
|
246
|
+
file.fileRef = fileReference.fileRef
|
|
247
|
+
xcodeProject.addToPbxBuildFileSection(file)
|
|
248
|
+
return { uuid: file.uuid, ...fileReference, group: file.group }
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function buildPhaseHasFile(xcodeProject: XcodeProject, buildPhase: any, fileRef: string): boolean {
|
|
252
|
+
if (!buildPhase?.files) {
|
|
253
|
+
return false
|
|
254
|
+
}
|
|
255
|
+
const buildFileSection = xcodeProject.pbxBuildFileSection()
|
|
256
|
+
|
|
257
|
+
return buildPhase.files.some((entry: any) => {
|
|
258
|
+
const buildFile = buildFileSection[entry.value]
|
|
259
|
+
return buildFile?.fileRef === fileRef
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function ensureBuildPhaseFiles(xcodeProject: XcodeProject, buildPhase: any, filePaths: string[]): void {
|
|
264
|
+
if (!buildPhase.files) {
|
|
265
|
+
buildPhase.files = []
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
for (const filePath of filePaths) {
|
|
269
|
+
const fileReference = ensureFileReference(xcodeProject, filePath)
|
|
270
|
+
if (buildPhaseHasFile(xcodeProject, buildPhase, fileReference.fileRef)) {
|
|
271
|
+
continue
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const buildFile = ensureBuildFile(xcodeProject, filePath)
|
|
275
|
+
buildPhase.files.push({
|
|
276
|
+
value: buildFile.uuid,
|
|
277
|
+
comment: util.format('%s in %s', buildFile.basename, buildFile.group),
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function ensureCopyFilesPhaseProduct(xcodeProject: XcodeProject, buildPhase: any, productFile: any): void {
|
|
283
|
+
if (!buildPhase.files) {
|
|
284
|
+
buildPhase.files = []
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const alreadyExists = buildPhase.files.some((entry: any) => entry.value === productFile.uuid)
|
|
288
|
+
if (alreadyExists) {
|
|
289
|
+
return
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const buildFileSection = xcodeProject.pbxBuildFileSection()
|
|
293
|
+
if (!buildFileSection[productFile.uuid]) {
|
|
294
|
+
xcodeProject.addToPbxBuildFileSection(productFile)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
buildPhase.files.push({
|
|
298
|
+
value: productFile.uuid,
|
|
299
|
+
comment: util.format('%s in %s', productFile.basename, productFile.group),
|
|
300
|
+
})
|
|
301
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
+
|
|
3
|
+
import { IOS } from '../../constants'
|
|
4
|
+
|
|
5
|
+
export interface AddConfigurationListOptions {
|
|
6
|
+
targetName: string
|
|
7
|
+
bundleIdentifier: string
|
|
8
|
+
deploymentTarget: string
|
|
9
|
+
codeSignStyle?: string
|
|
10
|
+
developmentTeam?: string
|
|
11
|
+
provisioningProfileSpecifier?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function createCommonBuildSettings(options: AddConfigurationListOptions) {
|
|
15
|
+
const {
|
|
16
|
+
targetName,
|
|
17
|
+
bundleIdentifier,
|
|
18
|
+
deploymentTarget,
|
|
19
|
+
codeSignStyle,
|
|
20
|
+
developmentTeam,
|
|
21
|
+
provisioningProfileSpecifier,
|
|
22
|
+
} = options
|
|
23
|
+
|
|
24
|
+
const commonBuildSettings: Record<string, string> = {
|
|
25
|
+
PRODUCT_NAME: `"$(TARGET_NAME)"`,
|
|
26
|
+
SWIFT_VERSION: IOS.SWIFT_VERSION,
|
|
27
|
+
TARGETED_DEVICE_FAMILY: `"${IOS.DEVICE_FAMILY}"`,
|
|
28
|
+
INFOPLIST_FILE: `${targetName}/Info.plist`,
|
|
29
|
+
INFOPLIST_OUTPUT_FORMAT: `"xml"`,
|
|
30
|
+
CURRENT_PROJECT_VERSION: `"1"`,
|
|
31
|
+
MARKETING_VERSION: `"1.0"`,
|
|
32
|
+
IPHONEOS_DEPLOYMENT_TARGET: `"${deploymentTarget}"`,
|
|
33
|
+
PRODUCT_BUNDLE_IDENTIFIER: `"${bundleIdentifier}"`,
|
|
34
|
+
SWIFT_OPTIMIZATION_LEVEL: `"-Onone"`,
|
|
35
|
+
CODE_SIGN_ENTITLEMENTS: `"${targetName}/${targetName}.entitlements"`,
|
|
36
|
+
APPLICATION_EXTENSION_API_ONLY: '"YES"',
|
|
37
|
+
ASSETCATALOG_COMPILER_APPICON_NAME: '""',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Synchronize code signing settings from main app target
|
|
41
|
+
if (codeSignStyle) {
|
|
42
|
+
commonBuildSettings.CODE_SIGN_STYLE = `"${codeSignStyle}"`
|
|
43
|
+
}
|
|
44
|
+
if (developmentTeam) {
|
|
45
|
+
commonBuildSettings.DEVELOPMENT_TEAM = `"${developmentTeam}"`
|
|
46
|
+
}
|
|
47
|
+
if (provisioningProfileSpecifier) {
|
|
48
|
+
commonBuildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${provisioningProfileSpecifier}"`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return commonBuildSettings
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Adds the XCConfigurationList for the widget extension target.
|
|
56
|
+
*/
|
|
57
|
+
export function addXCConfigurationList(xcodeProject: XcodeProject, options: AddConfigurationListOptions) {
|
|
58
|
+
const { targetName } = options
|
|
59
|
+
const commonBuildSettings = createCommonBuildSettings(options)
|
|
60
|
+
|
|
61
|
+
const buildConfigurationsList = [
|
|
62
|
+
{
|
|
63
|
+
name: 'Debug',
|
|
64
|
+
isa: 'XCBuildConfiguration',
|
|
65
|
+
buildSettings: {
|
|
66
|
+
...commonBuildSettings,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Release',
|
|
71
|
+
isa: 'XCBuildConfiguration',
|
|
72
|
+
buildSettings: {
|
|
73
|
+
...commonBuildSettings,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
const xCConfigurationList = xcodeProject.addXCConfigurationList(
|
|
79
|
+
buildConfigurationsList,
|
|
80
|
+
'Release',
|
|
81
|
+
`Build configuration list for PBXNativeTarget "${targetName}"`
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return xCConfigurationList
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Ensures an existing XCConfigurationList is updated, or adds a new one if missing.
|
|
89
|
+
*/
|
|
90
|
+
export function ensureXCConfigurationList(
|
|
91
|
+
xcodeProject: XcodeProject,
|
|
92
|
+
options: AddConfigurationListOptions,
|
|
93
|
+
existingConfigurationListId?: string | { value?: string }
|
|
94
|
+
) {
|
|
95
|
+
const configurationListId =
|
|
96
|
+
typeof existingConfigurationListId === 'string'
|
|
97
|
+
? existingConfigurationListId.split(' ')[0]
|
|
98
|
+
: existingConfigurationListId?.value?.split(' ')[0]
|
|
99
|
+
const configurationLists = xcodeProject.pbxXCConfigurationList()
|
|
100
|
+
const configurationList = configurationListId ? configurationLists?.[configurationListId] : null
|
|
101
|
+
|
|
102
|
+
if (!configurationList || !configurationList.buildConfigurations) {
|
|
103
|
+
return addXCConfigurationList(xcodeProject, options)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const commonBuildSettings = createCommonBuildSettings(options)
|
|
107
|
+
const buildConfigurations = configurationList.buildConfigurations
|
|
108
|
+
const buildConfigurationSection = xcodeProject.pbxXCBuildConfigurationSection()
|
|
109
|
+
|
|
110
|
+
for (const configRef of buildConfigurations) {
|
|
111
|
+
const configId = typeof configRef === 'string' ? configRef.split(' ')[0] : configRef.value?.split(' ')[0]
|
|
112
|
+
if (!configId) {
|
|
113
|
+
continue
|
|
114
|
+
}
|
|
115
|
+
const buildConfiguration = buildConfigurationSection[configId]
|
|
116
|
+
if (!buildConfiguration) {
|
|
117
|
+
continue
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
buildConfiguration.buildSettings = {
|
|
121
|
+
...(buildConfiguration.buildSettings ?? {}),
|
|
122
|
+
...commonBuildSettings,
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return { uuid: configurationListId }
|
|
127
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
+
|
|
3
|
+
import type { IOSWidgetExtensionFiles } from '../../types'
|
|
4
|
+
|
|
5
|
+
const pbxFile = require('xcode/lib/pbxFile')
|
|
6
|
+
|
|
7
|
+
export interface AddPbxGroupOptions {
|
|
8
|
+
targetName: string
|
|
9
|
+
widgetFiles: IOSWidgetExtensionFiles
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Adds a PBXGroup for the widget extension files.
|
|
14
|
+
*/
|
|
15
|
+
export function addPbxGroup(xcodeProject: XcodeProject, options: AddPbxGroupOptions): void {
|
|
16
|
+
const { targetName, widgetFiles } = options
|
|
17
|
+
const { swiftFiles, intentFiles, assetDirectories, entitlementFiles, plistFiles, localizedStringResources } =
|
|
18
|
+
widgetFiles
|
|
19
|
+
|
|
20
|
+
// Add PBX group with all widget files
|
|
21
|
+
const { uuid: pbxGroupUuid } = xcodeProject.addPbxGroup(
|
|
22
|
+
[
|
|
23
|
+
...swiftFiles,
|
|
24
|
+
...intentFiles,
|
|
25
|
+
...entitlementFiles,
|
|
26
|
+
...plistFiles,
|
|
27
|
+
...assetDirectories,
|
|
28
|
+
...localizedStringResources,
|
|
29
|
+
],
|
|
30
|
+
targetName,
|
|
31
|
+
targetName
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
// Add PBXGroup to top level group
|
|
35
|
+
const groups = xcodeProject.hash.project.objects['PBXGroup']
|
|
36
|
+
if (pbxGroupUuid) {
|
|
37
|
+
Object.keys(groups).forEach(function (key) {
|
|
38
|
+
if (groups[key].name === undefined && groups[key].path === undefined) {
|
|
39
|
+
xcodeProject.addToPbxGroup(pbxGroupUuid, key)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Ensures a PBXGroup exists for the widget extension files.
|
|
47
|
+
*/
|
|
48
|
+
export function ensurePbxGroup(xcodeProject: XcodeProject, options: AddPbxGroupOptions): void {
|
|
49
|
+
const { targetName, widgetFiles } = options
|
|
50
|
+
const { swiftFiles, intentFiles, assetDirectories, entitlementFiles, plistFiles, localizedStringResources } =
|
|
51
|
+
widgetFiles
|
|
52
|
+
const allFiles = [
|
|
53
|
+
...swiftFiles,
|
|
54
|
+
...intentFiles,
|
|
55
|
+
...entitlementFiles,
|
|
56
|
+
...plistFiles,
|
|
57
|
+
...assetDirectories,
|
|
58
|
+
...localizedStringResources,
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const existingGroup = xcodeProject.pbxGroupByName(targetName)
|
|
62
|
+
if (!existingGroup) {
|
|
63
|
+
addPbxGroup(xcodeProject, options)
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!existingGroup.children) {
|
|
68
|
+
existingGroup.children = []
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
for (const filePath of allFiles) {
|
|
72
|
+
const file = new pbxFile(filePath)
|
|
73
|
+
const fileRef = ensureFileReference(xcodeProject, filePath)
|
|
74
|
+
const alreadyInGroup = existingGroup.children.some(
|
|
75
|
+
(child: any) => child.value === fileRef || child.comment === file.basename
|
|
76
|
+
)
|
|
77
|
+
if (!alreadyInGroup) {
|
|
78
|
+
existingGroup.children.push({ value: fileRef, comment: file.basename })
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function ensureFileReference(xcodeProject: XcodeProject, filePath: string): string {
|
|
84
|
+
const fileReferenceSection = xcodeProject.pbxFileReferenceSection()
|
|
85
|
+
const file = new pbxFile(filePath)
|
|
86
|
+
|
|
87
|
+
for (const key of Object.keys(fileReferenceSection)) {
|
|
88
|
+
if (/_comment$/.test(key)) {
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
const entry = fileReferenceSection[key]
|
|
92
|
+
const entryPath = typeof entry?.path === 'string' ? entry.path.replace(/^"|"$/g, '') : ''
|
|
93
|
+
if (entryPath === file.path || entryPath === filePath) {
|
|
94
|
+
return key
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
file.fileRef = xcodeProject.generateUuid()
|
|
99
|
+
xcodeProject.addToPbxFileReferenceSection(file)
|
|
100
|
+
return file.fileRef
|
|
101
|
+
}
|