Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Internal/UI/MCamera/MCamera+Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ extension MCamera { @MainActor class Config {

// MARK: Others
var appDelegate: MApplicationDelegate.Type? = nil
var originalOrientationLock: UIInterfaceOrientationMask = .all
var isCameraConfigured: Bool = false
}}
2 changes: 1 addition & 1 deletion Sources/Internal/UI/MCamera/MCamera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private extension MCamera {
}
private extension MCamera {
func lockScreenOrientation(_ orientation: UIInterfaceOrientationMask?) {
config.appDelegate?.orientationLock = orientation ?? .all
config.appDelegate?.orientationLock = orientation ?? config.originalOrientationLock
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling lockScreenOrientation(nil) we will fallback to the original value set in AppDelegate (such as .portrait)

UINavigationController.attemptRotationToDeviceOrientation()
}
func notifyUserOfMediaCaptured(_ capturedMedia: MCameraMedia) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,13 @@ public extension MCamera {
}
```
*/
func lockCameraInPortraitOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self { config.appDelegate = appDelegate; manager.attributes.orientationLocked = true; return self }
func lockCameraInPortraitOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self {
config.appDelegate = appDelegate
config.originalOrientationLock = appDelegate.orientationLock
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Captures the AppDelegate's orientationLock and stores it as a default

manager.attributes.orientationLocked = true

return self
}

/**
Starts the camera session.
Expand Down