You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2015/12/21 17:01:00 UTC

cordova-plugin-splashscreen git commit: CB-10079 Splashscreen plugin does not honor SplashScreenDelay on iOS

Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master cfc6d7450 -> ccb3c2f45


CB-10079 Splashscreen plugin does not honor SplashScreenDelay on iOS

Github: close #64


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/ccb3c2f4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/ccb3c2f4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/ccb3c2f4

Branch: refs/heads/master
Commit: ccb3c2f4533fa52da474c33a7adc5ab5a887a805
Parents: cfc6d74
Author: Thejaswi Puthraya <th...@gmail.com>
Authored: Thu Nov 26 15:42:25 2015 +0530
Committer: daserge <v-...@microsoft.com>
Committed: Mon Dec 21 08:00:27 2015 -0800

----------------------------------------------------------------------
 src/ios/CDVSplashScreen.m | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/ccb3c2f4/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index 76b1c9f..c1c109a 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -331,6 +331,9 @@
 
         float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
 
+        id splashDurationString = [self.commandDelegate.settings objectForKey: [@"SplashScreenDelay" lowercaseString]];
+        float splashDuration = splashDurationString == nil ? kSplashScreenDurationDefault : [splashDurationString floatValue];
+
         if (fadeSplashScreenValue == nil)
         {
             fadeSplashScreenValue = @"true";
@@ -340,7 +343,7 @@
         {
             fadeDuration = 0;
         }
-        else if(fadeDuration < 30)
+        else if (fadeDuration < 30)
         {
             // [CB-9750] This value used to be in decimal seconds, so we will assume that if someone specifies 10
             // they mean 10 seconds, and not the meaningless 10ms
@@ -354,26 +357,29 @@
                 [self createViews];
             }
         }
-        else if (fadeDuration == 0)
+        else if (fadeDuration == 0 && splashDuration == 0)
         {
             [self destroyViews];
         }
         else
         {
             __weak __typeof(self) weakSelf = self;
-            [UIView transitionWithView:self.viewController.view
-                            duration:(fadeDuration / 1000)
-                            options:UIViewAnimationOptionTransitionNone
-                            animations:^(void) {
-                                [weakSelf hideViews];
-                            }
-                            completion:^(BOOL finished) {
-                                if (finished) {
-                                    [weakSelf destroyViews];
-                                    // TODO: It might also be nice to have a js event happen here -jm
-                                }
-                            }
-             ];
+            float effectiveSplashDuration = (splashDuration - fadeDuration) / 1000;
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (uint64_t) effectiveSplashDuration * NSEC_PER_SEC), dispatch_get_main_queue(), CFBridgingRelease(CFBridgingRetain(^(void) {
+                   [UIView transitionWithView:self.viewController.view
+                                   duration:(fadeDuration / 1000)
+                                   options:UIViewAnimationOptionTransitionNone
+                                   animations:^(void) {
+                                       [weakSelf hideViews];
+                                   }
+                                   completion:^(BOOL finished) {
+                                       if (finished) {
+                                           [weakSelf destroyViews];
+                                           // TODO: It might also be nice to have a js event happen here -jm
+                                       }
+                                     }
+                    ];
+            })));
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org