restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Foundation
|
||||
import HelderCore
|
||||
import HelderServices
|
||||
@testable import HelderUI
|
||||
|
||||
/// Sessions and the agent split, in memory instead of UserDefaults.
|
||||
final class FakeSession: SessionStoring, @unchecked Sendable {
|
||||
private let state = Locked((sessions: [String: SessionState](), layout: LayoutState()))
|
||||
|
||||
var sessions: [String: SessionState] {
|
||||
get { state.current.sessions }
|
||||
set { state.mutate { $0.sessions = newValue } }
|
||||
}
|
||||
|
||||
var layout: LayoutState { state.current.layout }
|
||||
|
||||
func loadSession(root: String) -> SessionState? { state.current.sessions[root] }
|
||||
func saveSession(_ session: SessionState, root: String) { state.mutate { $0.sessions[root] = session } }
|
||||
func loadLayout() -> LayoutState { state.current.layout }
|
||||
func saveLayout(_ layout: LayoutState) { state.mutate { $0.layout = layout } }
|
||||
}
|
||||
Reference in New Issue
Block a user