fix(swift): align async helper callsites across iOS and macOS
This commit is contained in:
@@ -164,7 +164,7 @@ actor CameraCaptureService {
|
||||
}
|
||||
|
||||
private func ensureAccess(for mediaType: AVMediaType) async throws {
|
||||
if !(await CameraAuthorization.isAuthorized(for: mediaType)) {
|
||||
if await !(CameraAuthorization.isAuthorized(for: mediaType)) {
|
||||
throw CameraError.permissionDenied(kind: mediaType == .video ? "Camera" : "Microphone")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,12 @@ final class MacNodeLocationService: NSObject, CLLocationManagerDelegate, Locatio
|
||||
desiredAccuracy: desiredAccuracy,
|
||||
maxAgeMs: maxAgeMs,
|
||||
timeoutMs: timeoutMs,
|
||||
request: { try await self.requestLocationOnce() }) { timeoutMs, operation in
|
||||
request: { try await self.requestLocationOnce() },
|
||||
withTimeout: { timeoutMs, operation in
|
||||
try await self.withTimeout(timeoutMs: timeoutMs) {
|
||||
try await operation()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func withTimeout<T: Sendable>(
|
||||
|
||||
@@ -64,9 +64,10 @@ final class NotifyOverlayController {
|
||||
OverlayPanelFactory.present(
|
||||
window: self.window,
|
||||
isVisible: &self.model.isVisible,
|
||||
target: target) { window in
|
||||
self.updateWindowFrame(animate: true)
|
||||
window.orderFrontRegardless()
|
||||
target: target)
|
||||
{ window in
|
||||
self.updateWindowFrame(animate: true)
|
||||
window.orderFrontRegardless()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@ final class TalkOverlayController {
|
||||
OverlayPanelFactory.present(
|
||||
window: self.window,
|
||||
isVisible: &self.model.isVisible,
|
||||
target: target) { window in
|
||||
window.setFrame(target, display: true)
|
||||
window.orderFrontRegardless()
|
||||
target: target)
|
||||
{ window in
|
||||
window.setFrame(target, display: true)
|
||||
window.orderFrontRegardless()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,14 +77,14 @@ struct GatewayCostUsageDay: Codable {
|
||||
init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.date = try c.decode(String.self, forKey: .date)
|
||||
self.totals = GatewayCostUsageTotals(
|
||||
input: try c.decode(Int.self, forKey: .input),
|
||||
output: try c.decode(Int.self, forKey: .output),
|
||||
cacheRead: try c.decode(Int.self, forKey: .cacheRead),
|
||||
cacheWrite: try c.decode(Int.self, forKey: .cacheWrite),
|
||||
totalTokens: try c.decode(Int.self, forKey: .totalTokens),
|
||||
totalCost: try c.decode(Double.self, forKey: .totalCost),
|
||||
missingCostEntries: try c.decode(Int.self, forKey: .missingCostEntries))
|
||||
self.totals = try GatewayCostUsageTotals(
|
||||
input: c.decode(Int.self, forKey: .input),
|
||||
output: c.decode(Int.self, forKey: .output),
|
||||
cacheRead: c.decode(Int.self, forKey: .cacheRead),
|
||||
cacheWrite: c.decode(Int.self, forKey: .cacheWrite),
|
||||
totalTokens: c.decode(Int.self, forKey: .totalTokens),
|
||||
totalCost: c.decode(Double.self, forKey: .totalCost),
|
||||
missingCostEntries: c.decode(Int.self, forKey: .missingCostEntries))
|
||||
}
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
|
||||
@@ -23,10 +23,11 @@ extension VoiceWakeOverlayController {
|
||||
"overlay present windowShown textLen=\(self.model.text.count, privacy: .public)")
|
||||
// Keep the status item in “listening” mode until we explicitly dismiss the overlay.
|
||||
AppStateStore.shared.triggerVoiceEars(ttl: nil)
|
||||
}) { window in
|
||||
},
|
||||
onAlreadyVisible: { window in
|
||||
self.updateWindowFrame(animate: true)
|
||||
window.orderFrontRegardless()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func ensureWindow() {
|
||||
|
||||
Reference in New Issue
Block a user