31 lines
981 B
Objective-C
31 lines
981 B
Objective-C
//
|
|
// NotificationService.m
|
|
// apnsextention
|
|
//
|
|
// Created by Lee Chungwon on 2021/05/25.
|
|
// Copyright © 2021 itsB. All rights reserved.
|
|
//
|
|
|
|
#import "NotificationService.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 {
|
|
[super didReceiveNotificationRequest:request 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
|