fix(ios): use existing CLLocationManager for authorizationStatus check

Avoid creating a throwaway CLLocationManager() on the main thread in
currentPermissions(). Route through NodeAppModel.locationAuthorizationStatus()
which reads from the delegate-managed LocationService instance instead.
This commit is contained in:
Yuto Tokunaga 2026-03-21 14:22:03 +09:00
parent 6526074c85
commit 46faaac4b2
No known key found for this signature in database
GPG Key ID: 58DBC6B878064C8A
2 changed files with 9 additions and 3 deletions

View File

@ -892,9 +892,10 @@ final class GatewayConnectionController {
permissions["camera"] = AVCaptureDevice.authorizationStatus(for: .video) == .authorized
permissions["microphone"] = AVCaptureDevice.authorizationStatus(for: .audio) == .authorized
permissions["speechRecognition"] = SFSpeechRecognizer.authorizationStatus() == .authorized
permissions["location"] = Self.isLocationAuthorized(
status: CLLocationManager().authorizationStatus)
&& CLLocationManager.locationServicesEnabled()
if let appModel = self.appModel {
permissions["location"] = Self.isLocationAuthorized(
status: appModel.locationAuthorizationStatus())
}
permissions["screenRecording"] = RPScreenRecorder.shared().isAvailable
let photoStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)

View File

@ -1,3 +1,4 @@
import CoreLocation
import OpenClawChatUI
import OpenClawKit
import OpenClawProtocol
@ -514,6 +515,10 @@ final class NodeAppModel {
}
}
func locationAuthorizationStatus() -> CLAuthorizationStatus {
self.locationService.authorizationStatus()
}
func requestLocationPermissions(mode: OpenClawLocationMode) async -> Bool {
guard mode != .off else { return true }
let status = await self.locationService.ensureAuthorization(mode: mode)