@use-voltra/expo-plugin 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.
Files changed (236) hide show
  1. package/README.md +9 -29
  2. package/build/cjs/constants.js +3 -43
  3. package/build/cjs/constants.js.map +1 -1
  4. package/build/cjs/index.js +23 -69
  5. package/build/cjs/index.js.map +1 -1
  6. package/build/cjs/types.js +4 -0
  7. package/build/cjs/types.js.map +1 -1
  8. package/build/cjs/utils/localePick.js +48 -0
  9. package/build/cjs/utils/localePick.js.map +1 -0
  10. package/build/cjs/utils/prerender.js +15 -9
  11. package/build/cjs/utils/prerender.js.map +1 -1
  12. package/build/cjs/utils/widgetLabel.js +19 -0
  13. package/build/cjs/utils/widgetLabel.js.map +1 -0
  14. package/build/cjs/validation.js +75 -166
  15. package/build/cjs/validation.js.map +1 -1
  16. package/build/esm/constants.js +2 -42
  17. package/build/esm/constants.js.map +1 -1
  18. package/build/esm/index.js +8 -69
  19. package/build/esm/index.js.map +1 -1
  20. package/build/esm/types.js +4 -0
  21. package/build/esm/types.js.map +1 -1
  22. package/build/esm/utils/localePick.js +44 -0
  23. package/build/esm/utils/localePick.js.map +1 -0
  24. package/build/esm/utils/prerender.js +15 -9
  25. package/build/esm/utils/prerender.js.map +1 -1
  26. package/build/esm/utils/widgetLabel.js +15 -0
  27. package/build/esm/utils/widgetLabel.js.map +1 -0
  28. package/build/esm/validation.js +71 -163
  29. package/build/esm/validation.js.map +1 -1
  30. package/build/types/constants.d.ts +2 -26
  31. package/build/types/constants.d.ts.map +1 -1
  32. package/build/types/index.d.ts +10 -12
  33. package/build/types/index.d.ts.map +1 -1
  34. package/build/types/types.d.ts +9 -260
  35. package/build/types/types.d.ts.map +1 -1
  36. package/build/types/utils/localePick.d.ts +7 -0
  37. package/build/types/utils/localePick.d.ts.map +1 -0
  38. package/build/types/utils/prerender.d.ts +6 -3
  39. package/build/types/utils/prerender.d.ts.map +1 -1
  40. package/build/types/utils/widgetLabel.d.ts +8 -0
  41. package/build/types/utils/widgetLabel.d.ts.map +1 -0
  42. package/build/types/validation.d.ts +6 -14
  43. package/build/types/validation.d.ts.map +1 -1
  44. package/package.json +11 -11
  45. package/build/cjs/android/files/assets.js +0 -259
  46. package/build/cjs/android/files/assets.js.map +0 -1
  47. package/build/cjs/android/files/fonts.js +0 -69
  48. package/build/cjs/android/files/fonts.js.map +0 -1
  49. package/build/cjs/android/files/index.js +0 -81
  50. package/build/cjs/android/files/index.js.map +0 -1
  51. package/build/cjs/android/files/initialStates.js +0 -83
  52. package/build/cjs/android/files/initialStates.js.map +0 -1
  53. package/build/cjs/android/files/kotlin.js +0 -142
  54. package/build/cjs/android/files/kotlin.js.map +0 -1
  55. package/build/cjs/android/files/xml.js +0 -247
  56. package/build/cjs/android/files/xml.js.map +0 -1
  57. package/build/cjs/android/index.js +0 -33
  58. package/build/cjs/android/index.js.map +0 -1
  59. package/build/cjs/android/manifest.js +0 -92
  60. package/build/cjs/android/manifest.js.map +0 -1
  61. package/build/cjs/ios/eas.js +0 -28
  62. package/build/cjs/ios/eas.js.map +0 -1
  63. package/build/cjs/ios/entitlements.js +0 -46
  64. package/build/cjs/ios/entitlements.js.map +0 -1
  65. package/build/cjs/ios/index.js +0 -39
  66. package/build/cjs/ios/index.js.map +0 -1
  67. package/build/cjs/ios/infoPlist.js +0 -51
  68. package/build/cjs/ios/infoPlist.js.map +0 -1
  69. package/build/cjs/ios/pushNotifications.js +0 -22
  70. package/build/cjs/ios/pushNotifications.js.map +0 -1
  71. package/build/cjs/ios-widget/eas.js +0 -66
  72. package/build/cjs/ios-widget/eas.js.map +0 -1
  73. package/build/cjs/ios-widget/files/assets.js +0 -199
  74. package/build/cjs/ios-widget/files/assets.js.map +0 -1
  75. package/build/cjs/ios-widget/files/entitlements.js +0 -77
  76. package/build/cjs/ios-widget/files/entitlements.js.map +0 -1
  77. package/build/cjs/ios-widget/files/index.js +0 -92
  78. package/build/cjs/ios-widget/files/index.js.map +0 -1
  79. package/build/cjs/ios-widget/files/infoPlist.js +0 -91
  80. package/build/cjs/ios-widget/files/infoPlist.js.map +0 -1
  81. package/build/cjs/ios-widget/files/swift.js +0 -256
  82. package/build/cjs/ios-widget/files/swift.js.map +0 -1
  83. package/build/cjs/ios-widget/fonts.js +0 -151
  84. package/build/cjs/ios-widget/fonts.js.map +0 -1
  85. package/build/cjs/ios-widget/index.js +0 -46
  86. package/build/cjs/ios-widget/index.js.map +0 -1
  87. package/build/cjs/ios-widget/podfile.js +0 -43
  88. package/build/cjs/ios-widget/podfile.js.map +0 -1
  89. package/build/cjs/ios-widget/widgetPlist.js +0 -99
  90. package/build/cjs/ios-widget/widgetPlist.js.map +0 -1
  91. package/build/cjs/ios-widget/xcode/buildPhases.js +0 -245
  92. package/build/cjs/ios-widget/xcode/buildPhases.js.map +0 -1
  93. package/build/cjs/ios-widget/xcode/configurationList.js +0 -91
  94. package/build/cjs/ios-widget/xcode/configurationList.js.map +0 -1
  95. package/build/cjs/ios-widget/xcode/groups.js +0 -65
  96. package/build/cjs/ios-widget/xcode/groups.js.map +0 -1
  97. package/build/cjs/ios-widget/xcode/index.js +0 -155
  98. package/build/cjs/ios-widget/xcode/index.js.map +0 -1
  99. package/build/cjs/ios-widget/xcode/mainAppSettings.js +0 -71
  100. package/build/cjs/ios-widget/xcode/mainAppSettings.js.map +0 -1
  101. package/build/cjs/ios-widget/xcode/productFile.js +0 -74
  102. package/build/cjs/ios-widget/xcode/productFile.js.map +0 -1
  103. package/build/cjs/ios-widget/xcode/target.js +0 -113
  104. package/build/cjs/ios-widget/xcode/target.js.map +0 -1
  105. package/build/cjs/utils/fileDiscovery.js +0 -107
  106. package/build/cjs/utils/fileDiscovery.js.map +0 -1
  107. package/build/cjs/utils/urlScheme.js +0 -40
  108. package/build/cjs/utils/urlScheme.js.map +0 -1
  109. package/build/esm/android/files/assets.js +0 -223
  110. package/build/esm/android/files/assets.js.map +0 -1
  111. package/build/esm/android/files/fonts.js +0 -33
  112. package/build/esm/android/files/fonts.js.map +0 -1
  113. package/build/esm/android/files/index.js +0 -77
  114. package/build/esm/android/files/index.js.map +0 -1
  115. package/build/esm/android/files/initialStates.js +0 -44
  116. package/build/esm/android/files/initialStates.js.map +0 -1
  117. package/build/esm/android/files/kotlin.js +0 -103
  118. package/build/esm/android/files/kotlin.js.map +0 -1
  119. package/build/esm/android/files/xml.js +0 -206
  120. package/build/esm/android/files/xml.js.map +0 -1
  121. package/build/esm/android/index.js +0 -29
  122. package/build/esm/android/index.js.map +0 -1
  123. package/build/esm/android/manifest.js +0 -88
  124. package/build/esm/android/manifest.js.map +0 -1
  125. package/build/esm/ios/eas.js +0 -24
  126. package/build/esm/ios/eas.js.map +0 -1
  127. package/build/esm/ios/entitlements.js +0 -42
  128. package/build/esm/ios/entitlements.js.map +0 -1
  129. package/build/esm/ios/index.js +0 -34
  130. package/build/esm/ios/index.js.map +0 -1
  131. package/build/esm/ios/infoPlist.js +0 -47
  132. package/build/esm/ios/infoPlist.js.map +0 -1
  133. package/build/esm/ios/pushNotifications.js +0 -18
  134. package/build/esm/ios/pushNotifications.js.map +0 -1
  135. package/build/esm/ios-widget/eas.js +0 -62
  136. package/build/esm/ios-widget/eas.js.map +0 -1
  137. package/build/esm/ios-widget/files/assets.js +0 -163
  138. package/build/esm/ios-widget/files/assets.js.map +0 -1
  139. package/build/esm/ios-widget/files/entitlements.js +0 -37
  140. package/build/esm/ios-widget/files/entitlements.js.map +0 -1
  141. package/build/esm/ios-widget/files/index.js +0 -55
  142. package/build/esm/ios-widget/files/index.js.map +0 -1
  143. package/build/esm/ios-widget/files/infoPlist.js +0 -55
  144. package/build/esm/ios-widget/files/infoPlist.js.map +0 -1
  145. package/build/esm/ios-widget/files/swift.js +0 -217
  146. package/build/esm/ios-widget/files/swift.js.map +0 -1
  147. package/build/esm/ios-widget/fonts.js +0 -111
  148. package/build/esm/ios-widget/fonts.js.map +0 -1
  149. package/build/esm/ios-widget/index.js +0 -42
  150. package/build/esm/ios-widget/index.js.map +0 -1
  151. package/build/esm/ios-widget/podfile.js +0 -39
  152. package/build/esm/ios-widget/podfile.js.map +0 -1
  153. package/build/esm/ios-widget/widgetPlist.js +0 -92
  154. package/build/esm/ios-widget/widgetPlist.js.map +0 -1
  155. package/build/esm/ios-widget/xcode/buildPhases.js +0 -208
  156. package/build/esm/ios-widget/xcode/buildPhases.js.map +0 -1
  157. package/build/esm/ios-widget/xcode/configurationList.js +0 -87
  158. package/build/esm/ios-widget/xcode/configurationList.js.map +0 -1
  159. package/build/esm/ios-widget/xcode/groups.js +0 -61
  160. package/build/esm/ios-widget/xcode/groups.js.map +0 -1
  161. package/build/esm/ios-widget/xcode/index.js +0 -118
  162. package/build/esm/ios-widget/xcode/index.js.map +0 -1
  163. package/build/esm/ios-widget/xcode/mainAppSettings.js +0 -68
  164. package/build/esm/ios-widget/xcode/mainAppSettings.js.map +0 -1
  165. package/build/esm/ios-widget/xcode/productFile.js +0 -70
  166. package/build/esm/ios-widget/xcode/productFile.js.map +0 -1
  167. package/build/esm/ios-widget/xcode/target.js +0 -108
  168. package/build/esm/ios-widget/xcode/target.js.map +0 -1
  169. package/build/esm/utils/fileDiscovery.js +0 -71
  170. package/build/esm/utils/fileDiscovery.js.map +0 -1
  171. package/build/esm/utils/urlScheme.js +0 -37
  172. package/build/esm/utils/urlScheme.js.map +0 -1
  173. package/build/types/android/files/assets.d.ts +0 -26
  174. package/build/types/android/files/assets.d.ts.map +0 -1
  175. package/build/types/android/files/fonts.d.ts +0 -19
  176. package/build/types/android/files/fonts.d.ts.map +0 -1
  177. package/build/types/android/files/index.d.ts +0 -21
  178. package/build/types/android/files/index.d.ts.map +0 -1
  179. package/build/types/android/files/initialStates.d.ts +0 -14
  180. package/build/types/android/files/initialStates.d.ts.map +0 -1
  181. package/build/types/android/files/kotlin.d.ts +0 -11
  182. package/build/types/android/files/kotlin.d.ts.map +0 -1
  183. package/build/types/android/files/xml.d.ts +0 -25
  184. package/build/types/android/files/xml.d.ts.map +0 -1
  185. package/build/types/android/index.d.ts +0 -12
  186. package/build/types/android/index.d.ts.map +0 -1
  187. package/build/types/android/manifest.d.ts +0 -16
  188. package/build/types/android/manifest.d.ts.map +0 -1
  189. package/build/types/ios/eas.d.ts +0 -12
  190. package/build/types/ios/eas.d.ts.map +0 -1
  191. package/build/types/ios/entitlements.d.ts +0 -14
  192. package/build/types/ios/entitlements.d.ts.map +0 -1
  193. package/build/types/ios/index.d.ts +0 -19
  194. package/build/types/ios/index.d.ts.map +0 -1
  195. package/build/types/ios/infoPlist.d.ts +0 -21
  196. package/build/types/ios/infoPlist.d.ts.map +0 -1
  197. package/build/types/ios/pushNotifications.d.ts +0 -10
  198. package/build/types/ios/pushNotifications.d.ts.map +0 -1
  199. package/build/types/ios-widget/eas.d.ts +0 -15
  200. package/build/types/ios-widget/eas.d.ts.map +0 -1
  201. package/build/types/ios-widget/files/assets.d.ts +0 -13
  202. package/build/types/ios-widget/files/assets.d.ts.map +0 -1
  203. package/build/types/ios-widget/files/entitlements.d.ts +0 -17
  204. package/build/types/ios-widget/files/entitlements.d.ts.map +0 -1
  205. package/build/types/ios-widget/files/index.d.ts +0 -24
  206. package/build/types/ios-widget/files/index.d.ts.map +0 -1
  207. package/build/types/ios-widget/files/infoPlist.d.ts +0 -10
  208. package/build/types/ios-widget/files/infoPlist.d.ts.map +0 -1
  209. package/build/types/ios-widget/files/swift.d.ts +0 -15
  210. package/build/types/ios-widget/files/swift.d.ts.map +0 -1
  211. package/build/types/ios-widget/fonts.d.ts +0 -22
  212. package/build/types/ios-widget/fonts.d.ts.map +0 -1
  213. package/build/types/ios-widget/index.d.ts +0 -31
  214. package/build/types/ios-widget/index.d.ts.map +0 -1
  215. package/build/types/ios-widget/podfile.d.ts +0 -9
  216. package/build/types/ios-widget/podfile.d.ts.map +0 -1
  217. package/build/types/ios-widget/widgetPlist.d.ts +0 -20
  218. package/build/types/ios-widget/widgetPlist.d.ts.map +0 -1
  219. package/build/types/ios-widget/xcode/buildPhases.d.ts +0 -25
  220. package/build/types/ios-widget/xcode/buildPhases.d.ts.map +0 -1
  221. package/build/types/ios-widget/xcode/configurationList.d.ts +0 -20
  222. package/build/types/ios-widget/xcode/configurationList.d.ts.map +0 -1
  223. package/build/types/ios-widget/xcode/groups.d.ts +0 -15
  224. package/build/types/ios-widget/xcode/groups.d.ts.map +0 -1
  225. package/build/types/ios-widget/xcode/index.d.ts +0 -20
  226. package/build/types/ios-widget/xcode/index.d.ts.map +0 -1
  227. package/build/types/ios-widget/xcode/mainAppSettings.d.ts +0 -15
  228. package/build/types/ios-widget/xcode/mainAppSettings.d.ts.map +0 -1
  229. package/build/types/ios-widget/xcode/productFile.d.ts +0 -14
  230. package/build/types/ios-widget/xcode/productFile.d.ts.map +0 -1
  231. package/build/types/ios-widget/xcode/target.d.ts +0 -42
  232. package/build/types/ios-widget/xcode/target.d.ts.map +0 -1
  233. package/build/types/utils/fileDiscovery.d.ts +0 -13
  234. package/build/types/utils/fileDiscovery.d.ts.map +0 -1
  235. package/build/types/utils/urlScheme.d.ts +0 -10
  236. package/build/types/utils/urlScheme.d.ts.map +0 -1
@@ -1,256 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.generateSwiftFiles = generateSwiftFiles;
40
- const dedent_1 = __importDefault(require("dedent"));
41
- const fs = __importStar(require("fs"));
42
- const path = __importStar(require("path"));
43
- const constants_1 = require("../../constants");
44
- const logger_1 = require("../../utils/logger");
45
- const prerender_1 = require("../../utils/prerender");
46
- // ============================================================================
47
- // Main Function
48
- // ============================================================================
49
- /**
50
- * Generates all Swift files for the widget extension.
51
- *
52
- * This creates:
53
- * - VoltraWidgetInitialStates.swift (pre-rendered widget states)
54
- * - VoltraWidgetBundle.swift (widget bundle definition)
55
- */
56
- async function generateSwiftFiles(options) {
57
- const { targetPath, projectRoot, widgets } = options;
58
- // Dynamic import for ESM module compatibility
59
- // voltra/server is an ESM module, but the plugin is compiled to CommonJS
60
- const serverModuleId = 'voltra/server';
61
- const { renderWidgetToString } = (await Promise.resolve(`${serverModuleId}`).then(s => __importStar(require(s))));
62
- // Prerender widget initial states if any widgets have initialStatePath configured
63
- const prerenderedStates = await (0, prerender_1.prerenderWidgetState)(widgets || [], projectRoot, renderWidgetToString);
64
- // Generate the initial states Swift file
65
- const initialStatesContent = generateInitialStatesSwift(prerenderedStates);
66
- const initialStatesPath = path.join(targetPath, 'VoltraWidgetInitialStates.swift');
67
- fs.writeFileSync(initialStatesPath, initialStatesContent);
68
- logger_1.logger.info(`Generated VoltraWidgetInitialStates.swift with ${prerenderedStates.size} pre-rendered widget states`);
69
- // Generate the widget bundle Swift file
70
- const widgetBundleContent = widgets && widgets.length > 0 ? generateWidgetBundleSwift(widgets) : generateDefaultWidgetBundleSwift();
71
- const widgetBundlePath = path.join(targetPath, 'VoltraWidgetBundle.swift');
72
- fs.writeFileSync(widgetBundlePath, widgetBundleContent);
73
- logger_1.logger.info(`Generated VoltraWidgetBundle.swift with ${widgets?.length ?? 0} home screen widgets`);
74
- }
75
- // ============================================================================
76
- // Widget Bundle
77
- // ============================================================================
78
- /**
79
- * Generates Swift code for a single widget struct
80
- */
81
- function generateWidgetStruct(widget) {
82
- const families = widget.supportedFamilies ?? constants_1.DEFAULT_WIDGET_FAMILIES;
83
- const familiesSwift = families.map((f) => constants_1.WIDGET_FAMILY_MAP[f]).join(', ');
84
- // Sanitize the widget id for use as a Swift identifier
85
- const structName = `VoltraWidget_${widget.id}`;
86
- return (0, dedent_1.default) `
87
- public struct ${structName}: Widget {
88
- private let widgetId = "${widget.id}"
89
-
90
- public init() {}
91
-
92
- public var body: some WidgetConfiguration {
93
- StaticConfiguration(
94
- kind: "Voltra_Widget_${widget.id}",
95
- provider: VoltraHomeWidgetProvider(
96
- widgetId: widgetId,
97
- initialState: VoltraWidgetInitialStates.getInitialState(for: widgetId)
98
- )
99
- ) { entry in
100
- VoltraHomeWidgetView(entry: entry)
101
- }
102
- .configurationDisplayName("${widget.displayName}")
103
- .description("${widget.description}")
104
- .supportedFamilies([${familiesSwift}])
105
- .contentMarginsDisabled()
106
- }
107
- }
108
- `;
109
- }
110
- /**
111
- * Generates the VoltraWidgetBundle.swift file content with configured widgets
112
- */
113
- function generateWidgetBundleSwift(widgets) {
114
- // Generate widget structs
115
- const widgetStructs = widgets.map(generateWidgetStruct).join('\n\n');
116
- // Generate widget bundle body entries
117
- const widgetInstances = widgets.map((w) => `VoltraWidget_${w.id}()`).join('\n ');
118
- return (0, dedent_1.default) `
119
- //
120
- // VoltraWidgetBundle.swift
121
- //
122
- // Auto-generated by Voltra config plugin.
123
- // This file defines which Voltra widgets are available in your app.
124
- //
125
-
126
- import SwiftUI
127
- import WidgetKit
128
- import VoltraWidget
129
-
130
- @main
131
- struct VoltraWidgetBundle: WidgetBundle {
132
- var body: some Widget {
133
- // Live Activity (with Watch/CarPlay support)
134
- VoltraWidget()
135
-
136
- // Home Screen Widgets
137
- ${widgetInstances}
138
- }
139
- }
140
-
141
- // MARK: - Home Screen Widget Definitions
142
-
143
- ${widgetStructs}
144
- `;
145
- }
146
- /**
147
- * Generates the VoltraWidgetBundle.swift file content when no widgets are configured
148
- * (only Live Activities)
149
- */
150
- function generateDefaultWidgetBundleSwift() {
151
- return (0, dedent_1.default) `
152
- //
153
- // VoltraWidgetBundle.swift
154
- //
155
- // This file defines which Voltra widgets are available in your app.
156
- // You can customize which widgets to include by adding or removing them below.
157
- //
158
-
159
- import SwiftUI
160
- import WidgetKit
161
- import VoltraWidget // Import Voltra widgets
162
-
163
- @main
164
- struct VoltraWidgetBundle: WidgetBundle {
165
- var body: some Widget {
166
- // Live Activity (with Watch/CarPlay support)
167
- VoltraWidget()
168
- }
169
- }
170
- `;
171
- }
172
- // ============================================================================
173
- // Initial States
174
- // ============================================================================
175
- /**
176
- * Generates Swift code that bundles pre-rendered widget initial states.
177
- */
178
- function generateInitialStatesSwift(prerenderedStates) {
179
- if (prerenderedStates.size === 0) {
180
- return generateEmptyInitialStatesSwift();
181
- }
182
- // Generate the bundled states dictionary
183
- const stateEntries = Array.from(prerenderedStates.entries())
184
- .map(([widgetId, json]) => {
185
- const delimiter = getSwiftRawStringDelimiter(json);
186
- return `"${widgetId}": ${delimiter}"${json}"${delimiter}`;
187
- })
188
- .join(',\n ');
189
- return (0, dedent_1.default) `
190
- //
191
- // VoltraWidgetInitialStates.swift
192
- //
193
- // Auto-generated by Voltra config plugin.
194
- // Contains pre-rendered initial states for home screen widgets.
195
- //
196
-
197
- import Foundation
198
-
199
- public enum VoltraWidgetInitialStates {
200
- private static let bundledStates: [String: String] = [
201
- ${stateEntries}
202
- ]
203
-
204
- /// Get the bundled initial state JSON for a widget.
205
- /// Returns nil if no initial state was configured for the widget.
206
- public static func getInitialState(for widgetId: String) -> Data? {
207
- guard let jsonString = bundledStates[widgetId] else { return nil }
208
- return jsonString.data(using: .utf8)
209
- }
210
- }
211
- `;
212
- }
213
- /**
214
- * Generates empty Swift code when no widgets have initial states configured.
215
- */
216
- function generateEmptyInitialStatesSwift() {
217
- return (0, dedent_1.default) `
218
- //
219
- // VoltraWidgetInitialStates.swift
220
- //
221
- // Auto-generated by Voltra config plugin.
222
- // No widget initial states configured.
223
- //
224
-
225
- import Foundation
226
-
227
- public enum VoltraWidgetInitialStates {
228
- /// Get the bundled initial state JSON for a widget.
229
- /// Always returns nil since no initial states are configured.
230
- public static func getInitialState(for widgetId: String) -> Data? {
231
- return nil
232
- }
233
- }
234
- `;
235
- }
236
- /**
237
- * Determines the appropriate Swift raw string delimiter for a given string.
238
- * Counts the maximum consecutive '#' characters after a '"' in the content
239
- * and returns a delimiter with one more '#' than that maximum.
240
- *
241
- * For example:
242
- * - Content has no '"#' → returns '#'
243
- * - Content has '"#' (1 hash) → returns '##'
244
- * - Content has '"##' (2 hashes) → returns '###'
245
- */
246
- function getSwiftRawStringDelimiter(str) {
247
- // Find all sequences of '#' that follow a '"'
248
- const matches = str.match(/"#+/g);
249
- if (!matches) {
250
- return '#';
251
- }
252
- // Find the maximum number of consecutive '#' after a '"'
253
- const maxHashes = Math.max(...matches.map((m) => m.length - 1)); // -1 to exclude the '"'
254
- return '#'.repeat(maxHashes + 1);
255
- }
256
- //# sourceMappingURL=swift.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swift.js","sourceRoot":"","sources":["../../../../src/ios-widget/files/swift.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,gDA4BC;AAxDD,oDAA2B;AAC3B,uCAAwB;AACxB,2CAA4B;AAE5B,+CAA4E;AAE5E,+CAA2C;A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QACjC,OAAO,+BAA+B,EAAE,CAAA;IAC1C,CAAC;IAED,yCAAyC;IACzC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;SACzD,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;QACxB,MAAM,SAAS,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAA;QAClD,OAAO,IAAI,QAAQ,MAAM,SAAS,IAAI,IAAI,IAAI,SAAS,EAAE,CAAA;IAC3D,CAAC,CAAC;SACD,IAAI,CAAC,SAAS,CAAC,CAAA;IAElB,OAAO,IAAA,gBAAM,EAAA;;;;;;;;;;;;UAYL,YAAY;;;;;;;;;;GAUnB,CAAA;AACH,CAAC;AAED;;GAEG;AACH,SAAS,+BAA+B;IACtC,OAAO,IAAA,gBAAM,EAAA;;;;;;;;;;;;;;;;;GAiBZ,CAAA;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,0BAA0B,CAAC,GAAW;IAC7C,8CAA8C;IAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAEjC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,yDAAyD;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA,CAAC,wBAAwB;IACxF,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;AAClC,CAAC"}
@@ -1,151 +0,0 @@
1
- "use strict";
2
- /**
3
- * Font configuration for Live Activity extension.
4
- *
5
- * This code is adapted from expo-font to support custom fonts in Live Activities.
6
- * @see https://github.com/expo/expo/tree/main/packages/expo-font/plugin
7
- *
8
- * I would love to reuse the existing expo-font infrastructure, but it's not that easy to do. I'll most likely revisit it later.
9
- */
10
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __importStar = (this && this.__importStar) || (function () {
27
- var ownKeys = function(o) {
28
- ownKeys = Object.getOwnPropertyNames || function (o) {
29
- var ar = [];
30
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
- return ar;
32
- };
33
- return ownKeys(o);
34
- };
35
- return function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- })();
43
- var __importDefault = (this && this.__importDefault) || function (mod) {
44
- return (mod && mod.__esModule) ? mod : { "default": mod };
45
- };
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.withFonts = void 0;
48
- const config_plugins_1 = require("@expo/config-plugins");
49
- const plist_1 = __importDefault(require("@expo/plist"));
50
- const fs_1 = require("fs");
51
- const path = __importStar(require("path"));
52
- const logger_1 = require("../utils/logger");
53
- const fonts_1 = require("../utils/fonts");
54
- /**
55
- * Plugin that adds custom fonts to the Live Activity extension.
56
- *
57
- * @param config - The Expo config
58
- * @param fonts - Array of font file paths or directories
59
- * @param targetName - Name of the Live Activity extension target
60
- * @returns Modified config
61
- */
62
- const withFonts = (config, { fonts, targetName }) => {
63
- if (!fonts || fonts.length === 0) {
64
- return config;
65
- }
66
- config = addFontsToTarget(config, fonts, targetName);
67
- config = addFontsToPlist(config, fonts, targetName);
68
- return config;
69
- };
70
- exports.withFonts = withFonts;
71
- /**
72
- * Adds font files to the Live Activity extension target.
73
- * This ensures fonts are bundled with the extension and accessible at runtime.
74
- */
75
- function addFontsToTarget(config, fonts, targetName) {
76
- return (0, config_plugins_1.withXcodeProject)(config, async (config) => {
77
- if (config.modRequest.introspect) {
78
- return config;
79
- }
80
- const resolvedFonts = await (0, fonts_1.resolveFontPaths)(fonts, config.modRequest.projectRoot);
81
- const project = config.modResults;
82
- const platformProjectRoot = config.modRequest.platformProjectRoot;
83
- const targetUuid = project.findTargetKey(targetName);
84
- if (targetUuid == null) {
85
- throw new Error(`Target ${targetName} not found in Xcode project. Report this issue to the Voltra team.`);
86
- }
87
- config_plugins_1.IOSConfig.XcodeUtils.ensureGroupRecursively(project, 'VoltraResources');
88
- for (const font of resolvedFonts) {
89
- const fontPath = path.relative(platformProjectRoot, font);
90
- config_plugins_1.IOSConfig.XcodeUtils.addResourceFileToGroup({
91
- filepath: fontPath,
92
- groupName: 'VoltraResources',
93
- project,
94
- isBuildFile: true,
95
- verbose: true,
96
- targetUuid,
97
- });
98
- logger_1.logger.info(`Added font file: ${path.basename(font)}`);
99
- }
100
- return config;
101
- });
102
- }
103
- /**
104
- * Adds font filenames to the Live Activity extension's Info.plist UIAppFonts array.
105
- * This makes iOS aware of the custom fonts and allows them to be used in SwiftUI.
106
- */
107
- function addFontsToPlist(config, fonts, targetName) {
108
- return (0, config_plugins_1.withDangerousMod)(config, [
109
- 'ios',
110
- async (config) => {
111
- if (config.modRequest.introspect) {
112
- return config;
113
- }
114
- const resolvedFonts = await (0, fonts_1.resolveFontPaths)(fonts, config.modRequest.projectRoot);
115
- const platformProjectRoot = config.modRequest.platformProjectRoot;
116
- // Read the Live Activity extension's Info.plist directly
117
- const targetPath = path.join(platformProjectRoot, targetName);
118
- const infoPlistPath = path.join(targetPath, 'Info.plist');
119
- try {
120
- const plistContent = plist_1.default.parse((0, fs_1.readFileSync)(infoPlistPath, 'utf8'));
121
- // Get existing fonts or initialize empty array
122
- const existingFonts = getUIAppFonts(plistContent);
123
- // Add new fonts
124
- const fontList = resolvedFonts.map((font) => path.basename(font));
125
- const allFonts = [...existingFonts, ...fontList];
126
- plistContent.UIAppFonts = Array.from(new Set(allFonts));
127
- // Write back to file
128
- (0, fs_1.writeFileSync)(infoPlistPath, plist_1.default.build(plistContent));
129
- logger_1.logger.info(`Added ${fontList.length} font(s) to ${targetName} Info.plist`);
130
- }
131
- catch (error) {
132
- logger_1.logger.warn(`Could not update Info.plist for fonts: ${error}`);
133
- }
134
- return config;
135
- },
136
- ]);
137
- }
138
- /**
139
- * Retrieves existing UIAppFonts from Info.plist.
140
- *
141
- * @param infoPlist - Info.plist object
142
- * @returns Array of font filenames
143
- */
144
- function getUIAppFonts(infoPlist) {
145
- const fonts = infoPlist['UIAppFonts'];
146
- if (fonts != null && Array.isArray(fonts) && fonts.every((font) => typeof font === 'string')) {
147
- return fonts;
148
- }
149
- return [];
150
- }
151
- //# sourceMappingURL=fonts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../src/ios-widget/fonts.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAAuH;AACvH,wDAA+B;AAE/B,2BAAgD;AAChD,2CAA4B;AAE5B,4CAAwC;AACxC,0CAAiD;AAEjD;;;;;;;GAOG;AACI,MAAM,SAAS,GAA0D,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAChH,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MA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AC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAEvD,qBAAqB;gBACrB,IAAA,kBAAa,EAAC,aAAa,EAAE,eAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;gBAEvD,eAAM,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,eAAe,UAAU,aAAa,CAAC,CAAA;YAC7E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,eAAM,CAAC,IAAI,CAAC,0CAA0C,KAAK,EAAE,CAAC,CAAA;YAChE,CAAC;YAED,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,SAAoB;IACzC,MAAM,KAAK,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IACrC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC7F,OAAO,KAAiB,CAAA;IAC1B,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withIOS = void 0;
4
- const config_plugins_1 = require("@expo/config-plugins");
5
- const eas_1 = require("./eas");
6
- const files_1 = require("./files");
7
- const fonts_1 = require("./fonts");
8
- const podfile_1 = require("./podfile");
9
- const widgetPlist_1 = require("./widgetPlist");
10
- const xcode_1 = require("./xcode");
11
- /**
12
- * Main iOS configuration plugin.
13
- *
14
- * This orchestrates all iOS-related configuration in the correct order:
15
- * 1. Add custom fonts (if provided)
16
- * 2. Configure Xcode project (targets, build phases, groups)
17
- * 3. Configure Podfile for widget extension
18
- * 4. Configure main app Info.plist (URL schemes)
19
- * 5. Configure EAS build settings
20
- * 6. Generate widget extension files (Swift, assets, plist, entitlements)
21
- *
22
- * NOTE: Expo mods execute in REVERSE registration order. Plugins that depend
23
- * on modifications from other plugins must be registered BEFORE their dependencies.
24
- * For example, fonts plugin needs the target created by configureXcodeProject,
25
- * so fonts must be registered before configureXcodeProject.
26
- */
27
- const withIOS = (config, props) => {
28
- const { targetName, bundleIdentifier, deploymentTarget, widgets, groupIdentifier, keychainGroup, fonts, version, buildNumber, } = props;
29
- const plugins = [
30
- // 1. Add custom fonts if provided
31
- ...(fonts && fonts.length > 0 ? [[fonts_1.withFonts, { fonts, targetName }]] : []),
32
- // 2. Configure Xcode project (creates the target - must run before fonts mod executes)
33
- [xcode_1.configureXcodeProject, { targetName, bundleIdentifier, deploymentTarget }],
34
- // 3. Configure Podfile for widget extension target
35
- [podfile_1.configurePodfile, { targetName }],
36
- // 4. Configure main app Info.plist (URL schemes, widget extension plist)
37
- [widgetPlist_1.configureWidgetExtensionPlist, { targetName, groupIdentifier, widgets, keychainGroup }],
38
- // 5. Configure EAS build settings
39
- [eas_1.configureEasBuild, { targetName, bundleIdentifier, groupIdentifier }],
40
- // 6. Generate widget extension files (dangerous mod should run before plist patchers)
41
- [files_1.generateWidgetExtensionFiles, { targetName, widgets, groupIdentifier, keychainGroup, version, buildNumber }],
42
- ];
43
- return (0, config_plugins_1.withPlugins)(config, plugins);
44
- };
45
- exports.withIOS = withIOS;
46
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ios-widget/index.ts"],"names":[],"mappings":";;;AAAA,yDAAgE;AAGhE,+BAAyC;AACzC,mCAAsD;AACtD,mCAAmC;AACnC,uCAA4C;AAC5C,+CAA6D;AAC7D,mCAA+C;AAc/C;;;;;;;;;;;;;;;GAeG;AACI,MAAM,OAAO,GAA+B,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IACnE,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,aAAa,EACb,KAAK,EACL,OAAO,EACP,WAAW,GACZ,GAAG,KAAK,CAAA;IAET,MAAM,OAAO,GAA+B;QAC1C,kCAAkC;QAClC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAS,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAA6B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEtG,uFAAuF;QACvF,CAAC,6BAAqB,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;QAE3E,mDAAmD;QACnD,CAAC,0BAAgB,EAAE,EAAE,UAAU,EAAE,CAAC;QAElC,yEAAyE;QACzE,CAAC,2CAA6B,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;QAExF,kCAAkC;QAClC,CAAC,uBAAiB,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;QAEtE,sFAAsF;QACtF,CAAC,oCAA4B,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;KAC9G,CAAA;IAED,OAAO,IAAA,4BAAW,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACrC,CAAC,CAAA;AAlCY,QAAA,OAAO,WAkCnB"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configurePodfile = void 0;
4
- const config_plugins_1 = require("@expo/config-plugins");
5
- /**
6
- * Generates the Podfile target content for the widget extension.
7
- */
8
- function getTargetContent(targetName) {
9
- return `
10
- # Voltra Widget Extension Target
11
- # DO NOT MODIFY THIS FILE - IT IS AUTO-GENERATED BY THE VOLTRA PLUGIN
12
- target '${targetName}' do
13
- use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
14
- use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
15
-
16
- require 'pathname'
17
- project_root = "#{Pod::Config.instance.installation_root}/.."
18
- library_name = 'voltra'
19
- voltra_module = JSON.parse(\`npx expo-modules-autolinking search -p apple --json --project-root #{project_root}\`)
20
- podspec_dir_path = File.join(voltra_module[library_name]['path'], 'ios')
21
- podspec_dir_path = File.realpath(podspec_dir_path) if File.exist?(podspec_dir_path)
22
- podspec_dir_path = Pathname.new(podspec_dir_path).relative_path_from(Pathname.new(__dir__)).to_path
23
-
24
- pod 'VoltraWidget', :path => podspec_dir_path
25
- end`;
26
- }
27
- /**
28
- * Plugin step that adds the Podfile target for the widget extension.
29
- */
30
- const configurePodfile = (config, { targetName }) => {
31
- return (0, config_plugins_1.withPodfile)(config, (podfile) => {
32
- const targetContent = getTargetContent(targetName);
33
- // Check if target already exists (avoid duplicates)
34
- const targetMarker = "target '" + targetName + "'";
35
- if (podfile.modResults.contents.includes(targetMarker)) {
36
- return podfile;
37
- }
38
- podfile.modResults.contents = podfile.modResults.contents + '\n' + targetContent;
39
- return podfile;
40
- });
41
- };
42
- exports.configurePodfile = configurePodfile;
43
- //# sourceMappingURL=podfile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"podfile.js","sourceRoot":"","sources":["../../../src/ios-widget/podfile.ts"],"names":[],"mappings":";;;AAAA,yDAAmF;AAEnF;;GAEG;AACH,SAAS,gBAAgB,CAAC,UAAkB;IAC1C,OAAO;;;UAGC,UAAU;;;;;;;;;;;;;IAahB,CAAA;AACJ,CAAC;AAMD;;GAEG;AACI,MAAM,gBAAgB,GAAwC,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IAC9F,OAAO,IAAA,4BAAe,EAAC,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAA;QAElD,oDAAoD;QACpD,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,GAAG,CAAA;QAClD,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,OAAO,OAAO,CAAA;QAChB,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,GAAG,aAAa,CAAA;QAChF,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAbY,QAAA,gBAAgB,oBAa5B"}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.configureWidgetExtensionPlist = void 0;
7
- const config_plugins_1 = require("@expo/config-plugins");
8
- const plist_1 = __importDefault(require("@expo/plist"));
9
- const fs_1 = require("fs");
10
- const path_1 = require("path");
11
- const logger_1 = require("../utils/logger");
12
- /**
13
- * Plugin step that configures the Info.plist files.
14
- *
15
- * This:
16
- * - Updates the widget extension's Info.plist with URL schemes
17
- * - Removes incompatible NSExtension keys for WidgetKit
18
- * - Adds group identifier if configured
19
- * - Adds server update URLs and intervals for server-driven widgets
20
- * - Adds Keychain group for shared credential access
21
- */
22
- const configureWidgetExtensionPlist = (expoConfig, { targetName, groupIdentifier, widgets, keychainGroup }) => (0, config_plugins_1.withDangerousMod)(expoConfig, [
23
- 'ios',
24
- async (config) => {
25
- if (config.modRequest.introspect) {
26
- return config;
27
- }
28
- const scheme = typeof expoConfig.scheme === 'string' ? expoConfig.scheme : expoConfig.ios?.bundleIdentifier;
29
- if (scheme) {
30
- const targetPath = (0, path_1.join)(config.modRequest.platformProjectRoot, targetName);
31
- const filePath = (0, path_1.join)(targetPath, 'Info.plist');
32
- if (!(0, fs_1.existsSync)(filePath)) {
33
- logger_1.logger.warn(`Widget Info.plist not found at ${filePath}, skipping widget plist updates`);
34
- return config;
35
- }
36
- const content = plist_1.default.parse((0, fs_1.readFileSync)(filePath, 'utf8'));
37
- // WidgetKit extensions must NOT declare NSExtensionPrincipalClass/MainStoryboard.
38
- // The @main WidgetBundle in Swift is the entry point.
39
- const ext = content.NSExtension;
40
- if (ext) {
41
- delete ext.NSExtensionPrincipalClass;
42
- delete ext.NSExtensionMainStoryboard;
43
- }
44
- // Keep URL schemes in the widget extension so Live Activity links can be resolved
45
- // from relative to absolute URLs (see VoltraDeepLinkResolver.swift).
46
- const existingTypes = content.CFBundleURLTypes || [];
47
- const hasScheme = existingTypes.some((t) => Array.isArray(t?.CFBundleURLSchemes) && t.CFBundleURLSchemes.includes(scheme));
48
- if (!hasScheme) {
49
- content.CFBundleURLTypes = [
50
- ...existingTypes,
51
- {
52
- CFBundleURLSchemes: [scheme],
53
- },
54
- ];
55
- }
56
- else {
57
- content.CFBundleURLTypes = existingTypes;
58
- }
59
- // Only set group identifier if provided
60
- if (groupIdentifier) {
61
- ;
62
- content['Voltra_AppGroupIdentifier'] = groupIdentifier;
63
- }
64
- // Configure server update URLs and intervals for widgets with serverUpdate
65
- if (widgets && widgets.length > 0) {
66
- const serverUrls = {};
67
- const serverIntervals = {};
68
- const serverRefresh = {};
69
- for (const widget of widgets) {
70
- if (widget.serverUpdate) {
71
- serverUrls[widget.id] = widget.serverUpdate.url;
72
- serverIntervals[widget.id] = widget.serverUpdate.intervalMinutes ?? 15;
73
- if (widget.serverUpdate.refresh) {
74
- serverRefresh[widget.id] = true;
75
- }
76
- }
77
- }
78
- if (Object.keys(serverUrls).length > 0) {
79
- ;
80
- content['Voltra_WidgetServerUrls'] = serverUrls;
81
- content['Voltra_WidgetServerIntervals'] = serverIntervals;
82
- }
83
- if (Object.keys(serverRefresh).length > 0) {
84
- ;
85
- content['Voltra_WidgetServerRefresh'] = serverRefresh;
86
- }
87
- }
88
- // Add Keychain group for shared credential access
89
- if (keychainGroup) {
90
- ;
91
- content['Voltra_KeychainGroup'] = keychainGroup;
92
- }
93
- (0, fs_1.writeFileSync)(filePath, plist_1.default.build(content));
94
- }
95
- return config;
96
- },
97
- ]);
98
- exports.configureWidgetExtensionPlist = configureWidgetExtensionPlist;
99
- //# sourceMappingURL=widgetPlist.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widgetPlist.js","sourceRoot":"","sources":["../../../src/ios-widget/widgetPlist.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgF;AAChF,wDAA+B;AAC/B,2BAA4D;AAC5D,+BAAuC;AAGvC,4CAAwC;AASxC;;;;;;;;;GASG;AACI,MAAM,6BAA6B,GAA6C,CACrF,UAAU,EACV,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,EAAE,EACvD,EAAE,CACF,IAAA,iCAAgB,EAAC,UAAU,EAAE;IAC3B,KAAK;IACL,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YACjC,OAAO,MAAM,CAAA;QACf,CAAC;QAED,MAAM,MAAM,GAAG,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,gBAAgB,CAAA;QAE3G,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,IAAA,WAAQ,EAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAA;YAC9E,MAAM,QAAQ,GAAG,IAAA,WAAQ,EAAC,UAAU,EAAE,YAAY,CAAC,CAAA;YACnD,IAAI,CAAC,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,eAAM,CAAC,IAAI,CAAC,kCAAkC,QAAQ,iCAAiC,CAAC,CAAA;gBACxF,OAAO,MAAM,CAAA;YACf,CAAC;YAED,MAAM,OAAO,GAAG,eAAK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