Skip to content

Commit

Permalink
Fix iphoneX support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Kuhlebrock committed Jan 10, 2018
1 parent d0cf3ab commit 1c95da6
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/ios/PrivacyScreenPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,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"];
}
Expand All @@ -116,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 {
Expand All @@ -129,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) {
Expand All @@ -148,20 +156,6 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
break;
}
}
} else if (device.iPhoneX) { // supports landscape
if (isOrientationLocked) {
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
} else {
switch (currentOrientation) {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
break;
default:
break;
}
}
imageName = [imageName stringByAppendingString:@"-812h"];
}

return imageName;
Expand Down

0 comments on commit 1c95da6

Please sign in to comment.