App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Use local Onyx key to throttle location permission prompts

Open garrettmknight opened this issue 1 year ago β€’ 19 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: N/A Reproducible in staging?: N/A Reproducible in production?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/378927 Issue reported by: @Julesssss Slack conversation:

Prerequisite - make sure location services is disabled for New Expensify

Action Performed:

  1. Sign up with a new account
  2. Big + > Submit expense
  3. Scan receipt
  4. Select a recipient
  5. Submit expense
  6. See the location services request > tap Not Now
  7. When the system request comes up, tap 'Don't Allow'
  8. Big + > Submit expense
  9. Scan receipt
  10. Select a recipient

Current Result:

Every time the user creates a money request, we prompt them to enable the location permission.

Requested Result:

Instead of waiting for a backend solution, we can use a local Onyx key/timestamp to prevent the modal from showing. Let's implement logic that adds a one-week delay between each prompt of the location permission.

Workaround:

N/A

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [ ] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016f65004bf221326c
  • Upwork Job ID: 1826277541188173965
  • Last Price Increase: 2024-08-21
  • Automatic offers:
    • shubham1206agra | Reviewer | 103692549
    • Krishna2323 | Contributor | 103692550
Issue OwnerCurrent Issue Owner: @shubham1206agra

garrettmknight avatar Aug 21 '24 15:08 garrettmknight

Triggered auto assignment to @slafortune (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Aug 21 '24 15:08 melvin-bot[bot]

:warning: It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time :warning:

melvin-bot[bot] avatar Aug 21 '24 15:08 melvin-bot[bot]

Triggered auto assignment to Design team member for new feature review - @dubielzyk-expensify (NewFeature)

melvin-bot[bot] avatar Aug 21 '24 15:08 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~016f65004bf221326c

melvin-bot[bot] avatar Aug 21 '24 15:08 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

melvin-bot[bot] avatar Aug 21 '24 15:08 melvin-bot[bot]

@Krishna2323 Your proposal will be dismissed because you did not follow the proposal template.

github-actions[bot] avatar Aug 21 '24 15:08 github-actions[bot]

Edited by proposal-police: This proposal was edited at 2024-08-21 15:49:46 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Use local Onyx key to throttle location permission prompts

What is the root cause of that problem?

New feat.

What changes do you think we should make in order to solve the problem?

  • Create a ONYX key in this file.
  • Create a type for the ONYX entry in src/types/onyx. We will create a object that contains 2 properties, value and timeStamp.
  • Before calling setStartLocationPermissionFlow, we will check the ONYX object. If the value is false, we will directly call setStartLocationPermissionFlow. However, if it is true and the timestamp is not 7 days old, we will return without calling it. If the value is false and the timestamp is older than 7 days, we will update the timestamp and value and then call setStartLocationPermissionFlow. https://github.com/Expensify/App/blob/715e167258c6cee065383b515bcb5d68e7f4704f/src/pages/iou/request/step/IOURequestStepConfirmation.tsx#L568-L571
  • We can use differenceInDays to get the days passed from the timestamp.

NOTE: Every time we call setStartLocationPermissionFlow, we need to update the ONYX value and timestamp accordingly.

EDIT: Actually, we don't even need the value property, the timestamp will be enough to check the day passed and to determine when was the last time we asked the user about that.

What alternative solutions did you explore? (Optional)



Result

Krishna2323 avatar Aug 21 '24 15:08 Krishna2323

Proposal

Please re-state the problem that we are trying to solve in this issue.

Use local Onyx key to throttle location permission prompts

What is the root cause of that problem?

This is a new feature request

What changes do you think we should make in order to solve the problem?

  1. Create an ONYXKEYS to store the last time we show the permission prompt
  2. Get the value of this key and before we show the location permission prompts in these places here, we will check if the last time the prompt opened is not 7 days old we will not process to show the current location prompt

https://github.com/Expensify/App/blob/f7d8e4850e729493eb8bfb52efa1a49d0d344ded/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx#L269

https://github.com/Expensify/App/blob/f7d8e4850e729493eb8bfb52efa1a49d0d344ded/src/pages/iou/request/step/IOURequestStepConfirmation.tsx#L568-L570

OPTIONAL: Since we can create Scan request in IOURequestStepScan via QAB, we also should add the location prompts in IOURequestStepConfirmation to IOURequestStepScan

  1. Then whenever we open the prompt here or here, update the ONYX value to update the time stamp.

What alternative solutions did you explore? (Optional)

NA

nkdengineer avatar Aug 21 '24 15:08 nkdengineer

Updated the steps to include submitting the receipt which needs to be done before the location services request populates.

slafortune avatar Aug 23 '24 18:08 slafortune

@shubham1206agra what do you think about these proposals?

trjExpensify avatar Aug 26 '24 13:08 trjExpensify

@Krishna2323's proposal looks good to me.

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

shubham1206agra avatar Aug 26 '24 17:08 shubham1206agra

Triggered auto assignment to @tgolen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Aug 26 '24 17:08 melvin-bot[bot]

πŸ“£ @shubham1206agra πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] avatar Aug 26 '24 21:08 melvin-bot[bot]

πŸ“£ @Krishna2323 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] avatar Aug 26 '24 21:08 melvin-bot[bot]

I was already assigned...

Triggered auto assignment to @tgolen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Julesssss avatar Aug 27 '24 09:08 Julesssss

I agree the timestamp is enough here. Lets figure out the rest of the minor details in the PR review.

Julesssss avatar Aug 27 '24 10:08 Julesssss

Reassigning Tim as I didn't see his 'ssigned Krishna2323 13 hours ago' action

Julesssss avatar Aug 27 '24 10:08 Julesssss

Will raise the PR today.

Krishna2323 avatar Aug 28 '24 16:08 Krishna2323

PR still in draft.

shubham1206agra avatar Sep 07 '24 15:09 shubham1206agra

Hey all. We have an edge case that is a bit annoying. iOS users who approve our modal, but select 'Allow Once' on the native iOS prompt will continue to be prompted when using the quick action flow. This obviously sucks because it slows down the quick action flow and is annoying.

Currently our choices are to:

  • Live with the fact that iOS users who selected 'Allow Once' will be re-prompted on each quick action
  • Disable the location check for iOS users on the quick flow action (this would include users who did grant permission)

We are discussing some alternatives, but it would be good to get some early thoughts on preferred solutions.

Julesssss avatar Sep 09 '24 10:09 Julesssss

Disable the location check for iOS users on the quick flow action (this would include users who did grant permission)

This sounds non-ideal, because the quick action is likely to be used repeatedly as the preferred method to submit expenses to your company over and over again. If I'm understanding you, disabling it would mean the added accuracy upside of location checking would not apply to this core flow.

iOS users who approve our modal, but select 'Allow Once' on the native iOS prompt will continue to be prompted when using the quick action flow.

Won't they also be prompted on every Submit expense attempt as well? That's kinda' the nature of choosing "Allow once" isn't it, or am I missing something on why this only applies to the quick action flow?

trjExpensify avatar Sep 09 '24 23:09 trjExpensify

disabling it would mean the added accuracy upside of location checking would not apply to this core flow.

Yeah, exactly. My thinking is that this is slightly preferrable to the frustrating native location prompt on every single request. Also, when users use the regular flow they will be re-prompted with context -- which may lead to them selecting 'always'.

Won't they also be prompted on every Submit expense attempt as well?

In the submit expense flow our 7-day throttling will prevent them from seeing the prompt every time. Additionally we are able to show our custom prompt ahead of the native-iOS prompt -- which is slightly less annoying as they at least are given context for the prompt.

Both options are not good, and in the meantime we are discussing other potential solutions.

Julesssss avatar Sep 10 '24 13:09 Julesssss

Why aren't we applying the same logic to the QAB as we are Submit expense?

trjExpensify avatar Sep 10 '24 14:09 trjExpensify

My thinking is that this is slightly preferrable to the frustrating native location prompt on every single request.

That's your own doing though, isn't it. You selected Only once, not Always. If it's annoying you, change it to Always.

trjExpensify avatar Sep 10 '24 14:09 trjExpensify

Fair point πŸ˜„

It makes the whole 'provide context around this contextless location permission' feature redundant. If users didn't select 'always' after going through our context flow the first time, I would suggest they are more likely to select 'never' when given apple prompt again. Though as it just occurs for iOS quick action IF users selected not now I suppose this is the better option.

Julesssss avatar Sep 10 '24 14:09 Julesssss

I suppose another point is that in order to use the quick action, users will have already seen the prompt. If Tom's happy then I am also. Lets move forward with the known iOS issue. I'll comment on the PR

Julesssss avatar Sep 10 '24 15:09 Julesssss

not deployed yet

slafortune avatar Sep 18 '24 16:09 slafortune

This issue has not been updated in over 15 days. @Julesssss, @slafortune, @shubham1206agra, @Krishna2323 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

melvin-bot[bot] avatar Oct 07 '24 18:10 melvin-bot[bot]

PR has had comments addressed and oday I requested an additional test for the prompt to reshow.

Julesssss avatar Oct 08 '24 11:10 Julesssss

Merged!

Julesssss avatar Oct 08 '24 12:10 Julesssss