@@ -66,6 +66,26 @@ import UIKit
6666 updateIsLockedTo ( value: false )
6767 self . adaptInterfaceTo ( deviceOrientation: deviceOrientation)
6868 }
69+
70+ @objc public func resetSupportedInterfaceOrientations( ) {
71+ self . supportedInterfaceOrientations = self . initialSupportedInterfaceOrientations
72+ self . requestInterfaceUpdateTo ( mask: self . supportedInterfaceOrientations)
73+ self . updateIsLockedTo ( value: self . initIsLocked ( ) )
74+
75+ let lastMask = OrientationDirectorUtils . getMaskFrom ( orientation: lastInterfaceOrientation)
76+ let isLastInterfaceOrientationAlreadySupported = self . supportedInterfaceOrientations. contains ( lastMask)
77+ if ( isLastInterfaceOrientationAlreadySupported) {
78+ return
79+ }
80+
81+ let supportedInterfaceOrientations = OrientationDirectorUtils . readSupportedInterfaceOrientationsFromBundle ( )
82+ guard let firstSupportedInterfaceOrientation = supportedInterfaceOrientations. first else {
83+ return
84+ }
85+
86+ let orientation = OrientationDirectorUtils . getOrientationFrom ( mask: firstSupportedInterfaceOrientation)
87+ self . updateLastInterfaceOrientation ( value: orientation)
88+ }
6989
7090 private func initInitialSupportedInterfaceOrientations( ) -> UIInterfaceOrientationMask {
7191 let supportedInterfaceOrientations = OrientationDirectorUtils . readSupportedInterfaceOrientationsFromBundle ( )
@@ -139,12 +159,16 @@ import UIKit
139159 return
140160 }
141161
142- self . eventManager. sendInterfaceOrientationDidChange ( orientationValue: deviceOrientation. rawValue)
143- lastInterfaceOrientation = deviceOrientation
162+ updateLastInterfaceOrientation ( value: deviceOrientation)
144163 }
145164
146165 private func updateIsLockedTo( value: Bool ) {
147166 eventManager. sendLockDidChange ( value: value)
148167 isLocked = value
149168 }
169+
170+ private func updateLastInterfaceOrientation( value: Orientation ) {
171+ self . eventManager. sendInterfaceOrientationDidChange ( orientationValue: value. rawValue)
172+ lastInterfaceOrientation = value
173+ }
150174}
0 commit comments