From ccb342fbc5b27875ad3fbdcce7182d527b902d44 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Mon, 30 Nov 2020 10:36:59 -0500 Subject: [PATCH] Show alert instead of sheet on logout --- Shared/Account/AccountLogoutView.swift | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Shared/Account/AccountLogoutView.swift b/Shared/Account/AccountLogoutView.swift index 9f69a50..0ff1c77 100644 --- a/Shared/Account/AccountLogoutView.swift +++ b/Shared/Account/AccountLogoutView.swift @@ -43,22 +43,13 @@ struct AccountLogoutView: View { Text("Log Out") }) } - .sheet(isPresented: $isPresentingLogoutConfirmation) { - VStack { - Text("Log Out?") - .font(.title) - Text("\(editedPostsWarningString)You won't lose any local posts. Are you sure?") - HStack { - Button(action: model.logout, label: { - Text("Log Out") - }) - Button(action: { - self.isPresentingLogoutConfirmation = false - }, label: { - Text("Cancel") - }).keyboardShortcut(.cancelAction) - } - } + .alert(isPresented: $isPresentingLogoutConfirmation) { + Alert( + title: Text("Log Out?"), + message: Text("\(editedPostsWarningString)You won't lose any local posts. Are you sure?"), + primaryButton: .cancel(Text("Cancel"), action: { self.isPresentingLogoutConfirmation = false }), + secondaryButton: .destructive(Text("Log Out"), action: model.logout ) + ) } #endif }