summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-splashscreen/src
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-splashscreen/src')
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/android/SplashScreen.java0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/blackberry10/index.js0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/browser/SplashScreenProxy.js0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.h0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m180
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.h0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.m0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/tizen/SplashScreenProxy.js0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.cpp0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.h0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/ResolutionHelper.cs0
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/SplashScreen.cs3
12 files changed, 116 insertions, 67 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/android/SplashScreen.java b/StoneIsland/plugins/cordova-plugin-splashscreen/src/android/SplashScreen.java
index 75ad724c..75ad724c 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/android/SplashScreen.java
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/android/SplashScreen.java
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/blackberry10/index.js b/StoneIsland/plugins/cordova-plugin-splashscreen/src/blackberry10/index.js
index bd7e48c8..bd7e48c8 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/blackberry10/index.js
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/blackberry10/index.js
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/browser/SplashScreenProxy.js b/StoneIsland/plugins/cordova-plugin-splashscreen/src/browser/SplashScreenProxy.js
index d19f8c87..d19f8c87 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/browser/SplashScreenProxy.js
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/browser/SplashScreenProxy.js
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.h b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.h
index 0d6ae397..0d6ae397 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.h
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.h
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
index 43b356ad..a1add304 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
@@ -22,14 +22,14 @@
#import <Cordova/CDVScreenOrientationDelegate.h>
#import "CDVViewController+SplashScreen.h"
-#define kSplashScreenDurationDefault 0.25f
+#define kSplashScreenDurationDefault 3000.0f
@implementation CDVSplashScreen
- (void)pluginInitialize
{
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:self.webView];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil];
[self setVisible:YES];
}
@@ -82,11 +82,16 @@
NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
- if ([topActivityIndicator isEqualToString:@"whiteLarge"]) {
+ if ([topActivityIndicator isEqualToString:@"whiteLarge"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
- } else if ([topActivityIndicator isEqualToString:@"white"]) {
+ }
+ else if ([topActivityIndicator isEqualToString:@"white"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
- } else if ([topActivityIndicator isEqualToString:@"gray"]) {
+ }
+ else if ([topActivityIndicator isEqualToString:@"gray"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
}
@@ -104,7 +109,8 @@
id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
// backwards compatibility - if key is missing, default to true
- if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) {
+ if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue])
+ {
[parentView addSubview:_activityView];
}
@@ -116,6 +122,12 @@
[self updateImage];
}
+- (void)hideViews
+{
+ [_imageView setAlpha:0];
+ [_activityView setAlpha:0];
+}
+
- (void)destroyViews
{
[(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController *)self.viewController shouldAutorotateDefaultValue]];
@@ -167,21 +179,33 @@
// this means there are no mixed orientations in there
BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);
- if (imageName) {
+ if (imageName)
+ {
imageName = [imageName stringByDeletingPathExtension];
- } else {
+ }
+ else
+ {
imageName = @"Default";
}
- if (device.iPhone5) { // does not support landscape
+ if (device.iPhone5)
+ { // does not support landscape
imageName = [imageName stringByAppendingString:@"-568h"];
- } else if (device.iPhone6) { // does not support landscape
+ }
+ else if (device.iPhone6)
+ { // does not support landscape
imageName = [imageName stringByAppendingString:@"-667h"];
- } else if (device.iPhone6Plus) { // supports landscape
- if (isOrientationLocked) {
+ }
+ else if (device.iPhone6Plus)
+ { // supports landscape
+ if (isOrientationLocked)
+ {
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
- } else {
- switch (currentOrientation) {
+ }
+ else
+ {
+ switch (currentOrientation)
+ {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
@@ -192,11 +216,17 @@
}
imageName = [imageName stringByAppendingString:@"-736h"];
- } else if (device.iPad) { // supports landscape
- if (isOrientationLocked) {
+ }
+ else if (device.iPad)
+ { // supports landscape
+ if (isOrientationLocked)
+ {
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
- } else {
- switch (currentOrientation) {
+ }
+ else
+ {
+ switch (currentOrientation)
+ {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
@@ -219,16 +249,20 @@
{
NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
- if (![imageName isEqualToString:_curImageName]) {
+ if (![imageName isEqualToString:_curImageName])
+ {
UIImage* img = [UIImage imageNamed:imageName];
_imageView.image = img;
_curImageName = imageName;
}
// Check that splash screen's image exists before updating bounds
- if (_imageView.image) {
+ if (_imageView.image)
+ {
[self updateBounds];
- } else {
+ }
+ else
+ {
NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
}
}
@@ -248,26 +282,34 @@
* correctly.
*/
BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
- if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) {
+ if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad)
+ {
imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
}
// There's a special case when the image is the size of the screen.
- if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
+ if (CGSizeEqualToSize(screenSize, imgBounds.size))
+ {
CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
- if (!(IsAtLeastiOSVersion(@"7.0"))) {
+ if (!(IsAtLeastiOSVersion(@"7.0")))
+ {
imgBounds.origin.y -= statusFrame.size.height;
}
- } else if (imgBounds.size.width > 0) {
+ }
+ else if (imgBounds.size.width > 0)
+ {
CGRect viewBounds = self.viewController.view.bounds;
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
// This matches the behaviour of the native splash screen.
CGFloat ratio;
- if (viewAspect > imgAspect) {
+ if (viewAspect > imgAspect)
+ {
ratio = viewBounds.size.width / imgBounds.size.width;
- } else {
+ }
+ else
+ {
ratio = viewBounds.size.height / imgBounds.size.height;
}
imgBounds.size.height *= ratio;
@@ -280,50 +322,54 @@
- (void)setVisible:(BOOL)visible
{
- if (visible == _visible) {
- return;
- }
- _visible = visible;
+ if (visible != _visible)
+ {
+ _visible = visible;
- id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
- id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]];
+ id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
+ id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]];
- float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
+ float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
- if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) {
- fadeDuration = 0;
- }
-
- // Never animate the showing of the splash screen.
- if (visible) {
- if (_imageView == nil) {
- [self createViews];
+ if ((fadeSplashScreenValue == nil) || ![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)
+ {
+ [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
+ }
+ }
+ ];
}
- } else if (fadeDuration == 0) {
- [self destroyViews];
- } else {
- __weak __typeof(self) weakSelf = self;
-
- [UIView transitionWithView:self.viewController.view
- duration:fadeDuration
- options:UIViewAnimationOptionTransitionNone
- animations:^(void) {
- __typeof(self) strongSelf = weakSelf;
- if (strongSelf != nil) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [strongSelf->_activityView setAlpha:0];
- [strongSelf->_imageView setAlpha:0];
- });
- }
- }
- completion:^(BOOL finished) {
- if (finished) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf destroyViews];
- });
- }
- }
- ];
}
}
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.h b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.h
index a948ea31..a948ea31 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.h
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.h
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.m b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.m
index 5736b6f2..5736b6f2 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.m
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVViewController+SplashScreen.m
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/tizen/SplashScreenProxy.js b/StoneIsland/plugins/cordova-plugin-splashscreen/src/tizen/SplashScreenProxy.js
index fbd9f35f..fbd9f35f 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/tizen/SplashScreenProxy.js
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/tizen/SplashScreenProxy.js
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.cpp b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.cpp
index 1c9ecac8..1c9ecac8 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.cpp
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.cpp
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.h b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.h
index 1d437f84..1d437f84 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.h
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ubuntu/splashscreen.h
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/ResolutionHelper.cs b/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/ResolutionHelper.cs
index 050c3927..050c3927 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/ResolutionHelper.cs
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/ResolutionHelper.cs
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/SplashScreen.cs b/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/SplashScreen.cs
index 680a8058..c56d4ad6 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/SplashScreen.cs
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/wp/SplashScreen.cs
@@ -105,6 +105,7 @@ namespace WPCordovaClassLib.Cordova.Commands
XDocument configFile = XDocument.Parse(sr.ReadToEnd());
string configAutoHide = configFile.Descendants()
+ .Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "AutoHideSplashScreen")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();
@@ -113,6 +114,7 @@ namespace WPCordovaClassLib.Cordova.Commands
prefAutoHide = bool.TryParse(configAutoHide, out bVal) ? bVal : prefAutoHide;
string configDelay = configFile.Descendants()
+ .Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "SplashScreenDelay")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();
@@ -120,6 +122,7 @@ namespace WPCordovaClassLib.Cordova.Commands
prefDelay = int.TryParse(configDelay, out nVal) ? nVal : prefDelay;
string configImage = configFile.Descendants()
+ .Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "SplashScreen")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();