Skip to content

Commit 4176e98

Browse files
authored
fix: apple team id not being used when persisted to the platforms folder (#5821)
1 parent 58078c3 commit 4176e98

File tree

1 file changed

+58
-39
lines changed

1 file changed

+58
-39
lines changed

lib/services/ios/ios-signing-service.ts

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,17 @@ export class IOSSigningService implements IiOSSigningService {
311311
"project.pbxproj"
312312
);
313313
}
314-
314+
private readTeamIdFromFile(projectRoot: string): string | undefined {
315+
try {
316+
const filePath = path.join(projectRoot, "teamid");
317+
if (this.$fs.exists(filePath)) {
318+
return this.$fs.readText(filePath);
319+
}
320+
} catch (e) {
321+
this.$logger.trace("Unable to read file: teamid. Error is: ", e);
322+
}
323+
return undefined;
324+
}
315325
private async getDevelopmentTeam(
316326
projectData: IProjectData,
317327
projectRoot: string,
@@ -345,45 +355,54 @@ export class IOSSigningService implements IiOSSigningService {
345355
)}. Specify team in app/App_Resources/iOS/build.xcconfig file in the following way: DEVELOPMENT_TEAM = <team id>`
346356
);
347357
}
348-
349-
const choices: string[] = [];
350-
for (const team of teams) {
351-
choices.push(team.name + " (" + team.id + ")");
358+
const fromFile = this.readTeamIdFromFile(projectRoot);
359+
if (fromFile) {
360+
const idFromFile = teams.find((value) => value.id === fromFile);
361+
if (idFromFile) {
362+
teamId = idFromFile.id;
363+
this.$logger.info(`Team Id resolved from file: '${teamId}'.`);
364+
}
352365
}
353-
const choice = await this.$prompter.promptForChoice(
354-
"Found multiple development teams, select one:",
355-
choices
356-
);
357-
teamId = teams[choices.indexOf(choice)].id;
358-
359-
const choicesPersist = [
360-
"Yes, set the DEVELOPMENT_TEAM setting in build.xcconfig file.",
361-
"Yes, persist the team id in platforms folder.",
362-
"No, don't persist this setting.",
363-
];
364-
const choicePersist = await this.$prompter.promptForChoice(
365-
"Do you want to make teamId: " +
366-
teamId +
367-
" a persistent choice for your app?",
368-
choicesPersist
369-
);
370-
switch (choicesPersist.indexOf(choicePersist)) {
371-
case 0:
372-
const xcconfigFile = path.join(
373-
projectData.appResourcesDirectoryPath,
374-
"iOS",
375-
BUILD_XCCONFIG_FILE_NAME
376-
);
377-
this.$fs.appendFile(
378-
xcconfigFile,
379-
"\nDEVELOPMENT_TEAM = " + teamId + "\n"
380-
);
381-
break;
382-
case 1:
383-
this.$fs.writeFile(path.join(projectRoot, "teamid"), teamId);
384-
break;
385-
default:
386-
break;
366+
if (!teamId) {
367+
const choices: string[] = [];
368+
for (const team of teams) {
369+
choices.push(team.name + " (" + team.id + ")");
370+
}
371+
const choice = await this.$prompter.promptForChoice(
372+
"Found multiple development teams, select one:",
373+
choices
374+
);
375+
teamId = teams[choices.indexOf(choice)].id;
376+
377+
const choicesPersist = [
378+
"Yes, set the DEVELOPMENT_TEAM setting in build.xcconfig file.",
379+
"Yes, persist the team id in platforms folder.",
380+
"No, don't persist this setting.",
381+
];
382+
const choicePersist = await this.$prompter.promptForChoice(
383+
"Do you want to make teamId: " +
384+
teamId +
385+
" a persistent choice for your app?",
386+
choicesPersist
387+
);
388+
switch (choicesPersist.indexOf(choicePersist)) {
389+
case 0:
390+
const xcconfigFile = path.join(
391+
projectData.appResourcesDirectoryPath,
392+
"iOS",
393+
BUILD_XCCONFIG_FILE_NAME
394+
);
395+
this.$fs.appendFile(
396+
xcconfigFile,
397+
"\nDEVELOPMENT_TEAM = " + teamId + "\n"
398+
);
399+
break;
400+
case 1:
401+
this.$fs.writeFile(path.join(projectRoot, "teamid"), teamId);
402+
break;
403+
default:
404+
break;
405+
}
387406
}
388407
}
389408
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy