expo-live-activity 0.3.0-alpha1 → 0.3.0-alpha3
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 +10 -4
- package/build/index.d.ts +15 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/ios/ExpoLiveActivityModule.swift +15 -4
- package/ios/LiveActivityAttributes.swift +1 -0
- package/ios-files/LiveActivityView.swift +4 -0
- package/ios-files/LiveActivityWidget.swift +1 -0
- package/package.json +2 -2
- package/plugin/build/index.js +0 -2
- package/plugin/build/xcode/addXCConfigurationList.js +1 -0
- package/plugin/src/index.ts +0 -2
- package/plugin/src/xcode/addXCConfigurationList.ts +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +19 -0
- package/plugin/build/withPodfile.d.ts +0 -4
- package/plugin/build/withPodfile.js +0 -92
- package/plugin/src/withPodfile.ts +0 -65
package/README.md
CHANGED
|
@@ -127,9 +127,12 @@ The `state` object should include:
|
|
|
127
127
|
{
|
|
128
128
|
title: string;
|
|
129
129
|
subtitle?: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
progressBar: { // Only one property, either date or progress, is available at a time as they share a single progress bar component
|
|
131
|
+
date?: number; // Set as epoch time in milliseconds. This is used as an end date in a timer.
|
|
132
|
+
progress?: number; //Set amount of progress in the progress bar
|
|
133
|
+
};
|
|
134
|
+
imageName?: string; // Matches the name of the image in 'assets/liveActivity'
|
|
135
|
+
dynamicIslandImageName?: string; // Matches the name of the image in 'assets/liveActivity'
|
|
133
136
|
};
|
|
134
137
|
```
|
|
135
138
|
|
|
@@ -161,7 +164,9 @@ Managing a live activity:
|
|
|
161
164
|
const state: LiveActivity.LiveActivityState = {
|
|
162
165
|
title: 'Title',
|
|
163
166
|
subtitle: 'This is a subtitle',
|
|
164
|
-
|
|
167
|
+
progressBar: {
|
|
168
|
+
date: new Date(Date.now() + 60 * 1000 * 5).getTime(),
|
|
169
|
+
},
|
|
165
170
|
imageName: 'live_activity_image',
|
|
166
171
|
dynamicIslandImageName: 'dynamic_island_image',
|
|
167
172
|
}
|
|
@@ -224,6 +229,7 @@ Example payload for starting live activity:
|
|
|
224
229
|
"title": "Live activity title!",
|
|
225
230
|
"subtitle": "Live activity subtitle.",
|
|
226
231
|
"timerEndDateInMilliseconds": 1754410997000,
|
|
232
|
+
"progress": 0.5,
|
|
227
233
|
"imageName": "live_activity_image",
|
|
228
234
|
"dynamicIslandImageName": "dynamic_island_image"
|
|
229
235
|
},
|
package/build/index.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { EventSubscription } from 'expo-modules-core';
|
|
2
2
|
type Voidable<T> = T | void;
|
|
3
3
|
export type DynamicIslandTimerType = 'circular' | 'digital';
|
|
4
|
+
type ProgressBarType = {
|
|
5
|
+
date?: number;
|
|
6
|
+
progress?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
date?: undefined;
|
|
9
|
+
progress?: number;
|
|
10
|
+
};
|
|
4
11
|
export type LiveActivityState = {
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
progressBar?: ProgressBarType;
|
|
15
|
+
imageName?: string;
|
|
16
|
+
dynamicIslandImageName?: string;
|
|
17
|
+
};
|
|
18
|
+
export type NativeLiveActivityState = {
|
|
5
19
|
title: string;
|
|
6
20
|
subtitle?: string;
|
|
7
21
|
date?: number;
|
|
22
|
+
progress?: number;
|
|
8
23
|
imageName?: string;
|
|
9
24
|
dynamicIslandImageName?: string;
|
|
10
25
|
};
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAKrD,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE3B,MAAM,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MAAM,EAAE,qCAAqC,KAAK,IAAI,CAAA;IACnF,aAAa,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CACrD,CAAA;AAUD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAErG;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,OAEhE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,OAElE;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GACpD,QAAQ,CAAC,iBAAiB,CAAC,CAE7B;AAED,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,CAAC,KAAK,EAAE,qCAAqC,KAAK,IAAI,GAC/D,QAAQ,CAAC,iBAAiB,CAAC,CAG7B;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,QAAQ,CAAC,iBAAiB,CAAC,CAE7B"}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;AAmE7D,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,KAAK,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ivityModule from './ExpoLiveActivityModule'\n\ntype Voidable<T> = T | void\n\nexport type DynamicIslandTimerType = 'circular' | 'digital'\n\ntype ProgressBarType =\n | {\n date?: number\n progress?: undefined\n }\n | {\n date?: undefined\n progress?: number\n }\n\nexport type LiveActivityState = {\n title: string\n subtitle?: string\n progressBar?: ProgressBarType\n imageName?: string\n dynamicIslandImageName?: string\n}\n\nexport type NativeLiveActivityState = {\n title: string\n subtitle?: string\n date?: number\n progress?: number\n imageName?: string\n dynamicIslandImageName?: string\n}\n\nexport type LiveActivityConfig = {\n backgroundColor?: string\n titleColor?: string\n subtitleColor?: string\n progressViewTint?: string\n progressViewLabelColor?: string\n deepLinkUrl?: string\n timerType?: DynamicIslandTimerType\n}\n\nexport type ActivityTokenReceivedEvent = {\n activityID: string\n activityName: string\n activityPushToken: string\n}\n\nexport type ActivityPushToStartTokenReceivedEvent = {\n activityPushToStartToken: string\n}\n\ntype ActivityState = 'active' | 'dismissed' | 'pending' | 'stale' | 'ended'\n\nexport type ActivityUpdateEvent = {\n activityID: string\n activityName: string\n activityState: ActivityState\n}\n\nexport type LiveActivityModuleEvents = {\n onTokenReceived: (params: ActivityTokenReceivedEvent) => void\n onPushToStartTokenReceived: (params: ActivityPushToStartTokenReceivedEvent) => void\n onStateChange: (params: ActivityUpdateEvent) => void\n}\n\nfunction assertIOS(name: string) {\n const isIOS = Platform.OS === 'ios'\n\n if (!isIOS) console.error(`${name} is only available on iOS`)\n\n return isIOS\n}\n\n/**\n * @param {LiveActivityState} state The state for the live activity.\n * @param {LiveActivityConfig} config Live activity config object.\n * @returns {string} The identifier of the started activity or undefined if creating live activity failed.\n */\nexport function startActivity(state: LiveActivityState, config?: LiveActivityConfig): Voidable<string> {\n if (assertIOS('startActivity')) return ExpoLiveActivityModule.startActivity(state, config)\n}\n\n/**\n * @param {string} id The identifier of the activity to stop.\n * @param {LiveActivityState} state The updated state for the live activity.\n */\nexport function stopActivity(id: string, state: LiveActivityState) {\n if (assertIOS('stopActivity')) return ExpoLiveActivityModule.stopActivity(id, state)\n}\n\n/**\n * @param {string} id The identifier of the activity to update.\n * @param {LiveActivityState} state The updated state for the live activity.\n */\nexport function updateActivity(id: string, state: LiveActivityState) {\n if (assertIOS('updateActivity')) return ExpoLiveActivityModule.updateActivity(id, state)\n}\n\nexport function addActivityTokenListener(\n listener: (event: ActivityTokenReceivedEvent) => void\n): Voidable<EventSubscription> {\n if (assertIOS('addActivityTokenListener')) return ExpoLiveActivityModule.addListener('onTokenReceived', listener)\n}\n\nexport function addActivityPushToStartTokenListener(\n listener: (event: ActivityPushToStartTokenReceivedEvent) => void\n): Voidable<EventSubscription> {\n if (assertIOS('addActivityPushToStartTokenListener'))\n return ExpoLiveActivityModule.addListener('onPushToStartTokenReceived', listener)\n}\n\nexport function addActivityUpdatesListener(\n listener: (event: ActivityUpdateEvent) => void\n): Voidable<EventSubscription> {\n if (assertIOS('addActivityUpdatesListener')) return ExpoLiveActivityModule.addListener('onStateChange', listener)\n}\n"]}
|
|
@@ -17,7 +17,15 @@ public class ExpoLiveActivityModule: Module {
|
|
|
17
17
|
var subtitle: String?
|
|
18
18
|
|
|
19
19
|
@Field
|
|
20
|
-
var
|
|
20
|
+
var progressBar: ProgressBar?
|
|
21
|
+
|
|
22
|
+
struct ProgressBar: Record {
|
|
23
|
+
@Field
|
|
24
|
+
var date: Double?
|
|
25
|
+
|
|
26
|
+
@Field
|
|
27
|
+
var progress: Double?
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
@Field
|
|
23
31
|
var imageName: String?
|
|
@@ -183,7 +191,8 @@ public class ExpoLiveActivityModule: Module {
|
|
|
183
191
|
let initialState = LiveActivityAttributes.ContentState(
|
|
184
192
|
title: state.title,
|
|
185
193
|
subtitle: state.subtitle,
|
|
186
|
-
timerEndDateInMilliseconds: state.date
|
|
194
|
+
timerEndDateInMilliseconds: state.progressBar?.date,
|
|
195
|
+
progress: state.progressBar?.progress
|
|
187
196
|
)
|
|
188
197
|
|
|
189
198
|
let activity = try Activity.request(
|
|
@@ -219,7 +228,8 @@ public class ExpoLiveActivityModule: Module {
|
|
|
219
228
|
var newState = LiveActivityAttributes.ContentState(
|
|
220
229
|
title: state.title,
|
|
221
230
|
subtitle: state.subtitle,
|
|
222
|
-
timerEndDateInMilliseconds: state.date
|
|
231
|
+
timerEndDateInMilliseconds: state.progressBar?.date,
|
|
232
|
+
progress: state.progressBar?.progress
|
|
223
233
|
)
|
|
224
234
|
try await updateImages(state: state, newState: &newState)
|
|
225
235
|
await activity.end(
|
|
@@ -242,7 +252,8 @@ public class ExpoLiveActivityModule: Module {
|
|
|
242
252
|
var newState = LiveActivityAttributes.ContentState(
|
|
243
253
|
title: state.title,
|
|
244
254
|
subtitle: state.subtitle,
|
|
245
|
-
timerEndDateInMilliseconds: state.date
|
|
255
|
+
timerEndDateInMilliseconds: state.progressBar?.date,
|
|
256
|
+
progress: state.progressBar?.progress
|
|
246
257
|
)
|
|
247
258
|
try await updateImages(state: state, newState: &newState)
|
|
248
259
|
await activity.update(ActivityContent(state: newState, staleDate: nil))
|
|
@@ -58,6 +58,10 @@ import WidgetKit
|
|
|
58
58
|
ProgressView(timerInterval: Date.toTimerInterval(miliseconds: date))
|
|
59
59
|
.tint(progressViewTint)
|
|
60
60
|
.modifier(ConditionalForegroundViewModifier(color: attributes.progressViewLabelColor))
|
|
61
|
+
} else if let progress = contentState.progress {
|
|
62
|
+
ProgressView(value: progress)
|
|
63
|
+
.tint(progressViewTint)
|
|
64
|
+
.modifier(ConditionalForegroundViewModifier(color: attributes.progressViewLabelColor))
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
.padding(24)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-live-activity",
|
|
3
|
-
"version": "0.3.0-
|
|
3
|
+
"version": "0.3.0-alpha3",
|
|
4
4
|
"description": "A module for adding Live Activity to a React Native app for iOS.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"eslint-plugin-prettier": "^5.5.4",
|
|
49
49
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
50
50
|
"expo": "~53.0.0",
|
|
51
|
-
"expo-module-scripts": "^4.1.
|
|
51
|
+
"expo-module-scripts": "^4.1.10",
|
|
52
52
|
"prettier": "^3.6.2",
|
|
53
53
|
"react-native": "0.79.1"
|
|
54
54
|
},
|
package/plugin/build/index.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const config_plugins_1 = require("expo/config-plugins");
|
|
7
7
|
const withConfig_1 = require("./withConfig");
|
|
8
8
|
const withPlist_1 = __importDefault(require("./withPlist"));
|
|
9
|
-
const withPodfile_1 = require("./withPodfile");
|
|
10
9
|
const withPushNotifications_1 = require("./withPushNotifications");
|
|
11
10
|
const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlements");
|
|
12
11
|
const withXcode_1 = require("./withXcode");
|
|
@@ -33,7 +32,6 @@ const withWidgetsAndLiveActivities = (config, props) => {
|
|
|
33
32
|
},
|
|
34
33
|
],
|
|
35
34
|
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { targetName }],
|
|
36
|
-
[withPodfile_1.withPodfile, { targetName }],
|
|
37
35
|
[withConfig_1.withConfig, { targetName, bundleIdentifier }],
|
|
38
36
|
]);
|
|
39
37
|
if (props?.enablePushNotifications) {
|
|
@@ -38,6 +38,7 @@ function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersio
|
|
|
38
38
|
MARKETING_VERSION: `"${marketingVersion}"`,
|
|
39
39
|
SWIFT_OPTIMIZATION_LEVEL: `"-Onone"`,
|
|
40
40
|
CODE_SIGN_ENTITLEMENTS: `"${targetName}/${targetName}.entitlements"`,
|
|
41
|
+
APPLICATION_EXTENSION_API_ONLY: '"YES"',
|
|
41
42
|
// DEVELOPMENT_TEAM: `"G76836P2D4"`,
|
|
42
43
|
};
|
|
43
44
|
const buildConfigurationsList = [
|
package/plugin/src/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { IOSConfig, withPlugins } from 'expo/config-plugins'
|
|
|
3
3
|
import type { LiveActivityConfigPlugin } from './types'
|
|
4
4
|
import { withConfig } from './withConfig'
|
|
5
5
|
import withPlist from './withPlist'
|
|
6
|
-
import { withPodfile } from './withPodfile'
|
|
7
6
|
import { withPushNotifications } from './withPushNotifications'
|
|
8
7
|
import { withWidgetExtensionEntitlements } from './withWidgetExtensionEntitlements'
|
|
9
8
|
import { withXcode } from './withXcode'
|
|
@@ -33,7 +32,6 @@ const withWidgetsAndLiveActivities: LiveActivityConfigPlugin = (config, props) =
|
|
|
33
32
|
},
|
|
34
33
|
],
|
|
35
34
|
[withWidgetExtensionEntitlements, { targetName }],
|
|
36
|
-
[withPodfile, { targetName }],
|
|
37
35
|
[withConfig, { targetName, bundleIdentifier }],
|
|
38
36
|
])
|
|
39
37
|
|
|
@@ -53,6 +53,7 @@ export function addXCConfigurationList(
|
|
|
53
53
|
MARKETING_VERSION: `"${marketingVersion}"`,
|
|
54
54
|
SWIFT_OPTIMIZATION_LEVEL: `"-Onone"`,
|
|
55
55
|
CODE_SIGN_ENTITLEMENTS: `"${targetName}/${targetName}.entitlements"`,
|
|
56
|
+
APPLICATION_EXTENSION_API_ONLY: '"YES"',
|
|
56
57
|
// DEVELOPMENT_TEAM: `"G76836P2D4"`,
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/types.ts","./src/withConfig.ts","./src/withPlist.ts","./src/
|
|
1
|
+
{"root":["./src/index.ts","./src/types.ts","./src/withConfig.ts","./src/withPlist.ts","./src/withPushNotifications.ts","./src/withWidgetExtensionEntitlements.ts","./src/withXcode.ts","./src/lib/getWidgetExtensionEntitlements.ts","./src/lib/getWidgetFiles.ts","./src/xcode/addBuildPhases.ts","./src/xcode/addPbxGroup.ts","./src/xcode/addProductFile.ts","./src/xcode/addTargetDependency.ts","./src/xcode/addToPbxNativeTargetSection.ts","./src/xcode/addToPbxProjectSection.ts","./src/xcode/addXCConfigurationList.ts"],"version":"5.8.3"}
|
package/src/index.ts
CHANGED
|
@@ -7,10 +7,29 @@ type Voidable<T> = T | void
|
|
|
7
7
|
|
|
8
8
|
export type DynamicIslandTimerType = 'circular' | 'digital'
|
|
9
9
|
|
|
10
|
+
type ProgressBarType =
|
|
11
|
+
| {
|
|
12
|
+
date?: number
|
|
13
|
+
progress?: undefined
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
date?: undefined
|
|
17
|
+
progress?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
export type LiveActivityState = {
|
|
21
|
+
title: string
|
|
22
|
+
subtitle?: string
|
|
23
|
+
progressBar?: ProgressBarType
|
|
24
|
+
imageName?: string
|
|
25
|
+
dynamicIslandImageName?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type NativeLiveActivityState = {
|
|
11
29
|
title: string
|
|
12
30
|
subtitle?: string
|
|
13
31
|
date?: number
|
|
32
|
+
progress?: number
|
|
14
33
|
imageName?: string
|
|
15
34
|
dynamicIslandImageName?: string
|
|
16
35
|
}
|
|
@@ -1,92 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.withPodfile = void 0;
|
|
37
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
38
|
-
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
40
|
-
const path = __importStar(require("path"));
|
|
41
|
-
const withPodfile = (config, { targetName }) => {
|
|
42
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
43
|
-
'ios',
|
|
44
|
-
(config) => {
|
|
45
|
-
const podFilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
|
|
46
|
-
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
47
|
-
/* podFileContent = mergeContents({
|
|
48
|
-
tag: "withWidgetExtensionPodfile1999999999",
|
|
49
|
-
src: podFileContent,
|
|
50
|
-
newSrc: ` target '${targetName}' do\n \n end`,
|
|
51
|
-
anchor: /post_install/,
|
|
52
|
-
offset: 0,
|
|
53
|
-
comment: "#",
|
|
54
|
-
}).contents; */
|
|
55
|
-
/* podFileContent = podFileContent.replace(
|
|
56
|
-
/use_expo_modules!/,
|
|
57
|
-
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
58
|
-
); */
|
|
59
|
-
podFileContent = (0, generateCode_1.mergeContents)({
|
|
60
|
-
tag: 'react-native-widget-extension-1',
|
|
61
|
-
src: podFileContent,
|
|
62
|
-
newSrc: `installer.pods_project.targets.each do |target|
|
|
63
|
-
target.build_configurations.each do |config|
|
|
64
|
-
# Sentry has build errors unless configured as 'YES' for the Sentry target: https://github.com/bndkt/react-native-widget-extension/issues/24
|
|
65
|
-
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name == 'Sentry' ? 'YES' : 'No'
|
|
66
|
-
end
|
|
67
|
-
end`,
|
|
68
|
-
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
69
|
-
offset: 0,
|
|
70
|
-
comment: '#',
|
|
71
|
-
}).contents;
|
|
72
|
-
/* podFileContent = mergeContents({
|
|
73
|
-
tag: "react-native-widget-extension-2",
|
|
74
|
-
src: podFileContent,
|
|
75
|
-
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
76
|
-
anchor: /use_react_native/,
|
|
77
|
-
offset: -1,
|
|
78
|
-
comment: "#",
|
|
79
|
-
}).contents; */
|
|
80
|
-
podFileContent = podFileContent
|
|
81
|
-
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
82
|
-
.concat(`target '${targetName}' do
|
|
83
|
-
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
84
|
-
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
85
|
-
end`)
|
|
86
|
-
.concat(`\n# >>> Inserted by react-native-widget-extension`);
|
|
87
|
-
fs.writeFileSync(podFilePath, podFileContent);
|
|
88
|
-
return config;
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
91
|
-
};
|
|
92
|
-
exports.withPodfile = withPodfile;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins'
|
|
2
|
-
import { mergeContents } from '@expo/config-plugins/build/utils/generateCode'
|
|
3
|
-
import * as fs from 'fs'
|
|
4
|
-
import * as path from 'path'
|
|
5
|
-
|
|
6
|
-
export const withPodfile: ConfigPlugin<{ targetName: string }> = (config, { targetName }) => {
|
|
7
|
-
return withDangerousMod(config, [
|
|
8
|
-
'ios',
|
|
9
|
-
(config) => {
|
|
10
|
-
const podFilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile')
|
|
11
|
-
let podFileContent = fs.readFileSync(podFilePath).toString()
|
|
12
|
-
|
|
13
|
-
/* podFileContent = mergeContents({
|
|
14
|
-
tag: "withWidgetExtensionPodfile1999999999",
|
|
15
|
-
src: podFileContent,
|
|
16
|
-
newSrc: ` target '${targetName}' do\n \n end`,
|
|
17
|
-
anchor: /post_install/,
|
|
18
|
-
offset: 0,
|
|
19
|
-
comment: "#",
|
|
20
|
-
}).contents; */
|
|
21
|
-
|
|
22
|
-
/* podFileContent = podFileContent.replace(
|
|
23
|
-
/use_expo_modules!/,
|
|
24
|
-
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
25
|
-
); */
|
|
26
|
-
|
|
27
|
-
podFileContent = mergeContents({
|
|
28
|
-
tag: 'react-native-widget-extension-1',
|
|
29
|
-
src: podFileContent,
|
|
30
|
-
newSrc: `installer.pods_project.targets.each do |target|
|
|
31
|
-
target.build_configurations.each do |config|
|
|
32
|
-
# Sentry has build errors unless configured as 'YES' for the Sentry target: https://github.com/bndkt/react-native-widget-extension/issues/24
|
|
33
|
-
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name == 'Sentry' ? 'YES' : 'No'
|
|
34
|
-
end
|
|
35
|
-
end`,
|
|
36
|
-
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
37
|
-
offset: 0,
|
|
38
|
-
comment: '#',
|
|
39
|
-
}).contents
|
|
40
|
-
|
|
41
|
-
/* podFileContent = mergeContents({
|
|
42
|
-
tag: "react-native-widget-extension-2",
|
|
43
|
-
src: podFileContent,
|
|
44
|
-
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
45
|
-
anchor: /use_react_native/,
|
|
46
|
-
offset: -1,
|
|
47
|
-
comment: "#",
|
|
48
|
-
}).contents; */
|
|
49
|
-
|
|
50
|
-
podFileContent = podFileContent
|
|
51
|
-
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
52
|
-
.concat(
|
|
53
|
-
`target '${targetName}' do
|
|
54
|
-
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
55
|
-
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
56
|
-
end`
|
|
57
|
-
)
|
|
58
|
-
.concat(`\n# >>> Inserted by react-native-widget-extension`)
|
|
59
|
-
|
|
60
|
-
fs.writeFileSync(podFilePath, podFileContent)
|
|
61
|
-
|
|
62
|
-
return config
|
|
63
|
-
},
|
|
64
|
-
])
|
|
65
|
-
}
|