Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ios/PrivacyScreenPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ - (void)onAppWillResignActive:(UIApplication *)application
} else {
imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]];
[imageView setImage:splash];

if ([self isUsingCDVLaunchScreen]) {
// launch screen expects the image to be scaled using AspectFill.
imageView.contentMode = UIViewContentModeScaleAspectFill;
}

#ifdef __CORDOVA_4_0_0
[[UIApplication sharedApplication].keyWindow addSubview:imageView];
Expand Down Expand Up @@ -76,11 +81,26 @@ - (CDV_iOSDevice) getCurrentDevice
return device;
}

- (BOOL) isUsingCDVLaunchScreen {
NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
if (launchStoryboardName) {
return ([launchStoryboardName isEqualToString:@"CDVLaunchScreen"]);
} else {
return NO;
}
}

- (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device
{
// Use UILaunchImageFile if specified in plist. Otherwise, use Default.
NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"];

// detect if we are using Launch Storyboard; if so, return the associated image instead
if ([self isUsingCDVLaunchScreen]) {
imageName = @"LaunchStoryboard";
return imageName;
}

NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations];

// Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
Expand Down