Skip to content

Commit f962041

Browse files
committed
Fix rebundling app extensions (Only .share for now)
1 parent 2226eb3 commit f962041

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

index.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,20 @@ class Applesign {
143143
}
144144
}
145145

146+
async adjustAllInfoPlists() {
147+
const infoPlistPath = path.join(this.config.appdir, "Info.plist");
148+
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
149+
const ls = new AppDirectory();
150+
const res = await ls.loadFromDirectory(this.config.appdir);
151+
for (let appex of ls.appexs) {
152+
const lidx = appex.lastIndexOf("/");
153+
if (lidx !== -1) {
154+
const plistPath = path.join(appex.substring(0, lidx), "Info.plist");
155+
adjustInfoPlist(plistPath, this.config, this.emit.bind(this));
156+
}
157+
}
158+
}
159+
146160
async signAppDirectoryInternal(ipadir: string, skipNested: boolean) {
147161
fchk(arguments, ["string", "boolean"]);
148162
await this._pullMobileProvision();
@@ -174,8 +188,7 @@ class Applesign {
174188
if (this.config.insertLibrary !== undefined) {
175189
await injectLibrary(this.config);
176190
}
177-
const infoPlistPath = path.join(this.config.appdir, "Info.plist");
178-
adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this));
191+
await this.adjustAllInfoPlists();
179192
if (!this.config.pseudoSign) {
180193
if (!this.config.mobileprovision) {
181194
throw new Error("warning: No mobile provisioning file provided");

lib/info-plist.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ function createEmptyArraysObject(keys: string[]): Record<string, any[]> {
1515
return Object.fromEntries(keys.map((key) => [key, []]));
1616
}
1717

18-
export default function fix(
18+
export default function adjustInfoPlist(
1919
file: string,
2020
options: ConfigOptions,
2121
emit: any,
2222
): void {
23-
if (!options.appdir) {
24-
throw new Error("Invalid parameters for fixPlist");
23+
let { bundleid, forceFamily, allowHttp } = options;
24+
if (!file) {
25+
throw new Error("Invalid parameters for adjustInfoPlist");
26+
}
27+
if (file.indexOf(".appex/") != -1) {
28+
bundleid += ".share";
2529
}
2630
let changed = false;
2731
const data = plist.readFileSync(file);

0 commit comments

Comments
 (0)