mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Show prompt if there are server-side changes to post
This commit is contained in:
parent
7cb7fa3017
commit
5ca32ddcfc
@ -66,7 +66,7 @@ struct ContentView: View {
|
||||
}
|
||||
ToolbarItem(placement: .status) {
|
||||
if let selectedPost = model.selectedPost {
|
||||
PostStatusBadgeView(post: selectedPost)
|
||||
PostEditorStatusToolbarView(post: selectedPost)
|
||||
}
|
||||
}
|
||||
ToolbarItemGroup(placement: .primaryAction) {
|
||||
|
@ -11,16 +11,21 @@ struct PostEditorStatusToolbarView: View {
|
||||
PostStatusBadgeView(post: post)
|
||||
#else
|
||||
HStack {
|
||||
HStack {
|
||||
Text("⚠️ Newer copy on server. Replace local copy?")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
model.updateFromServer(post: post)
|
||||
}, label: {
|
||||
Image(systemName: "square.and.arrow.down")
|
||||
})
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.background(Color.primary.opacity(0.1))
|
||||
.clipShape(Capsule())
|
||||
.padding(.trailing)
|
||||
PostStatusBadgeView(post: post)
|
||||
.padding(.trailing)
|
||||
Text("⚠️ Newer copy on server. Replace local copy?")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
model.updateFromServer(post: post)
|
||||
}, label: {
|
||||
Image(systemName: "square.and.arrow.down")
|
||||
})
|
||||
}
|
||||
#endif
|
||||
} else if post.wasDeletedFromServer && post.status != PostStatus.local.rawValue {
|
||||
@ -28,19 +33,24 @@ struct PostEditorStatusToolbarView: View {
|
||||
PostStatusBadgeView(post: post)
|
||||
#else
|
||||
HStack {
|
||||
HStack {
|
||||
Text("⚠️ Post deleted from server. Delete local copy?")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
model.selectedPost = nil
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
}
|
||||
}, label: {
|
||||
Image(systemName: "trash")
|
||||
})
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.background(Color.primary.opacity(0.1))
|
||||
.clipShape(Capsule())
|
||||
.padding(.trailing)
|
||||
PostStatusBadgeView(post: post)
|
||||
.padding(.trailing)
|
||||
Text("⚠️ Post deleted from server. Delete local copy?")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
model.selectedPost = nil
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
}
|
||||
}, label: {
|
||||
Image(systemName: "trash")
|
||||
})
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user