Always show Connections in Dashboard
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
return cases
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -144,8 +144,7 @@ struct MainView: View {
|
||||
private func updateButtonVisibility() {
|
||||
buttonState.update(
|
||||
profile: environments.extensionProfile,
|
||||
commandClient: environments.commandClient,
|
||||
requireAnyConnection: true
|
||||
commandClient: environments.commandClient
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user