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

Auto add authorities #587

Merged
merged 33 commits into from
Apr 27, 2020
Merged

Auto add authorities #587

merged 33 commits into from
Apr 27, 2020

Conversation

Patrick-Erichsen
Copy link
Contributor

@Patrick-Erichsen Patrick-Erichsen commented Apr 20, 2020

Description

This PR creates a new notification and filtering feature for Healthcare Authorities in a user's location.

Issue

#425

How to test

Unit

npx jest HCAService.spec.js

Integration

  • Visit the Choose health authority screen and press the Add Trusted Source button. Press the GPS filter switch and confirm that all health authorities are removed (the current live yaml file does not include a bounds field so by default there will be no authorities in your area)

Comments / Concerns

  • I added a line to the BackgroundTaskService that will send a push notification to the user every 12 hours if there is an authority in their region that they haven't subscribed to.
    • Is 12 hours too frequent? I believe we can only have a single BackgroundTaskService (ours runs every 12 hours to check for intersections), so I'm not sure how else we could check at a pre-defined interval.
    • What if a user intentionally decides not to subscribe to a particular authority? Currently, they will continue to get a notification every 12 hours to subscribe.
  • It would be nice if upon receiving a push notification, we could direct users to the Choose health authority screen. However, the only way to do that on iOS as far as I can tell is through the deprecated alertAction param. I believe that we can do this for Android through the action field for local notifications, but I'm not sure if we want that inconsistency between platforms.
  • I'm not sure of a good way to test the push notification piece of this PR without changing some code around to force the notification and then revert the changes. I was thinking of doing a similar approach that we use for intersections but would like some feedback before implementing. @tstirrat - feedback here would be appreciated.
  • Currently, the authorities list does not contain bounds info. @penrods - how should we go about updating that file on raw.githack, and in general, is there a way that we're going to force authorities to include bounds? And in the case where a user uploads an authority with the Add authority via URL option, will we just allow them to not include bounds?

Translation Notes

There are several new strings for translation.

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@penrods penrods self-requested a review April 20, 2020 05:55
Steve Penrod added 2 commits April 20, 2020 03:51
Tweak the text of the toggle UI.  Also add a localization string for manual URL entry.
Several light changes to this:
* The GPS filter toggle wasn't behaving properly
* Made the entire toggle line look different and react to a touch

Also:
* Added localization string for the text that appears when entering URL manually (it was hard-coded)
@penrods
Copy link
Contributor

penrods commented Apr 20, 2020

I've looked at the ChooseProvider.js screen and it works well! Awesome work, @Patrick-Erichsen. I tweaked the UI and behavior a little bit on this PR branch.

I haven't had time to verify the auto-subscription notification yet.

@penrods
Copy link
Contributor

penrods commented Apr 20, 2020

Answering some of your questions:

  • We can require bounding boxes for authorities and validate it when a new authority requests inclusion on that list via a PR. I have already added tooling to the publisher and will added the bounding box for Haiti under the https://raw.githubusercontent.com/tripleblindmarket/safe-places/develop/healthcare-authorities.yaml.
  • The manual addition of a healthcare authority capability does not require a GPS boundry, correct. It is to allow a user to hook to a safe-paths.json source that for some reason is not in the YAML Global Registry yet.

NOTE: We need to switch to the CDN version of the YAML before we push this code to the app stores.

Copy link
Collaborator

@alpita-masurkar alpita-masurkar left a comment

Choose a reason for hiding this comment

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

please fix this: typo in numAuthories in en.json

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@Patrick-Erichsen
Copy link
Contributor Author

please fix this: typo in numAuthories in en.json

Fixed - that same typo was copy/pasted in another file as well. Thanks for catching.

@Patrick-Erichsen
Copy link
Contributor Author

The linter is failing due to an error on no-mocks-import from these two lines:

import * as mockHCA from '../__mocks__/mockHCA';
import {
  mockNullUserLocHistory,
  mockUserLocHistory,
} from '../__mocks__/mockUserLocHistory';

Anyone mind if I just ignore that rule for those lines? I think it's meant to prevent actual module mocks - this is just mock data.

@kenpugsley kenpugsley added Do Not Merge (yet) Hold off on merging! This can be used for various reasons, Work in Progress, outside legal review... For next next release labels Apr 20, 2020
@kenpugsley
Copy link
Collaborator

The linter is failing due to an error on no-mocks-import from these two lines:

import * as mockHCA from '../__mocks__/mockHCA';
import {
  mockNullUserLocHistory,
  mockUserLocHistory,
} from '../__mocks__/mockUserLocHistory';

Anyone mind if I just ignore that rule for those lines? I think it's meant to prevent actual module mocks - this is just mock data.

@tstirrat - thoughts on this?

@kenpugsley
Copy link
Collaborator

kenpugsley commented Apr 20, 2020

Added Do Not Merge (yet) as we need to hold off on merging this until the branch for v1 is complete.

@tstirrat
Copy link
Contributor

a rule override is totally fine given that you're not double importing a module mock

@kenpugsley kenpugsley added Do Not Merge (yet) Hold off on merging! This can be used for various reasons, Work in Progress, outside legal review... and removed Do Not Merge (yet) Hold off on merging! This can be used for various reasons, Work in Progress, outside legal review... For next next release labels Apr 20, 2020
@kenpugsley
Copy link
Collaborator

I think there's still some UI work to do on this. Feel free to remove the Do Not Merge (yet) label when the UI is solid and we think we're in a solid place.

@Patrick-Erichsen
Copy link
Contributor Author

Patrick-Erichsen commented Apr 20, 2020

Based on the standup call today, I'm going to do a bit of refactoring on this:

  • Create an "Auto-Subscribe" functionality and add it to the onboarding screens
  • If a user is auto subscribed, the push notification will notify them of their new authorities they were automatically subscribed to, rather than just notifying them that there are authorities in their area.

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@tstirrat
Copy link
Contributor

tstirrat commented Apr 24, 2020

It would be nice if upon receiving a push notification, we could direct users to the Choose health authority screen. However, the only way to do that on iOS as far as I can tell is ...

Some contextual linking on a platform is better than none. So I'd be in favor of doing as much as possible here (but in another PR)

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.

Nothing major, great stuff on this!

app/constants/storage.js Outdated Show resolved Hide resolved
app/helpers/Intersect.js Outdated Show resolved Hide resolved
@@ -6,11 +6,19 @@
"authorities_desc": "Choose trusted healthcare authorities in your area to obtain exposure data. Either select a name from the global registry, or enter the web address provided by an authority which has implemented Safe Paths.",
"authorities_input_placeholder": "Paste your URL here",
"authorities_no_sources": "No data source yet",
"authorities_new_in_area_title": "New Healthcare Authority In Your Region",
Copy link
Contributor

Choose a reason for hiding this comment

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

Take screenhots of these new strings so we can upload to lokalise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where should we be placing these screenshots? This is used in a push notification - so we want a screenshot of that notification to upload to Lokalise?

app/locales/en.json Show resolved Hide resolved
app/services/HCAService.js Outdated Show resolved Hide resolved
app/views/onboarding/Onboarding5.js Outdated Show resolved Hide resolved
e2e/InsufficientLocationPermissions.spec.js Outdated Show resolved Hide resolved
e2e/NoAuthSubscriptionPermission.spec.js Outdated Show resolved Hide resolved
e2e/helpers/onboarding.js Outdated Show resolved Hide resolved
app/views/ChooseProvider.js Outdated Show resolved Hide resolved
@@ -51,6 +61,9 @@
"launch_notif_header": "Notifications will let you know if you cross paths with an infected person.",
"launch_notif_subheader": "We won't bother you except to share updates on your potential exposure risks.",
"launch_notification_access": "Allow notifications",
"launch_authority_header": "Healthcare Authorities will give us the local data to know if you cross paths with an infected person.",
"launch_authority_subheader": "Automatically subscribe to receive the latest updates from Healthcare Authorities in your area.",
"launch_authority_access": "Health authority subscription",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is my main issue, it's ambiguous on the final screen:

Screen Shot 2020-04-24 at 4 16 06 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like you're proposed update: Subscribe to nearby authorities. I think that along with the longer subtext in that screen should be enough context for a user. Maybe this is something, in particular, we can ask the testers to give us thoughts on?

Copy link
Contributor

Choose a reason for hiding this comment

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

Diarmid could probably weigh in ahead of time too

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@Patrick-Erichsen
Copy link
Contributor Author

@tstirrat I feel pretty solid at this point. Think it's ready to get in front of some testers ASAP.

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@kenpugsley
Copy link
Collaborator

I'll be doing a technical and functional review tonight. I think we need to open the discussion on whether or not we've covered this well enough for inclusion in v1.0.1.

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@Patrick-Erichsen
Copy link
Contributor Author

e2e tests are failing right now due to the missing Haitiain language strings. Once this is merged I'll open a new PR to only run the full suite of language tests on a merge to fix this issue.

tstirrat
tstirrat previously approved these changes Apr 27, 2020
@tstirrat
Copy link
Contributor

@kenpugsley we checked with Diarmid and there were no specific blockers getting this in.

One desired enhancement after this, is to immediately auto sub to any nearby HCAs when choosing the auto option, but this requires a refactor of the location tracking stuff as we've mentioned elsewhere (a non trivial job).

@tstirrat
Copy link
Contributor

@Patrick-Erichsen I think the label is too long on the onboard 5 screen:

I fixed it so it wraps if too long, but was not quire sure what to do with the vertical height of the Onboarding5 screen.

if we can keep the checkbox line to a single line, it's not quite ideal but it would probably prevent much of this wrapping:

(galaxy nexus emulator)

Screen Shot 2020-04-26 at 11 00 43 PM

@tstirrat
Copy link
Contributor

Still a problem on nexus4:

Screen Shot 2020-04-26 at 11 00 43 PM

Even if I make it single line :(

Screen Shot 2020-04-26 at 11 08 15 PM

I suspect we could merge and fast follow with some kind of text hack that uses less text on small devices.... as long as you pretty pretty pinky swear to look into it straight after I'd still love to get this PR in to prevent as many merge conflicts etc.

Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
@Patrick-Erichsen
Copy link
Contributor Author

Pushed up a fix to instead make the subheader text width .8 instead of .55. Given how long the text was it felt like .55 was too narrow.

@tstirrat
Copy link
Contributor

Pushed up a fix to instead make the subheader text width .8 instead of .55. Given how long the text was it felt like .55 was too narrow.

If you make a visual change provide a screenshot so that I don't have to check out everything and rebuild just to see the text tweak you did :)

@Patrick-Erichsen
Copy link
Contributor Author

Screen Shot 2020-04-27 at 3 57 28 PM

@tstirrat

@tstirrat tstirrat merged commit 8e68422 into Path-Check:develop Apr 27, 2020
@Patrick-Erichsen Patrick-Erichsen deleted the auto-add-authorities branch April 27, 2020 21:51
tstirrat added a commit that referenced this pull request Apr 27, 2020
* develop:
  Auto add authorities (#587)
  Clean up more eslint issues (#678)
  Make nav back arrow color theme aware (#686)
  yarn run-ios now runs pod install (#681)
  Fix settings icon on iOS 12, replace with new icon (#687)
  Feature/creole tests (#690)
tstirrat added a commit that referenced this pull request Apr 28, 2020
* develop:
  Fix "plural" keys, add i18n checks for new PRs (#648)
  Auto add authorities (#587)
  Clean up more eslint issues (#678)
  Make nav back arrow color theme aware (#686)
  yarn run-ios now runs pod install (#681)
  Fix settings icon on iOS 12, replace with new icon (#687)
  Feature/creole tests (#690)
  Fix formatting EULAs (#671)
  [i18n] Don't translate terms_of_use_url (#642)
  Fix background to run to edge of screen on iOS (#682)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge (yet) Hold off on merging! This can be used for various reasons, Work in Progress, outside legal review...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants