Skip to content

Stop hiding data when there is no connection#10848

Merged
develric merged 1 commit intodevelopfrom
fix/do_not_reload_widgets_on_no_network
Nov 25, 2019
Merged

Stop hiding data when there is no connection#10848
develric merged 1 commit intodevelopfrom
fix/do_not_reload_widgets_on_no_network

Conversation

@planarvoid
Copy link
Copy Markdown
Contributor

Fixes #10836

The idea behind this change is to not allow the error state of no connection to override the actual data shown. The widget refreshes the data periodically and I think there might actually be a fake no-connection response. I couldn't actually reproduce this error.

Once you have a widget data, we save a flag into the shared prefs for the given widget and never replace the data with the error (if the user still has the access token).

To test:

  • Try to add/remove/change Today widget for various sites
  • Lock the phone
  • Check that it does not hide the data when you come back

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@planarvoid planarvoid added this to the 13.8 milestone Nov 25, 2019
@planarvoid planarvoid requested a review from develric November 25, 2019 13:49
@planarvoid planarvoid self-assigned this Nov 25, 2019
@peril-wordpress-mobile
Copy link
Copy Markdown

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Copy Markdown
Contributor

@develric develric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @planarvoid , the approach seems reasonable and the code looks good! 👍

I was not able either to fully reproduce it, but I verified the desired difference in behavior with the following steps:

  • Activate the Today widget and check that it shows the correct today stats
  • turn on air mode
  • click on the widget to open the stats in the app
  • come back with back button to the home screen

Doing the above you get the no network message before your modification whereas the stats are preserved as it should be using your modification. AFAIU this is the correct expected behavior, so good job! 😎

@develric develric merged commit 5e17c66 into develop Nov 25, 2019
@develric develric deleted the fix/do_not_reload_widgets_on_no_network branch November 25, 2019 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stats widgets are showing "No network available" after some time

3 participants