Skip to content

Commit

Permalink
fix(splashscreen): Don't show splashscreen when used as a lib (#1014)
Browse files Browse the repository at this point in the history
When using CDVViewController via CordovaLib as a library, the app might
already be loaded and not need to show the launch storyboard again.

Rather than unconditionally showing the splashscreen until the webview
content has loaded, make it initially invisible. Then in the project
template, make it visible so that it continues working as expected for
apps using the Cordova CLI.

Closes #929.
  • Loading branch information
dpogue authored Jan 31, 2021
1 parent 1e331b7 commit ffdcc5a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CordovaLib/Classes/Public/CDVViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
}

@property (nonatomic, readonly, weak) IBOutlet UIView* webView;
@property (nonatomic, readonly, strong) UIView* launchView;

@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
@property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
Expand Down
1 change: 1 addition & 0 deletions CordovaLib/Classes/Public/CDVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ - (void)createLaunchView
webViewBounds.origin = self.view.bounds.origin;

UIView* view = [[UIView alloc] initWithFrame:webViewBounds];
[view setAlpha:0];

NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
if (launchStoryboardName != nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ - (void)viewWillAppear:(BOOL)animated
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self.launchView setAlpha:1];
}

@end
Expand Down

0 comments on commit ffdcc5a

Please sign in to comment.