Skip to content

Commit

Permalink
fix(iOS): missing check if deviceOrientation is actually supported (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
gladiuscode authored May 26, 2024
1 parent e5d4e11 commit 0e9c382
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ios/implementation/OrientationDirectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import UIKit
updateIsLockedTo(value: false)
self.adaptInterfaceTo(deviceOrientation: deviceOrientation)
}

@objc public func resetSupportedInterfaceOrientations() {
self.supportedInterfaceOrientations = self.initialSupportedInterfaceOrientations
self.requestInterfaceUpdateTo(mask: self.supportedInterfaceOrientations)
Expand All @@ -82,7 +82,7 @@ import UIKit
guard let firstSupportedInterfaceOrientation = supportedInterfaceOrientations.first else {
return
}

let orientation = OrientationDirectorUtils.getOrientationFrom(mask: firstSupportedInterfaceOrientation)
self.updateLastInterfaceOrientation(value: orientation)
}
Expand Down Expand Up @@ -155,8 +155,10 @@ import UIKit
return
}

if (deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN) {
return
let deviceOrientationMask = OrientationDirectorUtils.getMaskFrom(orientation: deviceOrientation)
let isDeviceOrientationMaskSupported = self.supportedInterfaceOrientations.contains(deviceOrientationMask)
if (!isDeviceOrientationMaskSupported) {
return
}

updateLastInterfaceOrientation(value: deviceOrientation)
Expand All @@ -166,7 +168,7 @@ import UIKit
eventManager.sendLockDidChange(value: value)
isLocked = value
}

private func updateLastInterfaceOrientation(value: Orientation) {
self.eventManager.sendInterfaceOrientationDidChange(orientationValue: value.rawValue)
lastInterfaceOrientation = value
Expand Down

0 comments on commit 0e9c382

Please sign in to comment.