react-native-ios-widget 0.0.7 → 0.0.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/build/index.d.ts +2 -8
- package/plugin/build/index.js +14 -16
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +4 -4
- package/plugin/build/lib/getWidgetExtensionEntitlements.js +5 -5
- package/plugin/build/lib/getWidgetFiles.d.ts +1 -2
- package/plugin/build/lib/getWidgetFiles.js +9 -10
- package/plugin/build/types.d.ts +9 -0
- package/plugin/build/types.js +2 -0
- package/plugin/build/withConfig.d.ts +2 -6
- package/plugin/build/withConfig.js +1 -1
- package/plugin/build/withPodfile.d.ts +2 -5
- package/plugin/build/withPodfile.js +15 -15
- package/plugin/build/withWidgetExtensionEntitlements.d.ts +2 -7
- package/plugin/build/withXcode.d.ts +2 -7
- package/plugin/build/withXcode.js +9 -15
- package/plugin/src/index.ts +18 -24
- package/plugin/src/lib/getWidgetExtensionEntitlements.ts +6 -6
- package/plugin/src/lib/getWidgetFiles.ts +8 -8
- package/plugin/src/types.ts +9 -0
- package/plugin/src/withConfig.ts +5 -6
- package/plugin/src/withPodfile.ts +19 -19
- package/plugin/src/withWidgetExtensionEntitlements.ts +4 -7
- package/plugin/src/withXcode.ts +12 -28
- package/_widgets/EmojiRanger/AdventureActivityConfiguration.swift +0 -71
- package/_widgets/EmojiRanger/AllCharactersView.swift +0 -43
- package/_widgets/EmojiRanger/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/_widgets/EmojiRanger/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -13
- package/_widgets/EmojiRanger/Assets.xcassets/Contents.json +0 -6
- package/_widgets/EmojiRanger/Assets.xcassets/WidgetBackground.colorset/Contents.json +0 -11
- package/_widgets/EmojiRanger/Attributes.swift +0 -21
- package/_widgets/EmojiRanger/EmojiRanger.swift +0 -248
- package/_widgets/EmojiRanger/EmojiRangersWidget.intentdefinition +0 -118
- package/_widgets/EmojiRanger/EmojiRangersWidget.swift +0 -189
- package/_widgets/EmojiRanger/EmojiRangersWidgetBundle.swift +0 -21
- package/_widgets/EmojiRanger/ImageURLProtocol.swift +0 -66
- package/_widgets/EmojiRanger/Info.plist +0 -11
- package/_widgets/EmojiRanger/LeaderboardWidget.swift +0 -93
- package/_widgets/EmojiRanger/Module.swift +0 -94
- package/_widgets/PizzaDelivery/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/_widgets/PizzaDelivery/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -13
- package/_widgets/PizzaDelivery/Assets.xcassets/Contents.json +0 -6
- package/_widgets/PizzaDelivery/Assets.xcassets/WidgetBackground.colorset/Contents.json +0 -11
- package/_widgets/PizzaDelivery/Attributes.swift +0 -15
- package/_widgets/PizzaDelivery/Info.plist +0 -11
- package/_widgets/PizzaDelivery/LiveActivity.swift +0 -108
- package/_widgets/PizzaDelivery/Module.swift +0 -94
- package/_widgets/PizzaDelivery/WidgetBundle.swift +0 -13
- package/_widgets/PizzaDelivery/Widgets.swift +0 -59
package/package.json
CHANGED
package/plugin/build/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
widgetsFolder?: string;
|
|
5
|
-
deploymentTarget?: string;
|
|
6
|
-
groupIdentifier?: string;
|
|
7
|
-
pods?: string[];
|
|
8
|
-
widgetName: string;
|
|
9
|
-
}>;
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
declare const withWidget: ConfigPlugin<WidgetConfig>;
|
|
10
4
|
export default withWidget;
|
package/plugin/build/index.js
CHANGED
|
@@ -5,23 +5,21 @@ const withXcode_1 = require("./withXcode");
|
|
|
5
5
|
const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlements");
|
|
6
6
|
const withPodfile_1 = require("./withPodfile");
|
|
7
7
|
const withConfig_1 = require("./withConfig");
|
|
8
|
-
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods, }) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods = [], targetName = "WidgetsExtension", bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`, }) => {
|
|
9
|
+
const widget = {
|
|
10
|
+
enabled,
|
|
11
|
+
deploymentTarget,
|
|
12
|
+
widgetsFolder,
|
|
13
|
+
groupIdentifier,
|
|
14
|
+
pods,
|
|
15
|
+
targetName,
|
|
16
|
+
bundleIdentifier,
|
|
17
|
+
};
|
|
11
18
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
targetName,
|
|
17
|
-
bundleIdentifier,
|
|
18
|
-
deploymentTarget,
|
|
19
|
-
widgetsFolder,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { enabled, targetName, groupIdentifier }],
|
|
23
|
-
[withPodfile_1.withPodfile, { enabled, targetName, pods }],
|
|
24
|
-
[withConfig_1.withConfig, { enabled, targetName, bundleIdentifier, groupIdentifier }],
|
|
19
|
+
[withXcode_1.withXcode, widget],
|
|
20
|
+
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, widget],
|
|
21
|
+
[withPodfile_1.withPodfile, widget],
|
|
22
|
+
[withConfig_1.withConfig, widget],
|
|
25
23
|
]);
|
|
26
24
|
};
|
|
27
25
|
exports.default = withWidget;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
|
-
export declare
|
|
3
|
-
groupIdentifier?: string;
|
|
4
|
-
})
|
|
5
|
-
export declare
|
|
2
|
+
export declare const getWidgetExtensionEntitlements: (iosConfig: ExportedConfig["ios"], { groupIdentifier, }: {
|
|
3
|
+
groupIdentifier?: string | undefined;
|
|
4
|
+
}) => InfoPlist;
|
|
5
|
+
export declare const addApplicationGroupsEntitlement: (entitlements: InfoPlist, groupIdentifier?: string) => InfoPlist;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addApplicationGroupsEntitlement = exports.getWidgetExtensionEntitlements = void 0;
|
|
4
|
-
|
|
4
|
+
const getWidgetExtensionEntitlements = (iosConfig, { groupIdentifier, }) => {
|
|
5
5
|
const entitlements = {};
|
|
6
|
-
addApplicationGroupsEntitlement(entitlements, groupIdentifier);
|
|
6
|
+
(0, exports.addApplicationGroupsEntitlement)(entitlements, groupIdentifier);
|
|
7
7
|
return entitlements;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
exports.getWidgetExtensionEntitlements = getWidgetExtensionEntitlements;
|
|
10
|
-
|
|
10
|
+
const addApplicationGroupsEntitlement = (entitlements, groupIdentifier) => {
|
|
11
11
|
if (groupIdentifier) {
|
|
12
12
|
const existingApplicationGroups = entitlements["com.apple.security.application-groups"] ?? [];
|
|
13
13
|
entitlements["com.apple.security.application-groups"] = [
|
|
@@ -16,5 +16,5 @@ function addApplicationGroupsEntitlement(entitlements, groupIdentifier) {
|
|
|
16
16
|
];
|
|
17
17
|
}
|
|
18
18
|
return entitlements;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
exports.addApplicationGroupsEntitlement = addApplicationGroupsEntitlement;
|
|
@@ -5,5 +5,4 @@ export type WidgetFiles = {
|
|
|
5
5
|
fontFiles: string[];
|
|
6
6
|
assetDirectories: string[];
|
|
7
7
|
};
|
|
8
|
-
export declare
|
|
9
|
-
export declare function copyFileSync(source: string, target: string): void;
|
|
8
|
+
export declare const getWidgetFiles: (widgetsPath: string, targetPath: string) => WidgetFiles;
|
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.getWidgetFiles = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
|
-
|
|
29
|
+
const getWidgetFiles = (widgetsPath, targetPath) => {
|
|
30
30
|
const widgetFiles = {
|
|
31
31
|
swiftFiles: [],
|
|
32
32
|
entitlementFiles: [],
|
|
@@ -76,20 +76,19 @@ function getWidgetFiles(widgetsPath, targetPath) {
|
|
|
76
76
|
// Copy directories
|
|
77
77
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
78
78
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
79
|
-
|
|
79
|
+
copyDirectorySync(imagesXcassetsSource, targetPath);
|
|
80
80
|
});
|
|
81
81
|
return widgetFiles;
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
exports.getWidgetFiles = getWidgetFiles;
|
|
84
|
-
|
|
84
|
+
const copyFileSync = (source, target) => {
|
|
85
85
|
let targetFile = target;
|
|
86
86
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
87
87
|
targetFile = path.join(target, path.basename(source));
|
|
88
88
|
}
|
|
89
89
|
fs.writeFileSync(targetFile, fs.readFileSync(source));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function copyFolderRecursiveSync(source, target) {
|
|
90
|
+
};
|
|
91
|
+
const copyDirectorySync = (source, target) => {
|
|
93
92
|
const targetPath = path.join(target, path.basename(source));
|
|
94
93
|
if (!fs.existsSync(targetPath)) {
|
|
95
94
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
@@ -99,11 +98,11 @@ function copyFolderRecursiveSync(source, target) {
|
|
|
99
98
|
files.forEach((file) => {
|
|
100
99
|
const currentPath = path.join(source, file);
|
|
101
100
|
if (fs.lstatSync(currentPath).isDirectory()) {
|
|
102
|
-
|
|
101
|
+
copyDirectorySync(currentPath, targetPath);
|
|
103
102
|
}
|
|
104
103
|
else {
|
|
105
104
|
copyFileSync(currentPath, targetPath);
|
|
106
105
|
}
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
|
-
}
|
|
108
|
+
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
bundleIdentifier: string;
|
|
5
|
-
targetName: string;
|
|
6
|
-
groupIdentifier?: string;
|
|
7
|
-
}>;
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withConfig: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withConfig = void 0;
|
|
4
4
|
const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
|
|
5
|
-
const withConfig = (config, { enabled,
|
|
5
|
+
const withConfig = (config, { enabled, groupIdentifier, targetName, bundleIdentifier }) => {
|
|
6
6
|
if (!enabled) {
|
|
7
7
|
return config;
|
|
8
8
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
targetName: string;
|
|
5
|
-
pods?: string[];
|
|
6
|
-
}>;
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withPodfile: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -28,7 +28,7 @@ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
|
28
28
|
const config_plugins_1 = require("expo/config-plugins");
|
|
29
29
|
const fs = __importStar(require("fs"));
|
|
30
30
|
const path = __importStar(require("path"));
|
|
31
|
-
const withPodfile = (config, { enabled, targetName, pods
|
|
31
|
+
const withPodfile = (config, { enabled, targetName, pods }) => {
|
|
32
32
|
if (!enabled) {
|
|
33
33
|
return config;
|
|
34
34
|
}
|
|
@@ -38,26 +38,26 @@ const withPodfile = (config, { enabled, targetName, pods = [] }) => {
|
|
|
38
38
|
const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
39
39
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
40
40
|
podFileContent = (0, generateCode_1.mergeContents)({
|
|
41
|
-
tag: "react-native-widget
|
|
41
|
+
tag: "react-native-ios-widget",
|
|
42
42
|
src: podFileContent,
|
|
43
|
-
newSrc:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
newSrc: `\t\tinstaller.pods_project.targets.each do |target|
|
|
44
|
+
\t\t\ttarget.build_configurations.each do |config|
|
|
45
|
+
\t\t\t\tconfig.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
46
|
+
\t\t\tend
|
|
47
|
+
\t\tend`,
|
|
48
48
|
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
49
|
-
offset:
|
|
50
|
-
comment: "#",
|
|
49
|
+
offset: 8,
|
|
50
|
+
comment: "\t\t#",
|
|
51
51
|
}).contents;
|
|
52
52
|
podFileContent = podFileContent
|
|
53
|
-
.concat(`\n\n# >>> Inserted by react-native-widget
|
|
53
|
+
.concat(`\n\n# >>> Inserted by react-native-ios-widget\n`)
|
|
54
54
|
.concat(`target '${targetName}' do
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
\tuse_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
56
|
+
\tuse_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.concat(`\n# >>> Inserted by react-native-widget
|
|
58
|
+
${pods.map((pod) => `\tpod '${pod}'`).join("\n")}
|
|
59
|
+
end`)
|
|
60
|
+
.concat(`\n# >>> Inserted by react-native-ios-widget`);
|
|
61
61
|
fs.writeFileSync(podFilePath, podFileContent);
|
|
62
62
|
return config;
|
|
63
63
|
},
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
targetName: string;
|
|
5
|
-
targetPath: string;
|
|
6
|
-
groupIdentifier: string;
|
|
7
|
-
appleSignin: boolean;
|
|
8
|
-
}>;
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withWidgetExtensionEntitlements: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
targetName: string;
|
|
5
|
-
bundleIdentifier: string;
|
|
6
|
-
deploymentTarget: string;
|
|
7
|
-
widgetsFolder: string;
|
|
8
|
-
}>;
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withXcode: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -35,24 +35,16 @@ const addPbxGroup_1 = require("./xcode/addPbxGroup");
|
|
|
35
35
|
const addBuildPhases_1 = require("./xcode/addBuildPhases");
|
|
36
36
|
const getWidgetFiles_1 = require("./lib/getWidgetFiles");
|
|
37
37
|
const withXcode = (config, { enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
|
|
38
|
-
if (!enabled) {
|
|
39
|
-
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
40
|
-
const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
|
|
41
|
-
const { platformProjectRoot } = config.modRequest;
|
|
42
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
43
|
-
(0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
|
|
44
|
-
return config;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
38
|
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
48
|
-
const
|
|
49
|
-
const widgetsPath = path.join(
|
|
50
|
-
const targetUuid = xcodeProject.generateUuid();
|
|
51
|
-
const groupName = "Embed Foundation Extensions";
|
|
52
|
-
const { platformProjectRoot } = config.modRequest;
|
|
53
|
-
const marketingVersion = config.version;
|
|
39
|
+
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
40
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
54
41
|
const targetPath = path.join(platformProjectRoot, targetName);
|
|
55
42
|
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
|
|
43
|
+
if (!enabled) {
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
const xcodeProject = config.modResults;
|
|
47
|
+
const marketingVersion = config.version;
|
|
56
48
|
const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
|
|
57
49
|
targetName,
|
|
58
50
|
currentProjectVersion: config.ios.buildNumber || "1",
|
|
@@ -60,10 +52,12 @@ const withXcode = (config, { enabled, targetName, bundleIdentifier, deploymentTa
|
|
|
60
52
|
deploymentTarget,
|
|
61
53
|
marketingVersion,
|
|
62
54
|
});
|
|
55
|
+
const groupName = "Embed Foundation Extensions";
|
|
63
56
|
const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
|
|
64
57
|
targetName,
|
|
65
58
|
groupName,
|
|
66
59
|
});
|
|
60
|
+
const targetUuid = xcodeProject.generateUuid();
|
|
67
61
|
const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
|
|
68
62
|
targetName,
|
|
69
63
|
targetUuid,
|
package/plugin/src/index.ts
CHANGED
|
@@ -3,41 +3,35 @@ import { withXcode } from "./withXcode";
|
|
|
3
3
|
import { withWidgetExtensionEntitlements } from "./withWidgetExtensionEntitlements";
|
|
4
4
|
import { withPodfile } from "./withPodfile";
|
|
5
5
|
import { withConfig } from "./withConfig";
|
|
6
|
+
import { WidgetConfig } from "./types";
|
|
6
7
|
|
|
7
|
-
const withWidget: ConfigPlugin<
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
widgetsFolder?: string;
|
|
10
|
-
deploymentTarget?: string;
|
|
11
|
-
groupIdentifier?: string;
|
|
12
|
-
pods?: string[];
|
|
13
|
-
widgetName: string;
|
|
14
|
-
}> = (
|
|
8
|
+
const withWidget: ConfigPlugin<WidgetConfig> = (
|
|
15
9
|
config,
|
|
16
10
|
{
|
|
17
11
|
enabled = true,
|
|
18
12
|
deploymentTarget = "14.0",
|
|
19
13
|
widgetsFolder = "widgets",
|
|
20
14
|
groupIdentifier,
|
|
21
|
-
pods,
|
|
15
|
+
pods = [],
|
|
16
|
+
targetName = "WidgetsExtension",
|
|
17
|
+
bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`,
|
|
22
18
|
}
|
|
23
19
|
) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
20
|
+
const widget: WidgetConfig = {
|
|
21
|
+
enabled,
|
|
22
|
+
deploymentTarget,
|
|
23
|
+
widgetsFolder,
|
|
24
|
+
groupIdentifier,
|
|
25
|
+
pods,
|
|
26
|
+
targetName,
|
|
27
|
+
bundleIdentifier,
|
|
28
|
+
};
|
|
26
29
|
|
|
27
30
|
return withPlugins(config, [
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
targetName,
|
|
33
|
-
bundleIdentifier,
|
|
34
|
-
deploymentTarget,
|
|
35
|
-
widgetsFolder,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
[withWidgetExtensionEntitlements, { enabled, targetName, groupIdentifier }],
|
|
39
|
-
[withPodfile, { enabled, targetName, pods }],
|
|
40
|
-
[withConfig, { enabled, targetName, bundleIdentifier, groupIdentifier }],
|
|
31
|
+
[withXcode, widget],
|
|
32
|
+
[withWidgetExtensionEntitlements, widget],
|
|
33
|
+
[withPodfile, widget],
|
|
34
|
+
[withConfig, widget],
|
|
41
35
|
]);
|
|
42
36
|
};
|
|
43
37
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export const getWidgetExtensionEntitlements = (
|
|
4
4
|
iosConfig: ExportedConfig["ios"],
|
|
5
5
|
{
|
|
6
6
|
groupIdentifier,
|
|
7
7
|
}: {
|
|
8
8
|
groupIdentifier?: string;
|
|
9
9
|
}
|
|
10
|
-
) {
|
|
10
|
+
) => {
|
|
11
11
|
const entitlements: InfoPlist = {};
|
|
12
12
|
|
|
13
13
|
addApplicationGroupsEntitlement(entitlements, groupIdentifier);
|
|
14
14
|
|
|
15
15
|
return entitlements;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export const addApplicationGroupsEntitlement = (
|
|
19
19
|
entitlements: InfoPlist,
|
|
20
20
|
groupIdentifier?: string
|
|
21
|
-
) {
|
|
21
|
+
) => {
|
|
22
22
|
if (groupIdentifier) {
|
|
23
23
|
const existingApplicationGroups =
|
|
24
24
|
(entitlements["com.apple.security.application-groups"] as string[]) ?? [];
|
|
@@ -30,4 +30,4 @@ export function addApplicationGroupsEntitlement(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return entitlements;
|
|
33
|
-
}
|
|
33
|
+
};
|
|
@@ -9,7 +9,7 @@ export type WidgetFiles = {
|
|
|
9
9
|
assetDirectories: string[];
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export const getWidgetFiles = (widgetsPath: string, targetPath: string) => {
|
|
13
13
|
const widgetFiles: WidgetFiles = {
|
|
14
14
|
swiftFiles: [],
|
|
15
15
|
entitlementFiles: [],
|
|
@@ -65,13 +65,13 @@ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
|
|
|
65
65
|
// Copy directories
|
|
66
66
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
67
67
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
68
|
-
|
|
68
|
+
copyDirectorySync(imagesXcassetsSource, targetPath);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
return widgetFiles;
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const copyFileSync = (source: string, target: string) => {
|
|
75
75
|
let targetFile = target;
|
|
76
76
|
|
|
77
77
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
@@ -79,9 +79,9 @@ export function copyFileSync(source: string, target: string) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
fs.writeFileSync(targetFile, fs.readFileSync(source));
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const copyDirectorySync = (source: string, target: string) => {
|
|
85
85
|
const targetPath = path.join(target, path.basename(source));
|
|
86
86
|
if (!fs.existsSync(targetPath)) {
|
|
87
87
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
@@ -92,10 +92,10 @@ function copyFolderRecursiveSync(source: string, target: string) {
|
|
|
92
92
|
files.forEach((file) => {
|
|
93
93
|
const currentPath = path.join(source, file);
|
|
94
94
|
if (fs.lstatSync(currentPath).isDirectory()) {
|
|
95
|
-
|
|
95
|
+
copyDirectorySync(currentPath, targetPath);
|
|
96
96
|
} else {
|
|
97
97
|
copyFileSync(currentPath, targetPath);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
};
|
package/plugin/src/withConfig.ts
CHANGED
|
@@ -3,13 +3,12 @@ import {
|
|
|
3
3
|
addApplicationGroupsEntitlement,
|
|
4
4
|
getWidgetExtensionEntitlements,
|
|
5
5
|
} from "./lib/getWidgetExtensionEntitlements";
|
|
6
|
+
import { WidgetConfig } from "./types";
|
|
6
7
|
|
|
7
|
-
export const withConfig: ConfigPlugin<
|
|
8
|
-
|
|
9
|
-
bundleIdentifier
|
|
10
|
-
|
|
11
|
-
groupIdentifier?: string;
|
|
12
|
-
}> = (config, { enabled, bundleIdentifier, targetName, groupIdentifier }) => {
|
|
8
|
+
export const withConfig: ConfigPlugin<Required<WidgetConfig>> = (
|
|
9
|
+
config,
|
|
10
|
+
{ enabled, groupIdentifier, targetName, bundleIdentifier }
|
|
11
|
+
) => {
|
|
13
12
|
if (!enabled) {
|
|
14
13
|
return config;
|
|
15
14
|
}
|
|
@@ -2,12 +2,12 @@ import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
|
|
|
2
2
|
import { ConfigPlugin, withDangerousMod } from "expo/config-plugins";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
+
import { WidgetConfig } from "./types";
|
|
5
6
|
|
|
6
|
-
export const withPodfile: ConfigPlugin<
|
|
7
|
-
|
|
8
|
-
targetName
|
|
9
|
-
|
|
10
|
-
}> = (config, { enabled, targetName, pods = [] }) => {
|
|
7
|
+
export const withPodfile: ConfigPlugin<Required<WidgetConfig>> = (
|
|
8
|
+
config,
|
|
9
|
+
{ enabled, targetName, pods }
|
|
10
|
+
) => {
|
|
11
11
|
if (!enabled) {
|
|
12
12
|
return config;
|
|
13
13
|
}
|
|
@@ -22,30 +22,30 @@ export const withPodfile: ConfigPlugin<{
|
|
|
22
22
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
23
23
|
|
|
24
24
|
podFileContent = mergeContents({
|
|
25
|
-
tag: "react-native-widget
|
|
25
|
+
tag: "react-native-ios-widget",
|
|
26
26
|
src: podFileContent,
|
|
27
|
-
newSrc:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
newSrc: `\t\tinstaller.pods_project.targets.each do |target|
|
|
28
|
+
\t\t\ttarget.build_configurations.each do |config|
|
|
29
|
+
\t\t\t\tconfig.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
30
|
+
\t\t\tend
|
|
31
|
+
\t\tend`,
|
|
32
32
|
anchor:
|
|
33
33
|
/installer.target_installation_results.pod_target_installation_results/,
|
|
34
|
-
offset:
|
|
35
|
-
comment: "#",
|
|
34
|
+
offset: 8,
|
|
35
|
+
comment: "\t\t#",
|
|
36
36
|
}).contents;
|
|
37
37
|
|
|
38
38
|
podFileContent = podFileContent
|
|
39
|
-
.concat(`\n\n# >>> Inserted by react-native-widget
|
|
39
|
+
.concat(`\n\n# >>> Inserted by react-native-ios-widget\n`)
|
|
40
40
|
.concat(
|
|
41
41
|
`target '${targetName}' do
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
\tuse_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
43
|
+
\tuse_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
${pods.map((pod) => `\tpod '${pod}'`).join("\n")}
|
|
46
|
+
end`
|
|
47
47
|
)
|
|
48
|
-
.concat(`\n# >>> Inserted by react-native-widget
|
|
48
|
+
.concat(`\n# >>> Inserted by react-native-ios-widget`);
|
|
49
49
|
|
|
50
50
|
fs.writeFileSync(podFilePath, podFileContent);
|
|
51
51
|
|
|
@@ -4,14 +4,11 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
|
|
6
6
|
import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
|
|
7
|
+
import { WidgetConfig } from "./types";
|
|
7
8
|
|
|
8
|
-
export const withWidgetExtensionEntitlements: ConfigPlugin<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
targetPath: string;
|
|
12
|
-
groupIdentifier: string;
|
|
13
|
-
appleSignin: boolean;
|
|
14
|
-
}> = (config, { enabled, targetName, groupIdentifier }) => {
|
|
9
|
+
export const withWidgetExtensionEntitlements: ConfigPlugin<
|
|
10
|
+
Required<WidgetConfig>
|
|
11
|
+
> = (config, { enabled, targetName, groupIdentifier }) => {
|
|
15
12
|
if (!enabled) {
|
|
16
13
|
return config;
|
|
17
14
|
}
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -9,43 +9,25 @@ import { addTargetDependency } from "./xcode/addTargetDependency";
|
|
|
9
9
|
import { addPbxGroup } from "./xcode/addPbxGroup";
|
|
10
10
|
import { addBuildPhases } from "./xcode/addBuildPhases";
|
|
11
11
|
import { getWidgetFiles } from "./lib/getWidgetFiles";
|
|
12
|
+
import { WidgetConfig } from "./types";
|
|
12
13
|
|
|
13
|
-
export const withXcode: ConfigPlugin<
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
targetName: string;
|
|
16
|
-
bundleIdentifier: string;
|
|
17
|
-
deploymentTarget: string;
|
|
18
|
-
widgetsFolder: string;
|
|
19
|
-
}> = (
|
|
14
|
+
export const withXcode: ConfigPlugin<Required<WidgetConfig>> = (
|
|
20
15
|
config,
|
|
21
16
|
{ enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
|
|
22
17
|
) => {
|
|
23
|
-
if (!enabled) {
|
|
24
|
-
return withXcodeProject(config, (config) => {
|
|
25
|
-
const widgetsPath = path.join(
|
|
26
|
-
config.modRequest.projectRoot,
|
|
27
|
-
widgetsFolder
|
|
28
|
-
);
|
|
29
|
-
const { platformProjectRoot } = config.modRequest;
|
|
30
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
31
|
-
getWidgetFiles(widgetsPath, targetPath);
|
|
32
|
-
return config;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
18
|
return withXcodeProject(config, (config) => {
|
|
37
|
-
const
|
|
38
|
-
const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
|
|
39
|
-
|
|
40
|
-
const targetUuid = xcodeProject.generateUuid();
|
|
41
|
-
const groupName = "Embed Foundation Extensions";
|
|
42
|
-
const { platformProjectRoot } = config.modRequest;
|
|
43
|
-
const marketingVersion = config.version;
|
|
19
|
+
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
44
20
|
|
|
21
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
45
22
|
const targetPath = path.join(platformProjectRoot, targetName);
|
|
46
|
-
|
|
47
23
|
const widgetFiles = getWidgetFiles(widgetsPath, targetPath);
|
|
48
24
|
|
|
25
|
+
if (!enabled) {
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const xcodeProject = config.modResults;
|
|
30
|
+
const marketingVersion = config.version;
|
|
49
31
|
const xCConfigurationList = addXCConfigurationList(xcodeProject, {
|
|
50
32
|
targetName,
|
|
51
33
|
currentProjectVersion: config.ios!.buildNumber || "1",
|
|
@@ -54,11 +36,13 @@ export const withXcode: ConfigPlugin<{
|
|
|
54
36
|
marketingVersion,
|
|
55
37
|
});
|
|
56
38
|
|
|
39
|
+
const groupName = "Embed Foundation Extensions";
|
|
57
40
|
const productFile = addProductFile(xcodeProject, {
|
|
58
41
|
targetName,
|
|
59
42
|
groupName,
|
|
60
43
|
});
|
|
61
44
|
|
|
45
|
+
const targetUuid = xcodeProject.generateUuid();
|
|
62
46
|
const target = addToPbxNativeTargetSection(xcodeProject, {
|
|
63
47
|
targetName,
|
|
64
48
|
targetUuid,
|