Skip to content

Commit

Permalink
♻️ Simplify addToPbxGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed May 14, 2024
1 parent d7cabaf commit 26edefd
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions plugin/src/withIosAppcuesRichPush.ts
Original file line number Diff line number Diff line change
@@ -87,22 +87,14 @@ const withAppcuesXcodeProject: ConfigPlugin<ConfigProps> = (config, props) => {
APPCUES_NSE_TARGET.NAME
);

// Add the group to the project group. This makes the files appear in the file explorer in Xcode.
// Searching for the nameless group is a proxy for the root group.
const groups = xcodeProject.hash.project.objects['PBXGroup'];
for (const groupUUID of Object.keys(groups)) {
if (
typeof groups[groupUUID] === 'object' &&
groups[groupUUID].name === undefined
) {
xcodeProject.addToPbxGroup(
appcuesNotificationServiceGroup.uuid,
groupUUID
);
// There should only be a single nameless group, but break anyways just to be sure it's not added twice.
break;
}
}
// Add the group to the main group. This makes the files appear in the file explorer in Xcode.
const mainGroupUUID =
xcodeProject.pbxProjectSection()[xcodeProject.getFirstProject().uuid]
.mainGroup;
xcodeProject.addToPbxGroup(
appcuesNotificationServiceGroup.uuid,
mainGroupUUID
);

// Add a target for the extension.
const targetBundleId = `${config.ios?.bundleIdentifier}.${APPCUES_NSE_TARGET.NAME}`;

0 comments on commit 26edefd

Please sign in to comment.