Skip to content

Commit

Permalink
feat: show a push while app in foreground
Browse files Browse the repository at this point in the history
  • Loading branch information
levibostian committed Nov 16, 2023
1 parent 2d462ad commit cdcf34a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/helpers/native-files/ios/PushService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CIOAppPushNotificationsHandler : NSObject {
// This is because after AppDelegate.didFinishLaunching is called, the app will start handling push click events.
// Configuring auto track push events after this point will not work.
config.autoTrackPushEvents = {{AUTO_TRACK_PUSH_EVENTS}}
config.showPushAppInForeground = {{SHOW_PUSH_APP_IN_FOREGROUND}}
}
MessagingPushAPN.initialize()
}
Expand Down
9 changes: 9 additions & 0 deletions src/ios/withNotificationsXcodeProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,14 @@ const updatePushFile = (
autoTrackPushEvents.toString()
);

const showPushAppInForeground =
options.showPushAppInForeground === undefined ||
options.showPushAppInForeground === true;
envFileContent = replaceCodeByRegex(
envFileContent,
/\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/,
showPushAppInForeground.toString()
);

FileManagement.writeFile(envFileName, envFileContent);
};
1 change: 1 addition & 0 deletions src/types/cio-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type CustomerIOPluginOptionsIOS = {
appName?: string;
disableNotificationRegistration?: boolean;
handleNotificationClick?: boolean;
showPushAppInForeground?: boolean;
handleDeeplinkInKilledState?: boolean;
useFrameworks?: 'static' | 'dynamic';
pushNotification?: {
Expand Down

0 comments on commit cdcf34a

Please sign in to comment.