expo-live-activity 0.1.0 → 0.2.0-alpha
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/LICENSE.txt +21 -0
- package/README.md +84 -19
- package/app.plugin.js +2 -0
- package/build/ExpoLiveActivityModule.d.ts +1 -8
- package/build/ExpoLiveActivityModule.d.ts.map +1 -1
- package/build/ExpoLiveActivityModule.js +2 -3
- package/build/ExpoLiveActivityModule.js.map +1 -1
- package/build/index.d.ts +36 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +37 -5
- package/build/index.js.map +1 -1
- package/expo-module.config.json +3 -11
- package/ios/ExpoLiveActivity.podspec +1 -1
- package/ios/ExpoLiveActivityModule.swift +130 -38
- package/ios/LiveActivityAttributes.swift +32 -0
- package/ios-files/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios-files/Assets.xcassets/AppIcon.appiconset/Contents.json +35 -0
- package/ios-files/Assets.xcassets/Contents.json +6 -0
- package/ios-files/Assets.xcassets/WidgetBackground.colorset/Contents.json +11 -0
- package/ios-files/Color+hex.swift +37 -0
- package/ios-files/Info.plist +11 -0
- package/ios-files/LiveActivityBundle.swift +16 -0
- package/ios-files/LiveActivityLiveActivity.swift +142 -0
- package/ios-files/LiveActivityView.swift +73 -0
- package/package.json +13 -14
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +40 -0
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +3 -0
- package/plugin/build/lib/getWidgetExtensionEntitlements.js +16 -0
- package/plugin/build/lib/getWidgetFiles.d.ts +10 -0
- package/plugin/build/lib/getWidgetFiles.js +172 -0
- package/plugin/build/withConfig.d.ts +6 -0
- package/plugin/build/withConfig.js +54 -0
- package/plugin/build/withPodfile.d.ts +4 -0
- package/plugin/build/withPodfile.js +92 -0
- package/plugin/build/withWidgetExtensionEntitlements.d.ts +6 -0
- package/plugin/build/withWidgetExtensionEntitlements.js +57 -0
- package/plugin/build/withXcode.d.ts +8 -0
- package/plugin/build/withXcode.js +99 -0
- package/plugin/build/xcode/addBuildPhases.d.ts +13 -0
- package/plugin/build/xcode/addBuildPhases.js +57 -0
- package/plugin/build/xcode/addPbxGroup.d.ts +6 -0
- package/plugin/build/xcode/addPbxGroup.js +25 -0
- package/plugin/build/xcode/addProductFile.d.ts +5 -0
- package/plugin/build/xcode/addProductFile.js +21 -0
- package/plugin/build/xcode/addTargetDependency.d.ts +4 -0
- package/plugin/build/xcode/addTargetDependency.js +14 -0
- package/plugin/build/xcode/addToPbxNativeTargetSection.d.ts +24 -0
- package/plugin/build/xcode/addToPbxNativeTargetSection.js +29 -0
- package/plugin/build/xcode/addToPbxProjectSection.d.ts +4 -0
- package/plugin/build/xcode/addToPbxProjectSection.js +14 -0
- package/plugin/build/xcode/addXCConfigurationList.d.ts +8 -0
- package/plugin/build/xcode/addXCConfigurationList.js +61 -0
- package/plugin/src/index.ts +49 -0
- package/plugin/src/lib/getWidgetExtensionEntitlements.ts +26 -0
- package/plugin/src/lib/getWidgetFiles.ts +162 -0
- package/plugin/src/withConfig.ts +62 -0
- package/plugin/src/withPodfile.ts +72 -0
- package/plugin/src/withWidgetExtensionEntitlements.ts +26 -0
- package/plugin/src/withXcode.ts +93 -0
- package/plugin/src/xcode/addBuildPhases.ts +83 -0
- package/plugin/src/xcode/addPbxGroup.ts +48 -0
- package/plugin/src/xcode/addProductFile.ts +25 -0
- package/plugin/src/xcode/addTargetDependency.ts +17 -0
- package/plugin/src/xcode/addToPbxNativeTargetSection.ts +46 -0
- package/plugin/src/xcode/addToPbxProjectSection.ts +23 -0
- package/plugin/src/xcode/addXCConfigurationList.ts +83 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/src/ExpoLiveActivityModule.ts +2 -11
- package/src/index.ts +59 -5
- package/android/build.gradle +0 -43
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/expo/modules/liveactivity/ExpoLiveActivityModule.kt +0 -50
- package/android/src/main/java/expo/modules/liveactivity/ExpoLiveActivityView.kt +0 -30
- package/build/ExpoLiveActivity.types.d.ts +0 -18
- package/build/ExpoLiveActivity.types.d.ts.map +0 -1
- package/build/ExpoLiveActivity.types.js +0 -2
- package/build/ExpoLiveActivity.types.js.map +0 -1
- package/build/ExpoLiveActivityModule.web.d.ts +0 -10
- package/build/ExpoLiveActivityModule.web.d.ts.map +0 -1
- package/build/ExpoLiveActivityModule.web.js +0 -12
- package/build/ExpoLiveActivityModule.web.js.map +0 -1
- package/build/ExpoLiveActivityView.d.ts +0 -4
- package/build/ExpoLiveActivityView.d.ts.map +0 -1
- package/build/ExpoLiveActivityView.js +0 -7
- package/build/ExpoLiveActivityView.js.map +0 -1
- package/build/ExpoLiveActivityView.web.d.ts +0 -4
- package/build/ExpoLiveActivityView.web.d.ts.map +0 -1
- package/build/ExpoLiveActivityView.web.js +0 -7
- package/build/ExpoLiveActivityView.web.js.map +0 -1
- package/ios/ExpoLiveActivityView.swift +0 -38
- package/src/ExpoLiveActivity.types.ts +0 -19
- package/src/ExpoLiveActivityModule.web.ts +0 -15
- package/src/ExpoLiveActivityView.tsx +0 -11
- package/src/ExpoLiveActivityView.web.tsx +0 -15
|
@@ -0,0 +1,92 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withPodfile = void 0;
|
|
37
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
38
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const withPodfile = (config, { targetName }) => {
|
|
42
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
43
|
+
"ios",
|
|
44
|
+
(config) => {
|
|
45
|
+
const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
46
|
+
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
47
|
+
/* podFileContent = mergeContents({
|
|
48
|
+
tag: "withWidgetExtensionPodfile1999999999",
|
|
49
|
+
src: podFileContent,
|
|
50
|
+
newSrc: ` target '${targetName}' do\n \n end`,
|
|
51
|
+
anchor: /post_install/,
|
|
52
|
+
offset: 0,
|
|
53
|
+
comment: "#",
|
|
54
|
+
}).contents; */
|
|
55
|
+
/* podFileContent = podFileContent.replace(
|
|
56
|
+
/use_expo_modules!/,
|
|
57
|
+
`use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
|
|
58
|
+
); */
|
|
59
|
+
podFileContent = (0, generateCode_1.mergeContents)({
|
|
60
|
+
tag: "react-native-widget-extension-1",
|
|
61
|
+
src: podFileContent,
|
|
62
|
+
newSrc: `installer.pods_project.targets.each do |target|
|
|
63
|
+
target.build_configurations.each do |config|
|
|
64
|
+
# Sentry has build errors unless configured as 'YES' for the Sentry target: https://github.com/bndkt/react-native-widget-extension/issues/24
|
|
65
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name == 'Sentry' ? 'YES' : 'No'
|
|
66
|
+
end
|
|
67
|
+
end`,
|
|
68
|
+
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
69
|
+
offset: 0,
|
|
70
|
+
comment: "#",
|
|
71
|
+
}).contents;
|
|
72
|
+
/* podFileContent = mergeContents({
|
|
73
|
+
tag: "react-native-widget-extension-2",
|
|
74
|
+
src: podFileContent,
|
|
75
|
+
newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
|
|
76
|
+
anchor: /use_react_native/,
|
|
77
|
+
offset: -1,
|
|
78
|
+
comment: "#",
|
|
79
|
+
}).contents; */
|
|
80
|
+
podFileContent = podFileContent
|
|
81
|
+
.concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
|
|
82
|
+
.concat(`target '${targetName}' do
|
|
83
|
+
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
84
|
+
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
85
|
+
end`)
|
|
86
|
+
.concat(`\n# >>> Inserted by react-native-widget-extension`);
|
|
87
|
+
fs.writeFileSync(podFilePath, podFileContent);
|
|
88
|
+
return config;
|
|
89
|
+
},
|
|
90
|
+
]);
|
|
91
|
+
};
|
|
92
|
+
exports.withPodfile = withPodfile;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.withWidgetExtensionEntitlements = void 0;
|
|
40
|
+
const plist_1 = __importDefault(require("@expo/plist"));
|
|
41
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
// import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
|
|
45
|
+
const withWidgetExtensionEntitlements = (config, { targetName }) => {
|
|
46
|
+
return (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
47
|
+
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
|
|
48
|
+
const filePath = path.join(targetPath, `${targetName}.entitlements`);
|
|
49
|
+
// const appClipEntitlements = getWidgetExtensionEntitlements(config.ios, {
|
|
50
|
+
// });
|
|
51
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
52
|
+
fs.writeFileSync(filePath, plist_1.default.build({}));
|
|
53
|
+
console.log("Finishing running withWidgetExtensionEntitlements");
|
|
54
|
+
return config;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.withWidgetExtensionEntitlements = withWidgetExtensionEntitlements;
|
|
@@ -0,0 +1,99 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withXcode = void 0;
|
|
37
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const addXCConfigurationList_1 = require("./xcode/addXCConfigurationList");
|
|
40
|
+
const addProductFile_1 = require("./xcode/addProductFile");
|
|
41
|
+
const addToPbxNativeTargetSection_1 = require("./xcode/addToPbxNativeTargetSection");
|
|
42
|
+
const addToPbxProjectSection_1 = require("./xcode/addToPbxProjectSection");
|
|
43
|
+
const addTargetDependency_1 = require("./xcode/addTargetDependency");
|
|
44
|
+
const addPbxGroup_1 = require("./xcode/addPbxGroup");
|
|
45
|
+
const addBuildPhases_1 = require("./xcode/addBuildPhases");
|
|
46
|
+
const getWidgetFiles_1 = require("./lib/getWidgetFiles");
|
|
47
|
+
const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget,
|
|
48
|
+
// widgetsFolder,
|
|
49
|
+
moduleFileName, attributesFileName, }) => {
|
|
50
|
+
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
51
|
+
console.log("Running withXcode");
|
|
52
|
+
const xcodeProject = config.modResults;
|
|
53
|
+
// const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
|
|
54
|
+
const targetUuid = xcodeProject.generateUuid();
|
|
55
|
+
const groupName = "Embed Foundation Extensions";
|
|
56
|
+
const { platformProjectRoot } = config.modRequest;
|
|
57
|
+
const marketingVersion = config.version;
|
|
58
|
+
const targetPath = path.join(platformProjectRoot, targetName);
|
|
59
|
+
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(
|
|
60
|
+
// widgetsPath,
|
|
61
|
+
targetPath, moduleFileName, attributesFileName);
|
|
62
|
+
console.log("Finished running withFiles");
|
|
63
|
+
const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
|
|
64
|
+
targetName,
|
|
65
|
+
currentProjectVersion: config.ios.buildNumber || "1",
|
|
66
|
+
bundleIdentifier,
|
|
67
|
+
deploymentTarget,
|
|
68
|
+
marketingVersion,
|
|
69
|
+
});
|
|
70
|
+
console.log("Finished running addXCConfigurationList");
|
|
71
|
+
const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
|
|
72
|
+
targetName,
|
|
73
|
+
groupName,
|
|
74
|
+
});
|
|
75
|
+
console.log("Finished running addProductFile");
|
|
76
|
+
const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
|
|
77
|
+
targetName,
|
|
78
|
+
targetUuid,
|
|
79
|
+
productFile,
|
|
80
|
+
xCConfigurationList,
|
|
81
|
+
});
|
|
82
|
+
console.log("Finished running addToPbxNativeTargetSection");
|
|
83
|
+
(0, addToPbxProjectSection_1.addToPbxProjectSection)(xcodeProject, target);
|
|
84
|
+
(0, addTargetDependency_1.addTargetDependency)(xcodeProject, target);
|
|
85
|
+
(0, addBuildPhases_1.addBuildPhases)(xcodeProject, {
|
|
86
|
+
targetUuid,
|
|
87
|
+
groupName,
|
|
88
|
+
productFile,
|
|
89
|
+
widgetFiles,
|
|
90
|
+
});
|
|
91
|
+
(0, addPbxGroup_1.addPbxGroup)(xcodeProject, {
|
|
92
|
+
targetName,
|
|
93
|
+
widgetFiles,
|
|
94
|
+
});
|
|
95
|
+
console.log("Finished running withXcode");
|
|
96
|
+
return config;
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
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,57 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.addBuildPhases = addBuildPhases;
|
|
37
|
+
const util = __importStar(require("util"));
|
|
38
|
+
function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widgetFiles, }) {
|
|
39
|
+
const buildPath = `""`;
|
|
40
|
+
const folderType = "app_extension";
|
|
41
|
+
const { swiftFiles, intentFiles, assetDirectories, entitlementFiles, plistFiles, } = widgetFiles;
|
|
42
|
+
// Sources build phase
|
|
43
|
+
xcodeProject.addBuildPhase([...swiftFiles, ...intentFiles], "PBXSourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
|
|
44
|
+
// Copy files build phase
|
|
45
|
+
xcodeProject.addBuildPhase([], "PBXCopyFilesBuildPhase", groupName, xcodeProject.getFirstTarget().uuid, folderType, buildPath);
|
|
46
|
+
xcodeProject
|
|
47
|
+
.buildPhaseObject("PBXCopyFilesBuildPhase", groupName, productFile.target)
|
|
48
|
+
.files.push({
|
|
49
|
+
value: productFile.uuid,
|
|
50
|
+
comment: util.format("%s in %s", productFile.basename, productFile.group), // longComment(file);
|
|
51
|
+
});
|
|
52
|
+
xcodeProject.addToPbxBuildFileSection(productFile);
|
|
53
|
+
// Frameworks build phase
|
|
54
|
+
xcodeProject.addBuildPhase([], "PBXFrameworksBuildPhase", groupName, targetUuid, folderType, buildPath);
|
|
55
|
+
// Resources build phase
|
|
56
|
+
xcodeProject.addBuildPhase([...assetDirectories], "PBXResourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
|
|
57
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPbxGroup = addPbxGroup;
|
|
4
|
+
function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
|
|
5
|
+
const { swiftFiles, intentFiles, otherFiles, assetDirectories, entitlementFiles, plistFiles, } = widgetFiles;
|
|
6
|
+
// Add PBX group
|
|
7
|
+
const { uuid: pbxGroupUuid } = xcodeProject.addPbxGroup([
|
|
8
|
+
...swiftFiles,
|
|
9
|
+
...intentFiles,
|
|
10
|
+
...otherFiles,
|
|
11
|
+
...entitlementFiles,
|
|
12
|
+
...plistFiles,
|
|
13
|
+
...assetDirectories,
|
|
14
|
+
`${targetName}.entitlements`,
|
|
15
|
+
], targetName, targetName);
|
|
16
|
+
// Add PBXGroup to top level group
|
|
17
|
+
const groups = xcodeProject.hash.project.objects["PBXGroup"];
|
|
18
|
+
if (pbxGroupUuid) {
|
|
19
|
+
Object.keys(groups).forEach(function (key) {
|
|
20
|
+
if (groups[key].name === undefined && groups[key].path === undefined) {
|
|
21
|
+
xcodeProject.addToPbxGroup(pbxGroupUuid, key);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProductFile = addProductFile;
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addTargetDependency = addTargetDependency;
|
|
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
|
+
}
|
|
@@ -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,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToPbxProjectSection = addToPbxProjectSection;
|
|
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
|
+
}
|
|
@@ -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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addXCConfigurationList = addXCConfigurationList;
|
|
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: `"${targetName}/${targetName}.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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ConfigPlugin, IOSConfig, withPlugins } from "expo/config-plugins";
|
|
2
|
+
import { withConfig } from "./withConfig";
|
|
3
|
+
import { withPodfile } from "./withPodfile";
|
|
4
|
+
|
|
5
|
+
import { withXcode } from "./withXcode";
|
|
6
|
+
import { withWidgetExtensionEntitlements } from "./withWidgetExtensionEntitlements";
|
|
7
|
+
|
|
8
|
+
const withWidgetsAndLiveActivities: ConfigPlugin = (
|
|
9
|
+
config
|
|
10
|
+
) => {
|
|
11
|
+
const deploymentTarget = "16.2";
|
|
12
|
+
const moduleFileName = "ExpoNativeConfigurationModule.swift"
|
|
13
|
+
const attributesFileName = "LiveActivityAttributes.swift"
|
|
14
|
+
|
|
15
|
+
const targetName = `${IOSConfig.XcodeUtils.sanitizedName(
|
|
16
|
+
config.name
|
|
17
|
+
)}LiveActivity`; // Widgets => LiveActivity
|
|
18
|
+
const bundleIdentifier = `${config.ios?.bundleIdentifier}.${targetName}`;
|
|
19
|
+
|
|
20
|
+
config.ios = {
|
|
21
|
+
...config.ios,
|
|
22
|
+
infoPlist: {
|
|
23
|
+
...config.ios?.infoPlist,
|
|
24
|
+
NSSupportsLiveActivities: true,
|
|
25
|
+
NSSupportsLiveActivitiesFrequentUpdates: false,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
config = withPlugins(config, [
|
|
30
|
+
[
|
|
31
|
+
withXcode,
|
|
32
|
+
{
|
|
33
|
+
targetName,
|
|
34
|
+
bundleIdentifier,
|
|
35
|
+
deploymentTarget,
|
|
36
|
+
// widgetsFolder,
|
|
37
|
+
moduleFileName,
|
|
38
|
+
attributesFileName,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
[withWidgetExtensionEntitlements, { targetName }],
|
|
42
|
+
[withPodfile, { targetName }],
|
|
43
|
+
[withConfig, { targetName, bundleIdentifier }],
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
return config;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default withWidgetsAndLiveActivities;
|
|
@@ -0,0 +1,26 @@
|
|
|
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);
|
|
14
|
+
|
|
15
|
+
return entitlements;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function addApplicationGroupsEntitlement(entitlements: InfoPlist, groupIdentifier?: string) {
|
|
19
|
+
// if (groupIdentifier) {
|
|
20
|
+
// const existingApplicationGroups = (entitlements["com.apple.security.application-groups"] as string[]) ?? [];
|
|
21
|
+
|
|
22
|
+
// entitlements["com.apple.security.application-groups"] = [groupIdentifier, ...existingApplicationGroups];
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
return entitlements;
|
|
26
|
+
}
|