Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop hiding data when there is no connection #10848

Merged
merged 1 commit into from
Nov 25, 2019

Conversation

planarvoid
Copy link
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.

@peril-wordpress-mobile
Copy link

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

Copy link
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