Clean up WriteFreelyModel’s published vars

This commit is contained in:
Angelo Stavrow 2022-05-09 08:55:43 -04:00
parent aefcd0d799
commit 3a53bec184
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 19 additions and 38 deletions

View File

@ -6,25 +6,15 @@ import Network
// MARK: - WriteFreelyModel // MARK: - WriteFreelyModel
final class WriteFreelyModel: ObservableObject { final class WriteFreelyModel: ObservableObject {
// MARK: - Models
@Published var account = AccountModel() @Published var account = AccountModel()
@Published var preferences = PreferencesModel() @Published var preferences = PreferencesModel()
@Published var posts = PostListModel() @Published var posts = PostListModel()
@Published var editor = PostEditorModel() @Published var editor = PostEditorModel()
@Published var isLoggingIn: Bool = false
@Published var isProcessingRequest: Bool = false // MARK: - Error handling
@Published var hasNetworkConnection: Bool = true
@Published var selectedPost: WFAPost?
@Published var selectedCollection: WFACollection?
@Published var showAllPosts: Bool = true
@Published var isPresentingDeleteAlert: Bool = false
@Published var postToDelete: WFAPost?
@Published var hasError: Bool = false @Published var hasError: Bool = false
#if os(iOS)
@Published var isPresentingSettingsView: Bool = false
#endif
static var shared = WriteFreelyModel()
var currentError: Error? { var currentError: Error? {
didSet { didSet {
#if DEBUG #if DEBUG
@ -43,6 +33,21 @@ final class WriteFreelyModel: ObservableObject {
} }
} }
// MARK: - State
@Published var isLoggingIn: Bool = false
@Published var isProcessingRequest: Bool = false
@Published var hasNetworkConnection: Bool = true
@Published var selectedPost: WFAPost?
@Published var selectedCollection: WFACollection?
@Published var showAllPosts: Bool = true
@Published var isPresentingDeleteAlert: Bool = false
@Published var postToDelete: WFAPost?
#if os(iOS)
@Published var isPresentingSettingsView: Bool = false
#endif
static var shared = WriteFreelyModel()
// swiftlint:disable line_length // swiftlint:disable line_length
let helpURL = URL(string: "https://discuss.write.as/c/help/5")! let helpURL = URL(string: "https://discuss.write.as/c/help/5")!
let howToURL = URL(string: "https://discuss.write.as/t/using-the-writefreely-ios-app/1946")! let howToURL = URL(string: "https://discuss.write.as/t/using-the-writefreely-ios-app/1946")!

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>ActionExtension-iOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict>
</dict>
</plist>