[ 
https://issues.apache.org/jira/browse/CB-13737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318952#comment-16318952
 ] 

ASF GitHub Bot commented on CB-13737:
-------------------------------------

jcesarmobile closed pull request #146: CB-13737 (iOS): fix Splash screen images 
for iPhone X
URL: https://github.com/apache/cordova-plugin-splashscreen/pull/146
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVSplashScreen.h b/src/ios/CDVSplashScreen.h
index ec5d6022..dcc0d779 100644
--- a/src/ios/CDVSplashScreen.h
+++ b/src/ios/CDVSplashScreen.h
@@ -28,6 +28,7 @@ typedef struct {
     BOOL iPhone6;
     BOOL iPhone6Plus;
     BOOL retina;
+    BOOL iPhoneX;
     
 } CDV_iOSDevice;
 
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index ab97055a..9b04582c 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -74,7 +74,7 @@ - (void)createViews
     // Determine whether rotation should be enabled for this device
     // Per iOS HIG, landscape is only supported on iPad and iPhone 6+
     CDV_iOSDevice device = [self getCurrentDevice];
-    BOOL autorotateValue = (device.iPad || device.iPhone6Plus) ?
+    BOOL autorotateValue = (device.iPad || device.iPhone6Plus || 
device.iPhoneX) ?
         [(CDVViewController *)self.viewController 
shouldAutorotateDefaultValue] :
         NO;
 
@@ -174,6 +174,7 @@ - (CDV_iOSDevice) getCurrentDevice
     // this is appropriate for detecting the runtime screen environment
     device.iPhone6 = (device.iPhone && limit == 667.0);
     device.iPhone6Plus = (device.iPhone && limit == 736.0);
+    device.iPhoneX  = (device.iPhone && limit == 812.0);
 
     return device;
 }
@@ -222,8 +223,12 @@ - 
(NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
             imageName = [imageName stringByAppendingString:@"-700"];
         } else if(device.iPhone6) {
             imageName = [imageName stringByAppendingString:@"-800"];
-        } else if(device.iPhone6Plus) {
-            imageName = [imageName stringByAppendingString:@"-800"];
+        } else if(device.iPhone6Plus || device.iPhoneX ) {
+            if(device.iPhone6Plus) {
+                imageName = [imageName stringByAppendingString:@"-800"];
+            } else {
+                imageName = [imageName stringByAppendingString:@"-1100"];
+            }
             if (currentOrientation == UIInterfaceOrientationPortrait || 
currentOrientation == UIInterfaceOrientationPortraitUpsideDown)
             {
                 imageName = [imageName stringByAppendingString:@"-Portrait"];
@@ -239,7 +244,7 @@ - 
(NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
     { // does not support landscape
         imageName = [imageName stringByAppendingString:@"-667h"];
     }
-    else if (device.iPhone6Plus)
+    else if (device.iPhone6Plus || device.iPhoneX)
     { // supports landscape
         if (isOrientationLocked)
         {
@@ -257,8 +262,11 @@ - 
(NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
                     break;
             }
         }
-        imageName = [imageName stringByAppendingString:@"-736h"];
-
+        if (device.iPhoneX) {
+            imageName = [imageName stringByAppendingString:@"-2436h"];
+        } else {
+            imageName = [imageName stringByAppendingString:@"-736h"];
+        }
     }
     else if (device.iPad)
     {   // supports landscape
@@ -370,7 +378,7 @@ - (void)updateBounds
      * correctly.
      */
     CDV_iOSDevice device = [self getCurrentDevice];
-    if (UIInterfaceOrientationIsLandscape(orientation) && !device.iPhone6Plus 
&& !device.iPad)
+    if (UIInterfaceOrientationIsLandscape(orientation) && !device.iPhone6Plus 
&& !device.iPad && !device.iPhoneX)
     {
         imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
         imgBounds.size = CGSizeMake(imgBounds.size.height, 
imgBounds.size.width);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Splash screen images are resized incorrectly on iPhone X
> --------------------------------------------------------
>
>                 Key: CB-13737
>                 URL: https://issues.apache.org/jira/browse/CB-13737
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-splashscreen
>         Environment: iOS 11 / iPhone X
>            Reporter: jcesarmobile
>            Assignee: jcesarmobile
>              Labels: splashscreen
>
> When not using storyboard, the splash images are not correctly resized for 
> iPhone X. So when it switches from the launch image to the splash image there 
> is a noticeable change.
> Also, the landscape image is not displayed, it will show the portrait one.
> {code}
> <splash height="2436" platform="ios" src="res/screens/ios/Default-2436h.png" 
> width="1125" />
> <splash height="1125" platform="ios" 
> src="res/screens/ios/Default-Landscape-2436h.png" width="2436" />
>  {code}       



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to