mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Publish isProcessingRequest flag to switch ProgressView with Button
This commit is contained in:
parent
22109a47d7
commit
1feeed7354
@ -12,6 +12,7 @@ class WriteFreelyModel: ObservableObject {
|
||||
@Published var editor = PostEditorModel()
|
||||
@Published var isLoggingIn: Bool = false
|
||||
@Published var hasNetworkConnection: Bool = false
|
||||
@Published var isProcessingRequest: Bool = false
|
||||
@Published var selectedPost: WFAPost? {
|
||||
didSet {
|
||||
if let post = selectedPost {
|
||||
|
@ -35,12 +35,16 @@ struct PostListView: View {
|
||||
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
Button(action: {
|
||||
reloadFromServer()
|
||||
}, label: {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
})
|
||||
.disabled(!model.account.isLoggedIn || !model.hasNetworkConnection)
|
||||
if model.isProcessingRequest {
|
||||
ProgressView()
|
||||
} else {
|
||||
Button(action: {
|
||||
reloadFromServer()
|
||||
}, label: {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
})
|
||||
.disabled(!model.account.isLoggedIn || !model.hasNetworkConnection)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.frame(width: geometry.size.width)
|
||||
|
@ -153,7 +153,10 @@ struct PostEditorView: View {
|
||||
PostEditorStatusToolbarView(post: post)
|
||||
}
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Menu(content: {
|
||||
if model.isProcessingRequest {
|
||||
ProgressView()
|
||||
} else {
|
||||
Menu(content: {
|
||||
if post.status == PostStatus.local.rawValue {
|
||||
Menu(content: {
|
||||
Label("Publish to…", systemImage: "paperplane")
|
||||
@ -226,6 +229,7 @@ struct PostEditorView: View {
|
||||
}, label: {
|
||||
Image(systemName: "ellipsis.circle")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: post.hasNewerRemoteCopy, perform: { _ in
|
||||
|
Loading…
Reference in New Issue
Block a user