mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-03-01 00:35:19 +08:00
feat: hide proxy names
This commit is contained in:
@@ -6,11 +6,18 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
class HideProxyNames: ObservableObject, Identifiable {
|
||||
let id = UUID().uuidString
|
||||
@Published var hide = false
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
|
||||
private let runningState = NotificationCenter.default.publisher(for: .init("ClashRunningStateChanged"))
|
||||
@State private var isRunning = false
|
||||
|
||||
@StateObject private var hideProxyNames = HideProxyNames()
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if !isRunning {
|
||||
@@ -24,6 +31,7 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.environmentObject(hideProxyNames)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
Button {
|
||||
@@ -34,6 +42,15 @@ struct ContentView: View {
|
||||
.help("Toggle Sidebar")
|
||||
.disabled(!isRunning)
|
||||
}
|
||||
|
||||
ToolbarItem {
|
||||
Button {
|
||||
hideProxyNames.hide = !hideProxyNames.hide
|
||||
} label: {
|
||||
Image(systemName: hideProxyNames.hide ? "eyeglasses" : "wand.and.stars")
|
||||
}
|
||||
.disabled(!isRunning)
|
||||
}
|
||||
}
|
||||
.onReceive(runningState) { _ in
|
||||
isRunning = ConfigManager.shared.isRunning
|
||||
|
||||
Reference in New Issue
Block a user