Merge branch 'charlesmchen/unsavedConversationChanges' into release/3.8.3
This commit is contained in:
commit
078e20975e
@ -995,9 +995,9 @@ extension ConversationSettingsViewController: OWSNavigationView {
|
||||
public func shouldCancelNavigationBack() -> Bool {
|
||||
let result = hasUnsavedChangesToDisappearingMessagesConfiguration
|
||||
if result {
|
||||
GroupAttributesViewController.showUnsavedGroupChangesActionSheet(from: self,
|
||||
saveBlock: {
|
||||
self.updateDisappearingMessagesConfigurationAndDismiss()
|
||||
Self.showUnsavedChangesActionSheet(from: self,
|
||||
saveBlock: {
|
||||
self.updateDisappearingMessagesConfigurationAndDismiss()
|
||||
}, discardBlock: {
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
})
|
||||
@ -1005,6 +1005,29 @@ extension ConversationSettingsViewController: OWSNavigationView {
|
||||
return result
|
||||
}
|
||||
|
||||
@objc
|
||||
public static func showUnsavedChangesActionSheet(from fromViewController: UIViewController,
|
||||
saveBlock: @escaping () -> Void,
|
||||
discardBlock: @escaping () -> Void) {
|
||||
let actionSheet = ActionSheetController(title: NSLocalizedString("CONVERSATION_SETTINGS_UNSAVED_CHANGES_TITLE",
|
||||
comment: "The alert title if user tries to exit conversation settings view without saving changes."),
|
||||
message: NSLocalizedString("CONVERSATION_SETTINGS_UNSAVED_CHANGES_MESSAGE",
|
||||
comment: "The alert message if user tries to exit conversation settings view without saving changes."))
|
||||
actionSheet.addAction(ActionSheetAction(title: NSLocalizedString("ALERT_SAVE",
|
||||
comment: "The label for the 'save' button in action sheets."),
|
||||
accessibilityIdentifier: UIView.accessibilityIdentifier(in: fromViewController, name: "save"),
|
||||
style: .default) { _ in
|
||||
saveBlock()
|
||||
})
|
||||
actionSheet.addAction(ActionSheetAction(title: NSLocalizedString("ALERT_DONT_SAVE",
|
||||
comment: "The label for the 'don't save' button in action sheets."),
|
||||
accessibilityIdentifier: UIView.accessibilityIdentifier(in: fromViewController, name: "dont_save"),
|
||||
style: .destructive) { _ in
|
||||
discardBlock()
|
||||
})
|
||||
fromViewController.presentActionSheet(actionSheet)
|
||||
}
|
||||
|
||||
private func updateDisappearingMessagesConfigurationAndDismiss() {
|
||||
let dmConfiguration: OWSDisappearingMessagesConfiguration = disappearingMessagesConfiguration
|
||||
let thread = self.thread
|
||||
|
||||
@ -860,6 +860,12 @@
|
||||
/* Label for button to unmute a thread. */
|
||||
"CONVERSATION_SETTINGS_UNMUTE_ACTION" = "Unmute";
|
||||
|
||||
/* The alert message if user tries to exit conversation settings view without saving changes. */
|
||||
"CONVERSATION_SETTINGS_UNSAVED_CHANGES_MESSAGE" = "Would you like to save the changes that you made to this conversation?";
|
||||
|
||||
/* The alert title if user tries to exit conversation settings view without saving changes. */
|
||||
"CONVERSATION_SETTINGS_UNSAVED_CHANGES_TITLE" = "Unsaved Changes";
|
||||
|
||||
/* Label for 'view all members' button in conversation settings view. */
|
||||
"CONVERSATION_SETTINGS_VIEW_ALL_MEMBERS" = "View all members";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user