Refactor task usage and profile auto update

This commit is contained in:
世界
2023-09-22 11:32:51 +08:00
parent 390e063f20
commit 3374f8e727
49 changed files with 823 additions and 636 deletions
@@ -6,7 +6,13 @@ import MacLibrary
class IndependentApplicationDelegate: ApplicationDelegate {
public func applicationWillFinishLaunching(_: Notification) {
Variant.useSystemExtension = true
Task.detached {
Task {
await setupSystemExtension()
}
}
private nonisolated func setupSystemExtension() async {
do {
if await SystemExtension.isInstalled() {
if let result = try await SystemExtension.install() {
if result == .willCompleteAfterReboot {
@@ -14,6 +20,8 @@ class IndependentApplicationDelegate: ApplicationDelegate {
}
}
}
} catch {
NSLog("setup system extension error: \(error.localizedDescription)")
}
}
}