Add Tonuino Manager website and Sparkle updates
This commit is contained in:
commit
1cac427ff2
44 files changed
+5861
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import AppKit
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
final class AppModel: ObservableObject {
|
||||
enum Section: String, CaseIterable, Identifiable, Hashable {
|
||||
case library = "SD-Karte"
|
||||
case cards = "NFC-Karten"
|
||||
case tonuino = "TonUINO"
|
||||
case settings = "Einstellungen"
|
||||
var id: String { rawValue }
|
||||
var icon: String {
|
||||
switch self {
|
||||
case .library: "sdcard"
|
||||
case .cards: "wave.3.right"
|
||||
case .tonuino: "slider.horizontal.3"
|
||||
case .settings: "gearshape"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Published var section: Section = .library
|
||||
@Published var library = LibraryModel()
|
||||
@Published var cards = CardModel()
|
||||
@Published var status = "Bereit"
|
||||
@Published var errorMessage: String?
|
||||
@Published var showError = false
|
||||
private var childSubscriptions = Set<AnyCancellable>()
|
||||
|
||||
init() {
|
||||
library.objectWillChange.sink { [weak self] _ in self?.objectWillChange.send() }.store(in: &childSubscriptions)
|
||||
cards.objectWillChange.sink { [weak self] _ in self?.objectWillChange.send() }.store(in: &childSubscriptions)
|
||||
}
|
||||
|
||||
func report(_ error: Error) {
|
||||
errorMessage = error.localizedDescription
|
||||
showError = true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user