Skip to content

Commit

Permalink
feat(iOS): create updateIsLockedTo method to centralize logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gladiuscode committed May 24, 2024
1 parent d97e5ae commit 2777911
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ios/implementation/OrientationDirectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ import UIKit

eventManager.sendInterfaceOrientationDidChange(orientationValue: orientation.rawValue)
lastInterfaceOrientation = orientation
eventManager.sendLockDidChange(value: true)
isLocked = true
updateIsLockedTo(value: true)
}

@objc public func unlock() {
self.requestInterfaceUpdateTo(mask: UIInterfaceOrientationMask.all)

let deviceOrientation = OrientationDirectorUtils.getOrientationFrom(deviceOrientation: UIDevice.current.orientation)
eventManager.sendLockDidChange(value: false)
isLocked = false
updateIsLockedTo(value: false)
self.adaptInterfaceTo(deviceOrientation: deviceOrientation)
}

Expand Down Expand Up @@ -135,4 +133,9 @@ import UIKit
self.eventManager.sendInterfaceOrientationDidChange(orientationValue: deviceOrientation.rawValue)
lastInterfaceOrientation = deviceOrientation
}

private func updateIsLockedTo(value: Bool) {
eventManager.sendLockDidChange(value: value)
isLocked = value
}
}

0 comments on commit 2777911

Please sign in to comment.