Prepare system extension support

This commit is contained in:
世界
2023-07-24 20:08:02 +08:00
parent 8a5c1a80d1
commit 12bf02070e
44 changed files with 1469 additions and 382 deletions
@@ -74,6 +74,27 @@ public struct SettingView: View {
SharedPreferences.disableMemoryLimit = newValue
}
}
#if os(macOS)
if Variant.useSystemExtension {
HStack {
Button("Update System Extension") {
Task {
do {
if let result = try await SystemExtension.install(forceUpdate: true) {
if result == .willCompleteAfterReboot {
errorMessage = "Need reboot"
errorPresented = true
}
}
} catch {
errorMessage = error.localizedDescription
errorPresented = true
}
}
}
}.frame(maxWidth: .infinity, alignment: .trailing)
}
#endif
}
Section("Core") {
FormTextItem("Version", version)