Set and unset lastDraft based on selectedPost

This commit is contained in:
Angelo Stavrow 2020-09-23 15:36:54 -04:00
parent 903ea78a27
commit 9daf553391
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 12 additions and 3 deletions

View File

@ -9,9 +9,18 @@ class WriteFreelyModel: ObservableObject {
@Published var account = AccountModel()
@Published var preferences = PreferencesModel()
@Published var posts = PostListModel()
@Published var editor = PostEditorModel()
@Published var isLoggingIn: Bool = false
@Published var hasNetworkConnection: Bool = false
@Published var selectedPost: WFAPost?
@Published var selectedPost: WFAPost? {
didSet {
if let post = selectedPost {
if post.status != PostStatus.published.rawValue { editor.setLastDraft(post) }
} else {
editor.clearLastDraft()
}
}
}
@Published var isPresentingDeleteAlert: Bool = false
@Published var postToDelete: WFAPost?
#if os(iOS)

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>