Minor fixes for tvOS

This commit is contained in:
世界
2023-10-01 20:31:03 +08:00
parent 495b7d8805
commit 4a0d683d7c
5 changed files with 47 additions and 17 deletions
@@ -73,7 +73,9 @@ public struct DashboardView: View {
DashboardView1().environmentObject(profile)
} else {
FormView {
InstallProfileButton()
InstallProfileButton {
await environments.reload()
}
}
}
}
@@ -5,7 +5,10 @@ import SwiftUI
public struct InstallProfileButton: View {
@State private var alert: Alert?
public init() {}
private let callback: () async -> Void
public init(_ callback: @escaping (() async -> Void)) {
self.callback = callback
}
public var body: some View {
Button("Install NetworkExtension") {
@@ -19,6 +22,7 @@ public struct InstallProfileButton: View {
private func installProfile() async {
do {
try await ExtensionProfile.install()
await callback()
} catch {
alert = Alert(error)
}