Replace sheets with navigation destinations on tvOS

This commit is contained in:
世界
2025-12-02 13:53:07 +08:00
parent b3714ed957
commit e9d6b380bf
4 changed files with 174 additions and 3 deletions
@@ -61,20 +61,53 @@ import SwiftUI
#if os(iOS) || os(tvOS)
.toolbar {
toolbar
}.sheet(isPresented: $showGroups) {
}
#if os(tvOS)
.navigationDestination(isPresented: $showGroups) {
GroupListView()
.navigationTitle("Groups")
.toolbar {
ToolbarItemGroup(placement: .topBarLeading) {
BackButton()
}
}
}
.navigationDestination(isPresented: $showConnections) {
ConnectionListView()
.navigationTitle("Connections")
.toolbar {
ToolbarItemGroup(placement: .topBarLeading) {
BackButton()
}
}
}
.navigationDestination(isPresented: $showCardManagement) {
CardManagementView(onDisappear: {
cardConfigurationVersion += 1
})
.navigationTitle("Dashboard Items")
.toolbar {
ToolbarItemGroup(placement: .topBarLeading) {
BackButton()
}
}
}
#else
.sheet(isPresented: $showGroups) {
groupsSheetContent
}.sheet(isPresented: $showConnections) {
connectionsSheetContent
}.sheet(isPresented: $showCardManagement, onDismiss: {
cardConfigurationVersion += 1
}, content: {
if #available(iOS 16.0, tvOS 17.0, *) {
if #available(iOS 16.0, *) {
CardManagementSheet().presentationDetents([.large]).presentationDragIndicator(.visible)
} else {
CardManagementSheet()
}
})
#endif
#endif
.onAppear {
if ApplicationLibrary.inPreview {
environments.commandClient.connect()