Reformat code

This commit is contained in:
世界
2026-02-08 18:23:42 +08:00
parent f765bf1e3b
commit a86dfc26d1
42 changed files with 163 additions and 98 deletions
+11 -3
View File
@@ -77,7 +77,10 @@ public class CommandClient: ObservableObject {
@Published public var isConnected: Bool
// Coalesce traffic updates so SwiftUI re-renders once per status tick.
@Published private var trafficSnapshot = TrafficSnapshot()
public var status: LibboxStatusMessage? { trafficSnapshot.status }
public var status: LibboxStatusMessage? {
trafficSnapshot.status
}
public var statusPublisher: AnyPublisher<LibboxStatusMessage?, Never> {
$trafficSnapshot
.map(\.status)
@@ -97,8 +100,13 @@ public class CommandClient: ObservableObject {
@Published public var hasAnyConnection: Bool = false
private var connectionsStore: LibboxConnections?
public var uplinkHistory: [CGFloat] { trafficSnapshot.uplinkHistory }
public var downlinkHistory: [CGFloat] { trafficSnapshot.downlinkHistory }
public var uplinkHistory: [CGFloat] {
trafficSnapshot.uplinkHistory
}
public var downlinkHistory: [CGFloat] {
trafficSnapshot.downlinkHistory
}
// Batch processing for logs
private var pendingLogs: [LogEntry] = []
+4 -2
View File
@@ -79,7 +79,6 @@ public struct AlertState: Equatable {
}
public extension View {
@ViewBuilder
func alert(_ binding: Binding<AlertState?>) -> some View {
alert(
binding.wrappedValue?.title ?? "",
@@ -119,7 +118,10 @@ public extension View {
}
public struct ImportRemoteProfileRequest: Hashable, Identifiable {
public var id: String { url }
public var id: String {
url
}
public let name: String
public let url: String
+8 -2
View File
@@ -19,8 +19,14 @@ extension ExtensionStartupError: LocalizedError {
}
extension ExtensionStartupError: CustomNSError {
public static var errorDomain: String { "ExtensionStartupError" }
public var errorCode: Int { 1 }
public static var errorDomain: String {
"ExtensionStartupError"
}
public var errorCode: Int {
1
}
public var errorUserInfo: [String: Any] {
[NSLocalizedDescriptionKey: message]
}
+1 -2
View File
@@ -262,8 +262,7 @@ public class ExtensionProfile: ObservableObject {
if managers.isEmpty {
return nil
}
let profile = ExtensionProfile(managers[0])
return profile
return ExtensionProfile(managers[0])
}
public static func install() async throws {
+9 -3
View File
@@ -7,7 +7,9 @@ public enum OnDemandRuleAction: Int, Codable, CaseIterable, Identifiable {
case evaluateConnection = 3
case ignore = 4
public var id: Int { rawValue }
public var id: Int {
rawValue
}
public var name: String {
switch self {
@@ -46,7 +48,9 @@ public enum OnDemandRuleInterfaceType: Int, Codable, Identifiable {
case cellular = 3
#endif
public var id: Int { rawValue }
public var id: Int {
rawValue
}
public var name: String {
switch self {
@@ -80,7 +84,9 @@ public enum EvaluateConnectionRuleAction: Int, Codable, CaseIterable, Identifiab
case connectIfNeeded = 1
case neverConnect = 2
public var id: Int { rawValue }
public var id: Int {
rawValue
}
public var name: String {
switch self {