Skip to content

Commit

Permalink
Try a new approach
Browse files Browse the repository at this point in the history
  • Loading branch information
cristipaval committed Jan 16, 2024
1 parent 020a22b commit 34d6d90
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,12 @@ function isConciergeChatReport(report: OnyxEntry<Report>): boolean {
* Only returns true if this is a DM report with Concierge, opened from OldDot
*/
function isOldDotConciergeChat(initialURL: string, report: OnyxEntry<Report>): boolean {

const params = new URLSearchParams(initialURL);
const exitToRoute = params.get('exitTo') ?? '';
const {reportID} = parseReportRouteParams(exitToRoute);

Check failure on line 840 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / lint

'parseReportRouteParams' was used before it was defined
if (reportID !== report?.reportID) {
return false;
}
return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE;
}

Expand Down
18 changes: 17 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {format as timezoneFormat, utcToZonedTime} from 'date-fns-tz';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import Str from 'expensify-common/lib/str';
import isEmpty from 'lodash/isEmpty';
import {DeviceEventEmitter, InteractionManager} from 'react-native';
import {DeviceEventEmitter, InteractionManager, Linking} from 'react-native';
import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {NullishDeep} from 'react-native-onyx/lib/types';
Expand Down Expand Up @@ -127,6 +127,16 @@ const allReports: OnyxCollection<Report> = {};
let conciergeChatReportID: string | undefined;
const typingWatchTimers: Record<string, NodeJS.Timeout> = {};

let reportIDDeeplinkedFromOldDot: string | undefined;
Linking.getInitialURL().then((url) => {
console.debug("CRISTIIII - " + url);

Check failure on line 132 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation
const params = new URLSearchParams(url ?? '');
const exitToRoute = params.get('exitTo') ?? '';
const {reportID} = ReportUtils.parseReportRouteParams(exitToRoute);
reportIDDeeplinkedFromOldDot = reportID;
console.debug("CRISTIIII - " + reportIDDeeplinkedFromOldDot);

Check failure on line 137 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation
});

/** Get the private pusher channel name for a Report. */
function getReportChannelName(reportID: string): string {
return `${CONST.PUSHER.PRIVATE_REPORT_CHANNEL_PREFIX}${reportID}${CONFIG.PUSHER.SUFFIX}`;
Expand Down Expand Up @@ -343,6 +353,7 @@ function addActions(reportID: string, text = '', file?: File) {
timezone?: string;
shouldAllowActionableMentionWhispers?: boolean;
clientCreatedTime?: string;
isOldDotConciergeChat?: boolean;
};

const parameters: AddCommentOrAttachementParameters = {
Expand All @@ -354,6 +365,11 @@ function addActions(reportID: string, text = '', file?: File) {
shouldAllowActionableMentionWhispers: true,
clientCreatedTime: file ? attachmentAction?.created : reportCommentAction?.created,
};
console.debug("CRISTIIII - reportIDDeeplinkedFromOldDot: " + reportIDDeeplinkedFromOldDot);

Check failure on line 368 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation
if (reportIDDeeplinkedFromOldDot === reportID && report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE) {
console.debug("CRISTIIII - isOldDotConciergeChat: " + true);

Check failure on line 370 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation
parameters.isOldDotConciergeChat = true;
}

const optimisticData: OnyxUpdate[] = [
{
Expand Down

0 comments on commit 34d6d90

Please sign in to comment.