mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-06-30 05:49:36 +00:00
stop executing applescript once per second
This commit is contained in:
parent
be1112d7e9
commit
2484318f05
1 changed files with 2 additions and 23 deletions
|
|
@ -63,17 +63,8 @@ final class SystemPermissionManager {
|
|||
category: "SystemPermissions"
|
||||
)
|
||||
|
||||
private var monitoringTask: Task<Void, Never>?
|
||||
|
||||
private init() {
|
||||
// Start monitoring immediately
|
||||
startMonitoring()
|
||||
}
|
||||
|
||||
deinit {
|
||||
// Task cancellation is thread-safe, but we can't access
|
||||
// main actor-isolated properties from deinit
|
||||
// The task will be cancelled automatically when deallocated
|
||||
// No automatic monitoring - UI components will check when visible
|
||||
}
|
||||
|
||||
// MARK: - Public API
|
||||
|
|
@ -136,19 +127,7 @@ final class SystemPermissionManager {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - Private Methods
|
||||
|
||||
private func startMonitoring() {
|
||||
monitoringTask = Task {
|
||||
while !Task.isCancelled {
|
||||
await checkAllPermissions()
|
||||
|
||||
// Check more frequently if permissions are missing
|
||||
let interval: TimeInterval = hasAllPermissions ? 30.0 : 5.0
|
||||
try? await Task.sleep(for: .seconds(interval))
|
||||
}
|
||||
}
|
||||
}
|
||||
// MARK: - Permission Checking
|
||||
|
||||
func checkAllPermissions() async {
|
||||
// Check each permission type
|
||||
|
|
|
|||
Loading…
Reference in a new issue