mirror of
https://github.com/yattee/yattee.git
synced 2025-12-20 19:50:19 +00:00
Replace environment objects with observed objects
This commit is contained in:
@@ -3,17 +3,15 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
final class SubscriptionsModel: ObservableObject {
|
||||
static var shared = SubscriptionsModel()
|
||||
|
||||
@Published var channels = [Channel]()
|
||||
var accounts: AccountsModel
|
||||
var accounts: AccountsModel { .shared }
|
||||
|
||||
var resource: Resource? {
|
||||
accounts.api.subscriptions
|
||||
}
|
||||
|
||||
init(accounts: AccountsModel? = nil) {
|
||||
self.accounts = accounts ?? AccountsModel()
|
||||
}
|
||||
|
||||
var all: [Channel] {
|
||||
channels.sorted { $0.name.lowercased() < $1.name.lowercased() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user