Skip to content

Commit ac9fa81

Browse files
committed
Fix rebundling apps with app extensions (.share only for now)
1 parent 9648a9f commit ac9fa81

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

index.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ class Applesign {
133133
}
134134
}
135135

136+
async adjustAllInfoPlists () {
137+
const infoPlistPath = path.join(this.config.appdir, 'Info.plist');
138+
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
139+
const ls = new AppDirectory();
140+
const res = await ls.loadFromDirectory(this.config.appdir);
141+
for (let appex of ls.appexs) {
142+
const lidx = appex.lastIndexOf('/');
143+
if (lidx !== -1) {
144+
const plistPath = path.join (appex.substring(0,lidx), 'Info.plist');
145+
adjustInfoPlist(plistPath, this.config, this.emit.bind(this));
146+
}
147+
}
148+
}
149+
136150
async signAppDirectory (ipadir, skipNested) {
137151
fchk(arguments, ['string', 'boolean']);
138152
await this._pullMobileProvision();
@@ -162,8 +176,7 @@ class Applesign {
162176
if (this.config.insertLibrary !== undefined) {
163177
await insertLibrary(this.config);
164178
}
165-
const infoPlistPath = path.join(this.config.appdir, 'Info.plist');
166-
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
179+
await this.adjustAllInfoPlists ();
167180
if (!this.config.pseudoSign) {
168181
if (!this.config.mobileprovision) {
169182
throw new Error('warning: No mobile provisioning file provided');

lib/info-plist.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ const plist = require('simple-plist');
55
const appleDevices = ['iPhone', 'iPad', 'AppleTV', 'AppleWatch'];
66
const objectFromEntries = (x) => Array.from(x, (k) => ({ [k]: [] })); // ES7 is not yet here
77

8-
function fix (file, options, emit) {
9-
const { appdir, bundleid, forceFamily, allowHttp } = options;
10-
if (!file || !appdir) {
11-
throw new Error('Invalid parameters for fixPlist');
8+
function adjustInfoPlist (file, options, emit) {
9+
let { bundleid, forceFamily, allowHttp } = options;
10+
if (!file) {
11+
throw new Error('Invalid parameters for adjustInfoPlist');
12+
}
13+
if (file.indexOf('.appex/') != -1) {
14+
bundleid += '.share';
1215
}
1316
let changed = false;
1417
const data = plist.readFileSync(file);
@@ -116,4 +119,4 @@ function supportedDevices (data) {
116119
return have;
117120
}
118121

119-
module.exports = fix;
122+
module.exports = adjustInfoPlist;

0 commit comments

Comments
 (0)