Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

Login via deeplink should open modal in request money #31529

Open dukenv0307 opened 6 months ago

dukenv0307 commented 6 months ago

Details

Login via deep link should open the modal in Request money

Fixed Issues

$ https://github.com/Expensify/App/issues/29115 PROPOSAL: https://github.com/Expensify/App/issues/29115#issuecomment-1754801666

Tests

  1. Open a request money report or raise one and open it
  2. Click on the description or merchant and copy the URL
  3. Logout and paste the URL
  4. Login and observe that the app opens the correct description or merchant modal

Offline tests

QA Steps

  1. Open a request money report or raise one and open it
  2. Click on the description or merchant and copy the URL
  3. Logout and paste the URL
  4. Login and observe that the app opens the correct description or merchant modal

PR Author Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome https://github.com/Expensify/App/assets/129500732/4d106dc6-624b-4154-a9c1-9855a57267d2
iOS: Native https://github.com/Expensify/App/assets/129500732/ed475b9f-23e2-4420-a308-8a0eaa1d60b1
iOS: mWeb Safari https://github.com/Expensify/App/assets/129500732/e60bcff8-67bc-4460-bc55-c57c39991f3b
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/129500732/c0e8c2da-e2ec-4376-9d46-d1900e94f4c3
MacOS: Desktop https://github.com/Expensify/App/assets/129500732/5f51cea0-a8d4-48ec-b9f8-e116da65b5e7
melvin-bot[bot] commented 6 months ago

@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

abdulrahuman5196 commented 5 months ago

@dukenv0307 Any update on the above?

dukenv0307 commented 5 months ago

Update today.

dukenv0307 commented 5 months ago

@abdulrahuman5196 I responded in the review thread.

abdulrahuman5196 commented 5 months ago

@dukenv0307 The changes doesn't seem to work properly in my testing.

https://github.com/Expensify/App/assets/46707890/ec47301f-1f73-48a9-b302-1101a01327e2

https://github.com/Expensify/App/assets/46707890/98805514-d05b-4ab4-846d-f68578c4eec1

dukenv0307 commented 5 months ago

@abdulrahuman5196 I believe the bug mentioned here is not related to my code change. The current behavior of the app is signing in via deeplink does not take the user to the correct report in the URL -> this causes OpenReport API not to get called, leading to infinite loading

Please check the video attached below for more details.

https://github.com/Expensify/App/assets/129500732/b1a37f8f-3246-46fe-a7d7-9611fdf7d9b7

I think we'd better put this on hold to find the PR or issue that caused this new bug

abdulrahuman5196 commented 5 months ago

Will take a review today

dukenv0307 commented 4 months ago

@abdulrahuman5196 Friendly bump.

abdulrahuman5196 commented 4 months ago

@dukenv0307 I doubt if the route is returned wrongly. I just wrapped the EditRequestPage with WithReportOrNotFound and printed the received reportID it had proper reportID. I think there could be something else happening here.

Code change I Made.

diff --git a/src/ROUTES.ts b/src/ROUTES.ts
index 49067d1c7b..f292a636b8 100644
--- a/src/ROUTES.ts
+++ b/src/ROUTES.ts
@@ -156,8 +156,8 @@ const ROUTES = {
         getRoute: (reportID: string) => `r/${reportID}` as const,
     },
     EDIT_REQUEST: {
-        route: 'r/:threadReportID/edit/:field',
-        getRoute: (threadReportID: string, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${threadReportID}/edit/${field}` as const,
+        route: 'r/:reportID/edit/:field',
+        getRoute: (reportID: string, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${reportID}/edit/${field}` as const,
     },
     EDIT_CURRENCY_REQUEST: {
         route: 'r/:threadReportID/edit/currency',
diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js
index e41f30779f..855f39be4b 100644
--- a/src/pages/EditRequestPage.js
+++ b/src/pages/EditRequestPage.js
@@ -29,6 +29,7 @@ import EditRequestReceiptPage from './EditRequestReceiptPage';
 import EditRequestTagPage from './EditRequestTagPage';
 import reportActionPropTypes from './home/report/reportActionPropTypes';
 import reportPropTypes from './reportPropTypes';
+import withReportOrNotFound from './home/report/withReportOrNotFound';

 const propTypes = {
     /** Route from navigation */
@@ -285,6 +286,7 @@ EditRequestPage.displayName = 'EditRequestPage';
 EditRequestPage.propTypes = propTypes;
 EditRequestPage.defaultProps = defaultProps;
 export default compose(
+    withReportOrNotFound(),
     withOnyx({
         report: {
             key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`,
diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx
index cf2c0d5aca..5c10e6cb81 100644
--- a/src/pages/home/report/withReportOrNotFound.tsx
+++ b/src/pages/home/report/withReportOrNotFound.tsx
@@ -73,7 +73,10 @@ export default function (

         return withOnyx<TProps & RefAttributes<TRef>, OnyxProps>({
             report: {
-                key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`,
+                key: ({route}) => {
+                    console.log("Abdul Test" + JSON.stringify(route))
+                    return `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID || route.params.threadReportID}`
+                },
             },
             isLoadingReportData: {

Video of testing:

https://github.com/Expensify/App/assets/46707890/34e7097c-bd45-41d2-9d27-5e1baa6ee3ac

dukenv0307 commented 4 months ago

@abdulrahuman5196 Updated. I fixed this issue in the past here https://github.com/Expensify/App/issues/28641 but it was removed when we migrate ReportScreenIDSetter to Typescript.

dukenv0307 commented 3 months ago

@abdulrahuman5196 Any update here.

abdulrahuman5196 commented 3 months ago

Will check tomorrow. @dukenv0307 Meanwhile could you kindly fix the merge conflicts.

dukenv0307 commented 3 months ago

@abdulrahuman5196 resolved conflict.

dukenv0307 commented 2 months ago

@abdulrahuman5196 I think we should hold this until EditRequestPage is removed.

abdulrahuman5196 commented 2 months ago

@abdulrahuman5196 I think we should hold this until EditRequestPage is removed.

Oh. This PR got missed.

Why should we wait on? If so could you share the links and reasoning?

dukenv0307 commented 2 months ago

Because we're refactor money request flow. And after that, EditRequestPage will be removed.

dukenv0307 commented 2 months ago

@abdulrahuman5196 What do you think about my comment above.

abdulrahuman5196 commented 2 months ago

@dukenv0307 Could you provide references of the refractor? Any GH for reference to confirm?

dukenv0307 commented 2 months ago

@abdulrahuman5196 It's here https://github.com/Expensify/App/issues/29107

dukenv0307 commented 1 month ago

@abdulrahuman5196 Updated the PR to add a new solution after refactor by adding the logic to show the loading page in WithWritableReportOrNotFound.

dukenv0307 commented 1 month ago

@abdulrahuman5196 Friendly bump.

abdulrahuman5196 commented 2 weeks ago

Checking now

dukenv0307 commented 1 week ago

@abdulrahuman5196 Any update here.

abdulrahuman5196 commented 1 week ago

Checking now

abdulrahuman5196 commented 2 days ago

Checking again

abdulrahuman5196 commented 2 days ago

Whenever I pick this issue I am not getting OTPs :sleepy: due to site issues I think. https://expensify.slack.com/archives/C01GTK53T8Q/p1715879150080079

dukenv0307 commented 2 days ago

I can get OTP to login.