From d7841c7ec9fdf9de83645abdfc9ba6494ad74235 Mon Sep 17 00:00:00 2001 From: daserge Date: Sat, 26 Dec 2015 19:43:58 +0300 Subject: [PATCH] CB-10263 Fix splashscreen plugin filenames for Asset Catalog Github: close #69 --- src/ios/CDVSplashScreen.h | 1 + src/ios/CDVSplashScreen.m | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVSplashScreen.h b/src/ios/CDVSplashScreen.h index 0d6ae39..4802a30 100644 --- a/src/ios/CDVSplashScreen.h +++ b/src/ios/CDVSplashScreen.h @@ -23,6 +23,7 @@ typedef struct { BOOL iPhone; BOOL iPad; + BOOL iPhone4; BOOL iPhone5; BOOL iPhone6; BOOL iPhone6Plus; diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m index b34a926..3e195b9 100644 --- a/src/ios/CDVSplashScreen.m +++ b/src/ios/CDVSplashScreen.m @@ -156,6 +156,7 @@ device.iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); device.iPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone); device.retina = ([mainScreen scale] == 2.0); + device.iPhone4 = (device.iPhone && limit == 480.0); device.iPhone5 = (device.iPhone && limit == 568.0); // note these below is not a true device detect, for example if you are on an // iPhone 6/6+ but the app is scaled it will prob set iPhone5 as true, but @@ -187,7 +188,23 @@ { imageName = @"Default"; } - + + // Add Asset Catalog specific prefixes + if ([imageName isEqualToString:@"LaunchImage"]) + { + if (device.iPhone4 || device.iPhone5 || device.iPad) { + imageName = [imageName stringByAppendingString:@"-700"]; + } else if(device.iPhone6) { + imageName = [imageName stringByAppendingString:@"-800"]; + } else if(device.iPhone6Plus) { + imageName = [imageName stringByAppendingString:@"-800"]; + if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown) + { + imageName = [imageName stringByAppendingString:@"-Portrait"]; + } + } + } + if (device.iPhone5) { // does not support landscape imageName = [imageName stringByAppendingString:@"-568h"];