@@ -178,27 +178,26 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
178178 return
179179 }
180180
181- val rotation = mUtils.getInterfaceRotation()
182- val newInterfaceOrientation = mUtils.convertToOrientationFromScreenRotation(rotation)
183- if (newInterfaceOrientation == lastInterfaceOrientation) {
184- return
185- }
181+ if (lastDeviceOrientation != Orientation .LANDSCAPE_RIGHT && lastDeviceOrientation != Orientation .LANDSCAPE_LEFT ) {
182+ val rotation = mUtils.getInterfaceRotation()
183+ val newInterfaceOrientation = mUtils.convertToOrientationFromScreenRotation(rotation)
186184
187- if (newInterfaceOrientation != Orientation .LANDSCAPE_LEFT && newInterfaceOrientation != Orientation .LANDSCAPE_RIGHT ) {
188185 updateLastInterfaceOrientationTo(newInterfaceOrientation)
189- return ;
186+ return
190187 }
191188
192189 /* *
193190 * The reason we invert the interface orientation is to match iOS behavior with
194- * UIInterfaceOrientation
191+ * UIInterfaceOrientation when device is in landscape mode
195192 */
196- val invertedLandscapeOrientation = if (newInterfaceOrientation == Orientation .LANDSCAPE_RIGHT ) {
197- Orientation .LANDSCAPE_LEFT
198- } else {
199- Orientation .LANDSCAPE_RIGHT
200- }
201- updateLastInterfaceOrientationTo(invertedLandscapeOrientation)
193+ val interfaceOrientationBasedOnDeviceOne =
194+ if (lastDeviceOrientation == Orientation .LANDSCAPE_RIGHT ) {
195+ Orientation .LANDSCAPE_LEFT
196+ } else {
197+ Orientation .LANDSCAPE_RIGHT
198+ }
199+
200+ updateLastInterfaceOrientationTo(interfaceOrientationBasedOnDeviceOne)
202201 }
203202
204203 private fun updateIsLockedTo (value : Boolean ) {
@@ -207,6 +206,10 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
207206 }
208207
209208 private fun updateLastInterfaceOrientationTo (value : Orientation ) {
209+ if (value == lastInterfaceOrientation) {
210+ return
211+ }
212+
210213 lastInterfaceOrientation = value
211214 mEventManager.sendInterfaceOrientationDidChange(value.ordinal)
212215 }
0 commit comments