Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "Leave" button on Room details screen #7275

Merged
merged 2 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 1 addition & 89 deletions Riot/Modules/Room/Settings/RoomSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
ROOM_SETTINGS_MAIN_SECTION_ROW_TOPIC,
ROOM_SETTINGS_MAIN_SECTION_ROW_TAG,
ROOM_SETTINGS_MAIN_SECTION_ROW_DIRECT_CHAT,
ROOM_SETTINGS_MAIN_SECTION_ROW_MUTE_NOTIFICATIONS,
ROOM_SETTINGS_MAIN_SECTION_ROW_LEAVE
ROOM_SETTINGS_MAIN_SECTION_ROW_MUTE_NOTIFICATIONS
};

enum
Expand Down Expand Up @@ -515,7 +514,6 @@ - (void)updateSections
{
[sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_MUTE_NOTIFICATIONS];
}
[sectionMain addRowWithTag:ROOM_SETTINGS_MAIN_SECTION_ROW_LEAVE];
[tmpSections addObject:sectionMain];

if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
Expand Down Expand Up @@ -2325,22 +2323,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell = favoriteCell;
}
}
else if (row == ROOM_SETTINGS_MAIN_SECTION_ROW_LEAVE)
{
MXKTableViewCellWithButton *leaveCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithButton defaultReuseIdentifier] forIndexPath:indexPath];

NSString* title = [VectorL10n leave];

[leaveCell.mxkButton setTitle:title forState:UIControlStateNormal];
[leaveCell.mxkButton setTitle:title forState:UIControlStateHighlighted];
[leaveCell.mxkButton setTintColor:ThemeService.shared.theme.tintColor];
leaveCell.mxkButton.titleLabel.font = [UIFont systemFontOfSize:17];

[leaveCell.mxkButton removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[leaveCell.mxkButton addTarget:self action:@selector(onLeave:) forControlEvents:UIControlEventTouchUpInside];

cell = leaveCell;
}
}
else if (section == SECTION_TAG_ACCESS)
{
Expand Down Expand Up @@ -3196,76 +3178,6 @@ - (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)ro

#pragma mark - actions

- (void)onLeave:(id)sender
{
// Prompt user before leaving the room
__weak typeof(self) weakSelf = self;

[currentAlert dismissViewControllerAnimated:NO completion:nil];

NSString *title, *message;
if ([self.mainSession roomWithRoomId:self.roomId].isDirect)
{
title = [VectorL10n roomParticipantsLeavePromptTitleForDm];
message = [VectorL10n roomParticipantsLeavePromptMsgForDm];
}
else
{
title = [VectorL10n roomParticipantsLeavePromptTitle];
message = [VectorL10n roomParticipantsLeavePromptMsg];
}

currentAlert = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];

[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {

if (weakSelf)
{
typeof(self) self = weakSelf;
self->currentAlert = nil;
}

}]];

[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n leave]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {

if (weakSelf)
{
typeof(self) self = weakSelf;
self->currentAlert = nil;

[self startActivityIndicator];
[self->mxRoom leave:^{

if (self.delegate) {
[self.delegate roomSettingsViewControllerDidLeaveRoom:self];
} else {
[[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil];
}

} failure:^(NSError *error) {

[self stopActivityIndicator];

MXLogDebug(@"[RoomSettingsViewController] Leave room failed");
// Alert user
[[AppDelegate theDelegate] showErrorAsAlert:error];

}];
}

}]];

[currentAlert mxk_setAccessibilityIdentifier:@"RoomSettingsVCLeaveAlert"];
[self presentViewController:currentAlert animated:YES completion:nil];
}

- (void)onRoomAvatarTap:(UITapGestureRecognizer *)recognizer
{
SingleImagePickerPresenter *singleImagePickerPresenter = [[SingleImagePickerPresenter alloc] initWithSession:self.mainSession];
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-7275.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove "Leave" button on Room details screen