Remove unnecessary alert because we don't clobber data anymore

This commit is contained in:
Angelo Stavrow 2020-08-27 17:41:41 -04:00
parent 5c08a9e723
commit a3fe7630e8
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -3,7 +3,6 @@ import SwiftUI
struct PostListView: View {
@EnvironmentObject var model: WriteFreelyModel
@State var selectedCollection: PostCollection
@State private var isPresentingRefreshWarning = false
#if os(iOS)
@State private var isPresentingSettings = false
@ -55,25 +54,10 @@ struct PostListView: View {
.foregroundColor(.secondary)
Spacer()
Button(action: {
isPresentingRefreshWarning = true
reloadFromServer()
}, label: {
Image(systemName: "arrow.clockwise")
})
.actionSheet(isPresented: $isPresentingRefreshWarning, content: {
ActionSheet(
title: Text("Are you sure you want to reload content from the server?"),
message: Text("""
Content on your device will be replaced by content from the server and any unpublished changes \
will be lost, except for local drafts.
You can't undo this action.
"""),
buttons: [
.cancel(),
.destructive(Text("Reload From Server"), action: reloadFromServer)
]
)
})
.disabled(!model.account.isLoggedIn)
}
.padding()
@ -103,23 +87,10 @@ struct PostListView: View {
Image(systemName: "square.and.pencil")
})
Button(action: {
isPresentingRefreshWarning = true
reloadFromServer()
}, label: {
Image(systemName: "arrow.clockwise")
})
.alert(isPresented: $isPresentingRefreshWarning, content: {
Alert(
title: Text("Are you sure you want to reload content from the server?"),
message: Text("""
Content on your Mac will be replaced by content from the server and any unpublished changes \
will be lost, except for local drafts.
You can't undo this action.
"""),
primaryButton: .cancel(),
secondaryButton: .destructive(Text("Reload From Server"), action: reloadFromServer)
)
})
.disabled(!model.account.isLoggedIn)
}
#endif