You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/12/18 16:53:46 UTC
[jira] [Commented] (CB-10079) Splashscreen plugin does not honor
SplashScreenDelay on iOS
[ https://issues.apache.org/jira/browse/CB-10079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15064124#comment-15064124 ]
ASF GitHub Bot commented on CB-10079:
-------------------------------------
Github user daserge commented on the pull request:
https://github.com/apache/cordova-plugin-splashscreen/pull/64#issuecomment-165813016
@theju, thanks for this fix!
A few notes on this:
- Could you please add the fallback to default value for `splashDuration` (like the way it is done for `fadeSplashScreenDuration`)?
```objective-c
id splashDurationString = [self.commandDelegate.settings objectForKey: [@ "SplashScreenDelay"lowercaseString]];
float splashDuration = splashDurationString == nil ? kSplashScreenDurationDefault : [splashDurationString floatValue];
```
- If we have `<preference name="FadeSplashScreen" value="false" />` there will be no delay at all - to fix this we should change this line:
```objective-c
else if (fadeDuration == 0 && splashDuration == 0) {
[self destroyViews];
}
```
- Could you also please rename the PR title and the commit title to `CB-10079 Splashscreen plugin does not honor SplashScreenDelay on iOS`?
The updated function:
```objective-c
-(void) setVisible: (BOOL) visible {
if (visible != _visible) {
_visible = visible;
id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey: [@ "FadeSplashScreen"lowercaseString]];
id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey: [@ "FadeSplashScreenDuration"lowercaseString]];
float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
id splashDurationString = [self.commandDelegate.settings objectForKey: [@ "SplashScreenDelay"lowercaseString]];
float splashDuration = splashDurationString == nil ? kSplashScreenDurationDefault : [splashDurationString floatValue];
// Changes from https://github.com/apache/cordova-plugin-splashscreen/pull/65
if (fadeSplashScreenValue == nil) {
fadeSplashScreenValue = @ "true";
}
if (![fadeSplashScreenValue boolValue]) {
fadeDuration = 0;
} 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
fadeDuration *= 1000;
}
if (_visible) {
if (_imageView == nil) {
[self createViews];
}
} else if (fadeDuration == 0 && splashDuration == 0) {
[self destroyViews];
} else {
__weak __typeof(self) weakSelf = self;
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
}
}
];
})));
}
}
}
```
> Splashscreen plugin does not honor SplashScreenDelay on iOS
> -----------------------------------------------------------
>
> Key: CB-10079
> URL: https://issues.apache.org/jira/browse/CB-10079
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin SplashScreen
> Affects Versions: 3.5.0
> Environment: iOS
> Reporter: Thejaswi Puthraya
>
> Supposing I want to have the splashscreen display for larger than the default of 2.5s, changing the `SplashScreenDelay` (to say 10 seconds) in the config.xml does not work for iOS.
> There is no place where the `SplashScreenDelay` is referenced in [1].
> [1] https://github.com/apache/cordova-plugin-splashscreen/blob/master/src/ios/CDVSplashScreen.m
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org