google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

Fix webview loading state finish #1606

Closed 4brunu closed 1 year ago

4brunu commented 1 year ago

Hi, I found some inconsistency with the current webview loading state implementation.

Sometimes the loadingState ends with Finished, sometimes it ends with Loading(1.0f). So the isLoading var doesn't work reliably.

Here are a few examples that are reproduced with the sample project.

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.0)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished
Loading(progress=1.0)

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Loading(progress=1.0)

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Loading(progress=1.0)

Initializing
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Loading(progress=1.0)

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Loading(progress=1.0)

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.1)
Loading(progress=0.0)
Finished

Initializing
Loading(progress=0.0)
Finished

To try to fix this, when the loading value is 100% it changes directly to finished.

Please add the library name to the PR title. Example: "[Insets] Fixes typo"

Doomsdayrs commented 1 year ago

@4brunu Why did you close this pr?

4brunu commented 1 year ago

I'm not sure if this is the right way to fix this issue, and if this solves all the edge cases, so I opened the following issue https://github.com/google/accompanist/issues/1607.