forked from Ivasoft/mattermost-mobile
Handle test notifications on iOS (#6002)
* Handle test notifications on iOS * Update ios/Mattermost/AppDelegate.m Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update ios/Mattermost/AppDelegate.m Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Fix indent Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9dbdae22fd
commit
d5ece8a4a7
@@ -25,6 +25,7 @@
|
||||
NSString* const NOTIFICATION_MESSAGE_ACTION = @"message";
|
||||
NSString* const NOTIFICATION_CLEAR_ACTION = @"clear";
|
||||
NSString* const NOTIFICATION_UPDATE_BADGE_ACTION = @"update_badge";
|
||||
NSString* const NOTIFICATION_TEST_ACTION = @"test";
|
||||
MattermostBucket* bucket = nil;
|
||||
|
||||
-(void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler {
|
||||
@@ -95,6 +96,12 @@ MattermostBucket* bucket = nil;
|
||||
NSString* action = [userInfo objectForKey:@"type"];
|
||||
NSString* channelId = [userInfo objectForKey:@"channel_id"];
|
||||
BOOL isClearAction = (action && [action isEqualToString: NOTIFICATION_CLEAR_ACTION]);
|
||||
BOOL isTestAction = (action && [action isEqualToString: NOTIFICATION_TEST_ACTION]);
|
||||
|
||||
if (isTestAction) {
|
||||
completionHandler(UIBackgroundFetchResultNoData);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isClearAction) {
|
||||
// If received a notification that a channel was read, remove all notifications from that channel (only with app in foreground/background)
|
||||
|
||||
Reference in New Issue
Block a user