cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject cordova-plugin-splashscreen git commit: CB-10562 hide() not working in latest splashscreen plug in 3.1.0 in iOS
Date Thu, 24 Mar 2016 13:27:47 GMT
Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master 9ca15db91 -> 41d9ae94f


CB-10562 hide() not working in latest splashscreen plug in 3.1.0 in iOS


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/41d9ae94
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/41d9ae94
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/41d9ae94

Branch: refs/heads/master
Commit: 41d9ae94ffe4e6d70f941f176045ceff45c69d4f
Parents: 9ca15db
Author: daserge <v-seshak@microsoft.com>
Authored: Thu Mar 10 15:38:32 2016 +0300
Committer: daserge <v-seshak@microsoft.com>
Committed: Thu Mar 24 16:19:19 2016 +0300

----------------------------------------------------------------------
 src/ios/CDVSplashScreen.h |  1 +
 src/ios/CDVSplashScreen.m | 40 +++++++++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/41d9ae94/src/ios/CDVSplashScreen.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.h b/src/ios/CDVSplashScreen.h
index 4802a30..ec5d602 100644
--- a/src/ios/CDVSplashScreen.h
+++ b/src/ios/CDVSplashScreen.h
@@ -36,6 +36,7 @@ typedef struct {
     UIImageView* _imageView;
     NSString* _curImageName;
     BOOL _visible;
+    BOOL _destroyed;
 }
 
 - (void)show:(CDVInvokedUrlCommand*)command;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/41d9ae94/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index 2883201..407fde2 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -41,7 +41,7 @@
 
 - (void)hide:(CDVInvokedUrlCommand*)command
 {
-    [self setVisible:NO];
+    [self setVisible:NO andForce:YES];
 }
 
 - (void)pageDidLoad
@@ -120,6 +120,7 @@
     [parentView addObserver:self forKeyPath:@"bounds" options:0 context:nil];
 
     [self updateImage];
+    _destroyed = NO;
 }
 
 - (void)hideViews
@@ -130,6 +131,7 @@
 
 - (void)destroyViews
 {
+    _destroyed = YES;
     [(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController
*)self.viewController shouldAutorotateDefaultValue]];
 
     [_imageView removeFromSuperview];
@@ -376,7 +378,12 @@
 
 - (void)setVisible:(BOOL)visible
 {
-    if (visible != _visible)
+    [self setVisible:visible andForce:NO];
+}
+
+- (void)setVisible:(BOOL)visible andForce:(BOOL)force
+{
+    if (visible != _visible || force)
     {
         _visible = visible;
 
@@ -433,26 +440,29 @@
             __weak __typeof(self) weakSelf = self;
             float effectiveSplashDuration;
 
-            if (!autoHideSplashScreen) {
+            // [CB-10562] AutoHideSplashScreen may be "true" but we should still be able
to hide the splashscreen manually.
+            if (!autoHideSplashScreen || force) {
                 effectiveSplashDuration = (fadeDuration) / 1000;
             } else {
                 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
-                                       }
-                                     }
+                if (!_destroyed) {
+                    [UIView transitionWithView:self.viewController.view
+                                    duration:(fadeDuration / 1000)
+                                    options:UIViewAnimationOptionTransitionNone
+                                    animations:^(void) {
+                                        [weakSelf hideViews];
+                                    }
+                                    completion:^(BOOL finished) {
+                                        if (finished && !_destroyed) {
+                                            [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


Mime
View raw message