diff --git a/CHANGES.rst b/CHANGES.rst index 419ffbcfd..c592f92e9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -26,6 +26,7 @@ Bug fix: * Xcode11: Respect system dark mode setting (#2628). * Xcode11: Fix noisy notifications (#3316). * Xcode11: Temporary workaround for navigation bar bg color on emoji selection screen (#3271). + * Xcode11: Pass eventId when navigating to room from notification (#3321). Changes in 0.11.6 (2020-xx-xx) =============================================== diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 931303e9b..2a357e8a0 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -1170,9 +1170,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - PushNotificationServiceDelegate -- (void)pushNotificationService:(PushNotificationService *)pushNotificationService shouldNavigateToRoomWithId:(NSString *)roomId +- (void)pushNotificationService:(PushNotificationService *)pushNotificationService shouldNavigateToRoomWithId:(NSString *)roomId eventId:(nonnull NSString *)eventId { - [self navigateToRoomById:roomId]; + [self navigateToRoomById:roomId eventId:eventId]; } #pragma mark - Badge Count @@ -2839,7 +2839,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - Matrix Rooms handling -- (void)navigateToRoomById:(NSString *)roomId +- (void)navigateToRoomById:(NSString *)roomId eventId:(NSString *)eventId { if (roomId.length) { @@ -2873,7 +2873,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSLog(@"[AppDelegate][Push] navigateToRoomById: open the roomViewController %@", roomId); - [self showRoom:roomId andEventId:nil withMatrixSession:dedicatedAccount.mxSession]; + [self showRoom:roomId andEventId:eventId withMatrixSession:dedicatedAccount.mxSession]; } else { diff --git a/Riot/Managers/PushNotification/PushNotificationService.h b/Riot/Managers/PushNotification/PushNotificationService.h index 5dfe46c4d..963d65a29 100644 --- a/Riot/Managers/PushNotification/PushNotificationService.h +++ b/Riot/Managers/PushNotification/PushNotificationService.h @@ -88,9 +88,11 @@ NS_ASSUME_NONNULL_BEGIN @param pushNotificationService PushNotificationService object. @param roomId Room identifier to be navigated. + @param eventId Event identifier to be navigated around. */ - (void)pushNotificationService:(PushNotificationService *)pushNotificationService - shouldNavigateToRoomWithId:(NSString *)roomId; + shouldNavigateToRoomWithId:(NSString *)roomId + eventId:(NSString *)eventId; @end; diff --git a/Riot/Managers/PushNotification/PushNotificationService.m b/Riot/Managers/PushNotification/PushNotificationService.m index 142d2b281..d83940030 100644 --- a/Riot/Managers/PushNotification/PushNotificationService.m +++ b/Riot/Managers/PushNotification/PushNotificationService.m @@ -140,6 +140,7 @@ UNNotificationContent *content = notification.request.content; NSString *actionIdentifier = [response actionIdentifier]; NSString *roomId = content.userInfo[@"room_id"]; + NSString *eventId = content.userInfo[@"event_id"]; if ([actionIdentifier isEqualToString:@"inline-reply"]) { @@ -176,7 +177,7 @@ } else if ([actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) { - [self notifyNavigateToRoomById:roomId]; + [self notifyNavigateToRoomById:roomId eventId:eventId]; completionHandler(); } else @@ -317,11 +318,11 @@ #pragma mark - Delegate Notifiers -- (void)notifyNavigateToRoomById:(NSString *)roomId +- (void)notifyNavigateToRoomById:(NSString *)roomId eventId:(NSString *)eventId { - if ([_delegate respondsToSelector:@selector(pushNotificationService:shouldNavigateToRoomWithId:)]) + if ([_delegate respondsToSelector:@selector(pushNotificationService:shouldNavigateToRoomWithId:eventId:)]) { - [_delegate pushNotificationService:self shouldNavigateToRoomWithId:roomId]; + [_delegate pushNotificationService:self shouldNavigateToRoomWithId:roomId eventId:eventId]; } }