Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 326EE19D2A for ; Fri, 15 Apr 2016 20:49:41 +0000 (UTC) Received: (qmail 35332 invoked by uid 500); 15 Apr 2016 20:49:40 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 35284 invoked by uid 500); 15 Apr 2016 20:49:40 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 34659 invoked by uid 99); 15 Apr 2016 20:49:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Apr 2016 20:49:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 60216E00C6; Fri, 15 Apr 2016 20:49:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Fri, 15 Apr 2016 20:49:52 -0000 Message-Id: <169898523e3048e0aedc9a9056c25fb5@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/17] cordova-plugin-splashscreen git commit: CB-10562 hide() not working in latest splashscreen plug in 3.1.0 in iOS 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/3.2.x Commit: 41d9ae94ffe4e6d70f941f176045ceff45c69d4f Parents: 9ca15db Author: daserge Authored: Thu Mar 10 15:38:32 2016 +0300 Committer: daserge 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