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
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: {
return @[];
@ -1113,22 +1117,21 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
TSThread *thread = [self threadForIndexPath:indexPath];
if (![thread isKindOfClass:[TSGroupThread class]]) {
[self deleteThread:thread];
return;
}
TSGroupThread *gThread = (TSGroupThread *)thread;
if (![gThread.groupModel.groupMemberIds containsObject:[TSAccountManager localNumber]]) {
[self deleteThread:thread];
return;
}
[ThreadUtil enqueueLeaveGroupMessageInThread:gThread];
// MJK TODO - DURABLE TESTPLAN is this safe to delete the gThread when the outgoing message hasn't completed
// sending?
[self deleteThread:thread];
__weak HomeViewController *weakSelf = self;
UIAlertController *alert =
[UIAlertController alertControllerWithTitle:NSLocalizedString(@"CONVERSATION_DELETE_CONFIRMATION_ALERT_TITLE",
@"Title for the 'conversation delete confirmation' alert.")
message:NSLocalizedString(@"CONVERSATION_DELETE_CONFIRMATION_ALERT_MESSAGE",
@"Message for the 'conversation delete confirmation' alert.")
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", nil)
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) {
[weakSelf deleteThread:thread];
}]];
[alert addAction:[OWSAlerts cancelAction]];
[self presentViewController:alert animated:YES completion:nil];
}
- (void)deleteThread:(TSThread *)thread

@ -191,9 +191,6 @@
/* Error indicating that the app received an invalid response from CloudKit. */
"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. */
"BACKUP_EXPORT_PHASE_CLEAN_UP" = "Cleaning Up Backup";
@ -557,6 +554,12 @@
/* Indicates that a contact has no name. */
"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 */
"CONVERSATION_SETTINGS" = "Conversation Settings";

Loading…
Cancel
Save