If you are managing notification from multiple servers, BlueShift notifications can be identify by SDK methods inside push notification extensions.
-
Push notification service extension for checking push notification received from blueshift server
[[BlueShiftPushNotification sharedInstance] isBlueShiftPushNotification:request]
it return 'true' or 'false'
for checking attachments downloaded from blueshift notification or not
[[BlueShiftPushNotification sharedInstance] hasBlueShiftAttachments]
return 'true' or 'false'
Sample Objective C code
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
if([[BlueShiftPushNotification sharedInstance] isBlueShiftPushNotification:request]) {
self.bestAttemptContent.attachments = [[BlueShiftPushNotification sharedInstance] integratePushNotificationWithMediaAttachementsForRequest:request];
} else {
// Your Custom code comes here
}
self.contentHandler(self.bestAttemptContent);
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if([[BlueShiftPushNotification sharedInstance] hasBlueShiftAttachments]) {
self.bestAttemptContent.attachments = [BlueShiftPushNotification sharedInstance].attachments;
} else {
// code here
}
self.contentHandler(self.bestAttemptContent);
}
- Push notification content extension
For checking delivered notification is BlueShift carousel push notification
[self isBlueShiftCarouselPushNotification:notification]
return 'true' or 'false'
For checking action is from BlueShift carousel notification or not
[self isBlueShiftCarouselActions:response]
return 'true' or 'false'
Sample objective C code
- (void)viewDidLoad {
[super viewDidLoad];
self.appGroupID = @"group.blueshift.app";
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)didReceiveNotification:(UNNotification *)notification {
if([self isBlueShiftCarouselPushNotification:notification]) {
[self showCarouselForNotfication:notification];
} else {
// Perform your codes here
}
}
- (void)didReceiveNotificationResponse:(UNNotificationResponse *)response completionHandler:(void (^)(UNNotificationContentExtensionResponseOption))completion {
//Place following codes after your code lines
if([self isBlueShiftCarouselActions:response]) {
[self setCarouselActionsForResponse:response completionHandler:^(UNNotificationContentExtensionResponseOption option) {
completion(option);
}];
}
}