Refine conversation delete/archive.

pull/1/head
Matthew Chen 6 years ago
parent 9eb0c5e773
commit 02c7a52a64

@ -947,7 +947,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
}); });
} }
#pragma mark Table Swipe to Delete #pragma mark - Edit Actions
- (void)tableView:(UITableView *)tableView - (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
@ -992,7 +992,11 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
}]; }];
} }
return @[ deleteAction, archiveAction ]; // The first action will be auto-performed for "very long swipes".
return @[
archiveAction,
deleteAction,
];
} }
case HomeViewControllerSectionArchiveButton: { case HomeViewControllerSectionArchiveButton: {
return @[]; return @[];
@ -1113,22 +1117,21 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
TSThread *thread = [self threadForIndexPath:indexPath]; TSThread *thread = [self threadForIndexPath:indexPath];
if (![thread isKindOfClass:[TSGroupThread class]]) { __weak HomeViewController *weakSelf = self;
[self deleteThread:thread]; UIAlertController *alert =
return; [UIAlertController alertControllerWithTitle:NSLocalizedString(@"CONVERSATION_DELETE_CONFIRMATION_ALERT_TITLE",
} @"Title for the 'conversation delete confirmation' alert.")
message:NSLocalizedString(@"CONVERSATION_DELETE_CONFIRMATION_ALERT_MESSAGE",
TSGroupThread *gThread = (TSGroupThread *)thread; @"Message for the 'conversation delete confirmation' alert.")
if (![gThread.groupModel.groupMemberIds containsObject:[TSAccountManager localNumber]]) { preferredStyle:UIAlertControllerStyleAlert];
[self deleteThread:thread]; [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", nil)
return; style:UIAlertActionStyleDestructive
} handler:^(UIAlertAction *action) {
[weakSelf deleteThread:thread];
[ThreadUtil enqueueLeaveGroupMessageInThread:gThread]; }]];
[alert addAction:[OWSAlerts cancelAction]];
// MJK TODO - DURABLE TESTPLAN is this safe to delete the gThread when the outgoing message hasn't completed
// sending? [self presentViewController:alert animated:YES completion:nil];
[self deleteThread:thread];
} }
- (void)deleteThread:(TSThread *)thread - (void)deleteThread:(TSThread *)thread

@ -191,9 +191,6 @@
/* Error indicating that the app received an invalid response from CloudKit. */ /* Error indicating that the app received an invalid response from CloudKit. */
"BACKUP_EXPORT_ERROR_INVALID_CLOUDKIT_RESPONSE" = "Invalid Service Response"; "BACKUP_EXPORT_ERROR_INVALID_CLOUDKIT_RESPONSE" = "Invalid Service Response";
/* Error indicating the backup export failed to save a file to the cloud. */
"BACKUP_EXPORT_ERROR_SAVE_FILE_TO_CLOUD_FAILED" = "Backup data could not be uploaded.";
/* Indicates that the cloud is being cleaned up. */ /* Indicates that the cloud is being cleaned up. */
"BACKUP_EXPORT_PHASE_CLEAN_UP" = "Cleaning Up Backup"; "BACKUP_EXPORT_PHASE_CLEAN_UP" = "Cleaning Up Backup";
@ -557,6 +554,12 @@
/* Indicates that a contact has no name. */ /* Indicates that a contact has no name. */
"CONTACT_WITHOUT_NAME" = "Unnamed Contact"; "CONTACT_WITHOUT_NAME" = "Unnamed Contact";
/* Message for the 'conversation delete confirmation' alert. */
"CONVERSATION_DELETE_CONFIRMATION_ALERT_MESSAGE" = "This cannot be undone.";
/* Title for the 'conversation delete confirmation' alert. */
"CONVERSATION_DELETE_CONFIRMATION_ALERT_TITLE" = "Delete Conversation?";
/* title for conversation settings screen */ /* title for conversation settings screen */
"CONVERSATION_SETTINGS" = "Conversation Settings"; "CONVERSATION_SETTINGS" = "Conversation Settings";

Loading…
Cancel
Save