mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-22 08:51:10 +00:00
fix(macos): silence Xcode 27 source warnings (#108081)
* fix(macos): silence Xcode 27 warnings * fix(macos): silence remaining Swift 6.4 warnings
This commit is contained in:
committed by
GitHub
parent
6c4e76ea8b
commit
bfb015dbc5
@@ -182,11 +182,17 @@ private final class DashboardLinkBrowserTabItemView: NSView {
|
||||
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
super.draw(dirtyRect)
|
||||
// SDK 27 restores AppKit's "Color" suffix; older Swift importers expose
|
||||
// the same API as quinaryLabel.
|
||||
#if compiler(>=6.4)
|
||||
let hoverColor = NSColor.quinaryLabelColor
|
||||
#else
|
||||
let hoverColor = NSColor.quinaryLabel
|
||||
#endif
|
||||
let color: NSColor? = if self.isActive {
|
||||
.quaternaryLabelColor
|
||||
} else if self.isHovered {
|
||||
// macOS 14+ spells this without the "Color" suffix; quinaryLabelColor does not exist.
|
||||
.quinaryLabel
|
||||
hoverColor
|
||||
} else {
|
||||
nil
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ final class DockIconManager: NSObject, @unchecked Sendable {
|
||||
}
|
||||
|
||||
private func setupObservers() {
|
||||
Task { @MainActor in
|
||||
Task { @MainActor [self] in
|
||||
guard let app = NSApp else {
|
||||
self.logger.warning("NSApp not ready, delaying Dock observers")
|
||||
try? await Task.sleep(for: .milliseconds(200))
|
||||
|
||||
@@ -227,7 +227,7 @@ public final class OpenClawChatSpeechController {
|
||||
/// Whole-clip playback for gateway-rendered container audio. File metadata
|
||||
/// helps AVAudioPlayer parse clips whose type is not obvious from the bytes.
|
||||
@MainActor
|
||||
final class ChatSpeechClipPlayer: NSObject, ChatSpeechClipPlaying, @preconcurrency AVAudioPlayerDelegate {
|
||||
final class ChatSpeechClipPlayer: NSObject, ChatSpeechClipPlaying {
|
||||
private var player: AVAudioPlayer?
|
||||
private var continuation: CheckedContinuation<Bool, Never>?
|
||||
|
||||
@@ -276,6 +276,14 @@ final class ChatSpeechClipPlayer: NSObject, ChatSpeechClipPlaying, @preconcurren
|
||||
}
|
||||
}
|
||||
|
||||
// SDK 27 imports AVAudioPlayerDelegate with compatible isolation. Older SDKs
|
||||
// still need the preconcurrency bridge for this main-actor implementation.
|
||||
#if compiler(>=6.4)
|
||||
extension ChatSpeechClipPlayer: AVAudioPlayerDelegate {}
|
||||
#else
|
||||
extension ChatSpeechClipPlayer: @preconcurrency AVAudioPlayerDelegate {}
|
||||
#endif
|
||||
|
||||
/// On-device fallback voice via AVSpeechSynthesizer.
|
||||
@MainActor
|
||||
final class ChatSpeechLocalSpeaker: NSObject, ChatSpeechLocalSpeaking,
|
||||
|
||||
@@ -8,11 +8,19 @@ public enum CameraAuthorization {
|
||||
case .authorized:
|
||||
return true
|
||||
case .notDetermined:
|
||||
#if compiler(>=6.4)
|
||||
return await withCheckedContinuation { cont in
|
||||
AVCaptureDevice.requestAccess(for: mediaType) { granted in
|
||||
cont.resume(returning: granted)
|
||||
}
|
||||
}
|
||||
#else
|
||||
return await withCheckedContinuation(isolation: nil) { cont in
|
||||
AVCaptureDevice.requestAccess(for: mediaType) { granted in
|
||||
cont.resume(returning: granted)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
case .denied, .restricted:
|
||||
return false
|
||||
@unknown default:
|
||||
|
||||
@@ -196,6 +196,16 @@ public enum DeviceIdentityStore {
|
||||
self.loadOrCreate(profile: .primary)
|
||||
}
|
||||
|
||||
#if compiler(>=6.4)
|
||||
static func withStateDirectory<T>(
|
||||
_ url: URL,
|
||||
operation: nonisolated(nonsending) () async throws -> T) async rethrows -> T
|
||||
{
|
||||
try await DeviceIdentityPaths.$scopedStateDirURL.withValue(
|
||||
url,
|
||||
operation: operation)
|
||||
}
|
||||
#else
|
||||
static func withStateDirectory<T>(
|
||||
_ url: URL,
|
||||
operation: () async throws -> T,
|
||||
@@ -206,6 +216,7 @@ public enum DeviceIdentityStore {
|
||||
operation: operation,
|
||||
isolation: isolation)
|
||||
}
|
||||
#endif
|
||||
|
||||
public static func loadOrCreate(profile: GatewayDeviceIdentityProfile) -> DeviceIdentity {
|
||||
self.loadOrCreate(
|
||||
|
||||
@@ -1316,7 +1316,7 @@ extension GatewayNodeSession {
|
||||
}
|
||||
|
||||
let receiptID = UUID()
|
||||
let task = Task {
|
||||
let task = Task { [self] in
|
||||
await Self.invokeWithTimeout(
|
||||
request: request,
|
||||
timeoutMs: timeoutMs,
|
||||
|
||||
@@ -10,7 +10,7 @@ import OSLog
|
||||
/// silently failing playback can never hang the talk loop. Shared by the iOS
|
||||
/// and macOS talk runtimes.
|
||||
@MainActor
|
||||
public final class TalkBufferedAudioPlayer: NSObject, @preconcurrency AVAudioPlayerDelegate {
|
||||
public final class TalkBufferedAudioPlayer: NSObject {
|
||||
public static let shared = TalkBufferedAudioPlayer()
|
||||
|
||||
override public init() {
|
||||
@@ -168,4 +168,12 @@ public final class TalkBufferedAudioPlayer: NSObject, @preconcurrency AVAudioPla
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// SDK 27 imports AVAudioPlayerDelegate with compatible isolation. Older SDKs
|
||||
// still need the preconcurrency bridge for this main-actor implementation.
|
||||
#if compiler(>=6.4)
|
||||
extension TalkBufferedAudioPlayer: AVAudioPlayerDelegate {}
|
||||
#else
|
||||
extension TalkBufferedAudioPlayer: @preconcurrency AVAudioPlayerDelegate {}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user