From ccaeeb8e6d65476f9001ee98f96a9c5f074efb7b Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 8 Sep 2019 10:04:36 -0500 Subject: [PATCH] Automatically dismiss the account detail view when the account is deleted. --- iOS/Settings/Account/SettingsDetailAccountView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iOS/Settings/Account/SettingsDetailAccountView.swift b/iOS/Settings/Account/SettingsDetailAccountView.swift index b97177f35..8e3365245 100644 --- a/iOS/Settings/Account/SettingsDetailAccountView.swift +++ b/iOS/Settings/Account/SettingsDetailAccountView.swift @@ -12,6 +12,7 @@ import Account import RSWeb struct SettingsDetailAccountView : View { + @Environment(\.presentationMode) var presentation @ObservedObject var viewModel: ViewModel @State private var isFeedbinCredentialsPresented = false @State private var isDeleteAlertPresented = false @@ -55,8 +56,11 @@ struct SettingsDetailAccountView : View { } .alert(isPresented: $isDeleteAlertPresented) { Alert(title: Text("Are you sure you want to delete \"\(viewModel.nameForDisplay)\"?"), - primaryButton: Alert.Button.default(Text("Delete"), action: { self.viewModel.delete() }), - secondaryButton: Alert.Button.cancel()) + primaryButton: Alert.Button.default(Text("Delete"), action: { + self.viewModel.delete() + self.presentation.wrappedValue.dismiss() + }), + secondaryButton: Alert.Button.cancel()) } } }