mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-27 13:03:12 +03:00
35 lines
1.1 KiB
Objective-C
35 lines
1.1 KiB
Objective-C
//
|
|
// NotificationService.m
|
|
// ImageNotifi
|
|
//
|
|
// Created by Feruz Muradov on 2023-10-09.
|
|
//
|
|
|
|
#import "NotificationService.h"
|
|
#import "FirebaseMessaging.h"
|
|
|
|
@interface NotificationService ()
|
|
|
|
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
|
|
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
|
|
|
|
@end
|
|
|
|
@implementation NotificationService
|
|
|
|
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
|
|
self.contentHandler = contentHandler;
|
|
self.bestAttemptContent = [request.content mutableCopy];
|
|
|
|
// Modify the notification content here...
|
|
[[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];
|
|
}
|
|
|
|
- (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.
|
|
self.contentHandler(self.bestAttemptContent);
|
|
}
|
|
|
|
@end
|