Reformat code
This commit is contained in:
@@ -218,7 +218,9 @@ public extension UTType {
|
||||
// MARK: - FileDocument for Export
|
||||
|
||||
public struct ProfileExportDocument: FileDocument {
|
||||
public static var readableContentTypes: [UTType] { [.profile] }
|
||||
public static var readableContentTypes: [UTType] {
|
||||
[.profile]
|
||||
}
|
||||
|
||||
public let data: Data
|
||||
public let filename: String
|
||||
@@ -245,7 +247,9 @@ public extension UTType {
|
||||
}
|
||||
|
||||
public struct ProfileJSONExportDocument: FileDocument {
|
||||
public static var readableContentTypes: [UTType] { [.json] }
|
||||
public static var readableContentTypes: [UTType] {
|
||||
[.json]
|
||||
}
|
||||
|
||||
public let content: String
|
||||
public let filename: String
|
||||
@@ -274,7 +278,9 @@ public extension UTType {
|
||||
}
|
||||
|
||||
public struct ProfileAnyExportDocument: FileDocument {
|
||||
public static var readableContentTypes: [UTType] { [.data, .json] }
|
||||
public static var readableContentTypes: [UTType] {
|
||||
[.data, .json]
|
||||
}
|
||||
|
||||
public let data: Data
|
||||
public let filename: String
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -22,16 +22,41 @@ public enum AppConfiguration {
|
||||
return String(appGroupID[..<dotIndex])
|
||||
}
|
||||
|
||||
public static var extensionBundleID: String { "\(packageName).extension" }
|
||||
public static var systemExtensionBundleID: String { "\(packageName).system" }
|
||||
public static var fileProviderDomainID: String { "\(packageName).workingdir" }
|
||||
public static var widgetControlKind: String { "\(packageName).widget.ServiceToggle" }
|
||||
public static var profileUTType: String { "\(packageName).profile" }
|
||||
public static var backgroundTaskID: String { "\(packageName).update_profiles" }
|
||||
public static var iCloudContainerID: String { "iCloud.\(packageName)" }
|
||||
public static var extensionBundleID: String {
|
||||
"\(packageName).extension"
|
||||
}
|
||||
|
||||
public static var systemExtensionBundleID: String {
|
||||
"\(packageName).system"
|
||||
}
|
||||
|
||||
public static var fileProviderDomainID: String {
|
||||
"\(packageName).workingdir"
|
||||
}
|
||||
|
||||
public static var widgetControlKind: String {
|
||||
"\(packageName).widget.ServiceToggle"
|
||||
}
|
||||
|
||||
public static var profileUTType: String {
|
||||
"\(packageName).profile"
|
||||
}
|
||||
|
||||
public static var backgroundTaskID: String {
|
||||
"\(packageName).update_profiles"
|
||||
}
|
||||
|
||||
public static var iCloudContainerID: String {
|
||||
"iCloud.\(packageName)"
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
public static var rootHelperBundleID: String { "\(packageName).helper" }
|
||||
public static var rootHelperMachService: String { "\(appGroupID).helper" }
|
||||
public static var rootHelperBundleID: String {
|
||||
"\(packageName).helper"
|
||||
}
|
||||
|
||||
public static var rootHelperMachService: String {
|
||||
"\(appGroupID).helper"
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user