Created
February 23, 2023 13:31
-
-
Save marcinwasowicz/193fb4916b277537a4b7f9e88a456e06 to your computer and use it in GitHub Desktop.
Test NotificationService.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NotificationService.h" | |
#import "TemporaryMessageStorage.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.contentHandler([[UNNotificationContent alloc] init]); | |
} | |
- (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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment