diff --git a/src/ios/PrivacyScreenPlugin.h b/src/ios/PrivacyScreenPlugin.h index 6ce5c3a..7b86c65 100644 --- a/src/ios/PrivacyScreenPlugin.h +++ b/src/ios/PrivacyScreenPlugin.h @@ -14,6 +14,7 @@ typedef struct { BOOL iPhone5; BOOL iPhone6; BOOL iPhone6Plus; + BOOL iPhoneX; BOOL retina; } CDV_iOSDevice; diff --git a/src/ios/PrivacyScreenPlugin.m b/src/ios/PrivacyScreenPlugin.m index 67303ee..fb85ad5 100644 --- a/src/ios/PrivacyScreenPlugin.m +++ b/src/ios/PrivacyScreenPlugin.m @@ -70,6 +70,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; } @@ -100,8 +101,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"]; } @@ -115,7 +120,7 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i imageName = isLandscape ? nil : [imageName stringByAppendingString:@"-568h"]; } else if (device.iPhone6) { // does not support landscape imageName = isLandscape ? nil : [imageName stringByAppendingString:@"-667h"]; - } else if (device.iPhone6Plus) { // supports landscape + } else if (device.iPhone6Plus || device.iPhoneX) { // supports landscape if (isOrientationLocked) { imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")]; } else { @@ -128,7 +133,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 if (isOrientationLocked) {