fix: remove public visibility from app-internal types; fix StatusBar arg order
This commit is contained in:
parent
267d8a0f23
commit
df85c9e85b
|
|
@ -5,21 +5,21 @@ import Foundation
|
|||
|
||||
// MARK: - SessionInfo
|
||||
|
||||
public struct SessionInfo: Identifiable, Hashable, Sendable {
|
||||
public let id: String
|
||||
public let name: String
|
||||
public let state: String // "running", "idle", etc.
|
||||
struct SessionInfo: Identifiable, Hashable, Sendable {
|
||||
let id: String
|
||||
let name: String
|
||||
let state: String // "running", "idle", etc.
|
||||
}
|
||||
|
||||
// MARK: - SessionRegistry
|
||||
|
||||
@MainActor
|
||||
public final class SessionRegistry: ObservableObject {
|
||||
@Published public var sessions: [SessionInfo] = []
|
||||
@Published public var isLoading = false
|
||||
@Published public var error: String? = nil
|
||||
final class SessionRegistry: ObservableObject {
|
||||
@Published var sessions: [SessionInfo] = []
|
||||
@Published var isLoading = false
|
||||
@Published var error: String? = nil
|
||||
|
||||
public init() {}
|
||||
init() {}
|
||||
|
||||
// MARK: - Private helpers
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public final class SessionRegistry: ObservableObject {
|
|||
// MARK: - GET /sessions
|
||||
|
||||
/// Fetches the current session list from the sidecar and updates `sessions`.
|
||||
public func refresh(credential: SidecarCredential) async {
|
||||
func refresh(credential: SidecarCredential) async {
|
||||
isLoading = true
|
||||
error = nil
|
||||
defer { isLoading = false }
|
||||
|
|
@ -57,7 +57,7 @@ public final class SessionRegistry: ObservableObject {
|
|||
|
||||
/// Creates a new session with the given name and returns the created `SessionInfo`.
|
||||
@discardableResult
|
||||
public func spawnSession(name: String, credential: SidecarCredential) async throws -> SessionInfo {
|
||||
func spawnSession(name: String, credential: SidecarCredential) async throws -> SessionInfo {
|
||||
let url = baseURL(credential: credential).appendingPathComponent("sessions")
|
||||
var req = authorizedRequest(url: url, credential: credential)
|
||||
req.httpMethod = "POST"
|
||||
|
|
@ -81,7 +81,7 @@ public final class SessionRegistry: ObservableObject {
|
|||
// MARK: - DELETE /sessions/<id>
|
||||
|
||||
/// Deletes the session with the given id.
|
||||
public func deleteSession(id: String, credential: SidecarCredential) async throws {
|
||||
func deleteSession(id: String, credential: SidecarCredential) async throws {
|
||||
let url = baseURL(credential: credential)
|
||||
.appendingPathComponent("sessions")
|
||||
.appendingPathComponent(id)
|
||||
|
|
@ -108,10 +108,10 @@ private struct SessionItem: Decodable {
|
|||
|
||||
// MARK: - Errors
|
||||
|
||||
public enum SessionRegistryError: LocalizedError {
|
||||
enum SessionRegistryError: LocalizedError {
|
||||
case unexpectedStatus
|
||||
|
||||
public var errorDescription: String? {
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
case .unexpectedStatus:
|
||||
return "Unexpected HTTP status from sidecar."
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ struct MainTerminalView: View {
|
|||
connectionStatus: statusText,
|
||||
piState: $currentPiState,
|
||||
onSwitcher: { showSwitcher = true },
|
||||
onSettings: { showSettings = true }, // T-2.11
|
||||
onUnpair: { appState.unpair() }
|
||||
onUnpair: { appState.unpair() },
|
||||
onSettings: { showSettings = true } // T-2.11
|
||||
)
|
||||
|
||||
// ── Terminal ────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in New Issue