Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master 887f0f6c8 -> c67622f1b


Fix for portrait/landscape detection

Sometimes the width can be 568 or 320 depending on orientation on iPhone 5. 
This fixes the detection.

Signed-off-by: Shazron Abdullah <shaz...@apache.org>


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

Branch: refs/heads/master
Commit: 2f37eed1840619c31f5fdc746cbf9324ef6afb53
Parents: 887f0f6
Author: Nic Mulvaney <n...@nicmulvaney.com>
Authored: Sat Oct 11 18:53:40 2014 +0100
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Mon Oct 13 16:03:33 2014 -0700

----------------------------------------------------------------------
 src/ios/CDVSplashScreen.m | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/2f37eed1/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index ade5df0..4b4d466 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -124,16 +124,19 @@
     
     UIScreen* mainScreen = [UIScreen mainScreen];
     CGFloat mainScreenHeight = mainScreen.bounds.size.height;
+    CGFloat mainScreenWidth = mainScreen.bounds.size.width;
+    
+    int limit = MAX(mainScreenHeight,mainScreenWidth);
     
     device.iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
     device.iPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
     device.retina = ([mainScreen scale] == 2.0);
-    device.iPhone5 = (device.iPhone && mainScreenHeight == 568.0);
+    device.iPhone5 = (device.iPhone && limit == 568.0);
     // note these below is not a true device detect, for example if you are on 
an
     // iPhone 6/6+ but the app is scaled it will prob set iPhone5 as true, but
     // this is appropriate for detecting the runtime screen environment
-    device.iPhone6 = (device.iPhone && mainScreenHeight == 667.0);
-    device.iPhone6Plus = (device.iPhone && mainScreenHeight == 736.0);
+    device.iPhone6 = (device.iPhone && limit == 667.0);
+    device.iPhone6Plus = (device.iPhone && limit == 736.0);
     
     return device;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to