@@ -74,7 +74,7 @@ - (void)createViews
7474 // Determine whether rotation should be enabled for this device
7575 // Per iOS HIG, landscape is only supported on iPad and iPhone 6+
7676 CDV_iOSDevice device = [self getCurrentDevice ];
77- BOOL autorotateValue = (device.iPad || device.iPhone6Plus ) ?
77+ BOOL autorotateValue = (device.iPad || device.iPhone6Plus || device. iPhoneX ) ?
7878 [(CDVViewController *)self .viewController shouldAutorotateDefaultValue ] :
7979 NO ;
8080
@@ -174,6 +174,7 @@ - (CDV_iOSDevice) getCurrentDevice
174174 // this is appropriate for detecting the runtime screen environment
175175 device.iPhone6 = (device.iPhone && limit == 667.0 );
176176 device.iPhone6Plus = (device.iPhone && limit == 736.0 );
177+ device.iPhoneX = (device.iPhone && limit == 812.0 );
177178
178179 return device;
179180}
@@ -222,8 +223,12 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
222223 imageName = [imageName stringByAppendingString: @" -700" ];
223224 } else if (device.iPhone6 ) {
224225 imageName = [imageName stringByAppendingString: @" -800" ];
225- } else if (device.iPhone6Plus ) {
226- imageName = [imageName stringByAppendingString: @" -800" ];
226+ } else if (device.iPhone6Plus || device.iPhoneX ) {
227+ if (device.iPhone6Plus ) {
228+ imageName = [imageName stringByAppendingString: @" -800" ];
229+ } else {
230+ imageName = [imageName stringByAppendingString: @" -1100" ];
231+ }
227232 if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown)
228233 {
229234 imageName = [imageName stringByAppendingString: @" -Portrait" ];
@@ -239,7 +244,7 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
239244 { // does not support landscape
240245 imageName = [imageName stringByAppendingString: @" -667h" ];
241246 }
242- else if (device.iPhone6Plus )
247+ else if (device.iPhone6Plus || device. iPhoneX )
243248 { // supports landscape
244249 if (isOrientationLocked)
245250 {
@@ -257,8 +262,11 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
257262 break ;
258263 }
259264 }
260- imageName = [imageName stringByAppendingString: @" -736h" ];
261-
265+ if (device.iPhoneX ) {
266+ imageName = [imageName stringByAppendingString: @" -2436h" ];
267+ } else {
268+ imageName = [imageName stringByAppendingString: @" -736h" ];
269+ }
262270 }
263271 else if (device.iPad )
264272 { // supports landscape
@@ -370,7 +378,7 @@ - (void)updateBounds
370378 * correctly.
371379 */
372380 CDV_iOSDevice device = [self getCurrentDevice ];
373- if (UIInterfaceOrientationIsLandscape (orientation) && !device.iPhone6Plus && !device.iPad )
381+ if (UIInterfaceOrientationIsLandscape (orientation) && !device.iPhone6Plus && !device.iPad && !device. iPhoneX )
374382 {
375383 imgTransform = CGAffineTransformMakeRotation (M_PI / 2 );
376384 imgBounds.size = CGSizeMake (imgBounds.size .height , imgBounds.size .width );
0 commit comments