Finish independent macOS version
This commit is contained in:
@@ -4,11 +4,7 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct Application: App {
|
||||
@NSApplicationDelegateAdaptor private var appDelegate: ApplicationDelegate
|
||||
|
||||
init() {
|
||||
Variant.useSystemExtension = true
|
||||
}
|
||||
@NSApplicationDelegateAdaptor private var appDelegate: IndependentApplicationDelegate
|
||||
|
||||
var body: some Scene {
|
||||
MacApplication()
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import AppKit
|
||||
import Foundation
|
||||
import Library
|
||||
import MacLibrary
|
||||
|
||||
class IndependentApplicationDelegate: ApplicationDelegate {
|
||||
public func applicationWillFinishLaunching(_: Notification) {
|
||||
Variant.useSystemExtension = true
|
||||
Task.detached {
|
||||
if await SystemExtension.isInstalled() {
|
||||
if let result = try await SystemExtension.install() {
|
||||
if result == .willCompleteAfterReboot {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user