You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-08-09] [$250] Switch to expensify classic button not working on m-web safari #45941
Please re-state the problem that we are trying to solve in this issue.
Switch to expensify classic button not working on m-web safari
What is the root cause of that problem?
The root cause of the issue is that the Linking.openURL method in React Native is not handling the URL correctly on Safari. Specifically, Safari has stricter URL handling requirements, and URLs need to be properly encoded to ensure they are opened correctly.
However, opening a link/new tab inside a promise doesn't work on mWeb Safari. We previously had this kind of issue at #3615 which we fix it by opening a new window first then wait for the promise to complete.
if (!NativeModules.HybridAppModule) {
Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX);
}
If we only do it in safari, then pressing the Switch to expensify classic will immediately open the new window, while for other platforms, we will wait until the loading is complete.
What alternative solutions did you explore? (Optional)
The main solution will open the window and set the old link link as the url to the window without waiting the switchToOldDot request to complete. If we want to wait for switchToOldDot, then we can update openOldDotLink to accept a new params called extraPromise. We pass the switchToOldDot to the extraPromise and wait for it to complete.
changed the title [-]Switch to expensify classic button not working on m-web safari[/-][+][$250] Switch to expensify classic button not working on m-web safari[/+]on Jul 23, 2024
After reviewing both proposals, we can move forward with @bernhardoj's proposal here since the solution follows a pattern that already exists in the codebase.
changed the title [-][$250] Switch to expensify classic button not working on m-web safari[/-][+][HOLD for payment 2024-08-09] [$250] Switch to expensify classic button not working on m-web safari[/+]on Aug 2, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
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:
[@akinwale] The PR that introduced the bug has been identified. Link to the PR:
[@akinwale] 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:
[@akinwale] A discussion in #expensify-bugs 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:
[@akinwale] Determine if we should create a regression test for this bug.
[@akinwale] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
[@akinwale] The PR that introduced the bug has been identified. Link to the PR:
[@akinwale] 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:
[@akinwale] A discussion in #expensify-bugs 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:
Not a regression.
[@akinwale] Determine if we should create a regression test for this bug.
[@akinwale] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Regression Test Steps
Launch Expensify on Safari on iOS
Navigate to Settings then select Switch to Expensify Classic
Complete the survey
Tap the Switch to Expensify Classic button
Verify that a new tab opens and loads the Old Dot URL
Activity
melvin-bot commentedon Jul 22, 2024
Triggered auto assignment to @abekkala (
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.nyomanjyotisa commentedon Jul 23, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Switch to expensify classic button not working on m-web safari
What is the root cause of that problem?
The root cause of the issue is that the
Linking.openURLmethod in React Native is not handling the URL correctly on Safari. Specifically, Safari has stricter URL handling requirements, and URLs need to be properly encoded to ensure they are opened correctly.App/src/libs/asyncOpenURL/index.ts
Lines 4 to 12 in 38cddee
What changes do you think we should make in order to solve the problem?
To address the issue, the following changes are proposed:
Linking.openURLis properly encoded. This prevents any special characters in the URL from causing issues in Safari.asyncOpenURLfunction to encode the URL before opening it withLinking.openURLUpdate this code to the following
RESULT
Switch-to-expensify-classic-button-not-working-on-m-web-safari-.-Issue-45941-.-Expensify-App.mp4
What alternative solutions did you explore? (Optional)
bernhardoj commentedon Jul 23, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Switch to expensify classic doesn't work in mWeb Safari.
What is the root cause of that problem?
Pressing the switch to expensify classic button will do an API request and will try to open the old dot link after the promise is resolved.
App/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
Lines 86 to 94 in 38cddee
However, opening a link/new tab inside a promise doesn't work on mWeb Safari. We previously had this kind of issue at #3615 which we fix it by opening a new window first then wait for the promise to complete.
App/src/libs/asyncOpenURL/index.website.ts
Lines 13 to 28 in 38cddee
The issue is that in mWeb Safari, opening a new tab/link requires a user gesture, and putting it inside a promise won't be considered a user gesture anymore.
What changes do you think we should make in order to solve the problem?
Call
Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX);outside of the promise (we can do it only for mWeb Safari).App/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
Lines 86 to 94 in 38cddee
If we only do it in safari, then pressing the Switch to expensify classic will immediately open the new window, while for other platforms, we will wait until the loading is complete.
What alternative solutions did you explore? (Optional)
The main solution will open the window and set the old link link as the url to the window without waiting the
switchToOldDotrequest to complete. If we want to wait forswitchToOldDot, then we can updateopenOldDotLinkto accept a new params calledextraPromise. We pass theswitchToOldDotto theextraPromiseand wait for it to complete.App/src/libs/actions/Link.ts
Lines 63 to 70 in 8e4dc0f
melvin-bot commentedon Jul 23, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01550410ab679e7457
[-]Switch to expensify classic button not working on m-web safari[/-][+][$250] Switch to expensify classic button not working on m-web safari[/+]melvin-bot commentedon Jul 23, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (
External)akinwale commentedon Jul 26, 2024
After reviewing both proposals, we can move forward with @bernhardoj's proposal here since the solution follows a pattern that already exists in the codebase.
🎀👀🎀 C+ reviewed.
melvin-bot commentedon Jul 26, 2024
Triggered auto assignment to @srikarparsi, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
13 remaining items
[-][$250] Switch to expensify classic button not working on m-web safari[/-][+][HOLD for payment 2024-08-09] [$250] Switch to expensify classic button not working on m-web safari[/+]melvin-bot commentedon Aug 2, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Aug 2, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-9 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-08-09. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Aug 2, 2024
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:
abekkala commentedon Aug 2, 2024
PAYMENT SUMMARY FOR AUG 09, if no regressions
please complete checklist
akinwale commentedon Aug 3, 2024
Not a regression.
Regression Test Steps
Do we agree 👍 or 👎?
bernhardoj commentedon Aug 9, 2024
Requested in ND.
abekkala commentedon Aug 9, 2024
@akinwale payment sent and contract ended - thank you! 🎉
Thank you @bernhardoj
Closing
JmillsExpensify commentedon Aug 9, 2024
$250 approved for @bernhardoj