react-native-ios-widget 0.0.4 → 0.0.6
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/build/ExpoModule.d.ts +3 -0
- package/build/ExpoModule.d.ts.map +1 -0
- package/build/ExpoModule.js +9 -0
- package/build/ExpoModule.js.map +1 -0
- package/build/{Widget.d.ts → index.d.ts} +1 -1
- package/build/index.d.ts.map +1 -0
- package/build/{Widget.js → index.js} +4 -8
- package/build/index.js.map +1 -0
- package/ios/ReactNativeWidgetExtension.podspec +2 -2
- package/package.json +4 -4
- package/plugin/build/index.d.ts +1 -1
- package/plugin/build/index.js +4 -9
- package/plugin/build/lib/getWidgetFiles.js +0 -11
- package/plugin/build/withPodfile.js +0 -20
- package/plugin/src/index.ts +6 -11
- package/plugin/src/lib/getWidgetFiles.ts +0 -15
- package/plugin/src/withPodfile.ts +0 -23
- package/src/{ReactNativeWidgetExtensionModule.ts → ExpoModule.ts} +7 -1
- package/src/{Widget.ts → index.ts} +3 -10
- package/build/ExpoWidget.d.ts +0 -3
- package/build/ExpoWidget.d.ts.map +0 -1
- package/build/ExpoWidget.js +0 -3
- package/build/ExpoWidget.js.map +0 -1
- package/build/ReactNativeWidgetExtensionModule.d.ts +0 -3
- package/build/ReactNativeWidgetExtensionModule.d.ts.map +0 -1
- package/build/ReactNativeWidgetExtensionModule.js +0 -5
- package/build/ReactNativeWidgetExtensionModule.js.map +0 -1
- package/build/Widget.d.ts.map +0 -1
- package/build/Widget.js.map +0 -1
- package/plugin/build/android/index.d.ts +0 -10
- package/plugin/build/android/index.js +0 -18
- package/plugin/build/android/withWidgetAndroidManifest.d.ts +0 -5
- package/plugin/build/android/withWidgetAndroidManifest.js +0 -55
- package/plugin/build/android/withWidgetAppBuildGradle.d.ts +0 -7
- package/plugin/build/android/withWidgetAppBuildGradle.js +0 -20
- package/plugin/build/android/withWidgetProjectBuildGradle.d.ts +0 -8
- package/plugin/build/android/withWidgetProjectBuildGradle.js +0 -21
- package/plugin/build/android/withWidgetSourceCode.d.ts +0 -5
- package/plugin/build/android/withWidgetSourceCode.js +0 -51
- package/plugin/build/ios/index.d.ts +0 -9
- package/plugin/build/ios/index.js +0 -34
- package/plugin/build/ios/withConfig.d.ts +0 -6
- package/plugin/build/ios/withConfig.js +0 -55
- package/plugin/build/ios/withPodfile.d.ts +0 -5
- package/plugin/build/ios/withPodfile.js +0 -83
- package/plugin/build/ios/withWidgetExtensionEntitlements.d.ts +0 -7
- package/plugin/build/ios/withWidgetExtensionEntitlements.js +0 -47
- package/plugin/build/ios/withXcode.d.ts +0 -7
- package/plugin/build/ios/withXcode.js +0 -79
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoModule.d.ts","sourceRoot":"","sources":["../src/ExpoModule.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,UAAU,KAGD,CAAC;AAEhB,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { requireNativeModule } from "expo-modules-core";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
// It loads the native module object from the JSI or falls back to
|
|
4
|
+
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
5
|
+
const ExpoWidget = Platform.OS === "ios"
|
|
6
|
+
? requireNativeModule("ReactNativeWidgetExtension")
|
|
7
|
+
: undefined;
|
|
8
|
+
export default ExpoWidget;
|
|
9
|
+
//# sourceMappingURL=ExpoModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoModule.js","sourceRoot":"","sources":["../src/ExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,kEAAkE;AAClE,4EAA4E;AAC5E,MAAM,UAAU,GACd,QAAQ,CAAC,EAAE,KAAK,KAAK;IACnB,CAAC,CAAC,mBAAmB,CAAC,4BAA4B,CAAC;IACnD,CAAC,CAAC,SAAS,CAAC;AAEhB,eAAe,UAAU,CAAC","sourcesContent":["import { requireNativeModule } from \"expo-modules-core\";\nimport { Platform } from \"react-native\";\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nconst ExpoWidget =\n Platform.OS === \"ios\"\n ? requireNativeModule(\"ReactNativeWidgetExtension\")\n : undefined;\n\nexport default ExpoWidget;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const reloadAllTimelines: () => Promise<void>;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,qBAM9B,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
? requireNativeModule("ReactNativeWidgetExtension")
|
|
5
|
-
: undefined;
|
|
6
|
-
const checkWidgetSupport = () => {
|
|
2
|
+
import ExpoWidget from "./ExpoModule";
|
|
3
|
+
const supportWidgets = (() => {
|
|
7
4
|
if (Platform.OS === "ios") {
|
|
8
5
|
return parseInt(Platform.Version, 10) >= 14;
|
|
9
6
|
}
|
|
10
7
|
return false;
|
|
11
|
-
};
|
|
12
|
-
const supportWidgets = checkWidgetSupport();
|
|
8
|
+
})();
|
|
13
9
|
export const reloadAllTimelines = async () => {
|
|
14
10
|
if (!supportWidgets || !ExpoWidget) {
|
|
15
11
|
return;
|
|
16
12
|
}
|
|
17
13
|
await ExpoWidget.reloadAllTimelines();
|
|
18
14
|
};
|
|
19
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IAC3B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;KAC7C;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IAC3C,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU,EAAE;QAClC,OAAO;KACR;IAED,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\nimport ExpoWidget from \"./ExpoModule\";\n\nconst supportWidgets = (() => {\n if (Platform.OS === \"ios\") {\n return parseInt(Platform.Version, 10) >= 14;\n }\n\n return false;\n})();\n\nexport const reloadAllTimelines = async () => {\n if (!supportWidgets || !ExpoWidget) {\n return;\n }\n\n await ExpoWidget.reloadAllTimelines();\n};\n"]}
|
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
13
|
s.platform = :ios, '13.0'
|
|
14
14
|
s.swift_version = '5.4'
|
|
15
|
-
s.source = { git: 'https://github.com/
|
|
15
|
+
s.source = { git: 'https://github.com/adrianso/react-native-ios-widget' }
|
|
16
16
|
s.static_framework = true
|
|
17
17
|
|
|
18
18
|
s.dependency 'ExpoModulesCore'
|
|
@@ -22,6 +22,6 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
'DEFINES_MODULE' => 'YES',
|
|
23
23
|
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
s.source_files = "**/*.{h,m,swift}"
|
|
27
27
|
end
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ios-widget",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Expo config plugin to add widgets to a React Native app",
|
|
5
|
-
"main": "build/
|
|
6
|
-
"types": "build/
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc --build ./ ./plugin",
|
|
8
|
+
"build": "rm -rf build plugin/build && tsc --build ./ ./plugin",
|
|
9
9
|
"dev": "tsc --build ./ ./plugin --watch"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
package/plugin/build/index.d.ts
CHANGED
package/plugin/build/index.js
CHANGED
|
@@ -5,17 +5,12 @@ 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, {
|
|
8
|
+
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods, }) => {
|
|
9
|
+
if (!enabled) {
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
9
12
|
const targetName = "WidgetsExtension";
|
|
10
13
|
const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
|
|
11
|
-
config.ios = {
|
|
12
|
-
...config.ios,
|
|
13
|
-
infoPlist: {
|
|
14
|
-
...config.ios?.infoPlist,
|
|
15
|
-
NSSupportsLiveActivities: true,
|
|
16
|
-
NSSupportsLiveActivitiesFrequentUpdates: frequentUpdates,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
14
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
20
15
|
[
|
|
21
16
|
withXcode_1.withXcode,
|
|
@@ -70,17 +70,6 @@ function getWidgetFiles(widgetsPath, targetPath) {
|
|
|
70
70
|
const source = path.join(widgetsPath, file);
|
|
71
71
|
copyFileSync(source, targetPath);
|
|
72
72
|
});
|
|
73
|
-
// Copy Module.swift and Attributes.swift
|
|
74
|
-
const modulePath = path.join(__dirname, "../../../ios");
|
|
75
|
-
copyFileSync(path.join(widgetsPath, "Module.swift"), path.join(modulePath, "Module.swift"));
|
|
76
|
-
// console.log(
|
|
77
|
-
// path.join(widgetsPath, "Module.swift"),
|
|
78
|
-
// path.join(modulePath, "Module.swift")
|
|
79
|
-
// );
|
|
80
|
-
// copyFileSync(
|
|
81
|
-
// path.join(widgetsPath, "Attributes.swift"),
|
|
82
|
-
// path.join(modulePath, "Attributes.swift")
|
|
83
|
-
// );
|
|
84
73
|
// Copy directories
|
|
85
74
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
86
75
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
@@ -34,18 +34,6 @@ const withPodfile = (config, { targetName, pods = [] }) => {
|
|
|
34
34
|
(config) => {
|
|
35
35
|
const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
36
36
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
37
|
-
/* podFileContent = mergeContents({
|
|
38
|
-
tag: "withWidgetExtensionPodfile1999999999",
|
|
39
|
-
src: podFileContent,
|
|
40
|
-
newSrc: ` target '${targetName}' do\n \n end`,
|
|
41
|
-
anchor: /post_install/,
|
|
42
|
-
offset: 0,
|
|
43
|
-
comment: "#",
|
|
44
|
-
}).contents; */
|
|
45
|
-
/* podFileContent = podFileContent.replace(
|
|
46
|
-
/use_expo_modules!/,
|
|
47
|
-
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
48
|
-
); */
|
|
49
37
|
podFileContent = (0, generateCode_1.mergeContents)({
|
|
50
38
|
tag: "react-native-widget-extension-1",
|
|
51
39
|
src: podFileContent,
|
|
@@ -58,14 +46,6 @@ const withPodfile = (config, { targetName, pods = [] }) => {
|
|
|
58
46
|
offset: 0,
|
|
59
47
|
comment: "#",
|
|
60
48
|
}).contents;
|
|
61
|
-
/* podFileContent = mergeContents({
|
|
62
|
-
tag: "react-native-widget-extension-2",
|
|
63
|
-
src: podFileContent,
|
|
64
|
-
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
65
|
-
anchor: /use_react_native/,
|
|
66
|
-
offset: -1,
|
|
67
|
-
comment: "#",
|
|
68
|
-
}).contents; */
|
|
69
49
|
podFileContent = podFileContent
|
|
70
50
|
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
71
51
|
.concat(`target '${targetName}' do
|
package/plugin/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { withPodfile } from "./withPodfile";
|
|
|
5
5
|
import { withConfig } from "./withConfig";
|
|
6
6
|
|
|
7
7
|
const withWidget: ConfigPlugin<{
|
|
8
|
-
|
|
8
|
+
enabled?: boolean;
|
|
9
9
|
widgetsFolder?: string;
|
|
10
10
|
deploymentTarget?: string;
|
|
11
11
|
groupIdentifier?: string;
|
|
@@ -14,25 +14,20 @@ const withWidget: ConfigPlugin<{
|
|
|
14
14
|
}> = (
|
|
15
15
|
config,
|
|
16
16
|
{
|
|
17
|
-
|
|
17
|
+
enabled = true,
|
|
18
18
|
deploymentTarget = "14.0",
|
|
19
19
|
widgetsFolder = "widgets",
|
|
20
20
|
groupIdentifier,
|
|
21
21
|
pods,
|
|
22
22
|
}
|
|
23
23
|
) => {
|
|
24
|
+
if (!enabled) {
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
const targetName = "WidgetsExtension";
|
|
25
29
|
const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
|
|
26
30
|
|
|
27
|
-
config.ios = {
|
|
28
|
-
...config.ios,
|
|
29
|
-
infoPlist: {
|
|
30
|
-
...config.ios?.infoPlist,
|
|
31
|
-
NSSupportsLiveActivities: true,
|
|
32
|
-
NSSupportsLiveActivitiesFrequentUpdates: frequentUpdates,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
31
|
return withPlugins(config, [
|
|
37
32
|
[
|
|
38
33
|
withXcode,
|
|
@@ -55,21 +55,6 @@ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
|
|
|
55
55
|
copyFileSync(source, targetPath);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
// Copy Module.swift and Attributes.swift
|
|
59
|
-
const modulePath = path.join(__dirname, "../../../ios");
|
|
60
|
-
copyFileSync(
|
|
61
|
-
path.join(widgetsPath, "Module.swift"),
|
|
62
|
-
path.join(modulePath, "Module.swift")
|
|
63
|
-
);
|
|
64
|
-
// console.log(
|
|
65
|
-
// path.join(widgetsPath, "Module.swift"),
|
|
66
|
-
// path.join(modulePath, "Module.swift")
|
|
67
|
-
// );
|
|
68
|
-
// copyFileSync(
|
|
69
|
-
// path.join(widgetsPath, "Attributes.swift"),
|
|
70
|
-
// path.join(modulePath, "Attributes.swift")
|
|
71
|
-
// );
|
|
72
|
-
|
|
73
58
|
// Copy directories
|
|
74
59
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
75
60
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
@@ -16,20 +16,6 @@ export const withPodfile: ConfigPlugin<{
|
|
|
16
16
|
);
|
|
17
17
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
18
18
|
|
|
19
|
-
/* podFileContent = mergeContents({
|
|
20
|
-
tag: "withWidgetExtensionPodfile1999999999",
|
|
21
|
-
src: podFileContent,
|
|
22
|
-
newSrc: ` target '${targetName}' do\n \n end`,
|
|
23
|
-
anchor: /post_install/,
|
|
24
|
-
offset: 0,
|
|
25
|
-
comment: "#",
|
|
26
|
-
}).contents; */
|
|
27
|
-
|
|
28
|
-
/* podFileContent = podFileContent.replace(
|
|
29
|
-
/use_expo_modules!/,
|
|
30
|
-
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
31
|
-
); */
|
|
32
|
-
|
|
33
19
|
podFileContent = mergeContents({
|
|
34
20
|
tag: "react-native-widget-extension-1",
|
|
35
21
|
src: podFileContent,
|
|
@@ -44,15 +30,6 @@ export const withPodfile: ConfigPlugin<{
|
|
|
44
30
|
comment: "#",
|
|
45
31
|
}).contents;
|
|
46
32
|
|
|
47
|
-
/* podFileContent = mergeContents({
|
|
48
|
-
tag: "react-native-widget-extension-2",
|
|
49
|
-
src: podFileContent,
|
|
50
|
-
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
51
|
-
anchor: /use_react_native/,
|
|
52
|
-
offset: -1,
|
|
53
|
-
comment: "#",
|
|
54
|
-
}).contents; */
|
|
55
|
-
|
|
56
33
|
podFileContent = podFileContent
|
|
57
34
|
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
58
35
|
.concat(
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { requireNativeModule } from "expo-modules-core";
|
|
2
|
+
import { Platform } from "react-native";
|
|
2
3
|
|
|
3
4
|
// It loads the native module object from the JSI or falls back to
|
|
4
5
|
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
5
|
-
|
|
6
|
+
const ExpoWidget =
|
|
7
|
+
Platform.OS === "ios"
|
|
8
|
+
? requireNativeModule("ReactNativeWidgetExtension")
|
|
9
|
+
: undefined;
|
|
10
|
+
|
|
11
|
+
export default ExpoWidget;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import
|
|
2
|
+
import ExpoWidget from "./ExpoModule";
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
Platform.OS === "ios"
|
|
6
|
-
? requireNativeModule("ReactNativeWidgetExtension")
|
|
7
|
-
: undefined;
|
|
8
|
-
|
|
9
|
-
const checkWidgetSupport = () => {
|
|
4
|
+
const supportWidgets = (() => {
|
|
10
5
|
if (Platform.OS === "ios") {
|
|
11
6
|
return parseInt(Platform.Version, 10) >= 14;
|
|
12
7
|
}
|
|
13
8
|
|
|
14
9
|
return false;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const supportWidgets = checkWidgetSupport();
|
|
10
|
+
})();
|
|
18
11
|
|
|
19
12
|
export const reloadAllTimelines = async () => {
|
|
20
13
|
if (!supportWidgets || !ExpoWidget) {
|
package/build/ExpoWidget.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidget.d.ts","sourceRoot":"","sources":["../src/ExpoWidget.ts"],"names":[],"mappings":";AACA,wBAAiE"}
|
package/build/ExpoWidget.js
DELETED
package/build/ExpoWidget.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidget.js","sourceRoot":"","sources":["../src/ExpoWidget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from \"expo-modules-core\";\nexport default requireNativeModule(\"ReactNativeWidgetExtension\");\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeWidgetExtensionModule.d.ts","sourceRoot":"","sources":["../src/ReactNativeWidgetExtensionModule.ts"],"names":[],"mappings":";AAIA,wBAAiE"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { requireNativeModule } from "expo-modules-core";
|
|
2
|
-
// It loads the native module object from the JSI or falls back to
|
|
3
|
-
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
4
|
-
export default requireNativeModule("ReactNativeWidgetExtension");
|
|
5
|
-
//# sourceMappingURL=ReactNativeWidgetExtensionModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeWidgetExtensionModule.js","sourceRoot":"","sources":["../src/ReactNativeWidgetExtensionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,kEAAkE;AAClE,4EAA4E;AAC5E,eAAe,mBAAmB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from \"expo-modules-core\";\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nexport default requireNativeModule(\"ReactNativeWidgetExtension\");\n"]}
|
package/build/Widget.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../src/Widget.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,kBAAkB,qBAM9B,CAAC"}
|
package/build/Widget.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Widget.js","sourceRoot":"","sources":["../src/Widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,UAAU,GACd,QAAQ,CAAC,EAAE,KAAK,KAAK;IACnB,CAAC,CAAC,mBAAmB,CAAC,4BAA4B,CAAC;IACnD,CAAC,CAAC,SAAS,CAAC;AAEhB,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;KAC7C;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IAC3C,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU,EAAE;QAClC,OAAO;KACR;IAED,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\nimport { requireNativeModule } from \"expo-modules-core\";\n\nconst ExpoWidget =\n Platform.OS === \"ios\"\n ? requireNativeModule(\"ReactNativeWidgetExtension\")\n : undefined;\n\nconst checkWidgetSupport = () => {\n if (Platform.OS === \"ios\") {\n return parseInt(Platform.Version, 10) >= 14;\n }\n\n return false;\n};\n\nconst supportWidgets = checkWidgetSupport();\n\nexport const reloadAllTimelines = async () => {\n if (!supportWidgets || !ExpoWidget) {\n return;\n }\n\n await ExpoWidget.reloadAllTimelines();\n};\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withWidgetAndroid = void 0;
|
|
4
|
-
const withWidgetAndroidManifest_1 = require("./withWidgetAndroidManifest");
|
|
5
|
-
const withWidgetSourceCode_1 = require("./withWidgetSourceCode");
|
|
6
|
-
/**
|
|
7
|
-
* @param config
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
const withWidgetAndroid = (config, { widgetName, widgetsFolder }) => {
|
|
11
|
-
config = (0, withWidgetAndroidManifest_1.withWidgetAndroidManifest)(config, { widgetName });
|
|
12
|
-
// config = withWidgetProjectBuildGradle(config);
|
|
13
|
-
// config = withWidgetAppBuildGradle(config);
|
|
14
|
-
config = (0, withWidgetSourceCode_1.withWidgetSourceCode)(config, { widgetsFolder });
|
|
15
|
-
return config;
|
|
16
|
-
};
|
|
17
|
-
exports.withWidgetAndroid = withWidgetAndroid;
|
|
18
|
-
exports.default = exports.withWidgetAndroid;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withWidgetAndroidManifest = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
const buildWidgetsReceivers = async (widgetName) => {
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
$: {
|
|
9
|
-
"android:name": widgetName,
|
|
10
|
-
"android:exported": "false",
|
|
11
|
-
},
|
|
12
|
-
"intent-filter": [
|
|
13
|
-
{
|
|
14
|
-
action: [
|
|
15
|
-
{
|
|
16
|
-
$: {
|
|
17
|
-
"android:name": "android.appwidget.action.APPWIDGET_UPDATE",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
"meta-data": [
|
|
24
|
-
{
|
|
25
|
-
$: {
|
|
26
|
-
"android:name": "android.appwidget.provider",
|
|
27
|
-
"android:resource": "@xml/widget_info",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
/*
|
|
34
|
-
<receiver
|
|
35
|
-
android:name=".SampleWidget"
|
|
36
|
-
android:exported="false">
|
|
37
|
-
<intent-filter>
|
|
38
|
-
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
|
39
|
-
</intent-filter>
|
|
40
|
-
|
|
41
|
-
<meta-data
|
|
42
|
-
android:name="android.appwidget.provider"
|
|
43
|
-
android:resource="@xml/sample_widget_info" />
|
|
44
|
-
</receiver>
|
|
45
|
-
*/
|
|
46
|
-
};
|
|
47
|
-
const withWidgetAndroidManifest = (config, { widgetName }) => {
|
|
48
|
-
return (0, config_plugins_1.withAndroidManifest)(config, async (newConfig) => {
|
|
49
|
-
const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(newConfig.modResults);
|
|
50
|
-
const widgetReceivers = await buildWidgetsReceivers(widgetName);
|
|
51
|
-
mainApplication.receiver = widgetReceivers;
|
|
52
|
-
return newConfig;
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
exports.withWidgetAndroidManifest = withWidgetAndroidManifest;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withWidgetAppBuildGradle = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
/**
|
|
6
|
-
* Add "apply plugin: kotlin-android" to app build.gradle
|
|
7
|
-
* @param config
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
const withWidgetAppBuildGradle = (config) => {
|
|
11
|
-
return (0, config_plugins_1.withAppBuildGradle)(config, async (newConfig) => {
|
|
12
|
-
const buildGradle = newConfig.modResults.contents;
|
|
13
|
-
const search = /(apply plugin: "com\.android\.application"\n)/gm;
|
|
14
|
-
const replace = `$1apply plugin: "kotlin-android"\n`;
|
|
15
|
-
const newBuildGradle = buildGradle.replace(search, replace);
|
|
16
|
-
newConfig.modResults.contents = newBuildGradle;
|
|
17
|
-
return newConfig;
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
exports.withWidgetAppBuildGradle = withWidgetAppBuildGradle;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withWidgetProjectBuildGradle = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
/**
|
|
6
|
-
* Add configuration of kotlin-gradle-plugin
|
|
7
|
-
* @param config
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
const withWidgetProjectBuildGradle = (config) => {
|
|
11
|
-
return (0, config_plugins_1.withProjectBuildGradle)(config, async (newConfig) => {
|
|
12
|
-
const buildGradle = newConfig.modResults.contents;
|
|
13
|
-
const search = /dependencies\s?{/;
|
|
14
|
-
const replace = `dependencies {
|
|
15
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:\${project.ext.kotlinVersion}"`;
|
|
16
|
-
const newBuildGradle = buildGradle.replace(search, replace);
|
|
17
|
-
newConfig.modResults.contents = newBuildGradle;
|
|
18
|
-
return newConfig;
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.withWidgetProjectBuildGradle = withWidgetProjectBuildGradle;
|
|
@@ -1,51 +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.withWidgetSourceCode = void 0;
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
8
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
9
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
-
const glob_1 = require("glob");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const copyResourceFiles = (widgetSourceDir, platformRoot) => {
|
|
13
|
-
const source = path_1.default.join(widgetSourceDir, "src", "main", "res");
|
|
14
|
-
const resDest = path_1.default.join(platformRoot, "app", "src", "main", "res");
|
|
15
|
-
console.log(`copy the res files from ${source} to ${resDest}`);
|
|
16
|
-
fs_extra_1.default.copySync(source, resDest);
|
|
17
|
-
};
|
|
18
|
-
const copyAssetFiles = (widgetSourceDir, platformRoot) => {
|
|
19
|
-
const source = path_1.default.join(widgetSourceDir, "src", "main", "assets");
|
|
20
|
-
const resDest = path_1.default.join(platformRoot, "app", "src", "main", "assets");
|
|
21
|
-
console.log(`copy the asset files from ${source} to ${resDest}`);
|
|
22
|
-
fs_extra_1.default.copySync(source, resDest);
|
|
23
|
-
};
|
|
24
|
-
const prepareSourceCodes = async (widgetSourceDir, platformRoot, packageName) => {
|
|
25
|
-
const source = path_1.default.join(widgetSourceDir, `src/main/java`);
|
|
26
|
-
const dest = path_1.default.join(platformRoot, "app/src/main/java");
|
|
27
|
-
console.log(`copy the kotlin codes from ${source} to ${dest}`);
|
|
28
|
-
fs_extra_1.default.copySync(source, dest);
|
|
29
|
-
const files = (0, glob_1.globSync)(`${dest}/**/*.java`);
|
|
30
|
-
for (const file of files) {
|
|
31
|
-
const content = fs_extra_1.default.readFileSync(file, "utf8");
|
|
32
|
-
const newContent = content.replace(/^package .*\s/, `package ${packageName};\n`);
|
|
33
|
-
fs_extra_1.default.writeFileSync(file, newContent);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const withWidgetSourceCode = (config, { widgetsFolder }) => {
|
|
37
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
38
|
-
"android",
|
|
39
|
-
async (newConfig) => {
|
|
40
|
-
const projectRoot = newConfig.modRequest.projectRoot;
|
|
41
|
-
const platformRoot = newConfig.modRequest.platformProjectRoot;
|
|
42
|
-
const widgetDir = path_1.default.join(projectRoot, widgetsFolder);
|
|
43
|
-
copyResourceFiles(widgetDir, platformRoot);
|
|
44
|
-
copyAssetFiles(widgetDir, platformRoot);
|
|
45
|
-
const packageName = config.android?.package;
|
|
46
|
-
prepareSourceCodes(widgetDir, platformRoot, packageName);
|
|
47
|
-
return newConfig;
|
|
48
|
-
},
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
exports.withWidgetSourceCode = withWidgetSourceCode;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
declare const withWidgetIos: ConfigPlugin<{
|
|
3
|
-
frequentUpdates?: boolean;
|
|
4
|
-
widgetsFolder?: string;
|
|
5
|
-
deploymentTarget?: string;
|
|
6
|
-
groupIdentifier?: string;
|
|
7
|
-
pods?: string[];
|
|
8
|
-
}>;
|
|
9
|
-
export default withWidgetIos;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
-
const withConfig_1 = require("./withConfig");
|
|
5
|
-
const withPodfile_1 = require("./withPodfile");
|
|
6
|
-
const withXcode_1 = require("./withXcode");
|
|
7
|
-
const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlements");
|
|
8
|
-
const withWidgetIos = (config, { frequentUpdates, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods, }) => {
|
|
9
|
-
const targetName = "WidgetsExtension";
|
|
10
|
-
const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
|
|
11
|
-
config.ios = {
|
|
12
|
-
...config.ios,
|
|
13
|
-
infoPlist: {
|
|
14
|
-
...config.ios?.infoPlist,
|
|
15
|
-
NSSupportsLiveActivities: true,
|
|
16
|
-
NSSupportsLiveActivitiesFrequentUpdates: frequentUpdates,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
return (0, config_plugins_1.withPlugins)(config, [
|
|
20
|
-
[
|
|
21
|
-
withXcode_1.withXcode,
|
|
22
|
-
{
|
|
23
|
-
targetName,
|
|
24
|
-
bundleIdentifier,
|
|
25
|
-
deploymentTarget,
|
|
26
|
-
widgetsFolder,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
|
|
30
|
-
[withPodfile_1.withPodfile, { targetName, pods }],
|
|
31
|
-
[withConfig_1.withConfig, { targetName, bundleIdentifier, groupIdentifier }],
|
|
32
|
-
]);
|
|
33
|
-
};
|
|
34
|
-
exports.default = withWidgetIos;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withConfig = void 0;
|
|
4
|
-
const getWidgetExtensionEntitlements_1 = require("../lib/getWidgetExtensionEntitlements");
|
|
5
|
-
const withConfig = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
|
|
6
|
-
let configIndex = null;
|
|
7
|
-
config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext, index) => {
|
|
8
|
-
if (ext.targetName === targetName) {
|
|
9
|
-
configIndex = index;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
if (!configIndex) {
|
|
13
|
-
config.extra = {
|
|
14
|
-
...config.extra,
|
|
15
|
-
eas: {
|
|
16
|
-
...config.extra?.eas,
|
|
17
|
-
build: {
|
|
18
|
-
...config.extra?.eas?.build,
|
|
19
|
-
experimental: {
|
|
20
|
-
...config.extra?.eas?.build?.experimental,
|
|
21
|
-
ios: {
|
|
22
|
-
...config.extra?.eas?.build?.experimental?.ios,
|
|
23
|
-
appExtensions: [
|
|
24
|
-
...(config.extra?.eas?.build?.experimental?.ios
|
|
25
|
-
?.appExtensions ?? []),
|
|
26
|
-
{
|
|
27
|
-
targetName,
|
|
28
|
-
bundleIdentifier,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
configIndex = 0;
|
|
37
|
-
}
|
|
38
|
-
if (configIndex != null && config.extra) {
|
|
39
|
-
const widgetsExtensionConfig = config.extra.eas.build.experimental.ios.appExtensions[configIndex];
|
|
40
|
-
widgetsExtensionConfig.entitlements = {
|
|
41
|
-
...widgetsExtensionConfig.entitlements,
|
|
42
|
-
...(0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
|
|
43
|
-
groupIdentifier,
|
|
44
|
-
}),
|
|
45
|
-
};
|
|
46
|
-
config.ios = {
|
|
47
|
-
...config.ios,
|
|
48
|
-
entitlements: {
|
|
49
|
-
...(0, getWidgetExtensionEntitlements_1.addApplicationGroupsEntitlement)(config.ios?.entitlements ?? {}, groupIdentifier),
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return config;
|
|
54
|
-
};
|
|
55
|
-
exports.withConfig = withConfig;
|
|
@@ -1,83 +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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.withPodfile = void 0;
|
|
27
|
-
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
28
|
-
const config_plugins_1 = require("expo/config-plugins");
|
|
29
|
-
const fs = __importStar(require("fs"));
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
const withPodfile = (config, { targetName, pods = [] }) => {
|
|
32
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
33
|
-
"ios",
|
|
34
|
-
(config) => {
|
|
35
|
-
const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
36
|
-
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
37
|
-
/* podFileContent = mergeContents({
|
|
38
|
-
tag: "withWidgetExtensionPodfile1999999999",
|
|
39
|
-
src: podFileContent,
|
|
40
|
-
newSrc: ` target '${targetName}' do\n \n end`,
|
|
41
|
-
anchor: /post_install/,
|
|
42
|
-
offset: 0,
|
|
43
|
-
comment: "#",
|
|
44
|
-
}).contents; */
|
|
45
|
-
/* podFileContent = podFileContent.replace(
|
|
46
|
-
/use_expo_modules!/,
|
|
47
|
-
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
48
|
-
); */
|
|
49
|
-
podFileContent = (0, generateCode_1.mergeContents)({
|
|
50
|
-
tag: "react-native-widget-extension-1",
|
|
51
|
-
src: podFileContent,
|
|
52
|
-
newSrc: `installer.pods_project.targets.each do |target|
|
|
53
|
-
target.build_configurations.each do |config|
|
|
54
|
-
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
55
|
-
end
|
|
56
|
-
end`,
|
|
57
|
-
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
58
|
-
offset: 0,
|
|
59
|
-
comment: "#",
|
|
60
|
-
}).contents;
|
|
61
|
-
/* podFileContent = mergeContents({
|
|
62
|
-
tag: "react-native-widget-extension-2",
|
|
63
|
-
src: podFileContent,
|
|
64
|
-
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
65
|
-
anchor: /use_react_native/,
|
|
66
|
-
offset: -1,
|
|
67
|
-
comment: "#",
|
|
68
|
-
}).contents; */
|
|
69
|
-
podFileContent = podFileContent
|
|
70
|
-
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
71
|
-
.concat(`target '${targetName}' do
|
|
72
|
-
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
73
|
-
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
74
|
-
|
|
75
|
-
${pods.map((pod) => `pod '${pod}'`).join("\n")}
|
|
76
|
-
end`)
|
|
77
|
-
.concat(`\n# >>> Inserted by react-native-widget-extension`);
|
|
78
|
-
fs.writeFileSync(podFilePath, podFileContent);
|
|
79
|
-
return config;
|
|
80
|
-
},
|
|
81
|
-
]);
|
|
82
|
-
};
|
|
83
|
-
exports.withPodfile = withPodfile;
|
|
@@ -1,47 +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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.withWidgetExtensionEntitlements = void 0;
|
|
30
|
-
const plist_1 = __importDefault(require("@expo/plist"));
|
|
31
|
-
const config_plugins_1 = require("expo/config-plugins");
|
|
32
|
-
const fs = __importStar(require("fs"));
|
|
33
|
-
const path = __importStar(require("path"));
|
|
34
|
-
const getWidgetExtensionEntitlements_1 = require("../lib/getWidgetExtensionEntitlements");
|
|
35
|
-
const withWidgetExtensionEntitlements = (config, { targetName, groupIdentifier }) => {
|
|
36
|
-
return (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
37
|
-
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
|
|
38
|
-
const filePath = path.join(targetPath, `${targetName}.entitlements`);
|
|
39
|
-
const appClipEntitlements = (0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
|
|
40
|
-
groupIdentifier,
|
|
41
|
-
});
|
|
42
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
43
|
-
fs.writeFileSync(filePath, plist_1.default.build(appClipEntitlements));
|
|
44
|
-
return config;
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
exports.withWidgetExtensionEntitlements = withWidgetExtensionEntitlements;
|
|
@@ -1,79 +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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.withXcode = void 0;
|
|
27
|
-
const config_plugins_1 = require("expo/config-plugins");
|
|
28
|
-
const path = __importStar(require("path"));
|
|
29
|
-
const addXCConfigurationList_1 = require("../xcode/addXCConfigurationList");
|
|
30
|
-
const addProductFile_1 = require("../xcode/addProductFile");
|
|
31
|
-
const addToPbxNativeTargetSection_1 = require("../xcode/addToPbxNativeTargetSection");
|
|
32
|
-
const addToPbxProjectSection_1 = require("../xcode/addToPbxProjectSection");
|
|
33
|
-
const addTargetDependency_1 = require("../xcode/addTargetDependency");
|
|
34
|
-
const addPbxGroup_1 = require("../xcode/addPbxGroup");
|
|
35
|
-
const addBuildPhases_1 = require("../xcode/addBuildPhases");
|
|
36
|
-
const getWidgetFiles_1 = require("../lib/getWidgetFiles");
|
|
37
|
-
const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
|
|
38
|
-
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
39
|
-
const xcodeProject = config.modResults;
|
|
40
|
-
const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
|
|
41
|
-
const targetUuid = xcodeProject.generateUuid();
|
|
42
|
-
const groupName = "Embed Foundation Extensions";
|
|
43
|
-
const { platformProjectRoot } = config.modRequest;
|
|
44
|
-
const marketingVersion = config.version;
|
|
45
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
46
|
-
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
|
|
47
|
-
const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
|
|
48
|
-
targetName,
|
|
49
|
-
currentProjectVersion: config.ios.buildNumber || "1",
|
|
50
|
-
bundleIdentifier,
|
|
51
|
-
deploymentTarget,
|
|
52
|
-
marketingVersion,
|
|
53
|
-
});
|
|
54
|
-
const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
|
|
55
|
-
targetName,
|
|
56
|
-
groupName,
|
|
57
|
-
});
|
|
58
|
-
const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
|
|
59
|
-
targetName,
|
|
60
|
-
targetUuid,
|
|
61
|
-
productFile,
|
|
62
|
-
xCConfigurationList,
|
|
63
|
-
});
|
|
64
|
-
(0, addToPbxProjectSection_1.addToPbxProjectSection)(xcodeProject, target);
|
|
65
|
-
(0, addTargetDependency_1.addTargetDependency)(xcodeProject, target);
|
|
66
|
-
(0, addBuildPhases_1.addBuildPhases)(xcodeProject, {
|
|
67
|
-
targetUuid,
|
|
68
|
-
groupName,
|
|
69
|
-
productFile,
|
|
70
|
-
widgetFiles,
|
|
71
|
-
});
|
|
72
|
-
(0, addPbxGroup_1.addPbxGroup)(xcodeProject, {
|
|
73
|
-
targetName,
|
|
74
|
-
widgetFiles,
|
|
75
|
-
});
|
|
76
|
-
return config;
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
exports.withXcode = withXcode;
|