Set lastDraft if post status changes to edited (or local)

This commit is contained in:
Angelo Stavrow 2020-09-23 16:16:18 -04:00
parent bc77fa14af
commit 70189a6193
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,13 @@ struct PostEditorView: View {
post.status = PostStatus.published.rawValue
}
})
.onChange(of: post.status, perform: { _ in
if post.status != PostStatus.published.rawValue {
DispatchQueue.main.async {
model.editor.setLastDraft(post)
}
}
})
.onDisappear(perform: {
if post.status != PostStatus.published.rawValue {
DispatchQueue.main.async {

View File

@ -128,6 +128,13 @@ struct PostEditorView: View {
post.status = PostStatus.published.rawValue
}
})
.onChange(of: post.status, perform: { _ in
if post.status != PostStatus.published.rawValue {
DispatchQueue.main.async {
model.editor.setLastDraft(post)
}
}
})
.onDisappear(perform: {
if post.status != PostStatus.published.rawValue {
DispatchQueue.main.async {