ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
529 stars 597 forks source link

@capacitor/splash-screen add "splashScreenHidden" event #2156

Open flgubler-ergon opened 3 months ago

flgubler-ergon commented 3 months ago

Feature Request

Plugin

@capacitor/splash-screen

Description

When auto-hide is enabled on the splash-screen plugin, the web-app has no way of getting notified when the splash-screen disappears.

This is a problem for us on Android because the Splash-Screen plugin changes the value of window.isNavigationBarContrastEnforced (setting it to false). That makes sense for the splash-screen because the navigation-bar is hidden. However, for the rest of our app, that is the wrong setting because we let the web-view overlap the navigation-bar. Therefore we need the navigation-bar to be transparent but with contrast to make sure it is visible in semi-transparent mode over the content of the web-app. That can be fixed by simply setting that flag to the right value again, but right now, we don't know the exact timing when to do it.

Platform(s)

Android (at least) and probably iOS

Preferred Solution

An event on the plugin to which the web-app can subscribe to be informed when the splash-screen has been hidden.

Alternatives

Of course, the splash-screen plugin could also just store the previous values of window.navigationBarColorand window.isNavigationBarContrastEnforced and restore them to their previous values after hiding the splash-screen.

flgubler-ergon commented 3 months ago

After further experimentation we have had to conclude that even disabling auto-hide and calling SplashScreen.hide() manually does not help because the changes to the status- and navigation-bars apparently happen some time after the the promise from SplashScreen.hide() completes.