Brion VIBBER has submitted this change and it was merged.

Change subject: Fix for onboarding globe flicker.
......................................................................


Fix for onboarding globe flicker.

Also fix for restricting onboarding screen to portrait for phones.

Change-Id: I6cafaddd5f83130269393b3ac1050f122acc3b9f
---
M wikipedia/View Controllers/Onboarding/OnboardingViewController.m
M wikipedia/View Controllers/Root/RootViewController.m
2 files changed, 38 insertions(+), 14 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved



diff --git a/wikipedia/View Controllers/Onboarding/OnboardingViewController.m 
b/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
index 4bc7cc7..117d508 100644
--- a/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
+++ b/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
@@ -46,6 +46,17 @@
 
 @implementation OnboardingViewController
 
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) ?
+        UIInterfaceOrientationMaskPortrait : UIInterfaceOrientationMaskAll;
+}
+
 - (BOOL)prefersAlertsHidden
 {
     return YES;
diff --git a/wikipedia/View Controllers/Root/RootViewController.m 
b/wikipedia/View Controllers/Root/RootViewController.m
index 0055fb9..68323bd 100644
--- a/wikipedia/View Controllers/Root/RootViewController.m
+++ b/wikipedia/View Controllers/Root/RootViewController.m
@@ -28,6 +28,8 @@
 
 @property (strong, nonatomic) UIView *splashImageBackgroundView;
 
+@property (nonatomic) BOOL showingOnboarding;
+
 @end
 
 @implementation RootViewController
@@ -36,13 +38,17 @@
 {
     [super viewDidLoad];
 
+    // Need to record ShowOnboarding here because by the time it is needed in 
viewDidAppear it has changed already.
     NSNumber *showingOnboarding = [[NSUserDefaults standardUserDefaults] 
objectForKey:@"ShowOnboarding"];
-    if (!showingOnboarding.boolValue) {
-        // Add an image view to view w globe image - center it in screen the 
in view
-        // did appear see if this view is still present, if so animate hiding 
it and
-        // remove it (and its constraints!).
-        [self splashImageShow];
-    }
+    self.showingOnboarding = showingOnboarding.boolValue;
+
+    // Add an image view to view w globe image - center it in screen the in 
view
+    // did appear see if this view is still present, if so animate hiding it 
and
+    // remove it (and its constraints!).
+    // (Show splash image even if onboarding to prevent flicker between time 
root
+    // view appears and time onboarding vc's view appears - it's the briefest
+    // interval, but noticeable)
+    [self splashImageShow];
 }
 
 -(void)viewDidAppear:(BOOL)animated
@@ -107,13 +113,7 @@
 
 -(void)splashImageHide
 {
-    CGFloat delay = 0.6;
-    CGFloat duration = 0.3;
-    
-    CFTimeInterval beginTime = CACurrentMediaTime() + delay;
-    [CATransaction begin];
-    [CATransaction setAnimationDuration:duration];
-    [CATransaction setCompletionBlock:^{
+    void (^completionBlock)(void) = ^{
         [self.splashImage 
removeConstraintsOfViewFromView:self.splashImageBackgroundView];
         [self.splashImage removeFromSuperview];
         self.splashImage = nil;
@@ -121,7 +121,20 @@
         [self.splashImageBackgroundView 
removeConstraintsOfViewFromView:self.view];
         [self.splashImageBackgroundView removeFromSuperview];
         self.splashImageBackgroundView = nil;
-    }];
+    };
+
+    if (self.showingOnboarding) {
+        completionBlock();
+        return;
+    }
+
+    CGFloat delay = 0.6;
+    CGFloat duration = 0.3;
+    
+    CFTimeInterval beginTime = CACurrentMediaTime() + delay;
+    [CATransaction begin];
+    [CATransaction setAnimationDuration:duration];
+    [CATransaction setCompletionBlock:completionBlock];
     
     CABasicAnimation *zoom = [CABasicAnimation 
animationWithKeyPath:@"transform"];
     zoom.fillMode = kCAFillModeForwards;

-- 
To view, visit https://gerrit.wikimedia.org/r/147525
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6cafaddd5f83130269393b3ac1050f122acc3b9f
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd <mh...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to