Skip to content

Commit 1c95da6

Browse files
author
Tobias Kuhlebrock
committed
Fix iphoneX support
1 parent d0cf3ab commit 1c95da6

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/ios/PrivacyScreenPlugin.m

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
101101
imageName = [imageName stringByAppendingString:@"-700"];
102102
} else if(device.iPhone6) {
103103
imageName = [imageName stringByAppendingString:@"-800"];
104-
} else if(device.iPhone6Plus) {
105-
imageName = [imageName stringByAppendingString:@"-800"];
104+
} else if(device.iPhone6Plus || device.iPhoneX) {
105+
if(device.iPhone6Plus) {
106+
imageName = [imageName stringByAppendingString:@"-800"];
107+
} else {
108+
imageName = [imageName stringByAppendingString:@"-1100"];
109+
}
106110
if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown) {
107111
imageName = [imageName stringByAppendingString:@"-Portrait"];
108112
}
@@ -116,7 +120,7 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
116120
imageName = isLandscape ? nil : [imageName stringByAppendingString:@"-568h"];
117121
} else if (device.iPhone6) { // does not support landscape
118122
imageName = isLandscape ? nil : [imageName stringByAppendingString:@"-667h"];
119-
} else if (device.iPhone6Plus) { // supports landscape
123+
} else if (device.iPhone6Plus || device.iPhoneX) { // supports landscape
120124
if (isOrientationLocked) {
121125
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
122126
} else {
@@ -129,7 +133,11 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
129133
break;
130134
}
131135
}
132-
imageName = [imageName stringByAppendingString:@"-736h"];
136+
if (device.iPhoneX) {
137+
imageName = [imageName stringByAppendingString:@"-2436h"];
138+
} else {
139+
imageName = [imageName stringByAppendingString:@"-736h"];
140+
}
133141

134142
} else if (device.iPad) { // supports landscape
135143
if (isOrientationLocked) {
@@ -148,20 +156,6 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
148156
break;
149157
}
150158
}
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"];
165159
}
166160

167161
return imageName;

0 commit comments

Comments
 (0)