Skip to content

Commit d0cf3ab

Browse files
author
Tobias Kuhlebrock
committed
add iPhoneX support
1 parent 0bc0f59 commit d0cf3ab

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/ios/PrivacyScreenPlugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef struct {
1414
BOOL iPhone5;
1515
BOOL iPhone6;
1616
BOOL iPhone6Plus;
17+
BOOL iPhoneX;
1718
BOOL retina;
1819

1920
} CDV_iOSDevice;

src/ios/PrivacyScreenPlugin.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ - (CDV_iOSDevice) getCurrentDevice
7070
// this is appropriate for detecting the runtime screen environment
7171
device.iPhone6 = (device.iPhone && limit == 667.0);
7272
device.iPhone6Plus = (device.iPhone && limit == 736.0);
73+
device.iPhoneX = (device.iPhone && limit == 812.0);
7374

7475
return device;
7576
}
@@ -147,6 +148,20 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
147148
break;
148149
}
149150
}
151+
} else if (device.iPhoneX) { // supports landscape
152+
if (isOrientationLocked) {
153+
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
154+
} else {
155+
switch (currentOrientation) {
156+
case UIInterfaceOrientationLandscapeLeft:
157+
case UIInterfaceOrientationLandscapeRight:
158+
imageName = [imageName stringByAppendingString:@"-Landscape"];
159+
break;
160+
default:
161+
break;
162+
}
163+
}
164+
imageName = [imageName stringByAppendingString:@"-812h"];
150165
}
151166

152167
return imageName;

0 commit comments

Comments
 (0)