You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/09/29 23:03:37 UTC

git commit: CB-7663 - prep for unit tests

Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master e1f17d666 -> fcd628ffc


CB-7663 - prep for unit tests


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/fcd628ff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/fcd628ff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/fcd628ff

Branch: refs/heads/master
Commit: fcd628ffc9038862e5906e1fc3fe48c6cada49ba
Parents: e1f17d6
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Sep 29 14:03:58 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Sep 29 14:03:58 2014 -0700

----------------------------------------------------------------------
 src/ios/CDVSplashScreen.m | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/fcd628ff/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
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 <Cordova/CDVViewController.h>
+#import <Cordova/CDVScreenOrientationDelegate.h>
 
 #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<CDVScreenOrientationDelegate>)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<CDVScreenOrientationDelegate>)self.viewController];
 
     if (![imageName isEqualToString:_curImageName]) {
         UIImage* img = [UIImage imageNamed:imageName];