Skip to content

Commit f1e3838

Browse files
committed
Merge branch 'Alex-Sessler-cordova-ios4-asset-prefixes'
2 parents 930dd42 + 9e618ac commit f1e3838

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/ios/PrivacyScreenPlugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
typedef struct {
1111
BOOL iPhone;
1212
BOOL iPad;
13+
BOOL iPhone4;
1314
BOOL iPhone5;
1415
BOOL iPhone6;
1516
BOOL iPhone6Plus;

src/ios/PrivacyScreenPlugin.m

+16
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ - (CDV_iOSDevice) getCurrentDevice
5757
device.iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
5858
device.iPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
5959
device.retina = ([mainScreen scale] == 2.0);
60+
device.iPhone4 = (device.iPhone && limit == 480.0);
6061
device.iPhone5 = (device.iPhone && limit == 568.0);
6162
// note these below is not a true device detect, for example if you are on an
6263
// iPhone 6/6+ but the app is scaled it will prob set iPhone5 as true, but
@@ -85,6 +86,21 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
8586
} else {
8687
imageName = @"Default";
8788
}
89+
90+
// Add Asset Catalog specific prefixes
91+
if ([imageName isEqualToString:@"LaunchImage"])
92+
{
93+
if(device.iPhone4 || device.iPhone5 || device.iPad) {
94+
imageName = [imageName stringByAppendingString:@"-700"];
95+
} else if(device.iPhone6) {
96+
imageName = [imageName stringByAppendingString:@"-800"];
97+
} else if(device.iPhone6Plus) {
98+
imageName = [imageName stringByAppendingString:@"-800"];
99+
if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown) {
100+
imageName = [imageName stringByAppendingString:@"-Portrait"];
101+
}
102+
}
103+
}
88104

89105
BOOL isLandscape = supportsLandscape &&
90106
(currentOrientation == UIInterfaceOrientationLandscapeLeft || currentOrientation == UIInterfaceOrientationLandscapeRight);

0 commit comments

Comments
 (0)