2022-07-01 21:28:32 +00:00
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
2022-07-05 17:26:03 +00:00
|
|
|
final class SettingsModel: ObservableObject {
|
2022-11-24 20:36:05 +00:00
|
|
|
static var shared = SettingsModel()
|
|
|
|
|
2022-07-01 21:28:32 +00:00
|
|
|
@Published var presentingAlert = false
|
|
|
|
@Published var alert = Alert(title: Text("Error"))
|
|
|
|
|
2024-02-01 22:54:16 +00:00
|
|
|
@Published var presentingSettingsImportSheet = false
|
|
|
|
@Published var settingsImportURL: URL?
|
|
|
|
|
2022-07-01 21:28:32 +00:00
|
|
|
func presentAlert(title: String, message: String? = nil) {
|
|
|
|
let message = message.isNil ? nil : Text(message!)
|
|
|
|
alert = Alert(title: Text(title), message: message)
|
|
|
|
presentingAlert = true
|
|
|
|
}
|
|
|
|
|
|
|
|
func presentAlert(_ alert: Alert) {
|
|
|
|
self.alert = alert
|
|
|
|
presentingAlert = true
|
|
|
|
}
|
2024-02-01 22:54:16 +00:00
|
|
|
|
|
|
|
func presentSettingsImportSheet(_ url: URL) {
|
|
|
|
settingsImportURL = url
|
|
|
|
presentingSettingsImportSheet = true
|
|
|
|
}
|
2022-07-01 21:28:32 +00:00
|
|
|
}
|