App: [$500] [Android] Requested for location after creating scan receipt expense

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.43-2 Reproducible in staging?: Yes Reproducible in production?: Yes Issue reported by: Me

The solution code should be the same for both iOS and Android. There is a bug that is causing the permission prompt to occur after the scan request is made.

Action Performed:

  • Camera permission should be set to ‘Ask every time’ when the app requests it
  • Location permission should be disabled
  • Create a Scan receipt expense
  • Request it

Expected Result:

  • Request submitted without issue

Actual Result:

  • Request submitted, and I am prompted for location permission

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

https://github.com/Expensify/App/assets/10736861/b90ca63e-52a2-4ea2-a45c-21536f684e77

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

See Above

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017b08f79b2ec6f294
  • Upwork Job ID: 1760968841543987200
  • Last Price Increase: 2024-03-01

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 47 (37 by maintainers)

Most upvoted comments

Closing this as we need a full internal discussion and design review.

This bug will be fixed with the implementation of this feature

📣 It’s been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

I think we’ll want to implement pre-permission prompt logic, something reusable that can be reused for our camera and location permissions. When I have a chance I’ll create a new issue or update this one and comment here.

@Julesssss We can pick the location from Onyx and use it with the help of userLocation key and remove getCurrentPosition() function call.

User reacts to dialog to make location data (or null) ready for this transaction (Optional)

@eh2077 yeah you’re correct, but one small change here:

At this point we only prompt for camera permission for the scan receipt flow, not location.

Do you agree that we should skip location data if location feature is off?

I agree, but that location dialog is native, and it is only occuring because of our code that is requesting location permission. When we remove the code that is triggering the location permissio, this dialog will also stop showing.

The reason I raised this bug is that it makes no sense to prompt for the permission after the request has been made. We don’t want to touch the existing permission prompt code unless it is necessary.

@Julesssss Thanks for your explanation. So the primary issue we want to fix here is to avoid triggering location prompt after pressing the Request button and the expected flow will be

  1. User selects or takes a photo to go to the Scan page
  2. Popup location related dialog according to device setting (Optional)
  3. User reacts to dialog to make location data (or null) ready for this transaction (Optional)
  4. User can click the ‘Request’ button without encountering subsequent location-related prompts.

Please correct me if I’m wrong.

The reason I raised this bug is that it makes no sense to prompt for the permission after the request has been made. We don’t want to touch the existing permission prompt code unless it is necessary.

Remove permission completely from here for both Android and iOS. That would mean the position would be used only if location permission is already available (granted previously).

My question is why do we even prompt at this point in the code? I understand needing to be careful with the prompt where it it used, but there is no use for it in my test case.

Note: Usually we don’t need code diff and demo videos to evaluate proposal but this platform-specific issue could be special and not that straightforward.

I think it’s okay to not do this to be honest. Its a bit unfair to ask someone to spend time on this and then not ending up using their solution.

That was a miss. Here is the update: This is behaving in a different way on iOS because iOS handles permission differently. Once a permission is denied on iOS, the app can’t ask for it again, it can only tell the user to go to settings and manually enable the permission. While in Android, the permission can be asked again (though after a few tries the user will get an option to choose “Don’t ask again”.