apache/cordova-plugin-statusbar

[android] StatusBarOverlaysWebView defaults to true not work {broken}

mosabab opened this issue ยท 21 comments

Bug Report

Problem

What is expected to happen?

The statusbar should overlay the webview.

  • According to the plugin docs:
    the preference StatusBarOverlaysWebView (boolean, defaults to true).

What does actually happen?

The status bar became in solid blank, and not overlay the webview.

  • the preference StatusBarOverlaysWebView defaults to true not working.

Information

Untitled-1

Maybe someone know how this issue can be solved !

Environment, Platform, Device

  • Any new android devices.

Version information

  • Phonegap/Cordova CLI 9.0.0 (Android 8.0.0)
  • cordova-plugin-statusbar master version.

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

@breautek sorry for the ping, but could you please take a look into this if you have any idea?
Regards

You may be hitting the bug as reported at #151 where android doesn't actually read the StatusBarOverlaysWebView preference. There is a pending PR to fix that, but with requested changes, and the author of the PR hasn't responded in quite awhile.

Workaround described at #151 (comment)

You may be hitting the bug as reported at #151 where android doesn't actually read the StatusBarOverlaysWebView preference. There is a pending PR to fix that, but with requested changes, and the author of the PR hasn't responded in quite awhile.

Workaround described at #151 (comment)

Thanks for reply,

Does this issue is the same old issue for ios before we add view-fit=cover to support ios ?

Why the pending PR still in request because who made the PR still not respond, I think anyone who is familiar with these codes can make a new PR and then done by approved, because this is high priority bug that need to be solved.

Does this issue is the same old issue for ios before we add view-fit=cover to support ios ?

Not sure what old issue you are referring to, but the issue I linked is an android issue only. iOS has always read the preference. I believe the source of the problem is the feature was implemented for iOS only originally.

Why the pending PR still in request because who made the PR still not respond

Because Cordova is 100% volunteer based and many of us is very busy.

I think anyone who is familiar with these codes can make a new PR and then done by approved

I agree, and honestly the changes required to fix #151 issue is rather trivial, PRs welcome, even if there is already a pending one.

But to confirm that this is even the problem that you are facing, I would use the JS API to set statusbar overlay to enable the statusbar. If that makes the statusbar work as expected, then we can confidently say that you were hitting the same issue as #151.

You are true.
I try yo use JS API and i will tell you if it work or not.

Regards

Hello @breautek
I add js api and it work, but i think this just temporary solution and not the optimal.
Maybe someone can solve this issue soon.
Regards

Yes, this was just a confirmation that you weren't experiencing a different problem than #151

Hello @breautek
I add js api and it work, but i think this just temporary solution and not the optimal.
Maybe someone can solve this issue soon.
Regards

Can you show me example how it works for you?

Hello @breautek
I add js api and it work, but i think this just temporary solution and not the optimal.
Maybe someone can solve this issue soon.
Regards

Can you show me example how it works for you?

Hello @diamond95

You can add StatusBar.overlaysWebView(true); after deviceready event fires.

for e.g.:

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {

StatusBar.overlaysWebView(true);

//......... other codes........
}

@mosababubakr well, it does not work for me when I compile mobile application on android 9

@mosababubakr well, it does not work for me when I compile mobile application on android 9

did you try to put the following code and not work ?

function onDeviceReady() {

StatusBar.overlaysWebView(true);

//......... other codes........
}

... if not work, then maybe @breautek could find the answer for this (android 9)

@mosababubakr I did already open bug, #155

@diamond95

did you used the master version of the plugin ?
do you used the latest cli for phonegap/ cordova ?

@mosababubakr Yup. Can you push to github some example with working status bar ? I would like to check that..

Thanks anyway

@diamond95

  • I just put <preference name="StatusBarOverlaysWebView" value="true" /> in the config.xml file.
  • I put the following code in onDeviceReady() function like this:

function onDeviceReady() {

StatusBar.overlaysWebView(true);

}

  • I use the master version of the plugin.
  • I use phonegap build to build the app and set phonegap version to phonegap cli 9.0.0 (aka: cordova cli 9.0.0)

StatusBar.overlaysWebView(true); may not consistently work properly when called from the deviceready. There is some sort of race condition. I don't see it on my production apps, but on simple apps I do see the issue. That issue is being tracked at #158

Currently <preference name="StatusBarOverlaysWebView" value="true" /> does nothing for android, as android doesn't read the preference value. The PR #171 will address this issue, but is only expected to land in master when prepping for the next major release.

So far the best way to avoid #158 is to apply #171 PR to your own fork so that you can use the StatusBarOverlaysWebView preference. In my testing, the status bar appears to consistently work as expected when the overlay is being applied in the plugin initialisation.

StatusBar.overlaysWebView(true); may not consistently work properly when called from the deviceready. There is some sort of race condition. I don't see it on my production apps, but on simple apps I do see the issue. That issue is being tracked at #158

Currently <preference name="StatusBarOverlaysWebView" value="true" /> does nothing for android, as android doesn't read the preference value. The PR #171 will address this issue, but is only expected to land in master when prepping for the next major release.

So far the best way to avoid #158 is to apply #171 PR to your own fork so that you can use the StatusBarOverlaysWebView preference. In my testing, the status bar appears to consistently work as expected when the overlay is being applied in the plugin initialisation.

when the PR will be merged and done if it ready ?

when the PR will be merged and done if it ready ?

#171 is a breaking change, even though it's fixing a bug because it's changing the default behaviour of the android platform, so the PR will only be merged once preparations for the next major starts. I can't really give a timeline when that will happen, but there are a few other PRs also waiting for a major version bump.

I still have one thing outstanding task for #171 but I'm planning on making that commit tonight.

03.2020 nothing happen... Ping?!

What's the update on this? Is anyone still working on something?