-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for Payment 2024-09-06] [$250] Navigated back to the home screen after granting for Camera permission #46422
Comments
Triggered auto assignment to @sakluger ( |
Let's make sure to test this for other SmartScan flows where the user grants camera permission (i.e. track expense). |
Job added to Upwork: https://www.upwork.com/jobs/~01a4e1ed614d93976d |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann ( |
I can't reproduce this bug on IOS |
ProposalPlease re-state the problem that we are trying to solve in this issue.On scan tab, alert for asking camera permission open System Setting app, coming back after grating camera permission reloads the app. It should resume from previous page What is the root cause of that problem?if we change any app permission in iOS from System Setting, it reloads the app to apply it. As its iOS's default behaviour. What changes do you think we should make in order to solve the problem?Since it’s OS' natural behaviour to reload the app when permissions changes in System Settings, we can use the Onyx database to track the last screen accessed before the settings change. When the app returns from the settings, we’ll retrieve the last screen from Onyx and navigate back to it if available.
function handlePermissionAfterRestart(status: boolean) {
Onyx.merge(ONYXKEYS.HANDLE_PERMISSION_AFTER_APP_RESTART, status);
}
handlePermissionAfterRestart(true);
if (handlePermissions) {
handlePermissionAfterRestart(false);
interceptAnonymousUser(() =>
IOU.startMoneyRequest(
CONST.IOU.TYPE.SUBMIT,
// When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
// for all of the routes in the creation flow.
ReportUtils.generateReportID(),
),
);
} What alternative solutions did you explore? (Optional) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@DylanDylann just to make sure, when you tried reproducing, did you remove camera permissions first? |
Commenting for melvin |
I can reproduce now. To reproduce we need to toggle on the permission before navigating back Screen.Recording.2024-08-02.at.12.11.25.mov |
More information for contributors, When an iOS app requests camera access and the user grants permission, the app restarts due to changes in the app's permission settings. We need to handle this more smoothly and avoid the appearance of a reload. |
@DylanDylann thanks for the more clarification, I've tried other solutions as well but somehow it had to take a little navigation before it re-opens the previous page like I added in proposal above. thanks. |
@ravindra-encoresky Thanks for your proposal. Will review soon |
@ravindra-encoresky Thanks for your idea. Could you please provide a testing branch for your solution? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Here is the branch with working sample - https://github.com/ravindra-encoresky/expensify/tree/46422-Navigated-home-after-camera-permission Branch contain the code with basic working sample, we can improve it as our requirements |
Screen.Recording.2024-08-06.at.17.55.44.mov@ravindra-encoresky After going back to scanning page, an error happens |
@ravindra-encoresky Thanks for your update. This is an edge case when the app restarts due to changes in the app's permission settings. Let's go with @ravindra-encoresky's proposal 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
hi @roryabraham proposal submitted on upwork. |
Thanks for the proposal @ravindra-encoresky, and good job finding the root cause (that the iOS app reloads with changed permissions). However, the solution you've proposed simply isn't flexible or reusable enough. There could be other flows that trigger permissions changes, and we won't always want to navigate to the scan receipt page. I think you're on the right track though - when triggering a permissions change modal, we want to stash the current navigation state (is the route enough?) and then restore it when the app reopens on permissions change. I'd also be curious to see if this is discussed in the React Navigation docs and perhaps has a prescribed solution? |
Agree at this point, we already did that in the test branch by using a new Onyx key called lastScreen. In the PR phase, maybe we need to adjust to set the current route to |
It sounds great to me |
I have not found anything specific in React Navigation Docs but on multiple places same solution is recommended. zoontek/react-native-permissions#307 |
📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @ravindra-encoresky 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Offer accepted. PR will be submitted by today 12 Aug 2024. |
hi @m-natarajan @sakluger since the PR is done, could you please complete the job on Upwork ? thanks. |
@sakluger The PR was deployed to production on August 31st. The payment should be issued on September 6th |
@DylanDylann @sakluger thanks, waiting for the job to be completed on upwork. |
Thanks everyone and sorry for the delay - our usual automation failed, so I will handle the updates and payments manually now. @DylanDylann can you please let us know if you think we need regression test steps for this case? |
Summarizing payment on this issue: Contributor: @ravindra-encoresky $250, paid via Upwork |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed: [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA Regression Test Proposal: Only for IOS native App
Do we agree 👍 or 👎 |
Looks good. Thanks! |
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: 9.0.13-3
Reproducible in staging?: Y
Reproducible in production?: Y
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:
Issue reported by: @cristipaval
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1722253630425759
Action Performed:
<- NewExpensify
on the top left corner of the iPhoneExpected Result:
Should resume the Submit Expense flow from where I left
Actual Result:
Landed on the home screen and I had to start the Submit Expense flow again
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Recording.3144.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: