mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-04-27 15:07:41 +00:00
- Update to swift-tools-version 6.0 and enable StrictConcurrency - Make all data models and types Sendable for concurrency safety - Migrate commands from ParsableCommand to AsyncParsableCommand - Remove AsyncUtils.swift and synchronous bridging patterns - Update WindowBounds property names to snake_case for consistency - Ensure all error types conform to Sendable protocol - Add comprehensive Swift 6 migration documentation This migration enables full Swift 6 concurrency checking and data race safety while maintaining backward compatibility with the existing API. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
import AVFoundation
|
|
import CoreGraphics
|
|
import Foundation
|
|
import ScreenCaptureKit
|
|
|
|
final class PermissionsChecker: Sendable {
|
|
static func checkScreenRecordingPermission() -> Bool {
|
|
// Use a simpler approach - check CGWindowListCreateImage which doesn't require async
|
|
// This is the traditional way to check screen recording permission
|
|
let windowList = CGWindowListCopyWindowInfo(.optionAll, kCGNullWindowID)
|
|
return windowList != nil && CFArrayGetCount(windowList) > 0
|
|
}
|
|
|
|
static func checkAccessibilityPermission() -> Bool {
|
|
// Check if we have accessibility permission
|
|
// Create options dictionary without using the global constant directly
|
|
let options = ["AXTrustedCheckOptionPrompt": false] as CFDictionary
|
|
return AXIsProcessTrustedWithOptions(options)
|
|
}
|
|
|
|
static func requireScreenRecordingPermission() throws {
|
|
if !checkScreenRecordingPermission() {
|
|
throw CaptureError.screenRecordingPermissionDenied
|
|
}
|
|
}
|
|
|
|
static func requireAccessibilityPermission() throws {
|
|
if !checkAccessibilityPermission() {
|
|
throw CaptureError.accessibilityPermissionDenied
|
|
}
|
|
}
|
|
}
|