Hide connections page by default since unstable
This commit is contained in:
@@ -8,7 +8,6 @@ public struct ConnectionListView: View {
|
||||
@State private var isLoading = true
|
||||
@StateObject private var commandClient = CommandClient(.connections)
|
||||
@State private var connections: [Connection] = []
|
||||
@State private var selection: ConnectionListPage = .active
|
||||
@State private var searchText = ""
|
||||
@State private var alert: Alert?
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public struct ConnectionView: View {
|
||||
Spacer()
|
||||
VStack(alignment: .trailing) {
|
||||
Text(connection.inboundType + "/" + connection.inbound)
|
||||
Text(connection.chain.reversed().joined(separator: "/"))
|
||||
Text(connection.chain[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public struct ConnectionView: View {
|
||||
|
||||
private nonisolated func closeConnection() async {
|
||||
do {
|
||||
try LibboxNewStandaloneCommandClient()!.closeConnection(connection.id)
|
||||
try await LibboxNewStandaloneCommandClient()!.closeConnection(connection.id)
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = Alert(error)
|
||||
|
||||
@@ -51,7 +51,7 @@ public struct ActiveDashboardView: View {
|
||||
#if os(iOS) || os(tvOS)
|
||||
if ApplicationLibrary.inPreview || profile.status.isConnectedStrict {
|
||||
Picker("Page", selection: $selection) {
|
||||
ForEach(DashboardPage.allCases) { page in
|
||||
ForEach(DashboardPage.enabledCases()) { page in
|
||||
page.label
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public struct ActiveDashboardView: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
TabView(selection: $selection) {
|
||||
ForEach(DashboardPage.enabledCases) { page in
|
||||
ForEach(DashboardPage.enabledCases()) { page in
|
||||
page.contentView($profileList, $selectedProfileID, $systemProxyAvailable, $systemProxyEnabled)
|
||||
.tag(page)
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ public enum DashboardPage: Int, CaseIterable, Identifiable {
|
||||
}
|
||||
|
||||
public extension DashboardPage {
|
||||
#if !tvOS
|
||||
static var enabledCases: [DashboardPage] = [
|
||||
.overview,
|
||||
.groups,
|
||||
.connections,
|
||||
]
|
||||
#else
|
||||
static var enabledCases: [DashboardPage] = [
|
||||
static func enabledCases() -> [DashboardPage] {
|
||||
var cases: [DashboardPage] = [
|
||||
.overview,
|
||||
.groups,
|
||||
]
|
||||
#endif
|
||||
#if !tvOS
|
||||
if Variant.isBeta {
|
||||
cases.append(.connections)
|
||||
}
|
||||
#endif
|
||||
return cases
|
||||
}
|
||||
}
|
||||
|
||||
public extension DashboardPage {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CommandClient: ObservableObject {
|
||||
@Published public var clashModeList: [String]
|
||||
@Published public var clashMode: String
|
||||
|
||||
@Published public var connectionStateFilter = ConnectionStateFilter.all
|
||||
@Published public var connectionStateFilter = ConnectionStateFilter.active
|
||||
@Published public var connectionSort = ConnectionSort.byDate
|
||||
@Published public var connections: [LibboxConnection]?
|
||||
public var rawConnections: LibboxConnections?
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
|
||||
public enum Variant {
|
||||
#if os(macOS)
|
||||
@@ -14,4 +15,6 @@ public enum Variant {
|
||||
#elseif os(tvOS)
|
||||
public static let applicationName = "SFT"
|
||||
#endif
|
||||
|
||||
public static var isBeta = LibboxVersion().contains("-")
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ public struct SidebarView: View {
|
||||
.tint(.textColor)
|
||||
.tag(NavigationPage.dashboard)
|
||||
NavigationPage.groups.label.tag(NavigationPage.groups)
|
||||
NavigationPage.connections.label.tag(NavigationPage.connections)
|
||||
if Variant.isBeta {
|
||||
NavigationPage.connections.label.tag(NavigationPage.connections)
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
ForEach(NavigationPage.macosDefaultPages, id: \.self) { it in
|
||||
|
||||
@@ -4,7 +4,7 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct Application: App {
|
||||
@NSApplicationDelegateAdaptor private var appDelegate: IndependentApplicationDelegate
|
||||
@NSApplicationDelegateAdaptor private var appDelegate: StandaloneApplicationDelegate
|
||||
|
||||
var body: some Scene {
|
||||
MacApplication()
|
||||
|
||||
+2
-1
@@ -3,9 +3,10 @@ import Foundation
|
||||
import Library
|
||||
import MacLibrary
|
||||
|
||||
class IndependentApplicationDelegate: ApplicationDelegate {
|
||||
class StandaloneApplicationDelegate: ApplicationDelegate {
|
||||
public func applicationWillFinishLaunching(_: Notification) {
|
||||
Variant.useSystemExtension = true
|
||||
Variant.isBeta = false
|
||||
Task {
|
||||
await setupSystemExtension()
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
3A251C122A52D09700651082 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AAB5E7A2A4C1446009757F1 /* Assets.xcassets */; };
|
||||
3A27D9002A89BE230031EBCC /* CommandClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27D8FF2A89BE230031EBCC /* CommandClient.swift */; };
|
||||
3A27D9022A89C6870031EBCC /* ExtensionEnvironments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27D9012A89C6870031EBCC /* ExtensionEnvironments.swift */; };
|
||||
3A2EAEED2A6F4CBB00D00DE3 /* IndependentApplicationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2EAEEC2A6F4CBB00D00DE3 /* IndependentApplicationDelegate.swift */; };
|
||||
3A2EAEED2A6F4CBB00D00DE3 /* StandaloneApplicationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2EAEEC2A6F4CBB00D00DE3 /* StandaloneApplicationDelegate.swift */; };
|
||||
3A2F29EB2C998A5D007E024C /* Export.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3A2F29EA2C998A5D007E024C /* Export.plist */; };
|
||||
3A334ED02C0F621E00E9C577 /* ConnectionDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A334ECF2C0F621E00E9C577 /* ConnectionDetailsView.swift */; };
|
||||
3A3AA7FC2A4EFDAE002F78AB /* Library.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AEC211D2A459B4700A63465 /* Library.framework */; };
|
||||
@@ -482,7 +482,7 @@
|
||||
3A2223592A6E212A00C50B23 /* SystemExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemExtension.swift; sourceTree = "<group>"; };
|
||||
3A27D8FF2A89BE230031EBCC /* CommandClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandClient.swift; sourceTree = "<group>"; };
|
||||
3A27D9012A89C6870031EBCC /* ExtensionEnvironments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionEnvironments.swift; sourceTree = "<group>"; };
|
||||
3A2EAEEC2A6F4CBB00D00DE3 /* IndependentApplicationDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndependentApplicationDelegate.swift; sourceTree = "<group>"; };
|
||||
3A2EAEEC2A6F4CBB00D00DE3 /* StandaloneApplicationDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StandaloneApplicationDelegate.swift; sourceTree = "<group>"; };
|
||||
3A334ECF2C0F621E00E9C577 /* ConnectionDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionDetailsView.swift; sourceTree = "<group>"; };
|
||||
3A2F29EA2C998A5D007E024C /* Export.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Export.plist; sourceTree = "<group>"; };
|
||||
3A334ECF2C0F621E00E9C577 /* ConnectionDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionDetailsView.swift; sourceTree = "<group>"; };
|
||||
@@ -1055,7 +1055,7 @@
|
||||
3AEECC062A6DF9CA006A0E0C /* Application.swift */,
|
||||
3AEECC502A6E0074006A0E0C /* SFM.entitlements */,
|
||||
3A2223532A6E1B6700C50B23 /* Info.plist */,
|
||||
3A2EAEEC2A6F4CBB00D00DE3 /* IndependentApplicationDelegate.swift */,
|
||||
3A2EAEEC2A6F4CBB00D00DE3 /* StandaloneApplicationDelegate.swift */,
|
||||
3AABFD462A9CCC58005A24A4 /* Upload.plist */,
|
||||
);
|
||||
path = SFM.System;
|
||||
@@ -1741,7 +1741,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3AEECC072A6DF9CA006A0E0C /* Application.swift in Sources */,
|
||||
3A2EAEED2A6F4CBB00D00DE3 /* IndependentApplicationDelegate.swift in Sources */,
|
||||
3A2EAEED2A6F4CBB00D00DE3 /* StandaloneApplicationDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user