From 4d7b522d2a2935c6b4587eda72c43e4a0cd2292d Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sat, 30 Nov 2024 00:59:02 +0400 Subject: [PATCH] Use true north for device orientation when available --- submodules/WebUI/Sources/WebAppController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index 0468d9e31b..9d1016ec36 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -2246,7 +2246,11 @@ public final class WebAppController: ViewController, AttachmentContainable { var effectiveIsAbsolute = false let referenceFrame: CMAttitudeReferenceFrame - if absolute && CMMotionManager.availableAttitudeReferenceFrames().contains(.xMagneticNorthZVertical) { + + if absolute && [.authorizedWhenInUse, .authorizedAlways].contains(CLLocationManager.authorizationStatus()) && CMMotionManager.availableAttitudeReferenceFrames().contains(.xTrueNorthZVertical) { + referenceFrame = .xTrueNorthZVertical + effectiveIsAbsolute = true + } else if absolute && CMMotionManager.availableAttitudeReferenceFrames().contains(.xMagneticNorthZVertical) { referenceFrame = .xMagneticNorthZVertical effectiveIsAbsolute = true } else {