Move clear-last-draft call to PostEditor.onDisappear

This commit is contained in:
Angelo Stavrow 2020-11-27 16:25:49 -05:00
parent 3114d037b3
commit 1c9ca05527
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
3 changed files with 5 additions and 8 deletions

View File

@ -86,12 +86,6 @@ struct PostListView: View {
)
)
.navigationSubtitle(postCount == 1 ? "\(postCount) post" : "\(postCount) posts")
.onChange(of: selectedCollection, perform: { _ in
DispatchQueue.main.async {
self.model.selectedPost = nil
self.model.editor.clearLastDraft()
}
})
#endif
}
}

View File

@ -7,12 +7,12 @@
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>

View File

@ -39,6 +39,9 @@ struct PostEditorView: View {
}
})
.onDisappear(perform: {
DispatchQueue.main.async {
model.editor.clearLastDraft()
}
if post.title.count == 0
&& post.body.count == 0
&& post.status == PostStatus.local.rawValue