From 020a22b0d97d5c2a1be8c29f413025cf36083174 Mon Sep 17 00:00:00 2001 From: Cristi Paval Date: Mon, 15 Jan 2024 21:35:23 +0200 Subject: [PATCH] Create ReportUtils.isOldDotConciergeChat function --- src/libs/ReportUtils.ts | 9 +++++++++ src/libs/SessionUtils.ts | 7 +------ src/pages/home/ReportScreen.js | 3 +-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 7e8966ed0d3f..de6250c2da84 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -831,6 +831,14 @@ function isConciergeChatReport(report: OnyxEntry): boolean { return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report); } +/** + * Only returns true if this is a DM report with Concierge, opened from OldDot + */ +function isOldDotConciergeChat(initialURL: string, report: OnyxEntry): boolean { + + return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE; +} + /** * Returns true if report is still being processed */ @@ -4432,6 +4440,7 @@ export { isPublicRoom, isPublicAnnounceRoom, isConciergeChatReport, + isOldDotConciergeChat, isProcessingReport, isCurrentUserTheOnlyParticipant, hasAutomatedExpensifyAccountIDs, diff --git a/src/libs/SessionUtils.ts b/src/libs/SessionUtils.ts index 24bc51fd3e9e..c73513c747af 100644 --- a/src/libs/SessionUtils.ts +++ b/src/libs/SessionUtils.ts @@ -53,9 +53,4 @@ function didUserLogInDuringSession() { return Boolean(loggedInDuringSession); } -function didSessionStartAsOldDotConcierge(initialURL: string) { - console.debug("CRISTIII - " + initialURL); - return Boolean(true); -} - -export {isLoggingInAsNewUser, didUserLogInDuringSession, resetDidUserLogInDuringSession, didSessionStartAsOldDotConcierge}; +export {isLoggingInAsNewUser, didUserLogInDuringSession, resetDidUserLogInDuringSession}; diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 3616499d0a08..77043c5142ec 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -44,7 +44,6 @@ import reportActionPropTypes from './report/reportActionPropTypes'; import ReportActionsView from './report/ReportActionsView'; import ReportFooter from './report/ReportFooter'; import {ActionListContext, ReactionListContext} from './ReportScreenContext'; -import * as SessionUtils from '@libs/SessionUtils'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -353,7 +352,7 @@ function ReportScreen({ Performance.markEnd(CONST.TIMING.CHAT_RENDER); Linking.getInitialURL().then((url) => { - isOldDotConciergeRef.current = SessionUtils.didSessionStartAsOldDotConcierge(url); + isOldDotConciergeRef.current = ReportUtils.isOldDotConciergeChat(url, report); }); fetchReportIfNeeded(); ComposerActions.setShouldShowComposeInput(true);