Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ios): support iOS 14+ App Clips #12107

Merged
merged 3 commits into from
Sep 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ iOSBuilder.prototype.initTiappSettings = function initTiappSettings() {
productType: productType,
isWatchAppV1Extension: productType === 'com.apple.product-type.watchkit-extension',
isExtension: containsExtension && (!containsWatchKit || productType === 'com.apple.product-type.watchkit-extension'),
isAppClip: productType === 'com.apple.product-type.application.on-demand-install-capable',
isWatchAppV1: productType === 'com.apple.product-type.application.watchapp',
isWatchAppV2orNewer: containsWatchApp && productType !== 'com.apple.product-type.application.watchapp',
sdkRoot: productType === 'com.apple.product-type.application.watchapp' ? 'watchos' : (buildSettings.SDKROOT || globalBuildSettings.SDKROOT || null),
Expand Down Expand Up @@ -3721,9 +3722,16 @@ iOSBuilder.prototype.createXcodeProject = function createXcodeProject(next) {
this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'PlugIns', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
} else if (targetInfo.isWatchAppV2orNewer) {
this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'Watch', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
} else if (targetInfo.isAppClip) {
const xcodeProj = path.basename(ext.projectPath);
const originPath = path.join(ext.projectPath.split(xcodeProj)[0], ext.targets[0].name);
const destinationPath = path.join(this.buildDir, ext.targets[0].name);

this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'AppClips', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
this.copyDirSync(originPath, destinationPath);
}

if (targetInfo.isExtension || targetInfo.isWatchAppV2orNewer) {
if (targetInfo.isExtension || targetInfo.isWatchAppV2orNewer || targetInfo.isAppClip) {
// add this target as a dependency of the titanium app's project
const proxyUuid = this.generateXcodeUuid(xcodeProject);
xobjs.PBXContainerItemProxy || (xobjs.PBXContainerItemProxy = {});
Expand Down Expand Up @@ -3801,8 +3809,10 @@ iOSBuilder.prototype.createXcodeProject = function createXcodeProject(next) {

if (targetInfo.isWatchAppV2orNewer) {
addEmbedBuildPhase.call(this, 'Embed Watch Content', '$(CONTENTS_FOLDER_PATH)/Watch', 16 /* type "watch app" */);
} else {
} else if (targetInfo.isExtension) {
addEmbedBuildPhase.call(this, 'Embed App Extensions', null, 13 /* type "plugin" */);
} else if (targetInfo.isAppClip) {
addEmbedBuildPhase.call(this, 'Embed App Clips', '$(CONTENTS_FOLDER_PATH)/AppClips', 16 /* type "application.on-demand-install-capable" */);
}
}
}, this);
Expand Down