Skip to content

Commit 3d07b37

Browse files
committed
fix: camera breaks app orientation configuration (#89)
1 parent 3cb2b56 commit 3d07b37

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Sources/Internal/UI/MCamera/MCamera+Config.swift

+1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ extension MCamera { @MainActor class Config {
2424

2525
// MARK: Others
2626
var appDelegate: MApplicationDelegate.Type? = nil
27+
var originalOrientationLock: UIInterfaceOrientationMask = .all
2728
var isCameraConfigured: Bool = false
2829
}}

Sources/Internal/UI/MCamera/MCamera.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private extension MCamera {
144144
}
145145
private extension MCamera {
146146
func lockScreenOrientation(_ orientation: UIInterfaceOrientationMask?) {
147-
config.appDelegate?.orientationLock = orientation ?? .all
147+
config.appDelegate?.orientationLock = orientation ?? config.originalOrientationLock
148148
UINavigationController.attemptRotationToDeviceOrientation()
149149
}
150150
func notifyUserOfMediaCaptured(_ capturedMedia: MCameraMedia) {

Sources/Public/Camera Settings/Public+CameraSettings+MCamera.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,13 @@ public extension MCamera {
384384
}
385385
```
386386
*/
387-
func lockCameraInPortraitOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self { config.appDelegate = appDelegate; manager.attributes.orientationLocked = true; return self }
387+
func lockCameraInPortraitOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self {
388+
config.appDelegate = appDelegate
389+
config.originalOrientationLock = appDelegate.orientationLock
390+
manager.attributes.orientationLocked = true
391+
392+
return self
393+
}
388394

389395
/**
390396
Starts the camera session.

0 commit comments

Comments
 (0)