apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 989 forks source link

Cannot disable splashscreen in standalone CDVViewController #929

Closed sherburne closed 3 years ago

sherburne commented 4 years ago

Bug Report

Problem

According to the Cordova Splashscreen documentation, iOS apps should be able to disable the Cordova-provided launch splashscreen by setting SplashScreenDelay to 0 and FadeSplashScreenDuration to 0. As of 6.1.0, these settings no longer have that effect. createLaunchView in CDVViewController.m does not inspect these settings before instantiating the launch storyboard.

Reference: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/index.html#launch-storyboard-images

https://github.com/apache/cordova-ios/compare/5.1.x...6.1.x#diff-3d962b8f101cacedea7abce2ca246eac

Checklist

dpogue commented 4 years ago

A Launch storyboard is a required part of every iOS app. It's not possible to disable entirely.

The default behaviour for Cordova is intended to show a blank screen until the web content loads.

sherburne commented 4 years ago

Okay - Looks like the Cordova documentation is stale then? I'm using Cordova as part of a broader native iOS project; that code manages the appearance of the splash screen. Is there a better way to disable the Cordova splash screen code that you'd recommend?

breautek commented 4 years ago

I believe the default behaviour is a splashscreen is shown for 3 seconds (in addition to however long it takes for the OS to launch the app).

The documentation you linked just disables the delay, but not the splashscreen. Did you mean disabling the delay no longer works in 6.x?

sherburne commented 4 years ago

Here's what I'm readin in the documentation that I linked to:

To disable the splashscreen add the following preference to config.xml: <preference name="SplashScreenDelay" value="0"> ... iOS Quirk: to disable the splashscreen on ios platform you should also add <preference name="FadeSplashScreenDuration" value="0"/> to config.xml.

I'm interpreting "disable" as "the cordova code won't show the splash screen, period". I've been using Cordova inside a native app for the past year, and I hadn't seen any contention over the splash screen until the upgrade from 5.0.0 to 6.1.0.

Of course I can fork the 6.1.0 code but I'd really like to avoid that for obvious reasons. Another approach I'd considered is subclassing CDVViewController, but createLaunchView and launchView are private so that won't help either. I'm continuing to look at other possibilities.

dpogue commented 4 years ago

yeah, I think this is a valid issue when using CDVViewController as part of another application. It will unconditionally show the LaunchStoryboard/blank screen until the web page has loaded.

None of those existing preferences sound like they properly capture what you're actually trying to do here, so we might want to add a new one specific to this use case.

sherburne commented 4 years ago

Thanks, that would be a big help. Let me know if there's anything I can do to make this happen.

j-crosson commented 4 years ago

I mentioned this issue in passing in a CDVViewController-leak bug report (920). Glad the issue is being addressed, guess I should have reported this as a separate issue. I have an ugly workaround that I'll use if a fix doesn't come out before I ship. Since "private" isn't really private in Objective-C, I exposed “launchView” which I replace in my subclassed ViewController “viewDidLoad”.