From 52efbd97d2a26d87ad8bb0a5362870d1f2db9f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 6 Dec 2025 20:13:09 +0800 Subject: [PATCH] Always show Connections in Dashboard --- .../Views/Dashboard/ActiveDashboardView.swift | 4 +--- .../Views/Dashboard/ButtonVisibilityState.swift | 5 ++--- .../Views/Dashboard/DashboardPage.swift | 17 ++--------------- SFI/MainView.swift | 3 +-- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift b/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift index 462e16d..33df537 100644 --- a/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift +++ b/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift @@ -161,8 +161,6 @@ import SwiftUI coordinator.selection = .overview } #endif - }.onReceive(environments.commandClient.$connections) { _ in - updateButtonVisibility() }.onReceive(profile.$status) { _ in updateButtonVisibility() #if os(iOS) @@ -193,7 +191,7 @@ import SwiftUI #if os(iOS) || os(tvOS) private func updateButtonVisibility() { - buttonState.update(profile: profile, commandClient: environments.commandClient, requireAnyConnection: true) + buttonState.update(profile: profile, commandClient: environments.commandClient) } #if os(iOS) diff --git a/ApplicationLibrary/Views/Dashboard/ButtonVisibilityState.swift b/ApplicationLibrary/Views/Dashboard/ButtonVisibilityState.swift index 97f3568..9bd5e9f 100644 --- a/ApplicationLibrary/Views/Dashboard/ButtonVisibilityState.swift +++ b/ApplicationLibrary/Views/Dashboard/ButtonVisibilityState.swift @@ -12,8 +12,7 @@ public struct ButtonVisibilityState { public mutating func update( profile: ExtensionProfile?, - commandClient: CommandClient, - requireAnyConnection: Bool = false + commandClient: CommandClient ) { guard let profile else { reset() @@ -25,7 +24,7 @@ public struct ButtonVisibilityState { let isConnected = ApplicationLibrary.inPreview || profile.status.isConnectedStrict - showConnectionsButton = isConnected && (!requireAnyConnection || commandClient.hasAnyConnection) + showConnectionsButton = isConnected showGroupsButton = isConnected && (commandClient.groups?.isEmpty == false) } diff --git a/ApplicationLibrary/Views/Dashboard/DashboardPage.swift b/ApplicationLibrary/Views/Dashboard/DashboardPage.swift index aba7ab2..089272f 100644 --- a/ApplicationLibrary/Views/Dashboard/DashboardPage.swift +++ b/ApplicationLibrary/Views/Dashboard/DashboardPage.swift @@ -14,16 +14,7 @@ public enum DashboardPage: Int, CaseIterable, Identifiable { public extension DashboardPage { static func enabledCases() -> [DashboardPage] { - var cases: [DashboardPage] = [ - .overview, - .groups, - ] - #if !os(tvOS) - if Variant.isBeta { - cases.append(.connections) - } - #endif - return cases + [.overview, .groups, .connections] } static func enabledCases(hasGroups: Bool) -> [DashboardPage] { @@ -31,11 +22,7 @@ public extension DashboardPage { if hasGroups { cases.append(.groups) } - #if !os(tvOS) - if Variant.isBeta { - cases.append(.connections) - } - #endif + cases.append(.connections) return cases } } diff --git a/SFI/MainView.swift b/SFI/MainView.swift index f067bdb..e79d7aa 100644 --- a/SFI/MainView.swift +++ b/SFI/MainView.swift @@ -144,8 +144,7 @@ struct MainView: View { private func updateButtonVisibility() { buttonState.update( profile: environments.extensionProfile, - commandClient: environments.commandClient, - requireAnyConnection: true + commandClient: environments.commandClient ) }