Skip to content

Commit 0e9c382

Browse files
authored
fix(iOS): missing check if deviceOrientation is actually supported (#13)
1 parent e5d4e11 commit 0e9c382

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

ios/implementation/OrientationDirectorImpl.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import UIKit
6666
updateIsLockedTo(value: false)
6767
self.adaptInterfaceTo(deviceOrientation: deviceOrientation)
6868
}
69-
69+
7070
@objc public func resetSupportedInterfaceOrientations() {
7171
self.supportedInterfaceOrientations = self.initialSupportedInterfaceOrientations
7272
self.requestInterfaceUpdateTo(mask: self.supportedInterfaceOrientations)
@@ -82,7 +82,7 @@ import UIKit
8282
guard let firstSupportedInterfaceOrientation = supportedInterfaceOrientations.first else {
8383
return
8484
}
85-
85+
8686
let orientation = OrientationDirectorUtils.getOrientationFrom(mask: firstSupportedInterfaceOrientation)
8787
self.updateLastInterfaceOrientation(value: orientation)
8888
}
@@ -155,8 +155,10 @@ import UIKit
155155
return
156156
}
157157

158-
if (deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN) {
159-
return
158+
let deviceOrientationMask = OrientationDirectorUtils.getMaskFrom(orientation: deviceOrientation)
159+
let isDeviceOrientationMaskSupported = self.supportedInterfaceOrientations.contains(deviceOrientationMask)
160+
if (!isDeviceOrientationMaskSupported) {
161+
return
160162
}
161163

162164
updateLastInterfaceOrientation(value: deviceOrientation)
@@ -166,7 +168,7 @@ import UIKit
166168
eventManager.sendLockDidChange(value: value)
167169
isLocked = value
168170
}
169-
171+
170172
private func updateLastInterfaceOrientation(value: Orientation) {
171173
self.eventManager.sendInterfaceOrientationDidChange(orientationValue: value.rawValue)
172174
lastInterfaceOrientation = value

0 commit comments

Comments
 (0)