diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index ef355b183..9d6727dbb 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -497,6 +497,7 @@ Tap the + to start adding people."; "room_preview_unlinked_email_warning" = "This invitation was sent to %@, which is not associated with this account. You may wish to login with a different account, or add this email to your account."; "room_preview_try_join_an_unknown_room" = "You are trying to access %@. Would you like to join in order to participate in the discussion?"; "room_preview_try_join_an_unknown_room_default" = "a room"; +"room_preview_decline_invitation_options" = "Do you want to decline the invitation or ignore this user?"; // Settings "settings_title" = "Settings"; @@ -2032,6 +2033,7 @@ Tap the + to start adding people."; "end_call" = "End Call"; "resume_call" = "Resume"; "ignore" = "Ignore"; +"ignore_user" = "Ignore User"; "unignore" = "Unignore"; // Events formatter diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 755555512..cf2c25d68 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -2127,6 +2127,10 @@ public class VectorL10n: NSObject { public static var ignore: String { return VectorL10n.tr("Vector", "ignore") } + /// Ignore User + public static var ignoreUser: String { + return VectorL10n.tr("Vector", "ignore_user") + } /// Take photo public static var imagePickerActionCamera: String { return VectorL10n.tr("Vector", "image_picker_action_camera") @@ -5323,6 +5327,10 @@ public class VectorL10n: NSObject { public static var roomPredecessorLink: String { return VectorL10n.tr("Vector", "room_predecessor_link") } + /// Do you want to decline the invitation or ignore this user? + public static var roomPreviewDeclineInvitationOptions: String { + return VectorL10n.tr("Vector", "room_preview_decline_invitation_options") + } /// You have been invited to join this room by %@ public static func roomPreviewInvitationFormat(_ p1: String) -> String { return VectorL10n.tr("Vector", "room_preview_invitation_format", p1) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index ffe224ede..28431729c 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -4979,10 +4979,31 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; } else if (tappedView == previewHeader.leftButton) { - [self declineRoomInvitation]; + [self presentDeclineOptions]; } } +- (void)presentDeclineOptions +{ + UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:[VectorL10n roomPreviewDeclineInvitationOptions] + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + [actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n decline] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self declineRoomInvitation]; + }]]; + [actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n ignoreUser] + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction * _Nonnull action) { + [self ignoreInviteSender]; + }]]; + [actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel] + style:UIAlertActionStyleCancel + handler:nil]]; + [self presentViewController:actionSheet animated:YES completion:nil]; +} + - (void)declineRoomInvitation { // 'Decline' button has been pressed @@ -4993,14 +5014,9 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; else { [self startActivityIndicator]; - [self.roomDataSource.room leave:^{ - [self stopActivityIndicator]; - - // We remove the current view controller. - // Pop to homes view controller - [[AppDelegate theDelegate] restoreInitialDisplay:^{}]; + [self popToHomeViewController]; } failure:^(NSError *error) { @@ -5011,6 +5027,26 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; } } +- (void)ignoreInviteSender +{ + [self startActivityIndicator]; + [self.roomDataSource.room ignoreInviteSender:^{ + [self stopActivityIndicator]; + [self popToHomeViewController]; + + } failure:^(NSError *error) { + [self stopActivityIndicator]; + MXLogDebug(@"[RoomVC] Failed to ignore inviter in room (%@)", self.roomDataSource.room.roomId); + }]; +} + +- (void)popToHomeViewController +{ + // We remove the current view controller. + // Pop to homes view controller + [[AppDelegate theDelegate] restoreInitialDisplay:^{}]; +} + #pragma mark - Typing management - (void)removeTypingNotificationsListener diff --git a/changelog.d/5807.change b/changelog.d/5807.change new file mode 100644 index 000000000..fa2b13524 --- /dev/null +++ b/changelog.d/5807.change @@ -0,0 +1 @@ +Room: Ignore the sender of a room invite without needing to join the room first