Skip to content

Commit 6ce5655

Browse files
committed
Bug fix for pull request and clean up
1 parent 7d66752 commit 6ce5655

File tree

1 file changed

+8
-73
lines changed

1 file changed

+8
-73
lines changed

src/ios/PrivacyScreenPlugin.m

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,21 @@ -(void) applyPrivacyScreen
140140
CDVViewController *vc = (CDVViewController*)self.viewController;
141141
NSString *imgName = [self getImageName:(id<CDVScreenOrientationDelegate>)vc device:[self getCurrentDevice]];
142142
UIImage* splash;
143-
if([self isUsingCDVLaunchScreen])
144-
{
145-
splash = [self updatePrivacyImage];
146-
}
147-
else
148-
{
149-
splash = [self getImageFromName:imgName];
150-
151-
}
143+
144+
splash = [self getImageFromName:imgName];
152145

153146
if (splash == NULL)
154147
{
155148
self.viewController.view.window.hidden = YES;
156149
}
157150
else
158151
{
159-
if(![self isUsingCDVLaunchScreen])
160-
{
161-
[imageView removeFromSuperview];
162-
imageView = nil;
152+
153+
[imageView removeFromSuperview];
154+
imageView = nil;
163155

164-
imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]];
165-
[imageView setImage:splash];
166-
}
156+
imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]];
157+
[imageView setImage:splash];
167158

168159
#ifdef __CORDOVA_4_0_0
169160
[[UIApplication sharedApplication].keyWindow addSubview:imageView];
@@ -202,52 +193,8 @@ - (CDV_iOSDevice) getCurrentDevice
202193
return device;
203194
}
204195

205-
- (BOOL) isUsingCDVLaunchScreen {
206-
NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
207-
if (launchStoryboardName) {
208-
return ([launchStoryboardName isEqualToString:@"CDVLaunchScreen"]);
209-
} else {
210-
return NO;
211-
}
212-
}
213-
214-
// Sets the view's frame and image.
215-
- (UIImage*)updatePrivacyImage
216-
{
217-
NSString* imageName = [self getImageName:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
218-
219-
UIImage* img = [UIImage imageNamed:imageName];
220-
[imageView removeFromSuperview];
221-
imageView = nil;
222-
223-
imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]];
224-
[imageView setImage: img];
225-
226-
// Check that splash screen's image exists before updating bounds
227-
if (imageView.image)
228-
{
229-
[self updateBounds];
230-
}
231-
else
232-
{
233-
NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
234-
}
235-
return img;
236-
}
237-
238196
- (void)updateBounds
239197
{
240-
/*
241-
* Launch Screen StoryBoard not supported
242-
*
243-
if ([self isUsingCDVLaunchScreen]) {
244-
// CB-9762's launch screen expects the image to fill the screen and be scaled using AspectFill.
245-
CGSize viewportSize = [UIApplication sharedApplication].delegate.window.bounds.size;
246-
imageView.frame = CGRectMake(0, 0, viewportSize.width, viewportSize.height);
247-
imageView.contentMode = UIViewContentModeScaleAspectFill;
248-
return;
249-
}
250-
*/
251198

252199
UIImage* img = imageView.image;
253200
CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero;
@@ -307,18 +254,6 @@ - (NSString*)getImageName:(id<CDVScreenOrientationDelegate>)orientationDelegate
307254
{
308255

309256
NSString* imageName;
310-
/*
311-
* Launch Storyboard not supported
312-
// detect if we are using CB-9762 Launch Storyboard; if so, return the associated image instead
313-
if ([self isUsingCDVLaunchScreen]) {
314-
// Use UILaunchImageFile if specified in plist. Otherwise, use Default.
315-
imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"];
316-
imageName = [imageName stringByDeletingPathExtension];
317-
imageName = imageName ? imageName : @"LaunchImage";
318-
return imageName;
319-
}
320-
*
321-
*/
322257

323258
NSString* privacyImageNameKey = @"privacyimagename";
324259
NSString* prefImageName = [self.commandDelegate.settings objectForKey:[privacyImageNameKey lowercaseString]];
@@ -370,7 +305,7 @@ - (NSString*)getImageName:(id<CDVScreenOrientationDelegate>)orientationDelegate
370305
} else if (device.iPhone6) { // does not support landscape
371306
imageName = isLandscape ? nil : [imageName stringByAppendingString:@"667h"];
372307
} else if (device.iPhoneX) { // does not support landscape
373-
imageName = isLandscape ? nil : [imageName stringByAppendingString:@"812];
308+
imageName = isLandscape ? nil : [imageName stringByAppendingString:@"812h"];
374309
} else if (device.iPhone6Plus) { // supports landscape
375310
if (isOrientationLocked) {
376311
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"Landscape" : @"")];

0 commit comments

Comments
 (0)