Skip to content
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

Improve flagging the users as texting Concierge from the OldDot on web #37088

4 changes: 4 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3319,6 +3319,10 @@ const CONST = {
PREFER_CLASSIC: 'preferClassic',
},
},

SESSION_STORAGE_KEYS: {
INITIAL_URL: 'INITIAL_URL',
},
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
26 changes: 22 additions & 4 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import DateUtils from '@libs/DateUtils';
import * as EmojiUtils from '@libs/EmojiUtils';
import * as Environment from '@libs/Environment/Environment';
import * as ErrorUtils from '@libs/ErrorUtils';
import getPlatform from '@libs/getPlatform';
import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
import LocalNotification from '@libs/Notification/LocalNotification';
Expand Down Expand Up @@ -175,10 +176,27 @@ const typingWatchTimers: Record<string, NodeJS.Timeout> = {};

let reportIDDeeplinkedFromOldDot: string | undefined;
Linking.getInitialURL().then((url) => {
const params = new URLSearchParams(url ?? '');
const exitToRoute = params.get('exitTo') ?? '';
const {reportID} = ReportUtils.parseReportRouteParams(exitToRoute);
reportIDDeeplinkedFromOldDot = reportID;
const isWeb = ([CONST.PLATFORM.WEB] as unknown as string).includes(getPlatform());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is not in compliance with our standards for cross-platform code. @rezkiy37 @abdulrahuman5196 @cristipaval please review App Philosophy with particular emphasis on item 5. Then please open a follow-up PR to implement this in a way that's compliant with our code standards. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I will prepare an additional PR. Ty!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am preparing a PR to fix it.

const currentParams = new URLSearchParams(url ?? '');
const currentExitToRoute = currentParams.get('exitTo') ?? '';
const {reportID: currentReportID} = ReportUtils.parseReportRouteParams(currentExitToRoute);

if (!isWeb) {
reportIDDeeplinkedFromOldDot = currentReportID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it possible that someone could click a link in OldDot web and have it open a native app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this scenario a few times. It always opens a browser to handle a deep link. It proposes to open a native app, once you get a report screen opened. Therefore, it does not need to handle the deep link anymore.


return;
}

const prevUrl = sessionStorage.getItem(CONST.SESSION_STORAGE_KEYS.INITIAL_URL);
const prevParams = new URLSearchParams(prevUrl ?? '');
const prevExitToRoute = prevParams.get('exitTo') ?? '';
const {reportID: prevReportID} = ReportUtils.parseReportRouteParams(prevExitToRoute);

reportIDDeeplinkedFromOldDot = currentReportID || prevReportID;

if (currentReportID && url) {
sessionStorage.setItem(CONST.SESSION_STORAGE_KEYS.INITIAL_URL, url);
}
});

let lastVisitedPath: string | undefined;
Expand Down
Loading