expo-live-activity 0.2.1-alpha1 → 0.2.2-alpha1
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/.prettierignore +5 -0
- package/.prettierrc +6 -0
- package/README.md +152 -56
- package/app.plugin.js +1 -1
- package/build/ExpoLiveActivityModule.d.ts.map +1 -1
- package/build/ExpoLiveActivityModule.js.map +1 -1
- package/build/index.d.ts +18 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +21 -33
- package/build/index.js.map +1 -1
- package/eslint.config.js +42 -0
- package/ios/ExpoLiveActivityModule.swift +154 -91
- package/ios/Helpers.swift +1 -2
- package/ios-files/Assets.xcassets/AccentColor.colorset/Contents.json +5 -5
- package/ios-files/Assets.xcassets/AppIcon.appiconset/Contents.json +19 -19
- package/ios-files/Assets.xcassets/Contents.json +3 -3
- package/ios-files/Assets.xcassets/WidgetBackground.colorset/Contents.json +5 -5
- package/ios-files/View+applyWidgetURL.swift +15 -1
- package/package.json +18 -6
- package/plugin/build/index.d.ts +1 -1
- package/plugin/build/index.js +8 -3
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +6 -2
- package/plugin/build/lib/getWidgetExtensionEntitlements.js +1 -1
- package/plugin/build/lib/getWidgetFiles.js +18 -17
- package/plugin/build/types.d.ts +1 -1
- package/plugin/build/withConfig.d.ts +1 -1
- package/plugin/build/withPlist.d.ts +5 -0
- package/plugin/build/withPlist.js +25 -0
- package/plugin/build/withPodfile.d.ts +1 -1
- package/plugin/build/withPodfile.js +5 -5
- package/plugin/build/withPushNotifications.d.ts +1 -1
- package/plugin/build/withPushNotifications.js +2 -2
- package/plugin/build/withWidgetExtensionEntitlements.d.ts +1 -1
- package/plugin/build/withWidgetExtensionEntitlements.js +1 -1
- package/plugin/build/withXcode.d.ts +1 -1
- package/plugin/build/withXcode.js +8 -8
- package/plugin/build/xcode/addBuildPhases.d.ts +2 -2
- package/plugin/build/xcode/addBuildPhases.js +8 -10
- package/plugin/build/xcode/addPbxGroup.d.ts +2 -2
- package/plugin/build/xcode/addPbxGroup.js +2 -2
- package/plugin/build/xcode/addProductFile.d.ts +1 -1
- package/plugin/build/xcode/addProductFile.js +3 -3
- package/plugin/build/xcode/addTargetDependency.d.ts +1 -1
- package/plugin/build/xcode/addTargetDependency.js +5 -7
- package/plugin/build/xcode/addToPbxNativeTargetSection.d.ts +1 -1
- package/plugin/build/xcode/addToPbxNativeTargetSection.js +5 -5
- package/plugin/build/xcode/addToPbxProjectSection.d.ts +1 -1
- package/plugin/build/xcode/addToPbxProjectSection.js +1 -2
- package/plugin/build/xcode/addXCConfigurationList.d.ts +1 -1
- package/plugin/build/xcode/addXCConfigurationList.js +6 -6
- package/plugin/src/index.ts +19 -18
- package/plugin/src/lib/getWidgetExtensionEntitlements.ts +10 -13
- package/plugin/src/lib/getWidgetFiles.ts +70 -74
- package/plugin/src/types.ts +3 -5
- package/plugin/src/withConfig.ts +15 -15
- package/plugin/src/withPlist.ts +27 -0
- package/plugin/src/withPodfile.ts +17 -24
- package/plugin/src/withPushNotifications.ts +7 -11
- package/plugin/src/withWidgetExtensionEntitlements.ts +14 -14
- package/plugin/src/withXcode.ts +32 -41
- package/plugin/src/xcode/addBuildPhases.ts +26 -41
- package/plugin/src/xcode/addPbxGroup.ts +9 -16
- package/plugin/src/xcode/addProductFile.ts +7 -7
- package/plugin/src/xcode/addTargetDependency.ts +7 -12
- package/plugin/src/xcode/addToPbxNativeTargetSection.ts +13 -15
- package/plugin/src/xcode/addToPbxProjectSection.ts +7 -17
- package/plugin/src/xcode/addXCConfigurationList.ts +16 -16
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/scripts/update-version.sh +15 -0
- package/src/ExpoLiveActivityModule.ts +2 -2
- package/src/index.ts +69 -55
- package/.eslintrc.js +0 -5
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import * as path from
|
|
1
|
+
import * as fs from 'fs'
|
|
2
|
+
import * as path from 'path'
|
|
3
3
|
|
|
4
4
|
export type WidgetFiles = {
|
|
5
|
-
swiftFiles: string[]
|
|
6
|
-
entitlementFiles: string[]
|
|
7
|
-
plistFiles: string[]
|
|
8
|
-
assetDirectories: string[]
|
|
9
|
-
intentFiles: string[]
|
|
10
|
-
otherFiles: string[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getWidgetFiles(
|
|
14
|
-
targetPath: string,
|
|
15
|
-
) {
|
|
5
|
+
swiftFiles: string[]
|
|
6
|
+
entitlementFiles: string[]
|
|
7
|
+
plistFiles: string[]
|
|
8
|
+
assetDirectories: string[]
|
|
9
|
+
intentFiles: string[]
|
|
10
|
+
otherFiles: string[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getWidgetFiles(targetPath: string) {
|
|
16
14
|
let packagePath
|
|
17
15
|
try {
|
|
18
|
-
packagePath = path.dirname(require.resolve(
|
|
16
|
+
packagePath = path.dirname(require.resolve('expo-live-activity/package.json'))
|
|
19
17
|
} catch {
|
|
20
|
-
console.log(
|
|
18
|
+
console.log('Building for example app')
|
|
21
19
|
}
|
|
22
|
-
const liveActivityFilesPath = path.join(packagePath ? packagePath :
|
|
23
|
-
const imageAssetsPath =
|
|
20
|
+
const liveActivityFilesPath = path.join(packagePath ? packagePath : '..', '/ios-files')
|
|
21
|
+
const imageAssetsPath = './assets/liveActivity'
|
|
24
22
|
|
|
25
23
|
const widgetFiles: WidgetFiles = {
|
|
26
24
|
swiftFiles: [],
|
|
@@ -29,123 +27,121 @@ export function getWidgetFiles(
|
|
|
29
27
|
assetDirectories: [],
|
|
30
28
|
intentFiles: [],
|
|
31
29
|
otherFiles: [],
|
|
32
|
-
}
|
|
30
|
+
}
|
|
33
31
|
|
|
34
32
|
if (!fs.existsSync(targetPath)) {
|
|
35
|
-
fs.mkdirSync(targetPath, { recursive: true })
|
|
33
|
+
fs.mkdirSync(targetPath, { recursive: true })
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
if (fs.lstatSync(liveActivityFilesPath).isDirectory()) {
|
|
39
|
-
const files = fs.readdirSync(liveActivityFilesPath)
|
|
37
|
+
const files = fs.readdirSync(liveActivityFilesPath)
|
|
40
38
|
|
|
41
39
|
files.forEach((file) => {
|
|
42
|
-
const fileExtension = file.split(
|
|
43
|
-
|
|
44
|
-
if (fileExtension ===
|
|
45
|
-
widgetFiles.swiftFiles.push(file)
|
|
46
|
-
} else if (fileExtension ===
|
|
47
|
-
widgetFiles.entitlementFiles.push(file)
|
|
48
|
-
} else if (fileExtension ===
|
|
49
|
-
widgetFiles.plistFiles.push(file)
|
|
50
|
-
} else if (fileExtension ===
|
|
51
|
-
widgetFiles.assetDirectories.push(file)
|
|
52
|
-
} else if (fileExtension ===
|
|
53
|
-
widgetFiles.intentFiles.push(file)
|
|
40
|
+
const fileExtension = file.split('.').pop()
|
|
41
|
+
|
|
42
|
+
if (fileExtension === 'swift') {
|
|
43
|
+
widgetFiles.swiftFiles.push(file)
|
|
44
|
+
} else if (fileExtension === 'entitlements') {
|
|
45
|
+
widgetFiles.entitlementFiles.push(file)
|
|
46
|
+
} else if (fileExtension === 'plist') {
|
|
47
|
+
widgetFiles.plistFiles.push(file)
|
|
48
|
+
} else if (fileExtension === 'xcassets') {
|
|
49
|
+
widgetFiles.assetDirectories.push(file)
|
|
50
|
+
} else if (fileExtension === 'intentdefinition') {
|
|
51
|
+
widgetFiles.intentFiles.push(file)
|
|
54
52
|
} else {
|
|
55
|
-
widgetFiles.otherFiles.push(file)
|
|
53
|
+
widgetFiles.otherFiles.push(file)
|
|
56
54
|
}
|
|
57
|
-
})
|
|
58
|
-
|
|
55
|
+
})
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
// Copy files
|
|
62
|
-
[
|
|
59
|
+
;[
|
|
63
60
|
...widgetFiles.swiftFiles,
|
|
64
61
|
...widgetFiles.entitlementFiles,
|
|
65
62
|
...widgetFiles.plistFiles,
|
|
66
63
|
...widgetFiles.intentFiles,
|
|
67
64
|
...widgetFiles.otherFiles,
|
|
68
65
|
].forEach((file) => {
|
|
69
|
-
const source = path.join(liveActivityFilesPath, file)
|
|
70
|
-
copyFileSync(source, targetPath)
|
|
71
|
-
})
|
|
66
|
+
const source = path.join(liveActivityFilesPath, file)
|
|
67
|
+
copyFileSync(source, targetPath)
|
|
68
|
+
})
|
|
72
69
|
|
|
73
70
|
// Copy assets directory
|
|
74
|
-
const imagesXcassetsSource = path.join(liveActivityFilesPath,
|
|
75
|
-
copyFolderRecursiveSync(imagesXcassetsSource, targetPath)
|
|
71
|
+
const imagesXcassetsSource = path.join(liveActivityFilesPath, 'Assets.xcassets')
|
|
72
|
+
copyFolderRecursiveSync(imagesXcassetsSource, targetPath)
|
|
76
73
|
|
|
77
74
|
// Move images to assets directory
|
|
78
75
|
if (fs.existsSync(imageAssetsPath) && fs.lstatSync(imageAssetsPath).isDirectory()) {
|
|
79
|
-
const imagesXcassetsTarget = path.join(targetPath,
|
|
76
|
+
const imagesXcassetsTarget = path.join(targetPath, 'Assets.xcassets')
|
|
80
77
|
|
|
81
|
-
const files = fs.readdirSync(imageAssetsPath)
|
|
78
|
+
const files = fs.readdirSync(imageAssetsPath)
|
|
82
79
|
|
|
83
80
|
files.forEach((file) => {
|
|
84
81
|
if (path.extname(file).match(/\.(png|jpg|jpeg)$/)) {
|
|
85
|
-
const source = path.join(imageAssetsPath, file)
|
|
86
|
-
const imageSetDir = path.join(imagesXcassetsTarget, `${path.basename(file, path.extname(file))}.imageset`)
|
|
82
|
+
const source = path.join(imageAssetsPath, file)
|
|
83
|
+
const imageSetDir = path.join(imagesXcassetsTarget, `${path.basename(file, path.extname(file))}.imageset`)
|
|
87
84
|
|
|
88
85
|
// Create the .imageset directory if it doesn't exist
|
|
89
86
|
if (!fs.existsSync(imageSetDir)) {
|
|
90
|
-
fs.mkdirSync(imageSetDir, { recursive: true })
|
|
87
|
+
fs.mkdirSync(imageSetDir, { recursive: true })
|
|
91
88
|
}
|
|
92
|
-
|
|
89
|
+
|
|
93
90
|
// Copy image file to the .imageset directory
|
|
94
|
-
const destPath = path.join(imageSetDir, file)
|
|
95
|
-
fs.copyFileSync(source, destPath)
|
|
96
|
-
|
|
91
|
+
const destPath = path.join(imageSetDir, file)
|
|
92
|
+
fs.copyFileSync(source, destPath)
|
|
93
|
+
|
|
97
94
|
// Create Contents.json file
|
|
98
95
|
const contentsJson = {
|
|
99
96
|
images: [
|
|
100
97
|
{
|
|
101
|
-
filename
|
|
102
|
-
idiom
|
|
103
|
-
}
|
|
98
|
+
filename: file,
|
|
99
|
+
idiom: 'universal',
|
|
100
|
+
},
|
|
104
101
|
],
|
|
105
102
|
info: {
|
|
106
|
-
author
|
|
107
|
-
version
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
fs.writeFileSync(
|
|
112
|
-
path.join(imageSetDir, 'Contents.json'),
|
|
113
|
-
JSON.stringify(contentsJson, null, 2)
|
|
114
|
-
);
|
|
103
|
+
author: 'xcode',
|
|
104
|
+
version: 1,
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
fs.writeFileSync(path.join(imageSetDir, 'Contents.json'), JSON.stringify(contentsJson, null, 2))
|
|
115
109
|
}
|
|
116
110
|
})
|
|
117
111
|
} else {
|
|
118
|
-
console.warn(
|
|
112
|
+
console.warn(
|
|
113
|
+
`Warning: Skipping adding images to live activity because directory does not exist at path: ${imageAssetsPath}`
|
|
114
|
+
)
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
return widgetFiles
|
|
117
|
+
return widgetFiles
|
|
122
118
|
}
|
|
123
119
|
|
|
124
120
|
export function copyFileSync(source: string, target: string) {
|
|
125
|
-
let targetFile = target
|
|
121
|
+
let targetFile = target
|
|
126
122
|
|
|
127
123
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
128
|
-
targetFile = path.join(target, path.basename(source))
|
|
124
|
+
targetFile = path.join(target, path.basename(source))
|
|
129
125
|
}
|
|
130
126
|
|
|
131
|
-
fs.writeFileSync(targetFile, fs.readFileSync(source))
|
|
127
|
+
fs.writeFileSync(targetFile, fs.readFileSync(source))
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
function copyFolderRecursiveSync(source: string, target: string) {
|
|
135
|
-
const targetPath = path.join(target, path.basename(source))
|
|
131
|
+
const targetPath = path.join(target, path.basename(source))
|
|
136
132
|
if (!fs.existsSync(targetPath)) {
|
|
137
|
-
fs.mkdirSync(targetPath, { recursive: true })
|
|
133
|
+
fs.mkdirSync(targetPath, { recursive: true })
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
if (fs.lstatSync(source).isDirectory()) {
|
|
141
|
-
const files = fs.readdirSync(source)
|
|
137
|
+
const files = fs.readdirSync(source)
|
|
142
138
|
files.forEach((file) => {
|
|
143
|
-
const currentPath = path.join(source, file)
|
|
139
|
+
const currentPath = path.join(source, file)
|
|
144
140
|
if (fs.lstatSync(currentPath).isDirectory()) {
|
|
145
|
-
copyFolderRecursiveSync(currentPath, targetPath)
|
|
141
|
+
copyFolderRecursiveSync(currentPath, targetPath)
|
|
146
142
|
} else {
|
|
147
|
-
copyFileSync(currentPath, targetPath)
|
|
143
|
+
copyFileSync(currentPath, targetPath)
|
|
148
144
|
}
|
|
149
|
-
})
|
|
145
|
+
})
|
|
150
146
|
}
|
|
151
147
|
}
|
package/plugin/src/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ConfigPlugin } from
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins'
|
|
2
2
|
|
|
3
3
|
interface ConfigPluginProps {
|
|
4
|
-
enablePushNotifications?: boolean
|
|
4
|
+
enablePushNotifications?: boolean
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export type LiveActivityConfigPlugin = ConfigPlugin<
|
|
8
|
-
ConfigPluginProps | undefined
|
|
9
|
-
>;
|
|
7
|
+
export type LiveActivityConfigPlugin = ConfigPlugin<ConfigPluginProps | undefined>
|
package/plugin/src/withConfig.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ConfigPlugin } from
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins'
|
|
2
2
|
|
|
3
|
-
import { addApplicationGroupsEntitlement, getWidgetExtensionEntitlements } from
|
|
3
|
+
import { addApplicationGroupsEntitlement, getWidgetExtensionEntitlements } from './lib/getWidgetExtensionEntitlements'
|
|
4
4
|
|
|
5
5
|
export const withConfig: ConfigPlugin<{
|
|
6
|
-
bundleIdentifier: string
|
|
7
|
-
targetName: string
|
|
8
|
-
groupIdentifier?: string
|
|
6
|
+
bundleIdentifier: string
|
|
7
|
+
targetName: string
|
|
8
|
+
groupIdentifier?: string
|
|
9
9
|
}> = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
|
|
10
|
-
let configIndex: null | number = null
|
|
10
|
+
let configIndex: null | number = null
|
|
11
11
|
config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext: any, index: number) => {
|
|
12
12
|
if (ext.targetName === targetName) {
|
|
13
|
-
configIndex = index
|
|
13
|
+
configIndex = index
|
|
14
14
|
}
|
|
15
|
-
})
|
|
15
|
+
})
|
|
16
16
|
|
|
17
17
|
if (!configIndex) {
|
|
18
18
|
config.extra = {
|
|
@@ -36,27 +36,27 @@ export const withConfig: ConfigPlugin<{
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
-
}
|
|
40
|
-
configIndex = 0
|
|
39
|
+
}
|
|
40
|
+
configIndex = 0
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (configIndex != null && config.extra) {
|
|
44
|
-
const widgetsExtensionConfig = config.extra.eas.build.experimental.ios.appExtensions[configIndex]
|
|
44
|
+
const widgetsExtensionConfig = config.extra.eas.build.experimental.ios.appExtensions[configIndex]
|
|
45
45
|
|
|
46
46
|
widgetsExtensionConfig.entitlements = {
|
|
47
47
|
...widgetsExtensionConfig.entitlements,
|
|
48
48
|
...getWidgetExtensionEntitlements(config.ios, {
|
|
49
49
|
groupIdentifier,
|
|
50
50
|
}),
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
|
|
53
53
|
config.ios = {
|
|
54
54
|
...config.ios,
|
|
55
55
|
entitlements: {
|
|
56
56
|
...addApplicationGroupsEntitlement(config.ios?.entitlements ?? {}, groupIdentifier),
|
|
57
57
|
},
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
return config
|
|
62
|
-
}
|
|
61
|
+
return config
|
|
62
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ConfigPlugin, InfoPlist, withInfoPlist } from '@expo/config-plugins'
|
|
2
|
+
import plist from '@expo/plist'
|
|
3
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
4
|
+
import { join as joinPath } from 'path'
|
|
5
|
+
|
|
6
|
+
const withPlist: ConfigPlugin<{ targetName: string }> = (expoConfig, { targetName }) =>
|
|
7
|
+
withInfoPlist(expoConfig, (plistConfig) => {
|
|
8
|
+
const scheme = typeof expoConfig.scheme === 'string' ? expoConfig.scheme : expoConfig.ios?.bundleIdentifier
|
|
9
|
+
|
|
10
|
+
if (scheme) {
|
|
11
|
+
const targetPath = joinPath(plistConfig.modRequest.platformProjectRoot, targetName)
|
|
12
|
+
const filePath = joinPath(targetPath, 'Info.plist')
|
|
13
|
+
const content = plist.parse(readFileSync(filePath, 'utf8')) as InfoPlist
|
|
14
|
+
|
|
15
|
+
content.CFBundleURLTypes = [
|
|
16
|
+
{
|
|
17
|
+
CFBundleURLSchemes: [scheme],
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
writeFileSync(filePath, plist.build(content))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return plistConfig
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export default withPlist
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as fs from
|
|
4
|
-
import * as path from
|
|
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
5
|
|
|
6
|
-
export const withPodfile: ConfigPlugin<{ targetName: string }> = (
|
|
7
|
-
config,
|
|
8
|
-
{ targetName }
|
|
9
|
-
) => {
|
|
6
|
+
export const withPodfile: ConfigPlugin<{ targetName: string }> = (config, { targetName }) => {
|
|
10
7
|
return withDangerousMod(config, [
|
|
11
|
-
|
|
8
|
+
'ios',
|
|
12
9
|
(config) => {
|
|
13
|
-
const podFilePath = path.join(
|
|
14
|
-
|
|
15
|
-
"Podfile"
|
|
16
|
-
);
|
|
17
|
-
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
10
|
+
const podFilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile')
|
|
11
|
+
let podFileContent = fs.readFileSync(podFilePath).toString()
|
|
18
12
|
|
|
19
13
|
/* podFileContent = mergeContents({
|
|
20
14
|
tag: "withWidgetExtensionPodfile1999999999",
|
|
@@ -31,7 +25,7 @@ export const withPodfile: ConfigPlugin<{ targetName: string }> = (
|
|
|
31
25
|
); */
|
|
32
26
|
|
|
33
27
|
podFileContent = mergeContents({
|
|
34
|
-
tag:
|
|
28
|
+
tag: 'react-native-widget-extension-1',
|
|
35
29
|
src: podFileContent,
|
|
36
30
|
newSrc: `installer.pods_project.targets.each do |target|
|
|
37
31
|
target.build_configurations.each do |config|
|
|
@@ -39,11 +33,10 @@ export const withPodfile: ConfigPlugin<{ targetName: string }> = (
|
|
|
39
33
|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name == 'Sentry' ? 'YES' : 'No'
|
|
40
34
|
end
|
|
41
35
|
end`,
|
|
42
|
-
anchor:
|
|
43
|
-
/installer.target_installation_results.pod_target_installation_results/,
|
|
36
|
+
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
44
37
|
offset: 0,
|
|
45
|
-
comment:
|
|
46
|
-
}).contents
|
|
38
|
+
comment: '#',
|
|
39
|
+
}).contents
|
|
47
40
|
|
|
48
41
|
/* podFileContent = mergeContents({
|
|
49
42
|
tag: "react-native-widget-extension-2",
|
|
@@ -62,11 +55,11 @@ export const withPodfile: ConfigPlugin<{ targetName: string }> = (
|
|
|
62
55
|
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
63
56
|
end`
|
|
64
57
|
)
|
|
65
|
-
.concat(`\n# >>> Inserted by react-native-widget-extension`)
|
|
58
|
+
.concat(`\n# >>> Inserted by react-native-widget-extension`)
|
|
66
59
|
|
|
67
|
-
fs.writeFileSync(podFilePath, podFileContent)
|
|
60
|
+
fs.writeFileSync(podFilePath, podFileContent)
|
|
68
61
|
|
|
69
|
-
return config
|
|
62
|
+
return config
|
|
70
63
|
},
|
|
71
|
-
])
|
|
72
|
-
}
|
|
64
|
+
])
|
|
65
|
+
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigPlugin,
|
|
3
|
-
withEntitlementsPlist,
|
|
4
|
-
withInfoPlist,
|
|
5
|
-
} from "@expo/config-plugins";
|
|
1
|
+
import { ConfigPlugin, withEntitlementsPlist, withInfoPlist } from '@expo/config-plugins'
|
|
6
2
|
|
|
7
3
|
export const withPushNotifications: ConfigPlugin = (config) =>
|
|
8
4
|
withInfoPlist(
|
|
9
5
|
withEntitlementsPlist(config, (mod) => {
|
|
10
|
-
mod.modResults[
|
|
11
|
-
return mod
|
|
6
|
+
mod.modResults['aps-environment'] = 'development'
|
|
7
|
+
return mod
|
|
12
8
|
}),
|
|
13
9
|
(mod) => {
|
|
14
|
-
mod.modResults[
|
|
15
|
-
return mod
|
|
16
|
-
}
|
|
17
|
-
)
|
|
10
|
+
mod.modResults['ExpoLiveActivity_EnablePushNotifications'] = true
|
|
11
|
+
return mod
|
|
12
|
+
}
|
|
13
|
+
)
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as fs from
|
|
4
|
-
import * as path from
|
|
1
|
+
import { ConfigPlugin, withInfoPlist } from '@expo/config-plugins'
|
|
2
|
+
import plist from '@expo/plist'
|
|
3
|
+
import * as fs from 'fs'
|
|
4
|
+
import * as path from 'path'
|
|
5
5
|
|
|
6
6
|
// import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
|
|
7
7
|
|
|
8
8
|
export const withWidgetExtensionEntitlements: ConfigPlugin<{
|
|
9
|
-
targetName: string
|
|
10
|
-
targetPath: string
|
|
9
|
+
targetName: string
|
|
10
|
+
targetPath: string
|
|
11
11
|
// groupIdentifier: string;
|
|
12
|
-
appleSignin: boolean
|
|
12
|
+
appleSignin: boolean
|
|
13
13
|
}> = (config, { targetName }) => {
|
|
14
14
|
return withInfoPlist(config, (config) => {
|
|
15
|
-
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName)
|
|
16
|
-
const filePath = path.join(targetPath, `${targetName}.entitlements`)
|
|
15
|
+
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName)
|
|
16
|
+
const filePath = path.join(targetPath, `${targetName}.entitlements`)
|
|
17
17
|
|
|
18
18
|
// const appClipEntitlements = getWidgetExtensionEntitlements(config.ios, {
|
|
19
19
|
// });
|
|
20
20
|
|
|
21
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
22
|
-
fs.writeFileSync(filePath, plist.build({}))
|
|
23
|
-
return config
|
|
24
|
-
})
|
|
25
|
-
}
|
|
21
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
22
|
+
fs.writeFileSync(filePath, plist.build({}))
|
|
23
|
+
return config
|
|
24
|
+
})
|
|
25
|
+
}
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -1,76 +1,67 @@
|
|
|
1
|
-
import { ConfigPlugin, withXcodeProject } from
|
|
2
|
-
import * as path from
|
|
1
|
+
import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins'
|
|
2
|
+
import * as path from 'path'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { addTargetDependency } from
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { getWidgetFiles } from './lib/getWidgetFiles'
|
|
5
|
+
import { addBuildPhases } from './xcode/addBuildPhases'
|
|
6
|
+
import { addPbxGroup } from './xcode/addPbxGroup'
|
|
7
|
+
import { addProductFile } from './xcode/addProductFile'
|
|
8
|
+
import { addTargetDependency } from './xcode/addTargetDependency'
|
|
9
|
+
import { addToPbxNativeTargetSection } from './xcode/addToPbxNativeTargetSection'
|
|
10
|
+
import { addToPbxProjectSection } from './xcode/addToPbxProjectSection'
|
|
11
|
+
import { addXCConfigurationList } from './xcode/addXCConfigurationList'
|
|
12
12
|
|
|
13
13
|
export const withXcode: ConfigPlugin<{
|
|
14
|
-
targetName: string
|
|
15
|
-
bundleIdentifier: string
|
|
16
|
-
deploymentTarget: string
|
|
17
|
-
}> = (
|
|
18
|
-
config,
|
|
19
|
-
{
|
|
20
|
-
targetName,
|
|
21
|
-
bundleIdentifier,
|
|
22
|
-
deploymentTarget,
|
|
23
|
-
}
|
|
24
|
-
) => {
|
|
14
|
+
targetName: string
|
|
15
|
+
bundleIdentifier: string
|
|
16
|
+
deploymentTarget: string
|
|
17
|
+
}> = (config, { targetName, bundleIdentifier, deploymentTarget }) => {
|
|
25
18
|
return withXcodeProject(config, (config) => {
|
|
26
|
-
const xcodeProject = config.modResults
|
|
27
|
-
const targetUuid = xcodeProject.generateUuid()
|
|
28
|
-
const groupName =
|
|
29
|
-
const { platformProjectRoot } = config.modRequest
|
|
30
|
-
const marketingVersion = config.version
|
|
19
|
+
const xcodeProject = config.modResults
|
|
20
|
+
const targetUuid = xcodeProject.generateUuid()
|
|
21
|
+
const groupName = 'Embed Foundation Extensions'
|
|
22
|
+
const { platformProjectRoot } = config.modRequest
|
|
23
|
+
const marketingVersion = config.version
|
|
31
24
|
|
|
32
|
-
const targetPath = path.join(platformProjectRoot, targetName)
|
|
25
|
+
const targetPath = path.join(platformProjectRoot, targetName)
|
|
33
26
|
|
|
34
|
-
const widgetFiles = getWidgetFiles(
|
|
35
|
-
targetPath,
|
|
36
|
-
);
|
|
27
|
+
const widgetFiles = getWidgetFiles(targetPath)
|
|
37
28
|
|
|
38
29
|
const xCConfigurationList = addXCConfigurationList(xcodeProject, {
|
|
39
30
|
targetName,
|
|
40
|
-
currentProjectVersion: config.ios!.buildNumber ||
|
|
31
|
+
currentProjectVersion: config.ios!.buildNumber || '1',
|
|
41
32
|
bundleIdentifier,
|
|
42
33
|
deploymentTarget,
|
|
43
34
|
marketingVersion,
|
|
44
|
-
})
|
|
35
|
+
})
|
|
45
36
|
|
|
46
37
|
const productFile = addProductFile(xcodeProject, {
|
|
47
38
|
targetName,
|
|
48
39
|
groupName,
|
|
49
|
-
})
|
|
40
|
+
})
|
|
50
41
|
|
|
51
42
|
const target = addToPbxNativeTargetSection(xcodeProject, {
|
|
52
43
|
targetName,
|
|
53
44
|
targetUuid,
|
|
54
45
|
productFile,
|
|
55
46
|
xCConfigurationList,
|
|
56
|
-
})
|
|
47
|
+
})
|
|
57
48
|
|
|
58
|
-
addToPbxProjectSection(xcodeProject, target)
|
|
49
|
+
addToPbxProjectSection(xcodeProject, target)
|
|
59
50
|
|
|
60
|
-
addTargetDependency(xcodeProject, target)
|
|
51
|
+
addTargetDependency(xcodeProject, target)
|
|
61
52
|
|
|
62
53
|
addBuildPhases(xcodeProject, {
|
|
63
54
|
targetUuid,
|
|
64
55
|
groupName,
|
|
65
56
|
productFile,
|
|
66
57
|
widgetFiles,
|
|
67
|
-
})
|
|
58
|
+
})
|
|
68
59
|
|
|
69
60
|
addPbxGroup(xcodeProject, {
|
|
70
61
|
targetName,
|
|
71
62
|
widgetFiles,
|
|
72
|
-
})
|
|
63
|
+
})
|
|
73
64
|
|
|
74
|
-
return config
|
|
75
|
-
})
|
|
76
|
-
}
|
|
65
|
+
return config
|
|
66
|
+
})
|
|
67
|
+
}
|