react-native-ios-widget 0.0.3

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 (109) hide show
  1. package/.eslintrc.js +5 -0
  2. package/README.md +100 -0
  3. package/_widgets/EmojiRanger/AdventureActivityConfiguration.swift +71 -0
  4. package/_widgets/EmojiRanger/AllCharactersView.swift +43 -0
  5. package/_widgets/EmojiRanger/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  6. package/_widgets/EmojiRanger/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  7. package/_widgets/EmojiRanger/Assets.xcassets/Contents.json +6 -0
  8. package/_widgets/EmojiRanger/Assets.xcassets/WidgetBackground.colorset/Contents.json +11 -0
  9. package/_widgets/EmojiRanger/Attributes.swift +21 -0
  10. package/_widgets/EmojiRanger/EmojiRanger.swift +248 -0
  11. package/_widgets/EmojiRanger/EmojiRangersWidget.intentdefinition +118 -0
  12. package/_widgets/EmojiRanger/EmojiRangersWidget.swift +189 -0
  13. package/_widgets/EmojiRanger/EmojiRangersWidgetBundle.swift +21 -0
  14. package/_widgets/EmojiRanger/ImageURLProtocol.swift +66 -0
  15. package/_widgets/EmojiRanger/Info.plist +11 -0
  16. package/_widgets/EmojiRanger/LeaderboardWidget.swift +93 -0
  17. package/_widgets/EmojiRanger/Module.swift +94 -0
  18. package/_widgets/PizzaDelivery/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  19. package/_widgets/PizzaDelivery/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  20. package/_widgets/PizzaDelivery/Assets.xcassets/Contents.json +6 -0
  21. package/_widgets/PizzaDelivery/Assets.xcassets/WidgetBackground.colorset/Contents.json +11 -0
  22. package/_widgets/PizzaDelivery/Attributes.swift +15 -0
  23. package/_widgets/PizzaDelivery/Info.plist +11 -0
  24. package/_widgets/PizzaDelivery/LiveActivity.swift +108 -0
  25. package/_widgets/PizzaDelivery/Module.swift +94 -0
  26. package/_widgets/PizzaDelivery/WidgetBundle.swift +13 -0
  27. package/_widgets/PizzaDelivery/Widgets.swift +59 -0
  28. package/app.plugin.js +1 -0
  29. package/build/ExpoWidget.d.ts +3 -0
  30. package/build/ExpoWidget.d.ts.map +1 -0
  31. package/build/ExpoWidget.js +3 -0
  32. package/build/ExpoWidget.js.map +1 -0
  33. package/build/ReactNativeWidgetExtensionModule.d.ts +3 -0
  34. package/build/ReactNativeWidgetExtensionModule.d.ts.map +1 -0
  35. package/build/ReactNativeWidgetExtensionModule.js +5 -0
  36. package/build/ReactNativeWidgetExtensionModule.js.map +1 -0
  37. package/build/Widget.d.ts +2 -0
  38. package/build/Widget.d.ts.map +1 -0
  39. package/build/Widget.js +19 -0
  40. package/build/Widget.js.map +1 -0
  41. package/expo-module.config.json +6 -0
  42. package/ios/ReactNativeWidgetExtension.podspec +27 -0
  43. package/package.json +48 -0
  44. package/plugin/build/android/index.d.ts +10 -0
  45. package/plugin/build/android/index.js +18 -0
  46. package/plugin/build/android/withWidgetAndroidManifest.d.ts +5 -0
  47. package/plugin/build/android/withWidgetAndroidManifest.js +55 -0
  48. package/plugin/build/android/withWidgetAppBuildGradle.d.ts +7 -0
  49. package/plugin/build/android/withWidgetAppBuildGradle.js +20 -0
  50. package/plugin/build/android/withWidgetProjectBuildGradle.d.ts +8 -0
  51. package/plugin/build/android/withWidgetProjectBuildGradle.js +21 -0
  52. package/plugin/build/android/withWidgetSourceCode.d.ts +5 -0
  53. package/plugin/build/android/withWidgetSourceCode.js +51 -0
  54. package/plugin/build/index.d.ts +10 -0
  55. package/plugin/build/index.js +34 -0
  56. package/plugin/build/ios/index.d.ts +9 -0
  57. package/plugin/build/ios/index.js +34 -0
  58. package/plugin/build/ios/withConfig.d.ts +6 -0
  59. package/plugin/build/ios/withConfig.js +55 -0
  60. package/plugin/build/ios/withPodfile.d.ts +5 -0
  61. package/plugin/build/ios/withPodfile.js +83 -0
  62. package/plugin/build/ios/withWidgetExtensionEntitlements.d.ts +7 -0
  63. package/plugin/build/ios/withWidgetExtensionEntitlements.js +47 -0
  64. package/plugin/build/ios/withXcode.d.ts +7 -0
  65. package/plugin/build/ios/withXcode.js +79 -0
  66. package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +5 -0
  67. package/plugin/build/lib/getWidgetExtensionEntitlements.js +20 -0
  68. package/plugin/build/lib/getWidgetFiles.d.ts +9 -0
  69. package/plugin/build/lib/getWidgetFiles.js +117 -0
  70. package/plugin/build/withConfig.d.ts +6 -0
  71. package/plugin/build/withConfig.js +55 -0
  72. package/plugin/build/withPodfile.d.ts +5 -0
  73. package/plugin/build/withPodfile.js +83 -0
  74. package/plugin/build/withWidgetExtensionEntitlements.d.ts +7 -0
  75. package/plugin/build/withWidgetExtensionEntitlements.js +47 -0
  76. package/plugin/build/withXcode.d.ts +7 -0
  77. package/plugin/build/withXcode.js +79 -0
  78. package/plugin/build/xcode/addBuildPhases.d.ts +13 -0
  79. package/plugin/build/xcode/addBuildPhases.js +48 -0
  80. package/plugin/build/xcode/addPbxGroup.d.ts +6 -0
  81. package/plugin/build/xcode/addPbxGroup.js +25 -0
  82. package/plugin/build/xcode/addProductFile.d.ts +5 -0
  83. package/plugin/build/xcode/addProductFile.js +22 -0
  84. package/plugin/build/xcode/addTargetDependency.d.ts +4 -0
  85. package/plugin/build/xcode/addTargetDependency.js +15 -0
  86. package/plugin/build/xcode/addToPbxNativeTargetSection.d.ts +24 -0
  87. package/plugin/build/xcode/addToPbxNativeTargetSection.js +30 -0
  88. package/plugin/build/xcode/addToPbxProjectSection.d.ts +4 -0
  89. package/plugin/build/xcode/addToPbxProjectSection.js +15 -0
  90. package/plugin/build/xcode/addXCConfigurationList.d.ts +8 -0
  91. package/plugin/build/xcode/addXCConfigurationList.js +62 -0
  92. package/plugin/src/index.ts +52 -0
  93. package/plugin/src/lib/getWidgetExtensionEntitlements.ts +33 -0
  94. package/plugin/src/lib/getWidgetFiles.ts +109 -0
  95. package/plugin/src/withConfig.ts +71 -0
  96. package/plugin/src/withPodfile.ts +73 -0
  97. package/plugin/src/withWidgetExtensionEntitlements.ts +30 -0
  98. package/plugin/src/withXcode.ts +73 -0
  99. package/plugin/src/xcode/addBuildPhases.ts +83 -0
  100. package/plugin/src/xcode/addPbxGroup.ts +46 -0
  101. package/plugin/src/xcode/addProductFile.ts +25 -0
  102. package/plugin/src/xcode/addTargetDependency.ts +17 -0
  103. package/plugin/src/xcode/addToPbxNativeTargetSection.ts +46 -0
  104. package/plugin/src/xcode/addToPbxProjectSection.ts +23 -0
  105. package/plugin/src/xcode/addXCConfigurationList.ts +83 -0
  106. package/plugin/tsconfig.json +16 -0
  107. package/src/ReactNativeWidgetExtensionModule.ts +5 -0
  108. package/src/Widget.ts +25 -0
  109. package/tsconfig.json +10 -0
@@ -0,0 +1,79 @@
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;
@@ -0,0 +1,13 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ import { WidgetFiles } from "../lib/getWidgetFiles";
3
+ export declare function addBuildPhases(xcodeProject: XcodeProject, { targetUuid, groupName, productFile, widgetFiles, }: {
4
+ targetUuid: string;
5
+ groupName: string;
6
+ productFile: {
7
+ uuid: string;
8
+ target: string;
9
+ basename: string;
10
+ group: string;
11
+ };
12
+ widgetFiles: WidgetFiles;
13
+ }): void;
@@ -0,0 +1,48 @@
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.addBuildPhases = void 0;
27
+ const util = __importStar(require("util"));
28
+ function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widgetFiles, }) {
29
+ const buildPath = `""`;
30
+ const folderType = "app_extension";
31
+ const { swiftFiles, assetDirectories, entitlementFiles, plistFiles, fontFiles, } = widgetFiles;
32
+ // Sources build phase
33
+ xcodeProject.addBuildPhase([...swiftFiles], "PBXSourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
34
+ // Copy files build phase
35
+ xcodeProject.addBuildPhase([], "PBXCopyFilesBuildPhase", groupName, xcodeProject.getFirstTarget().uuid, folderType, buildPath);
36
+ xcodeProject
37
+ .buildPhaseObject("PBXCopyFilesBuildPhase", groupName, productFile.target)
38
+ .files.push({
39
+ value: productFile.uuid,
40
+ comment: util.format("%s in %s", productFile.basename, productFile.group), // longComment(file);
41
+ });
42
+ xcodeProject.addToPbxBuildFileSection(productFile);
43
+ // Frameworks build phase
44
+ xcodeProject.addBuildPhase([], "PBXFrameworksBuildPhase", groupName, targetUuid, folderType, buildPath);
45
+ // Resources build phase
46
+ xcodeProject.addBuildPhase([...assetDirectories, ...fontFiles], "PBXResourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
47
+ }
48
+ exports.addBuildPhases = addBuildPhases;
@@ -0,0 +1,6 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ import { WidgetFiles } from "../lib/getWidgetFiles";
3
+ export declare function addPbxGroup(xcodeProject: XcodeProject, { targetName, widgetFiles, }: {
4
+ targetName: string;
5
+ widgetFiles: WidgetFiles;
6
+ }): void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPbxGroup = void 0;
4
+ function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
5
+ const { swiftFiles, assetDirectories, entitlementFiles, plistFiles, fontFiles, } = widgetFiles;
6
+ // Add PBX group
7
+ const { uuid: pbxGroupUuid } = xcodeProject.addPbxGroup([
8
+ ...swiftFiles,
9
+ ...entitlementFiles,
10
+ ...plistFiles,
11
+ ...fontFiles,
12
+ ...assetDirectories,
13
+ `${targetName}.entitlements`,
14
+ ], targetName, targetName);
15
+ // Add PBXGroup to top level group
16
+ const groups = xcodeProject.hash.project.objects["PBXGroup"];
17
+ if (pbxGroupUuid) {
18
+ Object.keys(groups).forEach(function (key) {
19
+ if (groups[key].name === undefined && groups[key].path === undefined) {
20
+ xcodeProject.addToPbxGroup(pbxGroupUuid, key);
21
+ }
22
+ });
23
+ }
24
+ }
25
+ exports.addPbxGroup = addPbxGroup;
@@ -0,0 +1,5 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ export declare function addProductFile(xcodeProject: XcodeProject, { targetName, groupName }: {
3
+ targetName: string;
4
+ groupName: string;
5
+ }): any;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addProductFile = void 0;
4
+ function addProductFile(xcodeProject, { targetName, groupName }) {
5
+ const options = {
6
+ basename: `${targetName}.appex`,
7
+ // fileRef: xcodeProject.generateUuid(),
8
+ // uuid: xcodeProject.generateUuid(),
9
+ group: groupName,
10
+ explicitFileType: "wrapper.app-extension",
11
+ /* fileEncoding: 4, */
12
+ settings: {
13
+ ATTRIBUTES: ["RemoveHeadersOnCopy"],
14
+ },
15
+ includeInIndex: 0,
16
+ path: `${targetName}.appex`,
17
+ sourceTree: "BUILT_PRODUCTS_DIR",
18
+ };
19
+ const productFile = xcodeProject.addProductFile(targetName, options);
20
+ return productFile;
21
+ }
22
+ exports.addProductFile = addProductFile;
@@ -0,0 +1,4 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ export declare function addTargetDependency(xcodeProject: XcodeProject, target: {
3
+ uuid: string;
4
+ }): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addTargetDependency = void 0;
4
+ function addTargetDependency(xcodeProject, target) {
5
+ if (!xcodeProject.hash.project.objects["PBXTargetDependency"]) {
6
+ xcodeProject.hash.project.objects["PBXTargetDependency"] = {};
7
+ }
8
+ if (!xcodeProject.hash.project.objects["PBXContainerItemProxy"]) {
9
+ xcodeProject.hash.project.objects["PBXContainerItemProxy"] = {};
10
+ }
11
+ xcodeProject.addTargetDependency(xcodeProject.getFirstTarget().uuid, [
12
+ target.uuid,
13
+ ]);
14
+ }
15
+ exports.addTargetDependency = addTargetDependency;
@@ -0,0 +1,24 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ export declare function addToPbxNativeTargetSection(xcodeProject: XcodeProject, { targetName, targetUuid, productFile, xCConfigurationList, }: {
3
+ targetName: string;
4
+ targetUuid: string;
5
+ productFile: {
6
+ fileRef: string;
7
+ };
8
+ xCConfigurationList: {
9
+ uuid: string;
10
+ };
11
+ }): {
12
+ uuid: string;
13
+ pbxNativeTarget: {
14
+ isa: string;
15
+ name: string;
16
+ productName: string;
17
+ productReference: string;
18
+ productType: string;
19
+ buildConfigurationList: string;
20
+ buildPhases: never[];
21
+ buildRules: never[];
22
+ dependencies: never[];
23
+ };
24
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addToPbxNativeTargetSection = void 0;
4
+ function addToPbxNativeTargetSection(xcodeProject, { targetName, targetUuid, productFile, xCConfigurationList, }) {
5
+ const target = {
6
+ uuid: targetUuid,
7
+ pbxNativeTarget: {
8
+ isa: "PBXNativeTarget",
9
+ name: targetName,
10
+ productName: targetName,
11
+ productReference: productFile.fileRef,
12
+ productType: `"com.apple.product-type.app-extension"`,
13
+ buildConfigurationList: xCConfigurationList.uuid,
14
+ buildPhases: [],
15
+ buildRules: [],
16
+ dependencies: [],
17
+ },
18
+ };
19
+ xcodeProject.addToPbxNativeTargetSection(target);
20
+ const frameworksGroup = xcodeProject.findPBXGroupKey({ name: "Frameworks" });
21
+ const file1 = xcodeProject.addFile("WidgetKit.framework", frameworksGroup);
22
+ const file2 = xcodeProject.addFile("SwiftUI.framework", frameworksGroup);
23
+ const frameworksBuildPhaseObj = xcodeProject.pbxFrameworksBuildPhaseObj(target.uuid);
24
+ /* console.log(
25
+ { file1, file2, frameworksBuildPhaseObj },
26
+ frameworksBuildPhaseObj.files
27
+ ); */
28
+ return target;
29
+ }
30
+ exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
@@ -0,0 +1,4 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ export declare function addToPbxProjectSection(xcodeProject: XcodeProject, target: {
3
+ uuid: string;
4
+ }): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addToPbxProjectSection = void 0;
4
+ function addToPbxProjectSection(xcodeProject, target) {
5
+ xcodeProject.addToPbxProjectSection(target);
6
+ // Add target attributes to project section
7
+ if (!xcodeProject.pbxProjectSection()[xcodeProject.getFirstProject().uuid]
8
+ .attributes.TargetAttributes) {
9
+ xcodeProject.pbxProjectSection()[xcodeProject.getFirstProject().uuid].attributes.TargetAttributes = {};
10
+ }
11
+ xcodeProject.pbxProjectSection()[xcodeProject.getFirstProject().uuid].attributes.TargetAttributes[target.uuid] = {
12
+ LastSwiftMigration: 1250,
13
+ };
14
+ }
15
+ exports.addToPbxProjectSection = addToPbxProjectSection;
@@ -0,0 +1,8 @@
1
+ import { XcodeProject } from "expo/config-plugins";
2
+ export declare function addXCConfigurationList(xcodeProject: XcodeProject, { targetName, currentProjectVersion, bundleIdentifier, deploymentTarget, marketingVersion, }: {
3
+ targetName: string;
4
+ currentProjectVersion: string;
5
+ bundleIdentifier: string;
6
+ deploymentTarget: string;
7
+ marketingVersion?: string;
8
+ }): any;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addXCConfigurationList = void 0;
4
+ function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersion, bundleIdentifier, deploymentTarget, marketingVersion, }) {
5
+ const commonBuildSettings = {
6
+ /* ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
7
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
8
+ CLANG_ANALYZER_NONNULL = YES;
9
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
10
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
11
+ CLANG_ENABLE_OBJC_WEAK = YES;
12
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
13
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
14
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
15
+ CODE_SIGN_STYLE = Automatic;
16
+ DEBUG_INFORMATION_FORMAT = dwarf;
17
+ DEVELOPMENT_TEAM = G76836P2D4;
18
+ GCC_C_LANGUAGE_STANDARD = gnu11;
19
+
20
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
21
+ MARKETING_VERSION = 1.0;
22
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
23
+ MTL_FAST_MATH = YES;
24
+ SKIP_INSTALL = YES;
25
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
26
+ SWIFT_EMIT_LOC_STRINGS = YES;
27
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; */
28
+ PRODUCT_NAME: `"$(TARGET_NAME)"`,
29
+ SWIFT_VERSION: "5.0",
30
+ TARGETED_DEVICE_FAMILY: `"1,2"`,
31
+ INFOPLIST_FILE: `${targetName}/Info.plist`,
32
+ CURRENT_PROJECT_VERSION: `"${currentProjectVersion}"`,
33
+ IPHONEOS_DEPLOYMENT_TARGET: `"${deploymentTarget}"`,
34
+ PRODUCT_BUNDLE_IDENTIFIER: `"${bundleIdentifier}"`,
35
+ GENERATE_INFOPLIST_FILE: `"YES"`,
36
+ INFOPLIST_KEY_CFBundleDisplayName: targetName,
37
+ INFOPLIST_KEY_NSHumanReadableCopyright: `""`,
38
+ MARKETING_VERSION: `"${marketingVersion}"`,
39
+ SWIFT_OPTIMIZATION_LEVEL: `"-Onone"`,
40
+ CODE_SIGN_ENTITLEMENTS: "WidgetsExtension/WidgetsExtension.entitlements",
41
+ // DEVELOPMENT_TEAM: `"G76836P2D4"`,
42
+ };
43
+ const buildConfigurationsList = [
44
+ {
45
+ name: "Debug",
46
+ isa: "XCBuildConfiguration",
47
+ buildSettings: {
48
+ ...commonBuildSettings,
49
+ },
50
+ },
51
+ {
52
+ name: "Release",
53
+ isa: "XCBuildConfiguration",
54
+ buildSettings: {
55
+ ...commonBuildSettings,
56
+ },
57
+ },
58
+ ];
59
+ const xCConfigurationList = xcodeProject.addXCConfigurationList(buildConfigurationsList, "Release", `Build configuration list for PBXNativeTarget "${targetName}"`);
60
+ return xCConfigurationList;
61
+ }
62
+ exports.addXCConfigurationList = addXCConfigurationList;
@@ -0,0 +1,52 @@
1
+ import { ConfigPlugin, withPlugins } from "expo/config-plugins";
2
+ import { withXcode } from "./withXcode";
3
+ import { withWidgetExtensionEntitlements } from "./withWidgetExtensionEntitlements";
4
+ import { withPodfile } from "./withPodfile";
5
+ import { withConfig } from "./withConfig";
6
+
7
+ const withWidget: ConfigPlugin<{
8
+ frequentUpdates?: boolean;
9
+ widgetsFolder?: string;
10
+ deploymentTarget?: string;
11
+ groupIdentifier?: string;
12
+ pods?: string[];
13
+ widgetName: string;
14
+ }> = (
15
+ config,
16
+ {
17
+ frequentUpdates,
18
+ deploymentTarget = "14.0",
19
+ widgetsFolder = "widgets",
20
+ groupIdentifier,
21
+ pods,
22
+ }
23
+ ) => {
24
+ const targetName = "WidgetsExtension";
25
+ const bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`;
26
+
27
+ config.ios = {
28
+ ...config.ios,
29
+ infoPlist: {
30
+ ...config.ios?.infoPlist,
31
+ NSSupportsLiveActivities: true,
32
+ NSSupportsLiveActivitiesFrequentUpdates: frequentUpdates,
33
+ },
34
+ };
35
+
36
+ return withPlugins(config, [
37
+ [
38
+ withXcode,
39
+ {
40
+ targetName,
41
+ bundleIdentifier,
42
+ deploymentTarget,
43
+ widgetsFolder,
44
+ },
45
+ ],
46
+ [withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
47
+ [withPodfile, { targetName, pods }],
48
+ [withConfig, { targetName, bundleIdentifier, groupIdentifier }],
49
+ ]);
50
+ };
51
+
52
+ export default withWidget;
@@ -0,0 +1,33 @@
1
+ import { ExportedConfig, InfoPlist } from "expo/config-plugins";
2
+
3
+ export function getWidgetExtensionEntitlements(
4
+ iosConfig: ExportedConfig["ios"],
5
+ {
6
+ groupIdentifier,
7
+ }: {
8
+ groupIdentifier?: string;
9
+ }
10
+ ) {
11
+ const entitlements: InfoPlist = {};
12
+
13
+ addApplicationGroupsEntitlement(entitlements, groupIdentifier);
14
+
15
+ return entitlements;
16
+ }
17
+
18
+ export function addApplicationGroupsEntitlement(
19
+ entitlements: InfoPlist,
20
+ groupIdentifier?: string
21
+ ) {
22
+ if (groupIdentifier) {
23
+ const existingApplicationGroups =
24
+ (entitlements["com.apple.security.application-groups"] as string[]) ?? [];
25
+
26
+ entitlements["com.apple.security.application-groups"] = [
27
+ groupIdentifier,
28
+ ...existingApplicationGroups,
29
+ ];
30
+ }
31
+
32
+ return entitlements;
33
+ }
@@ -0,0 +1,109 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+
4
+ export type WidgetFiles = {
5
+ swiftFiles: string[];
6
+ entitlementFiles: string[];
7
+ plistFiles: string[];
8
+ fontFiles: string[];
9
+ assetDirectories: string[];
10
+ };
11
+
12
+ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
13
+ const widgetFiles: WidgetFiles = {
14
+ swiftFiles: [],
15
+ entitlementFiles: [],
16
+ plistFiles: [],
17
+ fontFiles: [],
18
+ assetDirectories: [],
19
+ };
20
+
21
+ if (!fs.existsSync(targetPath)) {
22
+ fs.mkdirSync(targetPath, { recursive: true });
23
+ }
24
+
25
+ if (fs.lstatSync(widgetsPath).isDirectory()) {
26
+ const files = fs.readdirSync(widgetsPath);
27
+
28
+ files.forEach((file) => {
29
+ const fileExtension = file.split(".").pop();
30
+
31
+ if (fileExtension === "swift") {
32
+ if (file !== "Module.swift") {
33
+ widgetFiles.swiftFiles.push(file);
34
+ }
35
+ } else if (fileExtension === "entitlements") {
36
+ widgetFiles.entitlementFiles.push(file);
37
+ } else if (fileExtension === "plist") {
38
+ widgetFiles.plistFiles.push(file);
39
+ } else if (fileExtension === "ttf" || fileExtension === "otf") {
40
+ widgetFiles.fontFiles.push(file);
41
+ } else if (fileExtension === "xcassets") {
42
+ widgetFiles.assetDirectories.push(file);
43
+ }
44
+ });
45
+ }
46
+
47
+ // Copy files
48
+ [
49
+ ...widgetFiles.swiftFiles,
50
+ ...widgetFiles.entitlementFiles,
51
+ ...widgetFiles.plistFiles,
52
+ ...widgetFiles.fontFiles,
53
+ ].forEach((file) => {
54
+ const source = path.join(widgetsPath, file);
55
+ copyFileSync(source, targetPath);
56
+ });
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
+ // Copy directories
74
+ widgetFiles.assetDirectories.forEach((directory) => {
75
+ const imagesXcassetsSource = path.join(widgetsPath, directory);
76
+ copyFolderRecursiveSync(imagesXcassetsSource, targetPath);
77
+ });
78
+
79
+ return widgetFiles;
80
+ }
81
+
82
+ export function copyFileSync(source: string, target: string) {
83
+ let targetFile = target;
84
+
85
+ if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
86
+ targetFile = path.join(target, path.basename(source));
87
+ }
88
+
89
+ fs.writeFileSync(targetFile, fs.readFileSync(source));
90
+ }
91
+
92
+ function copyFolderRecursiveSync(source: string, target: string) {
93
+ const targetPath = path.join(target, path.basename(source));
94
+ if (!fs.existsSync(targetPath)) {
95
+ fs.mkdirSync(targetPath, { recursive: true });
96
+ }
97
+
98
+ if (fs.lstatSync(source).isDirectory()) {
99
+ const files = fs.readdirSync(source);
100
+ files.forEach((file) => {
101
+ const currentPath = path.join(source, file);
102
+ if (fs.lstatSync(currentPath).isDirectory()) {
103
+ copyFolderRecursiveSync(currentPath, targetPath);
104
+ } else {
105
+ copyFileSync(currentPath, targetPath);
106
+ }
107
+ });
108
+ }
109
+ }
@@ -0,0 +1,71 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ import {
3
+ addApplicationGroupsEntitlement,
4
+ getWidgetExtensionEntitlements,
5
+ } from "./lib/getWidgetExtensionEntitlements";
6
+
7
+ export const withConfig: ConfigPlugin<{
8
+ bundleIdentifier: string;
9
+ targetName: string;
10
+ groupIdentifier?: string;
11
+ }> = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
12
+ let configIndex: null | number = null;
13
+ config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach(
14
+ (ext: any, index: number) => {
15
+ if (ext.targetName === targetName) {
16
+ configIndex = index;
17
+ }
18
+ }
19
+ );
20
+
21
+ if (!configIndex) {
22
+ config.extra = {
23
+ ...config.extra,
24
+ eas: {
25
+ ...config.extra?.eas,
26
+ build: {
27
+ ...config.extra?.eas?.build,
28
+ experimental: {
29
+ ...config.extra?.eas?.build?.experimental,
30
+ ios: {
31
+ ...config.extra?.eas?.build?.experimental?.ios,
32
+ appExtensions: [
33
+ ...(config.extra?.eas?.build?.experimental?.ios
34
+ ?.appExtensions ?? []),
35
+ {
36
+ targetName,
37
+ bundleIdentifier,
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ },
43
+ },
44
+ };
45
+ configIndex = 0;
46
+ }
47
+
48
+ if (configIndex != null && config.extra) {
49
+ const widgetsExtensionConfig =
50
+ config.extra.eas.build.experimental.ios.appExtensions[configIndex];
51
+
52
+ widgetsExtensionConfig.entitlements = {
53
+ ...widgetsExtensionConfig.entitlements,
54
+ ...getWidgetExtensionEntitlements(config.ios, {
55
+ groupIdentifier,
56
+ }),
57
+ };
58
+
59
+ config.ios = {
60
+ ...config.ios,
61
+ entitlements: {
62
+ ...addApplicationGroupsEntitlement(
63
+ config.ios?.entitlements ?? {},
64
+ groupIdentifier
65
+ ),
66
+ },
67
+ };
68
+ }
69
+
70
+ return config;
71
+ };