Skip to content

[HOLD for payment 2024-11-29] [$250] Update second Allow location access modal on web #50601

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

Closed
4 tasks
jamesdeanexpensify opened this issue Oct 10, 2024 · 63 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@jamesdeanexpensify
Copy link
Contributor

jamesdeanexpensify commented Oct 10, 2024

On web only, for the second Allow location access modal only (the one with the Got it button):

  • Fix the bug where you can't submit after clicking Got it (see video below)
  • Fix the bug where, after clicking the Got it button, the same button quickly flickers to say Continue (same video below)
  • Update the copy on the modal slightly to:

Allow location access
Location access helps us keep your timezone and currency accurate wherever you go. Please allow location access from your device's permission settings.

  • Remove the Not now button entirely because it serves no purpose in this case
2024-10-10_09-11-41.mp4
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021847227311681373401
  • Upwork Job ID: 1847227311681373401
  • Last Price Increase: 2024-10-25
  • Automatic offers:
    • alitoshmatov | Reviewer | 104624114
    • truph01 | Contributor | 104624115
Issue OwnerCurrent Issue Owner: @alitoshmatov
@jamesdeanexpensify jamesdeanexpensify added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

Triggered auto assignment to @Christinadobrzyn (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@truph01
Copy link
Contributor

truph01 commented Oct 11, 2024

Edited by proposal-police: This proposal was edited at 2024-10-17 18:30:45 UTC.

Proposal

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

  • Remove "Allow location access" modal on web

What is the root cause of that problem?

if so, the startPermissionFlow is set to true then this useEffect is called:

useEffect(() => {
if (!startPermissionFlow) {
return;
}
getLocationPermission().then((status) => {
if (status === RESULTS.GRANTED || status === RESULTS.LIMITED) {
return onGrant();
}
setShowModal(true);
setHasError(status === RESULTS.BLOCKED);
});
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- We only want to run this effect when startPermissionFlow changes
}, [startPermissionFlow]);

  • First, it checks the current permission. If it is RESULTS.GRANTED or RESULTS.LIMITED, it don't show any modal. Otherwise, the modal is shown.

  • This modal is to:

pre-prompt the user for their location access instead of using the native prompt from Apple/Google that would penalize you if you asked for location access too many times. This way, we can prompt users with our own modal on mobile to get a response before the native prompt, avoiding any penalties if the answer is "no" but still allowing us to ask as many times as we want.

  • When user chooses "Confirm" button, then the native prompt is shown. In this issue, we are going to remove pre-prompt.

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

  • As I mentioned above, In this issue, we are going to remove pre-prompt. So the permission flow will be: Checking existing permission > displaying native prompt > sending expense instead of Checking existing permission > display custom pre-prompt > displaying native prompt > sending expense.

  • To match the new flow, we can create a new index.website.ts, its logic is the same as index.ts, just need to update the useEffect:

useEffect(() => {
if (!startPermissionFlow) {
return;
}
getLocationPermission().then((status) => {
if (status === RESULTS.GRANTED || status === RESULTS.LIMITED) {
return onGrant();
}
setShowModal(true);
setHasError(status === RESULTS.BLOCKED);
});
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- We only want to run this effect when startPermissionFlow changes
}, [startPermissionFlow]);

useEffect(() => {
    if (!startPermissionFlow) {
        return;
    }

    getLocationPermission().then((status) => {
        if (status === RESULTS.GRANTED || status === RESULTS.LIMITED) {
            return onGrant();
        }
        
        // If the user has previously denied the permission, we still need to show a modal
        // to inform them that they must go to the settings page to enable location permission.
        if (status === RESULTS.BLOCKED) {
            setShowModal(true);
            setHasError(status === RESULTS.BLOCKED);
        } else {
            // If the native permission prompt hasn't been shown before, show it now.
            grantLocationPermission();
        }
    });
    
    // eslint-disable-next-line react-hooks/exhaustive-deps -- We only want this effect to run when startPermissionFlow changes.
}, [startPermissionFlow]);

What alternative solutions did you explore? (Optional)

Solution for new design:

  1. Update:

        <ConfirmModal
            shouldShowCancelButton={!(isWeb && hasError)}
            onModalHide={() => {
                setHasError(false);
                resetPermissionFlow();
            }}
  1. Update:

const handledBlockedPermission = (cb: () => void) => () => {
if (hasError) {
if (Linking.openSettings) {
Linking.openSettings();
}
setShowModal(false);
setHasError(false);
resetPermissionFlow();
return;
}
cb();
};

    const handledBlockedPermission = (cb: () => void) => () => {
        if (hasError) {
            if (Linking.openSettings) {
                Linking.openSettings();
            } else {
                onDeny?.();
            }
            setShowModal(false);
            return;
        }
        cb();
    };
  1. Update the title:

title={translate(hasError ? 'receipt.locationErrorTitle' : 'receipt.locationAccessTitle')}

and prompt:

prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')}

to match the new design:

Allow location access
Location access helps us keep your timezone and currency accurate wherever you go. Please allow location access from your device's permission settings.

It is very straightforward:

            prompt={translate(hasError ? (isWeb ? {new_prompt} : 'receipt.locationErrorMessage') : 'receipt.locationAccessMessage')}
            title={translate(hasError ? (isWeb ? {new_title} : 'receipt.locationErrorTitle') : 'receipt.locationAccessTitle')}

@truph01
Copy link
Contributor

truph01 commented Oct 11, 2024

@jamesdeanexpensify We don't want to display the pre-prompt but still display the native prompt on web, no?

@Julesssss Julesssss self-assigned this Oct 11, 2024
@jamesdeanexpensify
Copy link
Contributor Author

Yes, we would still show the native prompt on web. Thanks!

@twilight2294
Copy link
Contributor

twilight2294 commented Oct 11, 2024

Edited by proposal-police: This proposal was edited at 2024-10-15 11:18:52 UTC.

Proposal

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

Remove "Allow location access" modal on web

What is the root cause of that problem?

Feature request

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

New Solution according to expected results:

  1. Call skipLocationPermission when we click got it on web:
  2. Introduce shouldShowCancelButton prop to ConfirmModal:

And update the locationErrorMessage message to Location access helps us keep your timezone and currency accurate wherever you go. Please allow location access from your device's permission settings., if this doesn't fit screen then minor style changes would also be needed. But

        <ConfirmModal
            onConfirm={(hasError && isWeb) ? skipLocationPermission : grantLocationPermission}
            shouldShowCancelButton={!(hasError && isWeb)}

These changes are enough to match the expected results in this case

@truph01
Copy link
Contributor

truph01 commented Oct 11, 2024

@jamesdeanexpensify @Julesssss In my opinion, I don’t think we can fully hide the modal

Previously, when the user clicked the submit button and the native prompt hadn’t been shown yet, we displayed the pre-prompt modal:

image

If the user chose 'Continue,' but location permission wasn’t granted, the native prompt wouldn’t appear in the future. That's why, the next time, we display a modal to inform them that they need to manually enable location permission:

image

So, the 2nd modal should not be hidden.

Copy link

melvin-bot bot commented Oct 14, 2024

@Julesssss, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Christinadobrzyn
Copy link
Contributor

Thanks for the feedback @truph01!

Sorry, just catching up here, can you confirm the difference you are proposing? I think it's that we only show the "Not Now"/"Got it" prompt on the web and not the pre-prompt? Is that right?

@melvin-bot melvin-bot bot removed the Overdue label Oct 15, 2024
@truph01
Copy link
Contributor

truph01 commented Oct 15, 2024

I think it's that we only show the "Not Now"/"Got it" prompt on the web and not the pre-prompt

Yes

@Christinadobrzyn
Copy link
Contributor

I think this makes sense - do you @Julesssss @jamesdeanexpensify? Do you think we need a consensus from the team about this?

@Julesssss
Copy link
Contributor

That seems to be what we agreed, but lets check in with James first.

@jamesdeanexpensify
Copy link
Contributor Author

We're discussing this one internally and may recommend an alternative course of action. Stay tuned!

@jamesdeanexpensify
Copy link
Contributor Author

Just for alignment purposes - by "native prompt" on web, are we all talking about the second screenshot here?

@twilight2294
Copy link
Contributor

Just for alignment purposes - by "native prompt" on web, are we all talking about the second screenshot here?

Yes

@twilight2294
Copy link
Contributor

The video you attached is not being played, can you add another

@twilight2294
Copy link
Contributor

I actually think on web we can probably leave these prompts entirely in place, but (again, on web only):

@jamesdeanexpensify this means that we only show the prompt on native devices right?

@jamesdeanexpensify
Copy link
Contributor Author

Hmmm...that video is working for me. Here it is again:

2024-10-10_09-11-41.mp4

And sorry, what do you mean by "only show the prompt on native devices"?

@truph01
Copy link
Contributor

truph01 commented Oct 16, 2024

Just for alignment purposes - by "native prompt" on web, are we all talking about the second screenshot #50601 (comment)?

  • When users sign-in on a new device and are not asked about the location permission before. If they create a scan expense, the modal below is displayed, it is "pre-prompt":

Screenshot 2024-10-17 at 06 34 00

  • If the user chooses "Continue", the modal below is displayed (in top left screen), it is "native prompt":

Screenshot 2024-10-17 at 06 31 15

  • If the user chooses "Block", and then creates an other expense, the modal below is displayed:

Screenshot 2024-10-17 at 06 34 00

  • If the user chooses "Got it", the modal will close.

@jamesdeanexpensify
Copy link
Contributor Author

Ah, that's super helpful! Bringing this back to the team to chat about next steps again. Thanks!

@jamesdeanexpensify
Copy link
Contributor Author

OK, here is where we landed:

On web only, for the second Allow location access modal only (the one with the Got it button):

  • Fix the bug where you can't submit after clicking Got it (see video below)
  • Fix the bug where, after clicking the Got it button, the same button quickly flickers to say Continue (same video below)
  • Update the copy on the modal slightly to:

Allow location access
Location access helps us keep your timezone and currency accurate wherever you go. Please allow location access from your device's permission settings.

  • Remove the Not now button entirely because it serves no purpose in this case
2024-10-10_09-11-41.mp4

@jamesdeanexpensify jamesdeanexpensify changed the title Remove "Allow location access" modal on web Updated second Allow location access modal on web Oct 17, 2024
@jamesdeanexpensify jamesdeanexpensify changed the title Updated second Allow location access modal on web Update second Allow location access modal on web Oct 17, 2024
@twilight2294
Copy link
Contributor

@jamesdeanexpensify so by only web we mean that there should be no change to the behaviour on native platforms right ?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Nov 22, 2024
@melvin-bot melvin-bot bot changed the title [$250] Update second Allow location access modal on web [HOLD for payment 2024-11-29] [$250] Update second Allow location access modal on web Nov 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Nov 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.65-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-11-29. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 22, 2024

@alitoshmatov @Christinadobrzyn @alitoshmatov The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Nov 29, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

@Julesssss, @Christinadobrzyn, @alitoshmatov, @truph01 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Dec 2, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other: Not bug, feature extension

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: -

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: No need

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template

Regression Test Proposal

NOTE: This test steps are from PR, we have 7 days cooldown for asking location permission in PR we disabled this via code to test, not sure how this condition should be handled here

Precondition:

  • Clear all the ND's permission in chrome://settings/content/location if has.
  • Freshly signed in user
  • We have Forward time in settings step in several places this means you should go to device's settings and change time to future at least 7 days from now

Test:

Test 1: For [Chrome]

  1. FAB > Submit expense > Scan > Upload receipt.
  2. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 05 PM
  1. Choose "Continue". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 12 PM
  1. Choose "Block".
  2. Forward time in settings
  3. FAB > Submit expense > Scan > Upload receipt.
  4. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 18 PM
  1. Choose "Got it". Verify the expense is submitted.

Test 2: For [Safari]

  1. Login in ND in new tab.
  2. FAB > Submit expense > Scan > Upload receipt.
  3. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 30 PM
  1. Choose "Continue". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 41 PM
  1. Choose "Don't allow".
  2. Forward time in settings
  3. FAB > Submit expense > Scan > Upload receipt.
  4. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 18 49 PM
  1. Choose "Continue". Verify the expense is submitted.

Test 3: For Android/IOS app

  1. FAB > Submit expense > Scan > Upload receipt.
  2. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 19 01 PM
  1. Choose "Continue". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 19 07 PM
  1. Choose "Don't Allow".
  2. Forward time in settings
  3. FAB > Submit expense > Scan > Upload receipt.
  4. In confirmation page, click "Submit expense". Verify the below modal is displayed:
Screenshot 2024-12-03 at 10 19 12 PM
  1. Choose "Settings". Verify app redirect to setting screen.

Do we agree 👍 or 👎

@Christinadobrzyn
Copy link
Contributor

sorry @alitoshmatov can you update the images above so they are visible? I can't seem to access them.

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugs Dec 3, 2024
@alitoshmatov
Copy link
Contributor

@Christinadobrzyn Can you recheck it

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Dec 3, 2024

Thanks @alitoshmatov can you just check this - I tested again and the popup isn't showing at all.

  1. Log into New Expensify on Mac Chrome (in a new account)
  2. Click Fab > Submit Expense
  3. Click Distance expense
  4. Click Start > Use Current Location
  5. Click on link in the “It looks like you’ve denied access to your location. Please allow location access in settings and try again.” message
  6. Notice you’re redirected to https://help.expensify.com/, not a specific article.
  7. There's no popup.
2024-12-03_10-10-35.mp4

@Christinadobrzyn
Copy link
Contributor

Just checking @alitoshmatov - can you review ^. The Allow Location popup is no longer showing, is that expected?

@alitoshmatov
Copy link
Contributor

@Christinadobrzyn You have to upload a receipt not create a distance expanse

@alitoshmatov
Copy link
Contributor

Also there is this point to consider:

NOTE: This test steps are from PR, we have 7 days cooldown for asking location permission in PR we disabled this via code to test, not sure how this condition should be handled here

@Christinadobrzyn
Copy link
Contributor

@alitoshmatov sorry can you provide more context on that point, as in, do you think we should discuss changing something with the team related to that cooldown period or are you just thinking how that should be documented in the regression test?

@melvin-bot melvin-bot bot added the Overdue label Dec 6, 2024
@alitoshmatov
Copy link
Contributor

@Christinadobrzyn I think you can change computer/phone's time manually on the settings to bypass 7 day cooldown. Just checked it and it works.

Updated QA to show when they should change device's time with Forward time in settings step.
Feel free to update testing steps to be more explanatory

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2024
@JmillsExpensify
Copy link

Awaiting payment summary

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
@Christinadobrzyn
Copy link
Contributor

Thanks @alitoshmatov! Created a regression test with this information.

It look like payment is through Upwork according to this payment summary.

Closing out as complete!

@melvin-bot melvin-bot bot removed the Overdue label Dec 9, 2024
@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in #expensify-bugs Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

7 participants