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

Fix incorrect news from health authority in Latest News #704

Merged
merged 1 commit into from
Apr 28, 2020

Conversation

kenpugsley
Copy link
Collaborator

Description

Fixes a condition where the news url specified by an authority will not be shown on "Latest News", and instead the default Safe Paths news will be shown.

The issue is that the React Native Webview seems to have issues if the uri is set on webview, and then the webview uri is updated very shortly thereafter (probably before rendering completes). We currently try to set the default news in the news components constructor, and then we quickly update the url of the same webview after the storage retrieval for AUTHORITY_NEWS completes. This causes the race condition and is definitely an issue on Android. I couldn't make it happen on iOS, but can't rule it out either.

The fix is very small ... to remove the setting of the default_news url's on the news component's constructor. The initial render has no news to show (so no webviews created), but once the callback from the AUTHORITY_NEWS storage completes, the setting of the component state triggers a re-render, this time with the news_url populated correct. And yes, this will work (and I tested) when the app is first installed and no AUTHORITY_NEWS url's have been set.

Linked issues:

https://pathcheck.atlassian.net/browse/SAF-97

How to test

Set your health authority to "Mairie de PAP/Tabarre/PV/Delmas/CH". Go back and load the latest news. Prior to the fix you'll probably get the default Safe Paths news (esp on Android). After the fix, you should see the correct news from the Haiti website (https://www.covidsource.org/).

Note that you may need to wait a few seconds for the download and parse from the health authorty to complete.

Copy link
Contributor

@tstirrat tstirrat left a comment

Choose a reason for hiding this comment

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

Longest description for smallest change 🏆

@kenpugsley kenpugsley merged commit b4e034f into develop Apr 28, 2020
@kenpugsley kenpugsley deleted the kpugsley/incorrect-news-fix branch April 28, 2020 19:24
tstirrat added a commit that referenced this pull request Apr 28, 2020
* develop:
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
@tstirrat tstirrat mentioned this pull request Apr 29, 2020
tstirrat added a commit that referenced this pull request Apr 30, 2020
* develop:
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
tstirrat added a commit that referenced this pull request Apr 30, 2020
* develop: (22 commits)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
  Remove react-native-maps (#695)
  Fix e2e authority auto sub tests (#706)
  Fallback to English translations in e2e tests (#697)
  Add ja and fil languages (#700)
  Add a script to pull translations from lokalise (#641)
  Really really push to lokalise (#699)
  Run lokalize push on merge into develop (#698)
  ...
tstirrat added a commit that referenced this pull request May 2, 2020
* develop:
  Recommend PR best practices in PR template (#750)
  Add eslint react-hooks checks (#751)
  iOS: Added local notification in terminate function. (#521)
  Update dev README (#705)
  Better error logging in Google import (#703)
  Remove rebasing from suggestions in CONTRIBUTING.md (#724)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
tstirrat added a commit that referenced this pull request May 2, 2020
* develop: (60 commits)
  Recommend PR best practices in PR template (#750)
  Add eslint react-hooks checks (#751)
  iOS: Added local notification in terminate function. (#521)
  Update dev README (#705)
  Better error logging in Google import (#703)
  Remove rebasing from suggestions in CONTRIBUTING.md (#724)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
  Remove react-native-maps (#695)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants