Skip to content

Commit cde5a20

Browse files
committed
Fix rebundling apps with app extensions (.share only for now)
1 parent 1d9a904 commit cde5a20

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
@@ -114,6 +114,20 @@ class Applesign {
114114
}
115115
}
116116

117+
async adjustAllInfoPlists () {
118+
const infoPlistPath = path.join(this.config.appdir, 'Info.plist');
119+
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
120+
const ls = new AppDirectory();
121+
const res = await ls.loadFromDirectory(this.config.appdir);
122+
for (let appex of ls.appexs) {
123+
const lidx = appex.lastIndexOf('/');
124+
if (lidx !== -1) {
125+
const plistPath = path.join (appex.substring(0,lidx), 'Info.plist');
126+
adjustInfoPlist(plistPath, this.config, this.emit.bind(this));
127+
}
128+
}
129+
}
130+
117131
async signAppDirectory (ipadir, skipNested) {
118132
fchk(arguments, ['string', 'boolean']);
119133
this._pullMobileProvision();
@@ -143,8 +157,7 @@ class Applesign {
143157
if (this.config.insertLibrary !== undefined) {
144158
await insertLibrary(this.config);
145159
}
146-
const infoPlistPath = path.join(this.config.appdir, 'Info.plist');
147-
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
160+
await this.adjustAllInfoPlists ();
148161
if (!this.config.pseudoSign) {
149162
if (!this.config.mobileprovision) {
150163
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)