summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-splashscreen/src
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-10-26 01:41:16 +0200
committerJules Laplace <julescarbon@gmail.com>2017-10-26 01:41:16 +0200
commit8dae6a5044f9c1b7a8497cc1c96155fd262b40cf (patch)
tree6f546503efcb198a193f919efafb83977abb9535 /StoneIsland/plugins/cordova-plugin-splashscreen/src
parent531c60ee7ecbee516812d560b63a8317c3cf3590 (diff)
iphone x fixes
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-splashscreen/src')
-rw-r--r--StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
index 8ad8116b..ab97055a 100644
--- a/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
+++ b/StoneIsland/plugins/cordova-plugin-splashscreen/src/ios/CDVSplashScreen.m
@@ -178,11 +178,26 @@
return device;
}
+- (BOOL) isUsingCDVLaunchScreen {
+ NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
+ if (launchStoryboardName) {
+ return ([launchStoryboardName isEqualToString:@"CDVLaunchScreen"]);
+ } else {
+ return NO;
+ }
+}
+
- (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device
{
// Use UILaunchImageFile if specified in plist. Otherwise, use Default.
NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"];
+ // detect if we are using CB-9762 Launch Storyboard; if so, return the associated image instead
+ if ([self isUsingCDVLaunchScreen]) {
+ imageName = @"LaunchStoryboard";
+ return imageName;
+ }
+
NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations];
// Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
@@ -334,6 +349,14 @@
- (void)updateBounds
{
+ if ([self isUsingCDVLaunchScreen]) {
+ // CB-9762's launch screen expects the image to fill the screen and be scaled using AspectFill.
+ CGSize viewportSize = [UIApplication sharedApplication].delegate.window.bounds.size;
+ _imageView.frame = CGRectMake(0, 0, viewportSize.width, viewportSize.height);
+ _imageView.contentMode = UIViewContentModeScaleAspectFill;
+ return;
+ }
+
UIImage* img = _imageView.image;
CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero;