advplyr.audiobookshelf-app/ios/App/Shared/util/Store.swift

30 lines
661 B
Swift
Raw Normal View History

2022-04-11 16:29:19 +02:00
//
// Store.swift
// App
//
// Created by Rasmus Krämer on 11.04.22.
//
import Foundation
import RealmSwift
class Store {
@ThreadSafe private static var _serverConfig: ServerConnectionConfig?
2022-04-15 10:16:11 +02:00
public static var serverConfig: ServerConnectionConfig? {
2022-04-11 16:29:19 +02:00
get {
2022-04-15 10:16:11 +02:00
return _serverConfig
2022-04-11 16:29:19 +02:00
}
set(updated) {
2022-04-15 10:16:11 +02:00
if updated != nil {
Database.setServerConnectionConfig(config: updated!)
} else {
Database.setLastActiveConfigIndexToNil()
}
2022-04-15 12:21:46 +02:00
Database.realmQueue.sync {
_serverConfig = updated
}
2022-04-11 16:29:19 +02:00
}
}
}