Skip to content

Commit

Permalink
add devTeam and default service extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrico972 committed Dec 12, 2024
1 parent f418f16 commit 8f7668b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// NotificationService.swift


import AirshipServiceExtension

class AirshipNotificationService: UANotificationServiceExtension {

}
6 changes: 5 additions & 1 deletion plugin/src/withAirship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ export type AirshipIOSPluginProps = {
/**
* Optional. The local path to a custom Notification Service Extension.
*/
notificationService?: string;
notificationService?: 'DEFAULT_AIRSHIP_SERVICE_EXTENSION' | string;
/**
* Optional. Airship will use a default one if not provided.
* The local path to a Notification Service Extension Info.plist.
*/
notificationServiceInfo?: string;
/**
* Optional. The Apple Development Team ID used to configure the Notification Service Extension target.
*/
developmentTeamID?: string;
}

export type AirshipPluginProps = {
Expand Down
10 changes: 8 additions & 2 deletions plugin/src/withAirshipIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ async function writeNotificationServiceFilesAsync(props: AirshipIOSPluginProps,
}

// Copy the NotificationService.swift file into the iOS expo project as AirshipNotificationService.swift.
readFile(props.notificationService, 'utf8', (err, data) => {
var notificationServiceFile = props.notificationService == "DEFAULT_AIRSHIP_SERVICE_EXTENSION" ? join(sourceDir, NOTIFICATION_SERVICE_FILE_NAME) : props.notificationService;
readFile(notificationServiceFile, 'utf8', (err, data) => {
if (err || !data) {
console.error("Airship couldn't read file " + props.notificationService);
console.error("Airship couldn't read file " + notificationServiceFile);
console.error(err);
return;
}
Expand Down Expand Up @@ -160,9 +161,14 @@ const withExtensionTargetInXcodeProject: ConfigPlugin<AirshipIOSPluginProps> = (
const buildSettingsObj = configurations[key].buildSettings;
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = "14.0";
buildSettingsObj.SWIFT_VERSION = "5.0";
buildSettingsObj.DEVELOPMENT_TEAM = props?.developmentTeamID;
buildSettingsObj.CODE_SIGN_STYLE = "Automatic";
}
}

// Add development teams to the target
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.developmentTeamID, notificationServiceExtensionTarget);

return newConfig;
});
};
Expand Down

0 comments on commit 8f7668b

Please sign in to comment.