Toolbar is in a much better shape.

This commit is contained in:
Stuart Breckenridge
2020-07-13 22:29:33 +08:00
parent 122249d716
commit f4d776688b
2 changed files with 38 additions and 32 deletions

View File

@@ -14,11 +14,7 @@ class AccountsPreferenceModel: ObservableObject {
@Published var sortedAccounts: [Account] = []
// Configured Accounts
@Published var selectedConfiguredAccountID: String? = nil
// Sheets
@Published var showAddAccountView: Bool = false
var selectedAccountIsDefault: Bool {
@@ -32,19 +28,19 @@ class AccountsPreferenceModel: ObservableObject {
}
// Subscriptions
var notifcationSubscriptions = Set<AnyCancellable>()
var notificationSubscriptions = Set<AnyCancellable>()
init() {
sortedAccounts = AccountManager.shared.sortedAccounts
NotificationCenter.default.publisher(for: .UserDidAddAccount).sink(receiveValue: { _ in
self.sortedAccounts = AccountManager.shared.sortedAccounts
}).store(in: &notifcationSubscriptions)
}).store(in: &notificationSubscriptions)
NotificationCenter.default.publisher(for: .UserDidDeleteAccount).sink(receiveValue: { _ in
self.selectedConfiguredAccountID = nil
self.sortedAccounts = AccountManager.shared.sortedAccounts
}).store(in: &notifcationSubscriptions)
}).store(in: &notificationSubscriptions)
}
}