Skip to content

Commit 904ab01

Browse files
committed
Code style improved
1 parent 3697bb1 commit 904ab01

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

LTHPasscodeViewController/LTHPasscodeViewController.m

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ - (void)showLockScreenOver:(UIView *)superview withAnimation:(BOOL)animated with
10171017
_isCurrentlyOnScreen = YES;
10181018

10191019
[superview addSubview: self.view];
1020-
1020+
10211021
// All this hassle because a view added to UIWindow does not rotate automatically
10221022
// and if we would have added the view anywhere else, it wouldn't display properly
10231023
// (having a modal on screen when the user leaves the app, for example).
@@ -1734,16 +1734,13 @@ - (void)_addObservers {
17341734
#pragma mark - Handling rotation
17351735

17361736
// Internal method for fetching the current orientation
1737-
+ (UIInterfaceOrientation)currentOrientation
1738-
{
1737+
+ (UIInterfaceOrientation)currentOrientation {
17391738
// statusBarOrientation is deprecated in iOS 13 and windowScene isn't available before iOS 13
17401739
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
1741-
if (@available(iOS 13.0, *))
1742-
{
1740+
if (@available(iOS 13.0, *)) {
17431741
return LTHMainWindow.windowScene.interfaceOrientation;
17441742
}
1745-
else
1746-
{
1743+
else {
17471744
#pragma clang diagnostic push
17481745
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
17491746
#endif
@@ -1771,17 +1768,18 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
17711768
- (UIInterfaceOrientation)desiredOrientation {
17721769
UIInterfaceOrientation statusBarOrientation = [LTHPasscodeViewController currentOrientation];
17731770
UIInterfaceOrientationMask statusBarOrientationAsMask = UIInterfaceOrientationMaskFromOrientation(statusBarOrientation);
1774-
if(self.supportedInterfaceOrientations & statusBarOrientationAsMask) {
1771+
1772+
if (self.supportedInterfaceOrientations & statusBarOrientationAsMask) {
17751773
return statusBarOrientation;
17761774
}
17771775
else {
1778-
if(self.supportedInterfaceOrientations & UIInterfaceOrientationMaskPortrait) {
1776+
if (self.supportedInterfaceOrientations & UIInterfaceOrientationMaskPortrait) {
17791777
return UIInterfaceOrientationPortrait;
17801778
}
1781-
else if(self.supportedInterfaceOrientations & UIInterfaceOrientationMaskLandscapeLeft) {
1779+
else if (self.supportedInterfaceOrientations & UIInterfaceOrientationMaskLandscapeLeft) {
17821780
return UIInterfaceOrientationLandscapeLeft;
17831781
}
1784-
else if(self.supportedInterfaceOrientations & UIInterfaceOrientationMaskLandscapeRight) {
1782+
else if (self.supportedInterfaceOrientations & UIInterfaceOrientationMaskLandscapeRight) {
17851783
return UIInterfaceOrientationLandscapeRight;
17861784
}
17871785
else {
@@ -1795,17 +1793,13 @@ - (void)rotateAccordingToStatusBarOrientationAndSupportedOrientations {
17951793
UIInterfaceOrientation orientation = [self desiredOrientation];
17961794
CGFloat angle = UIInterfaceOrientationAngleOfOrientation(orientation);
17971795
CGAffineTransform transform = CGAffineTransformMakeRotation(angle);
1798-
1799-
[self setIfNotEqualTransform: transform];
1800-
}
1801-
1802-
1803-
- (void)setIfNotEqualTransform:(CGAffineTransform)transform {
18041796
CGRect frame = self.view.superview.frame;
1805-
if(!CGAffineTransformEqualToTransform(self.view.transform, transform)) {
1797+
1798+
if (!CGAffineTransformEqualToTransform(self.view.transform, transform)) {
18061799
self.view.transform = transform;
18071800
}
1808-
if(!CGRectEqualToRect(self.view.frame, frame)) {
1801+
1802+
if (!CGRectEqualToRect(self.view.frame, frame)) {
18091803
self.view.frame = frame;
18101804
}
18111805
}
@@ -1843,17 +1837,15 @@ + (CGFloat)getStatusBarHeight {
18431837

18441838
// statusBarFrame is deprecated in iOS 13 and windowScene isn't available before iOS 13
18451839
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
1846-
if (@available(iOS 13.0, *))
1847-
{
1840+
if (@available(iOS 13.0, *)) {
18481841
if (UIInterfaceOrientationIsLandscape(orientation)) {
18491842
return LTHMainWindow.windowScene.statusBarManager.statusBarFrame.size.width;
18501843
}
18511844
else {
18521845
return LTHMainWindow.windowScene.statusBarManager.statusBarFrame.size.height;
18531846
}
18541847
}
1855-
else
1856-
{
1848+
else {
18571849
#pragma clang diagnostic push
18581850
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
18591851
#endif

0 commit comments

Comments
 (0)