react-native-ios-widget 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/build/ExpoModule.d.ts +3 -0
  2. package/build/ExpoModule.d.ts.map +1 -0
  3. package/build/ExpoModule.js +9 -0
  4. package/build/ExpoModule.js.map +1 -0
  5. package/build/{Widget.d.ts → index.d.ts} +1 -1
  6. package/build/index.d.ts.map +1 -0
  7. package/build/{Widget.js → index.js} +4 -8
  8. package/build/index.js.map +1 -0
  9. package/ios/ReactNativeWidgetExtension.podspec +2 -2
  10. package/package.json +4 -4
  11. package/plugin/build/index.js +4 -6
  12. package/plugin/build/lib/getWidgetFiles.js +0 -8
  13. package/plugin/build/withConfig.d.ts +1 -0
  14. package/plugin/build/withConfig.js +4 -1
  15. package/plugin/build/withPodfile.d.ts +1 -0
  16. package/plugin/build/withPodfile.js +4 -21
  17. package/plugin/build/withWidgetExtensionEntitlements.d.ts +1 -0
  18. package/plugin/build/withWidgetExtensionEntitlements.js +4 -1
  19. package/plugin/build/withXcode.d.ts +1 -0
  20. package/plugin/build/withXcode.js +10 -1
  21. package/plugin/src/index.ts +4 -7
  22. package/plugin/src/lib/getWidgetFiles.ts +0 -8
  23. package/plugin/src/withConfig.ts +6 -1
  24. package/plugin/src/withPodfile.ts +6 -24
  25. package/plugin/src/withWidgetExtensionEntitlements.ts +6 -1
  26. package/plugin/src/withXcode.ts +15 -1
  27. package/src/{ReactNativeWidgetExtensionModule.ts → ExpoModule.ts} +7 -1
  28. package/src/{Widget.ts → index.ts} +3 -10
  29. package/build/ExpoWidget.d.ts +0 -3
  30. package/build/ExpoWidget.d.ts.map +0 -1
  31. package/build/ExpoWidget.js +0 -3
  32. package/build/ExpoWidget.js.map +0 -1
  33. package/build/ReactNativeWidgetExtensionModule.d.ts +0 -3
  34. package/build/ReactNativeWidgetExtensionModule.d.ts.map +0 -1
  35. package/build/ReactNativeWidgetExtensionModule.js +0 -5
  36. package/build/ReactNativeWidgetExtensionModule.js.map +0 -1
  37. package/build/Widget.d.ts.map +0 -1
  38. package/build/Widget.js.map +0 -1
  39. package/plugin/build/android/index.d.ts +0 -10
  40. package/plugin/build/android/index.js +0 -18
  41. package/plugin/build/android/withWidgetAndroidManifest.d.ts +0 -5
  42. package/plugin/build/android/withWidgetAndroidManifest.js +0 -55
  43. package/plugin/build/android/withWidgetAppBuildGradle.d.ts +0 -7
  44. package/plugin/build/android/withWidgetAppBuildGradle.js +0 -20
  45. package/plugin/build/android/withWidgetProjectBuildGradle.d.ts +0 -8
  46. package/plugin/build/android/withWidgetProjectBuildGradle.js +0 -21
  47. package/plugin/build/android/withWidgetSourceCode.d.ts +0 -5
  48. package/plugin/build/android/withWidgetSourceCode.js +0 -51
  49. package/plugin/build/ios/index.d.ts +0 -9
  50. package/plugin/build/ios/index.js +0 -34
  51. package/plugin/build/ios/withConfig.d.ts +0 -6
  52. package/plugin/build/ios/withConfig.js +0 -55
  53. package/plugin/build/ios/withPodfile.d.ts +0 -5
  54. package/plugin/build/ios/withPodfile.js +0 -83
  55. package/plugin/build/ios/withWidgetExtensionEntitlements.d.ts +0 -7
  56. package/plugin/build/ios/withWidgetExtensionEntitlements.js +0 -47
  57. package/plugin/build/ios/withXcode.d.ts +0 -7
  58. package/plugin/build/ios/withXcode.js +0 -79
@@ -0,0 +1,3 @@
1
+ declare const ExpoWidget: any;
2
+ export default ExpoWidget;
3
+ //# sourceMappingURL=ExpoModule.d.ts.map
@@ -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=Widget.d.ts.map
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 { requireNativeModule } from "expo-modules-core";
3
- const ExpoWidget = Platform.OS === "ios"
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=Widget.js.map
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/bndkt/react-native-widget-extension' }
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.5",
3
+ "version": "0.0.7",
4
4
  "description": "Expo config plugin to add widgets to a React Native app",
5
- "main": "build/Widget.js",
6
- "types": "build/Widget.d.ts",
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": [
@@ -6,24 +6,22 @@ const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlem
6
6
  const withPodfile_1 = require("./withPodfile");
7
7
  const withConfig_1 = require("./withConfig");
8
8
  const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods, }) => {
9
- if (!enabled) {
10
- return config;
11
- }
12
9
  const targetName = "WidgetsExtension";
13
10
  const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
14
11
  return (0, config_plugins_1.withPlugins)(config, [
15
12
  [
16
13
  withXcode_1.withXcode,
17
14
  {
15
+ enabled,
18
16
  targetName,
19
17
  bundleIdentifier,
20
18
  deploymentTarget,
21
19
  widgetsFolder,
22
20
  },
23
21
  ],
24
- [withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
25
- [withPodfile_1.withPodfile, { targetName, pods }],
26
- [withConfig_1.withConfig, { targetName, bundleIdentifier, groupIdentifier }],
22
+ [withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { enabled, targetName, groupIdentifier }],
23
+ [withPodfile_1.withPodfile, { enabled, targetName, pods }],
24
+ [withConfig_1.withConfig, { enabled, targetName, bundleIdentifier, groupIdentifier }],
27
25
  ]);
28
26
  };
29
27
  exports.default = withWidget;
@@ -73,14 +73,6 @@ function getWidgetFiles(widgetsPath, targetPath) {
73
73
  // Copy Module.swift and Attributes.swift
74
74
  const modulePath = path.join(__dirname, "../../../ios");
75
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
76
  // Copy directories
85
77
  widgetFiles.assetDirectories.forEach((directory) => {
86
78
  const imagesXcassetsSource = path.join(widgetsPath, directory);
@@ -1,5 +1,6 @@
1
1
  import { ConfigPlugin } from "expo/config-plugins";
2
2
  export declare const withConfig: ConfigPlugin<{
3
+ enabled: boolean;
3
4
  bundleIdentifier: string;
4
5
  targetName: string;
5
6
  groupIdentifier?: string;
@@ -2,7 +2,10 @@
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, { bundleIdentifier, targetName, groupIdentifier }) => {
5
+ const withConfig = (config, { enabled, bundleIdentifier, targetName, groupIdentifier }) => {
6
+ if (!enabled) {
7
+ return config;
8
+ }
6
9
  let configIndex = null;
7
10
  config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext, index) => {
8
11
  if (ext.targetName === targetName) {
@@ -1,5 +1,6 @@
1
1
  import { ConfigPlugin } from "expo/config-plugins";
2
2
  export declare const withPodfile: ConfigPlugin<{
3
+ enabled: boolean;
3
4
  targetName: string;
4
5
  pods?: string[];
5
6
  }>;
@@ -28,24 +28,15 @@ 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, { targetName, pods = [] }) => {
31
+ const withPodfile = (config, { enabled, targetName, pods = [] }) => {
32
+ if (!enabled) {
33
+ return config;
34
+ }
32
35
  return (0, config_plugins_1.withDangerousMod)(config, [
33
36
  "ios",
34
37
  (config) => {
35
38
  const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
36
39
  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
40
  podFileContent = (0, generateCode_1.mergeContents)({
50
41
  tag: "react-native-widget-extension-1",
51
42
  src: podFileContent,
@@ -58,14 +49,6 @@ const withPodfile = (config, { targetName, pods = [] }) => {
58
49
  offset: 0,
59
50
  comment: "#",
60
51
  }).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
52
  podFileContent = podFileContent
70
53
  .concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
71
54
  .concat(`target '${targetName}' do
@@ -1,5 +1,6 @@
1
1
  import { ConfigPlugin } from "expo/config-plugins";
2
2
  export declare const withWidgetExtensionEntitlements: ConfigPlugin<{
3
+ enabled: boolean;
3
4
  targetName: string;
4
5
  targetPath: string;
5
6
  groupIdentifier: string;
@@ -32,7 +32,10 @@ const config_plugins_1 = require("expo/config-plugins");
32
32
  const fs = __importStar(require("fs"));
33
33
  const path = __importStar(require("path"));
34
34
  const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
35
- const withWidgetExtensionEntitlements = (config, { targetName, groupIdentifier }) => {
35
+ const withWidgetExtensionEntitlements = (config, { enabled, targetName, groupIdentifier }) => {
36
+ if (!enabled) {
37
+ return config;
38
+ }
36
39
  return (0, config_plugins_1.withInfoPlist)(config, (config) => {
37
40
  const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
38
41
  const filePath = path.join(targetPath, `${targetName}.entitlements`);
@@ -1,5 +1,6 @@
1
1
  import { ConfigPlugin } from "expo/config-plugins";
2
2
  export declare const withXcode: ConfigPlugin<{
3
+ enabled: boolean;
3
4
  targetName: string;
4
5
  bundleIdentifier: string;
5
6
  deploymentTarget: string;
@@ -34,7 +34,16 @@ const addTargetDependency_1 = require("./xcode/addTargetDependency");
34
34
  const addPbxGroup_1 = require("./xcode/addPbxGroup");
35
35
  const addBuildPhases_1 = require("./xcode/addBuildPhases");
36
36
  const getWidgetFiles_1 = require("./lib/getWidgetFiles");
37
- const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
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
+ }
38
47
  return (0, config_plugins_1.withXcodeProject)(config, (config) => {
39
48
  const xcodeProject = config.modResults;
40
49
  const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
@@ -21,10 +21,6 @@ const withWidget: ConfigPlugin<{
21
21
  pods,
22
22
  }
23
23
  ) => {
24
- if (!enabled) {
25
- return config;
26
- }
27
-
28
24
  const targetName = "WidgetsExtension";
29
25
  const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
30
26
 
@@ -32,15 +28,16 @@ const withWidget: ConfigPlugin<{
32
28
  [
33
29
  withXcode,
34
30
  {
31
+ enabled,
35
32
  targetName,
36
33
  bundleIdentifier,
37
34
  deploymentTarget,
38
35
  widgetsFolder,
39
36
  },
40
37
  ],
41
- [withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
42
- [withPodfile, { targetName, pods }],
43
- [withConfig, { targetName, bundleIdentifier, groupIdentifier }],
38
+ [withWidgetExtensionEntitlements, { enabled, targetName, groupIdentifier }],
39
+ [withPodfile, { enabled, targetName, pods }],
40
+ [withConfig, { enabled, targetName, bundleIdentifier, groupIdentifier }],
44
41
  ]);
45
42
  };
46
43
 
@@ -61,14 +61,6 @@ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
61
61
  path.join(widgetsPath, "Module.swift"),
62
62
  path.join(modulePath, "Module.swift")
63
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
64
 
73
65
  // Copy directories
74
66
  widgetFiles.assetDirectories.forEach((directory) => {
@@ -5,10 +5,15 @@ import {
5
5
  } from "./lib/getWidgetExtensionEntitlements";
6
6
 
7
7
  export const withConfig: ConfigPlugin<{
8
+ enabled: boolean;
8
9
  bundleIdentifier: string;
9
10
  targetName: string;
10
11
  groupIdentifier?: string;
11
- }> = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
12
+ }> = (config, { enabled, bundleIdentifier, targetName, groupIdentifier }) => {
13
+ if (!enabled) {
14
+ return config;
15
+ }
16
+
12
17
  let configIndex: null | number = null;
13
18
  config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach(
14
19
  (ext: any, index: number) => {
@@ -4,9 +4,14 @@ import * as fs from "fs";
4
4
  import * as path from "path";
5
5
 
6
6
  export const withPodfile: ConfigPlugin<{
7
+ enabled: boolean;
7
8
  targetName: string;
8
9
  pods?: string[];
9
- }> = (config, { targetName, pods = [] }) => {
10
+ }> = (config, { enabled, targetName, pods = [] }) => {
11
+ if (!enabled) {
12
+ return config;
13
+ }
14
+
10
15
  return withDangerousMod(config, [
11
16
  "ios",
12
17
  (config) => {
@@ -16,20 +21,6 @@ export const withPodfile: ConfigPlugin<{
16
21
  );
17
22
  let podFileContent = fs.readFileSync(podFilePath).toString();
18
23
 
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
24
  podFileContent = mergeContents({
34
25
  tag: "react-native-widget-extension-1",
35
26
  src: podFileContent,
@@ -44,15 +35,6 @@ export const withPodfile: ConfigPlugin<{
44
35
  comment: "#",
45
36
  }).contents;
46
37
 
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
38
  podFileContent = podFileContent
57
39
  .concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
58
40
  .concat(
@@ -6,11 +6,16 @@ import * as path from "path";
6
6
  import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
7
7
 
8
8
  export const withWidgetExtensionEntitlements: ConfigPlugin<{
9
+ enabled: boolean;
9
10
  targetName: string;
10
11
  targetPath: string;
11
12
  groupIdentifier: string;
12
13
  appleSignin: boolean;
13
- }> = (config, { targetName, groupIdentifier }) => {
14
+ }> = (config, { enabled, targetName, groupIdentifier }) => {
15
+ if (!enabled) {
16
+ return config;
17
+ }
18
+
14
19
  return withInfoPlist(config, (config) => {
15
20
  const targetPath = path.join(
16
21
  config.modRequest.platformProjectRoot,
@@ -11,14 +11,28 @@ import { addBuildPhases } from "./xcode/addBuildPhases";
11
11
  import { getWidgetFiles } from "./lib/getWidgetFiles";
12
12
 
13
13
  export const withXcode: ConfigPlugin<{
14
+ enabled: boolean;
14
15
  targetName: string;
15
16
  bundleIdentifier: string;
16
17
  deploymentTarget: string;
17
18
  widgetsFolder: string;
18
19
  }> = (
19
20
  config,
20
- { targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
21
+ { enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
21
22
  ) => {
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
+
22
36
  return withXcodeProject(config, (config) => {
23
37
  const xcodeProject = config.modResults;
24
38
  const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
@@ -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
- export default requireNativeModule("ReactNativeWidgetExtension");
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 { requireNativeModule } from "expo-modules-core";
2
+ import ExpoWidget from "./ExpoModule";
3
3
 
4
- const ExpoWidget =
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) {
@@ -1,3 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
3
- //# sourceMappingURL=ExpoWidget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoWidget.d.ts","sourceRoot":"","sources":["../src/ExpoWidget.ts"],"names":[],"mappings":";AACA,wBAAiE"}
@@ -1,3 +0,0 @@
1
- import { requireNativeModule } from "expo-modules-core";
2
- export default requireNativeModule("ReactNativeWidgetExtension");
3
- //# sourceMappingURL=ExpoWidget.js.map
@@ -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,3 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
3
- //# sourceMappingURL=ReactNativeWidgetExtensionModule.d.ts.map
@@ -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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../src/Widget.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,kBAAkB,qBAM9B,CAAC"}
@@ -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,10 +0,0 @@
1
- import { ConfigPlugin } from "@expo/config-plugins";
2
- /**
3
- * @param config
4
- * @returns
5
- */
6
- export declare const withWidgetAndroid: ConfigPlugin<{
7
- widgetName: string;
8
- widgetsFolder: string;
9
- }>;
10
- export default withWidgetAndroid;
@@ -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,5 +0,0 @@
1
- import { ConfigPlugin } from "@expo/config-plugins";
2
- declare const withWidgetAndroidManifest: ConfigPlugin<{
3
- widgetName: string;
4
- }>;
5
- export { withWidgetAndroidManifest };
@@ -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,7 +0,0 @@
1
- import { ConfigPlugin } from "@expo/config-plugins";
2
- /**
3
- * Add "apply plugin: kotlin-android" to app build.gradle
4
- * @param config
5
- * @returns
6
- */
7
- export declare const withWidgetAppBuildGradle: ConfigPlugin;
@@ -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,8 +0,0 @@
1
- import { ConfigPlugin } from "@expo/config-plugins";
2
- /**
3
- * Add configuration of kotlin-gradle-plugin
4
- * @param config
5
- * @returns
6
- */
7
- declare const withWidgetProjectBuildGradle: ConfigPlugin;
8
- export { withWidgetProjectBuildGradle };
@@ -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,5 +0,0 @@
1
- import { ConfigPlugin } from "@expo/config-plugins";
2
- declare const withWidgetSourceCode: ConfigPlugin<{
3
- widgetsFolder: string;
4
- }>;
5
- export { withWidgetSourceCode };
@@ -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,6 +0,0 @@
1
- import { ConfigPlugin } from "expo/config-plugins";
2
- export declare const withConfig: ConfigPlugin<{
3
- bundleIdentifier: string;
4
- targetName: string;
5
- groupIdentifier?: string;
6
- }>;
@@ -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,5 +0,0 @@
1
- import { ConfigPlugin } from "expo/config-plugins";
2
- export declare const withPodfile: ConfigPlugin<{
3
- targetName: string;
4
- pods?: string[];
5
- }>;
@@ -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,7 +0,0 @@
1
- import { ConfigPlugin } from "expo/config-plugins";
2
- export declare const withWidgetExtensionEntitlements: ConfigPlugin<{
3
- targetName: string;
4
- targetPath: string;
5
- groupIdentifier: string;
6
- appleSignin: boolean;
7
- }>;
@@ -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,7 +0,0 @@
1
- import { ConfigPlugin } from "expo/config-plugins";
2
- export declare const withXcode: ConfigPlugin<{
3
- targetName: string;
4
- bundleIdentifier: string;
5
- deploymentTarget: string;
6
- widgetsFolder: string;
7
- }>;
@@ -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;