Fix interfaces for tvOS

This commit is contained in:
世界
2024-02-23 23:37:42 +08:00
parent be67111425
commit 45b4e58b3f
8 changed files with 95 additions and 47 deletions
@@ -35,24 +35,28 @@ public struct ServiceLogView: View {
}
}
}
#if !os(tvOS)
.toolbar {
if !content.isEmpty {
ShareButtonCompat($alert) {
Label("Export", systemImage: "square.and.arrow.up.fill")
} itemURL: {
try content.generateShareFile(name: "service.log")
}
#if !os(tvOS)
ShareButtonCompat($alert) {
Label("Export", systemImage: "square.and.arrow.up.fill")
} itemURL: {
try content.generateShareFile(name: "service.log")
}
#endif
Button(role: .destructive) {
Task {
await deleteContent()
}
} label: {
Label("Delete", systemImage: "trash.fill")
#if !os(tvOS)
Label("Delete", systemImage: "trash.fill")
#else
Image(systemName: "trash.fill")
#endif
}
}
}
#endif
.alertBinding($alert)
.navigationTitle("Service Log")
#if os(tvOS)
@@ -78,7 +78,7 @@ public struct SettingView: View {
@MainActor
var navigationLink: some View {
NavigationLink {
FormNavigationLink {
contentView
} label: {
label
@@ -98,25 +98,25 @@ public struct SettingView: View {
ForEach([Tabs.core, Tabs.packetTunnel, Tabs.profileOverride]) { it in
it.navigationLink
}
Section("About") {
Link(destination: URL(string: "https://sing-box.sagernet.org/")!) {
Label("Documentation", systemImage: "doc.on.doc.fill")
}
.buttonStyle(.plain)
.foregroundColor(.accentColor)
#if !os(tvOS)
#if !os(tvOS)
Section("About") {
Link(destination: URL(string: "https://sing-box.sagernet.org/")!) {
Label("Documentation", systemImage: "doc.on.doc.fill")
}
.buttonStyle(.plain)
.foregroundColor(.accentColor)
RequestReviewButton {
Label("Rate on the App Store", systemImage: "text.bubble.fill")
}
#endif
#if os(macOS)
if Variant.useSystemExtension {
Tabs.sponsors.navigationLink
}
#endif
}
#if os(macOS)
if Variant.useSystemExtension {
Tabs.sponsors.navigationLink
}
#endif
}
#endif
Section("Debug") {
NavigationLink {
FormNavigationLink {
ServiceLogView()
} label: {
Label("Service Log", systemImage: "doc.on.clipboard")
@@ -136,6 +136,5 @@ public struct SettingView: View {
}
}
}
.navigationTitle("Settings")
}
}