From fcd628ffc9038862e5906e1fc3fe48c6cada49ba Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Mon, 29 Sep 2014 14:03:58 -0700 Subject: [PATCH] CB-7663 - prep for unit tests --- src/ios/CDVSplashScreen.m | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m index 7ce828d..15c665d 100644 --- a/src/ios/CDVSplashScreen.m +++ b/src/ios/CDVSplashScreen.m @@ -19,6 +19,7 @@ #import "CDVSplashScreen.h" #import +#import #define kSplashScreenDurationDefault 0.25f @@ -116,26 +117,25 @@ [self.viewController.view removeObserver:self forKeyPath:@"bounds"]; } -// Sets the view's frame and image. -- (void)updateImage +- (NSString*)getImageName:(id)screenOrientationDelegate { UIInterfaceOrientation orientation = self.viewController.interfaceOrientation; - + // Use UILaunchImageFile if specified in plist. Otherwise, use Default. NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"]; - + // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape CDVViewController* vc = (CDVViewController*)self.viewController; BOOL supportsLandscape = [vc supportsOrientation:UIInterfaceOrientationLandscapeLeft] || [vc supportsOrientation:UIInterfaceOrientationLandscapeRight]; BOOL supportsPortrait = [vc supportsOrientation:UIInterfaceOrientationPortrait] || [vc supportsOrientation:UIInterfaceOrientationPortraitUpsideDown]; BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape); - + if (imageName) { imageName = [imageName stringByDeletingPathExtension]; } else { imageName = @"Default"; } - + if (CDV_IsIPhone5()) { imageName = [imageName stringByAppendingString:@"-568h"]; } else if (CDV_IsIPad()) { @@ -147,7 +147,7 @@ case UIInterfaceOrientationLandscapeRight: imageName = [imageName stringByAppendingString:@"-Landscape"]; break; - + case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: default: @@ -156,6 +156,14 @@ } } } + + return imageName; +} + +// Sets the view's frame and image. +- (void)updateImage +{ + NSString* imageName = [self getImageName:(id)self.viewController]; if (![imageName isEqualToString:_curImageName]) { UIImage* img = [UIImage imageNamed:imageName];