1010#import " LTHKeychainUtils.h"
1111#import < LocalAuthentication/LocalAuthentication.h>
1212
13- #define LTHiOS8 ([[[UIDevice currentDevice ] systemVersion ] compare: @" 8.0" \
14- options: NSNumericSearch] != NSOrderedAscending)
1513#define LTHiPad ([[UIDevice currentDevice ] userInterfaceIdiom ] == UIUserInterfaceIdiomPad)
1614
1715#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
@@ -565,23 +563,7 @@ - (void)_dismissMe {
565563 [_passcodeTextField resignFirstResponder ];
566564 [UIView animateWithDuration: _lockAnimationDuration animations: ^{
567565 if (self.displayedAsLockScreen ) {
568- if (LTHiOS8) {
569- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
570- }
571- else {
572- if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationLandscapeLeft) {
573- self.view .center = CGPointMake (self.view .center .x * -1 .f , self.view .center .y );
574- }
575- else if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationLandscapeRight) {
576- self.view .center = CGPointMake (self.view .center .x * 2 .f , self.view .center .y );
577- }
578- else if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationPortrait) {
579- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
580- }
581- else {
582- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
583- }
584- }
566+ self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
585567 }
586568 else {
587569 // Delete from Keychain
@@ -1049,34 +1031,10 @@ - (void)showLockScreenOver:(UIView *)superview withAnimation:(BOOL)animated with
10491031 [self rotateAccordingToStatusBarOrientationAndSupportedOrientations ];
10501032 CGPoint superviewCenter = CGPointMake (superview.center .x , superview.center .y );
10511033 CGPoint newCenter;
1052- [self statusBarFrameOrOrientationChanged: nil ];
1053- if (LTHiOS8) {
1054- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
1055- newCenter = CGPointMake (superviewCenter.x ,
1056- superviewCenter.y + self.navigationController .navigationBar .frame .size .height / 2 );
1057- }
1058- else {
1059- if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationLandscapeLeft) {
1060- self.view .center = CGPointMake (self.view .center .x * -1 .f , self.view .center .y );
1061- newCenter = CGPointMake (superviewCenter.x - self.navigationController .navigationBar .frame .size .height / 2 ,
1062- superviewCenter.y );
1063- }
1064- else if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationLandscapeRight) {
1065- self.view .center = CGPointMake (self.view .center .x * 2 .f , self.view .center .y );
1066- newCenter = CGPointMake (superviewCenter.x + self.navigationController .navigationBar .frame .size .height / 2 ,
1067- superviewCenter.y );
1068- }
1069- else if ([LTHPasscodeViewController currentOrientation ] == UIInterfaceOrientationPortrait) {
1070- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
1071- newCenter = CGPointMake (superviewCenter.x ,
1072- superviewCenter.y - self.navigationController .navigationBar .frame .size .height / 2 );
1073- }
1074- else {
1075- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
1076- newCenter = CGPointMake (superviewCenter.x ,
1077- superviewCenter.y + self.navigationController .navigationBar .frame .size .height / 2 );
1078- }
1079- }
1034+
1035+ self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
1036+ newCenter = CGPointMake (superviewCenter.x ,
1037+ superviewCenter.y + self.navigationController .navigationBar .frame .size .height / 2 );
10801038
10811039 [UIView animateWithDuration: animated ? _lockAnimationDuration : 0 animations: ^{
10821040 self.view .center = newCenter;
@@ -1777,16 +1735,6 @@ - (void)_addObservers {
17771735 selector: @selector (_applicationWillEnterForeground )
17781736 name: UIApplicationWillEnterForegroundNotification
17791737 object: nil ];
1780- [[NSNotificationCenter defaultCenter ]
1781- addObserver: self
1782- selector: @selector (statusBarFrameOrOrientationChanged: )
1783- name: UIApplicationDidChangeStatusBarOrientationNotification
1784- object: nil ];
1785- [[NSNotificationCenter defaultCenter ]
1786- addObserver: self
1787- selector: @selector (statusBarFrameOrOrientationChanged: )
1788- name: UIApplicationDidChangeStatusBarFrameNotification
1789- object: nil ];
17901738}
17911739
17921740
@@ -1814,8 +1762,6 @@ + (UIInterfaceOrientation)currentOrientation
18141762}
18151763
18161764- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
1817- if (_displayedAsLockScreen)
1818- return LTHiOS8 ? UIInterfaceOrientationMaskPortrait : UIInterfaceOrientationMaskAll;
18191765 // I'll be honest and mention I have no idea why this line of code below works.
18201766 // Without it, if you present the passcode view as lockscreen (directly on the window)
18211767 // and then inside of a modal, the orientation will be wrong.
@@ -1825,28 +1771,6 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
18251771}
18261772
18271773
1828- // All of the rotation handling is thanks to Håvard Fossli's - https://github.com/hfossli
1829- // answer: http://stackoverflow.com/a/4960988/793916
1830- - (void )statusBarFrameOrOrientationChanged:(NSNotification *)notification {
1831- /*
1832- This notification is most likely triggered inside an animation block,
1833- therefore no animation is needed to perform this nice transition.
1834- */
1835- [self rotateAccordingToStatusBarOrientationAndSupportedOrientations ];
1836- if (LTHiOS8) {
1837- _animatingView.frame = self.view .bounds ;
1838- }
1839- else {
1840- if (UIInterfaceOrientationIsPortrait ([LTHPasscodeViewController currentOrientation ])) {
1841- _animatingView.frame = CGRectMake (0 , 0 , LTHMainWindow.frame .size .width , LTHMainWindow.frame .size .height );
1842- }
1843- else {
1844- _animatingView.frame = CGRectMake (0 , 0 , LTHMainWindow.frame .size .height , LTHMainWindow.frame .size .width );
1845- }
1846- }
1847- }
1848-
1849-
18501774// And to his AGWindowView: https://github.com/hfossli/AGWindowView
18511775// Without the 'desiredOrientation' method, using showLockscreen in one orientation,
18521776// then presenting it inside a modal in another orientation would display
0 commit comments