Brion VIBBER has submitted this change and it was merged.

Change subject: Animate splash logo.
......................................................................


Animate splash logo.

Change-Id: I3d25c17b3f86f0821d669b894f08b4796618bbda
---
M wikipedia/Base.lproj/Main_iPhone.storyboard
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_320x480.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024-1.png
M wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024.png
M wikipedia/View Controllers/Onboarding/OnboardingViewController.m
M wikipedia/View Controllers/Root/RootViewController.m
M wikipedia/View Controllers/WebView/WebViewController.m
17 files changed, 261 insertions(+), 47 deletions(-)

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



diff --git a/wikipedia/Base.lproj/Main_iPhone.storyboard 
b/wikipedia/Base.lproj/Main_iPhone.storyboard
index f830763..c44bf88 100644
--- a/wikipedia/Base.lproj/Main_iPhone.storyboard
+++ b/wikipedia/Base.lproj/Main_iPhone.storyboard
@@ -833,32 +833,32 @@
                         <viewControllerLayoutGuide type="top" id="Wha-F2-A5d"/>
                         <viewControllerLayoutGuide type="bottom" 
id="aHG-dq-Url"/>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="GRM-Ns-1PB">
+                    <view key="view" opaque="NO" 
clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="GRM-Ns-1PB">
                         <rect key="frame" x="0.0" y="0.0" width="320" 
height="568"/>
                         <autoresizingMask key="autoresizingMask" 
flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
-                            <scrollView opaque="NO" clipsSubviews="YES" 
clearsContextBeforeDrawing="NO" multipleTouchEnabled="YES" 
contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" 
id="mLM-M6-Y1D">
+                            <scrollView opaque="NO" clipsSubviews="YES" 
clearsContextBeforeDrawing="NO" multipleTouchEnabled="YES" 
contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" 
translatesAutoresizingMaskIntoConstraints="NO" id="mLM-M6-Y1D">
                                 <rect key="frame" x="0.0" y="0.0" width="320" 
height="568"/>
                                 <autoresizingMask key="autoresizingMask" 
widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <view opaque="NO" 
clearsContextBeforeDrawing="NO" contentMode="scaleToFill" 
translatesAutoresizingMaskIntoConstraints="NO" id="7jD-Km-GNT" 
userLabel="Scroll Container">
-                                        <rect key="frame" x="0.0" y="0.0" 
width="320" height="475"/>
+                                        <rect key="frame" x="0.0" y="0.0" 
width="320" height="477"/>
                                         <autoresizingMask 
key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
                                             <view opaque="NO" 
clearsContextBeforeDrawing="NO" contentMode="scaleToFill" 
translatesAutoresizingMaskIntoConstraints="NO" id="Ypf-Xx-Lly">
-                                                <rect key="frame" x="20" 
y="0.0" width="280" height="475"/>
+                                                <rect key="frame" x="20" 
y="0.0" width="280" height="477"/>
                                                 <autoresizingMask 
key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                 <subviews>
-                                                    <imageView 
userInteractionEnabled="NO" contentMode="center" 
horizontalHuggingPriority="251" verticalHuggingPriority="251" 
image="logo-onboarding.png" translatesAutoresizingMaskIntoConstraints="NO" 
id="K0v-hf-TOf">
+                                                    <imageView opaque="NO" 
clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" 
contentMode="center" horizontalHuggingPriority="251" 
verticalHuggingPriority="251" image="logo-onboarding.png" 
translatesAutoresizingMaskIntoConstraints="NO" id="K0v-hf-TOf">
                                                         <rect key="frame" 
x="35" y="56" width="210" height="192"/>
                                                         <autoresizingMask 
key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     </imageView>
                                                     <imageView 
userInteractionEnabled="NO" contentMode="scaleAspectFit" 
horizontalHuggingPriority="251" verticalHuggingPriority="251" 
image="logo-onboarding-subtitle.png" 
translatesAutoresizingMaskIntoConstraints="NO" id="21q-p1-vV2">
-                                                        <rect key="frame" 
x="35" y="264" width="210" height="70"/>
+                                                        <rect key="frame" 
x="35" y="266" width="210" height="70"/>
                                                         <autoresizingMask 
key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     </imageView>
                                                     <view opaque="NO" 
clearsContextBeforeDrawing="NO" contentMode="scaleToFill" 
translatesAutoresizingMaskIntoConstraints="NO" id="ay5-1L-SPF" 
userLabel="Buttons Container">
-                                                        <rect key="frame" 
x="-12" y="379" width="304" height="76"/>
+                                                        <rect key="frame" 
x="-12" y="381" width="304" height="76"/>
                                                         <autoresizingMask 
key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                         <subviews>
                                                             <label opaque="NO" 
clipsSubviews="YES" contentMode="left" horizontalHuggingPriority="251" 
verticalHuggingPriority="251" text="Create account" textAlignment="center" 
lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" 
adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="304" 
translatesAutoresizingMaskIntoConstraints="NO" id="wkl-j8-wLX" 
customClass="PaddedLabel">
@@ -909,7 +909,7 @@
                                                     <constraint 
firstAttribute="centerX" secondItem="ay5-1L-SPF" secondAttribute="centerX" 
id="eiR-s7-4e3"/>
                                                     <constraint 
firstItem="ay5-1L-SPF" firstAttribute="top" secondItem="21q-p1-vV2" 
secondAttribute="bottom" constant="45" id="nWX-Cw-MAY"/>
                                                     <constraint 
firstAttribute="centerX" secondItem="21q-p1-vV2" secondAttribute="centerX" 
id="s7I-hO-BX9"/>
-                                                    <constraint 
firstItem="21q-p1-vV2" firstAttribute="top" secondItem="K0v-hf-TOf" 
secondAttribute="bottom" constant="16" id="x2S-hf-UQ7"/>
+                                                    <constraint 
firstItem="21q-p1-vV2" firstAttribute="top" secondItem="K0v-hf-TOf" 
secondAttribute="bottom" constant="18" id="x2S-hf-UQ7"/>
                                                 </constraints>
                                             </view>
                                         </subviews>
@@ -944,9 +944,11 @@
                         <outlet property="createAccountButton" 
destination="wkl-j8-wLX" id="Q0x-Lf-aBP"/>
                         <outlet property="loginButton" 
destination="heA-3K-nhS" id="90C-kg-bai"/>
                         <outlet property="logoImage" destination="K0v-hf-TOf" 
id="IDl-op-jI7"/>
+                        <outlet property="logoTextImage" 
destination="21q-p1-vV2" id="woA-xt-AfL"/>
                         <outlet property="skipButton" destination="P6J-IE-CiO" 
id="uVS-3Y-c6m"/>
                         <outlet property="spaceAboveLogoConstraint" 
destination="0B0-Zk-SGf" id="Xaw-AS-lGs"/>
-                        <outlet property="spaceBelowLogoConstraint" 
destination="nWX-Cw-MAY" id="RnU-fa-AFO"/>
+                        <outlet property="spaceBelowLogoTextImageConstraint" 
destination="nWX-Cw-MAY" id="auV-mf-LGZ"/>
+                        <outlet property="spaceBetweenLogoImagesConstraint" 
destination="x2S-hf-UQ7" id="Wpj-ek-ejd"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" 
id="a0q-Kk-k0T" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -1754,7 +1756,7 @@
         <simulatedScreenMetrics key="destination" type="retina4"/>
     </simulatedMetricsContainer>
     <inferredMetricsTieBreakers>
-        <segue reference="lfF-8A-MqZ"/>
         <segue reference="ca4-hw-8WK"/>
+        <segue reference="lfF-8A-MqZ"/>
     </inferredMetricsTieBreakers>
 </document>
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768-1.png
index f7ea466..dfba0a6 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768.png
index f7ea466..8e136f1 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1024x768.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048-1.png
index 2ed50bd..b2278b7 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048.png
index 2ed50bd..5ab702b 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_1536x2048.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536-1.png
index ffafbc4..7ba06a7 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536.png
index ffafbc4..3337eb9 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_2048x1536.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_320x480.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_320x480.png
index 471ab3d..92de472 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_320x480.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_320x480.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136-1.png
index adf0a88..de8ad43 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136.png
index adf0a88..e37d31a 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x1136.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960-1.png
index ff372ea..6a6ac73 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960.png
index ff372ea..7a34270 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_640x960.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024-1.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024-1.png
index dc0d772..97c2620 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024-1.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024-1.png
Binary files differ
diff --git 
a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024.png 
b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024.png
index dc0d772..cfb414d 100644
--- a/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024.png
+++ b/wikipedia/Images.xcassets/LaunchImage.launchimage/splash_768x1024.png
Binary files differ
diff --git a/wikipedia/View Controllers/Onboarding/OnboardingViewController.m 
b/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
index 4733b46..4bc7cc7 100644
--- a/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
+++ b/wikipedia/View Controllers/Onboarding/OnboardingViewController.m
@@ -12,6 +12,15 @@
 #import "TopMenuContainerView.h"
 #import "UIViewController+ModalPresent.h"
 #import "UIViewController+Alert.h"
+#import "UIView+Debugging.h"
+
+#define TAKE_SPLASH_SCREENSHOT NO
+
+typedef NS_ENUM(NSUInteger, DisplayMode) {
+    DISPLAY_MODE_UNDEFINED,
+    DISPLAY_MODE_SPLASH,
+    DISPLAY_MODE_NORMAL
+};
 
 @interface OnboardingViewController ()
 
@@ -19,10 +28,19 @@
 @property (weak, nonatomic) IBOutlet PaddedLabel *loginButton;
 @property (weak, nonatomic) IBOutlet PaddedLabel *skipButton;
 
-@property (weak, nonatomic) IBOutlet NSLayoutConstraint 
*spaceBelowLogoConstraint;
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint 
*spaceAboveLogoConstraint;
+@property (nonatomic) CGFloat origSpaceAboveLogoConstraint;
+
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint 
*spaceBelowLogoTextImageConstraint;
+@property (nonatomic) CGFloat origSpaceBelowLogoTextImageConstraint;
+
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint 
*spaceBetweenLogoImagesConstraint;
+@property (nonatomic) CGFloat origSpaceBetweenLogoImagesConstraint;
 
 @property (weak, nonatomic) IBOutlet UIImageView *logoImage;
+@property (weak, nonatomic) IBOutlet UIImageView *logoTextImage;
+
+@property (nonatomic) DisplayMode displayMode;
 
 @end
 
@@ -38,21 +56,43 @@
     return YES;
 }
 
-//- (BOOL)prefersStatusBarHidden
-//{
-//    return YES;
-//}
+- (BOOL)prefersStatusBarHidden
+{
+    return TAKE_SPLASH_SCREENSHOT;
+}
+
+-(UIModalTransitionStyle)modalTransitionStyle
+{
+    return UIModalTransitionStyleCrossDissolve;
+}
 
 -(void)hide
 {
     [self.presentingViewController dismissViewControllerAnimated:YES 
completion:nil];
 }
 
+-(void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+
+    static BOOL once = NO;
+    if (once) return;
+    once = YES;
+
+    if (!TAKE_SPLASH_SCREENSHOT) {
+        [self animateToDisplayMode:DISPLAY_MODE_NORMAL];
+    }
+}
+
 - (void)viewDidLoad
 {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    
+
+    self.origSpaceAboveLogoConstraint = self.spaceAboveLogoConstraint.constant;
+    self.origSpaceBelowLogoTextImageConstraint = 
self.spaceBelowLogoTextImageConstraint.constant;
+    self.origSpaceBetweenLogoImagesConstraint = 
self.spaceBetweenLogoImagesConstraint.constant;
+
     self.view.backgroundColor = CHROME_COLOR;
     self.createAccountButton.backgroundColor = WMF_COLOR_GREEN;
     self.loginButton.layer.borderWidth = 1.0f / [UIScreen mainScreen].scale;
@@ -75,52 +115,91 @@
     self.createAccountButton.text = 
MWLocalizedString(@"onboarding-create-account", nil);
     self.skipButton.text = MWLocalizedString(@"onboarding-skip", nil);
 
-    [self adjustSpacingForVariousScreenSizes];
-
     [self styleLoginButtonText];
     
     self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
+}
 
-    /*
-    // To take splash image uncomment the respective item below and use the 
same simulator - then use command-s to
-    // take screenshot. Will also need to force onboarding to appear. Will 
also need to uncomment the
-    // "prefersStatusBarHidden" method.
-    //4 inch
-    UIView *splashImageMask = [[UIView alloc] initWithFrame:CGRectMake(0, 305, 
320, 1000)];
-    //3.5 inch
-    UIView *splashImageMask = [[UIView alloc] initWithFrame:CGRectMake(0, 278, 
320, 1000)];
-    //iPad
-    UIView *splashImageMask = [[UIView alloc] initWithFrame:CGRectMake(0, 418, 
768, 1000)];
+-(void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
 
-    splashImageMask.backgroundColor = CHROME_COLOR;
-    [self.view addSubview:splashImageMask];
-    */
+    static BOOL once = NO;
+    if (once) return;
+    once = YES;
+
+    self.displayMode = DISPLAY_MODE_SPLASH;
+}
+
+-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
 duration:(NSTimeInterval)duration
+{
+    self.displayMode = self.displayMode;
+}
+
+-(void)setDisplayMode:(DisplayMode)displayMode
+{
+    _displayMode = displayMode;
+    switch (self.displayMode) {
+        case DISPLAY_MODE_SPLASH:
+            // Center the globe image vertically.
+            self.spaceAboveLogoConstraint.constant =
+                (self.view.bounds.size.height / 2.0) - 
(self.logoImage.bounds.size.height / 2.0);
+            self.createAccountButton.alpha = 0.0;
+            self.loginButton.alpha = 0.0;
+            self.skipButton.alpha = 0.0;
+            self.logoTextImage.alpha = 0.0;
+            self.logoImage.transform = CGAffineTransformIdentity;
+            break;
+        case DISPLAY_MODE_NORMAL:
+            self.spaceAboveLogoConstraint.constant = 
self.origSpaceAboveLogoConstraint;
+            self.spaceBelowLogoTextImageConstraint.constant = 
self.origSpaceBelowLogoTextImageConstraint;
+            self.spaceBetweenLogoImagesConstraint.constant = 
self.origSpaceBetweenLogoImagesConstraint;
+            self.createAccountButton.alpha = 1.0;
+            self.loginButton.alpha = 1.0;
+            self.skipButton.alpha = 1.0;
+            self.logoTextImage.alpha = 1.0;
+            [self adjustSpacingForVariousScreenSizes];
+            break;
+        default:
+            break;
+    }
+    [self.view setNeedsUpdateConstraints];
+    [self.view layoutIfNeeded];
 }
 
 -(void)adjustSpacingForVariousScreenSizes
 {
-    CGFloat aboveMultiplier = 1.0;
+    CGFloat aboveMultiplier = 1.3;
     CGFloat belowMultiplier = 1.0;
+    CGFloat betweenMultiplier = 1.0;
+    //CGFloat imageScale = 1.0;
+    
     switch ((int)[UIScreen mainScreen].bounds.size.height) {
-        case 480:{
+        case 480:
             // Make everything fit on 3.5 inch screens.
-            aboveMultiplier = 1.0;
-            belowMultiplier = 0.0;
-            self.logoImage.layer.transform = CATransform3DMakeScale(0.85, 
0.85, 1.0);
-            }
+            aboveMultiplier = 0.65;
+            betweenMultiplier = 0.35;
+            belowMultiplier = 0.25;
             break;
         case 1024:
             // Make everything fit on iPad screens.
             aboveMultiplier = 3.0;
-            belowMultiplier = 3.0;
             break;
         default:
             break;
     }
 
-    self.spaceBelowLogoConstraint.constant = 
roundf(self.spaceBelowLogoConstraint.constant * belowMultiplier);
-    self.spaceAboveLogoConstraint.constant = 
roundf(self.spaceAboveLogoConstraint.constant * aboveMultiplier);
+    //self.logoImage.transform = CGAffineTransformMakeScale(imageScale, 
imageScale);
 
+    self.spaceAboveLogoConstraint.constant =
+        roundf(self.spaceAboveLogoConstraint.constant * aboveMultiplier);
+
+    self.spaceBetweenLogoImagesConstraint.constant =
+        roundf(self.spaceBetweenLogoImagesConstraint.constant * 
betweenMultiplier);
+
+    self.spaceBelowLogoTextImageConstraint.constant =
+        roundf(self.spaceBelowLogoTextImageConstraint.constant * 
belowMultiplier);
+    
     // Adjust for iOS 6 status bar height.
     if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
         self.spaceAboveLogoConstraint.constant -= 20;
@@ -164,6 +243,24 @@
 {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
+
+    /*
+    DisplayMode newDisplayMode = DISPLAY_MODE_UNDEFINED;
+    newDisplayMode = (self.displayMode == DISPLAY_MODE_NORMAL) ? 
DISPLAY_MODE_SPLASH : DISPLAY_MODE_NORMAL;
+    [self animateToDisplayMode:newDisplayMode];
+    */
+}
+
+-(void)animateToDisplayMode:(DisplayMode)displayMode
+{
+    CGFloat delay = 0.5;
+    // Reminder: must have small delay to give web view, which is the root 
view controller, a bit of time to
+    // do some of its setup stuff - otherwise the animation here will be 
choppy (web views use main thread
+    // heavily).
+    [UIView animateWithDuration:0.5 delay:delay 
options:UIViewAnimationOptionBeginFromCurrentState animations:^{
+        self.displayMode = displayMode;
+    } completion:^(BOOL done){
+    }];
 }
 
 /*
diff --git a/wikipedia/View Controllers/Root/RootViewController.m 
b/wikipedia/View Controllers/Root/RootViewController.m
index 3c536fd..0055fb9 100644
--- a/wikipedia/View Controllers/Root/RootViewController.m
+++ b/wikipedia/View Controllers/Root/RootViewController.m
@@ -12,6 +12,7 @@
 #import "ModalMenuAndContentViewController.h"
 #import "UIViewController+ModalPresent.h"
 #import "OnboardingViewController.h"
+#import "UIView+RemoveConstraints.h"
 
 @interface RootViewController (){
     
@@ -23,10 +24,124 @@
 
 @property (strong, nonatomic) UIViewController *topVC;
 
+@property (strong, nonatomic) UIImageView *splashImage;
+
+@property (strong, nonatomic) UIView *splashImageBackgroundView;
+
 @end
 
 @implementation RootViewController
 
+-(void)viewDidLoad
+{
+    [super viewDidLoad];
+
+    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];
+    }
+}
+
+-(void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+
+    if (self.splashImage) {
+        [self splashImageHide];
+    }
+}
+
+-(void)splashImageShow
+{
+    self.splashImageBackgroundView = [[UIView alloc] init];
+    self.splashImageBackgroundView.backgroundColor = CHROME_COLOR;
+    self.splashImageBackgroundView.translatesAutoresizingMaskIntoConstraints = 
NO;
+
+    self.splashImage = [[UIImageView alloc] initWithImage:[UIImage 
imageNamed:@"logo-onboarding.png"]];
+    self.splashImage.opaque = NO;
+    self.splashImage.translatesAutoresizingMaskIntoConstraints = NO;
+
+    [self.splashImageBackgroundView addSubview:self.splashImage];
+    [self.splashImageBackgroundView addConstraint:
+     [NSLayoutConstraint constraintWithItem: self.splashImage
+                                  attribute: NSLayoutAttributeCenterX
+                                  relatedBy: NSLayoutRelationEqual
+                                     toItem: self.splashImageBackgroundView
+                                  attribute: NSLayoutAttributeCenterX
+                                 multiplier: 1
+                                   constant: 0]];
+    
+    CGFloat vTweak = ([UIScreen mainScreen].scale != 1.0) ? -(1.0f / [UIScreen 
mainScreen].scale) : 0.0f;
+
+    [self.splashImageBackgroundView addConstraint:
+     [NSLayoutConstraint constraintWithItem: self.splashImage
+                                  attribute: NSLayoutAttributeCenterY
+                                  relatedBy: NSLayoutRelationEqual
+                                     toItem: self.splashImageBackgroundView
+                                  attribute: NSLayoutAttributeCenterY
+                                 multiplier: 1
+                                   constant: vTweak]];
+
+
+    [self.view addSubview:self.splashImageBackgroundView];
+
+    NSDictionary *views = @{@"splashImageBackgroundView": 
self.splashImageBackgroundView};
+    NSArray *viewConstraintArrays = @
+        [
+         [NSLayoutConstraint constraintsWithVisualFormat: 
@"H:|[splashImageBackgroundView]|"
+                                                 options: 0
+                                                 metrics: nil
+                                                   views: views],
+         
+         [NSLayoutConstraint constraintsWithVisualFormat: 
@"V:|[splashImageBackgroundView]|"
+                                                 options: 0
+                                                 metrics: nil
+                                                   views: views]
+     ];
+
+    [self.view addConstraints:[viewConstraintArrays 
valueForKeyPath:@"@unionOfArrays.self"]];
+}
+
+-(void)splashImageHide
+{
+    CGFloat delay = 0.6;
+    CGFloat duration = 0.3;
+    
+    CFTimeInterval beginTime = CACurrentMediaTime() + delay;
+    [CATransaction begin];
+    [CATransaction setAnimationDuration:duration];
+    [CATransaction setCompletionBlock:^{
+        [self.splashImage 
removeConstraintsOfViewFromView:self.splashImageBackgroundView];
+        [self.splashImage removeFromSuperview];
+        self.splashImage = nil;
+
+        [self.splashImageBackgroundView 
removeConstraintsOfViewFromView:self.view];
+        [self.splashImageBackgroundView removeFromSuperview];
+        self.splashImageBackgroundView = nil;
+    }];
+    
+    CABasicAnimation *zoom = [CABasicAnimation 
animationWithKeyPath:@"transform"];
+    zoom.fillMode = kCAFillModeForwards;
+    zoom.autoreverses = NO;
+    zoom.removedOnCompletion = NO;
+    zoom.beginTime = beginTime;
+    zoom.toValue = [NSValue 
valueWithCATransform3D:CATransform3DMakeScale(10.0f, 10.0f, 1.0f)];
+    [self.splashImageBackgroundView.layer addAnimation:zoom 
forKey:@"animateZoom"];
+    
+    CABasicAnimation *fade = [CABasicAnimation 
animationWithKeyPath:@"opacity"];
+    fade.beginTime = beginTime;
+    fade.autoreverses = NO;
+    fade.removedOnCompletion = NO;
+    fade.fillMode = kCAFillModeForwards;
+    fade.toValue = @(0.0f);
+    [self.splashImageBackgroundView.layer addAnimation:fade 
forKey:@"animateOpacity"];
+    
+    [CATransaction commit];
+}
+
 -(void)constrainTopContainerHeight
 {
     CGFloat topMenuHeight = TOP_MENU_INITIAL_HEIGHT;
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m 
b/wikipedia/View Controllers/WebView/WebViewController.m
index 171b014..2350e20 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -247,13 +247,6 @@
 {
     [super viewDidAppear:animated];
 
-    // Don't move this to viewDidLoad - this is because viewDidLoad may only 
get
-    // called very occasionally as app suspend/resume probably doesn't cause
-    // viewDidLoad to fire.
-    [self downloadAssetsFilesIfNecessary];
-
-    [self performHousekeepingIfNecessary];
-
     if ([self shouldShowOnboarding]) {
         [self showOnboarding];
 
@@ -263,6 +256,13 @@
         self.webView.alpha = 1.0f;
     }
 
+    // Don't move this to viewDidLoad - this is because viewDidLoad may only 
get
+    // called very occasionally as app suspend/resume probably doesn't cause
+    // viewDidLoad to fire.
+    [self downloadAssetsFilesIfNecessary];
+
+    [self performHousekeepingIfNecessary];
+
     //[self.view randomlyColorSubviews];
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d25c17b3f86f0821d669b894f08b4796618bbda
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