Reformat code
This commit is contained in:
@@ -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] = []
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user