Redesign dashboard
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import Library
|
||||
import SwiftUI
|
||||
|
||||
public struct HTTPProxyCard: View {
|
||||
@EnvironmentObject private var profile: ExtensionProfile
|
||||
@Binding private var systemProxyAvailable: Bool
|
||||
@Binding private var systemProxyEnabled: Bool
|
||||
private let onToggle: (Bool) async -> Void
|
||||
|
||||
public init(
|
||||
systemProxyAvailable: Binding<Bool>,
|
||||
systemProxyEnabled: Binding<Bool>,
|
||||
onToggle: @escaping (Bool) async -> Void
|
||||
) {
|
||||
_systemProxyAvailable = systemProxyAvailable
|
||||
_systemProxyEnabled = systemProxyEnabled
|
||||
self.onToggle = onToggle
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
DashboardCardView(title: "", isHalfWidth: false) {
|
||||
Toggle("System HTTP Proxy", isOn: $systemProxyEnabled)
|
||||
.onChangeCompat(of: systemProxyEnabled) { newValue in
|
||||
Task {
|
||||
await onToggle(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user