From efc79b1f1c09bbdc6e6b8ee3dfe409ec439dcaa4 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Fri, 10 Feb 2023 14:37:30 -0500 Subject: [PATCH 01/34] Use reconnect instead of openReport in handleReportChanged --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 952920708e80..9b1cfb883f4a 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -660,7 +660,7 @@ function handleReportChanged(report) { // A report can be missing a name if a comment is received via pusher event // and the report does not yet exist in Onyx (eg. a new DM created with the logged in person) if (report.reportID && report.reportName === undefined) { - openReport(report.reportID); + reconnect(report.reportID); } } From d002ab792c873c8bb1a18ae8edfcb5d04b3887ea Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Fri, 10 Feb 2023 15:56:12 -0500 Subject: [PATCH 02/34] Add report name to optimistic data in reconnectToReport --- src/libs/actions/Report.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 9b1cfb883f4a..2d0755a4f540 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -435,6 +435,7 @@ function reconnect(reportID) { value: { isLoadingReportActions: true, isLoadingMoreReportActions: false, + reportName: lodashGet(allReports, [reportID, 'reportName'], CONST.REPORT.DEFAULT_REPORT_NAME), }, }], successData: [{ From 29095d89a964f0584c440aff3015e1f169ec48bc Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Fri, 10 Feb 2023 15:58:37 -0500 Subject: [PATCH 03/34] Rename reconnect to reconnectToReport to match API call --- src/libs/actions/Report.js | 6 +++--- src/pages/home/report/ReportActionsView.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 2d0755a4f540..a60a6f3098e7 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -422,7 +422,7 @@ function navigateToAndOpenReport(userLogins) { * * @param {String} reportID */ -function reconnect(reportID) { +function reconnectToReport(reportID) { API.write('ReconnectToReport', { reportID, @@ -661,7 +661,7 @@ function handleReportChanged(report) { // A report can be missing a name if a comment is received via pusher event // and the report does not yet exist in Onyx (eg. a new DM created with the logged in person) if (report.reportID && report.reportName === undefined) { - reconnect(report.reportID); + reconnectToReport(report.reportID); } } @@ -1180,7 +1180,7 @@ function clearIOUError(reportID) { export { addComment, addAttachment, - reconnect, + reconnectToReport, updateNotificationPreference, subscribeToReportTypingEvents, subscribeToReportCommentPushNotifications, diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 4bbeaa997ae2..80836e787867 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -187,7 +187,7 @@ class ReportActionsView extends React.Component { if (isReportFullyVisible) { this.openReportIfNecessary(); } else { - Report.reconnect(this.props.report.reportID); + Report.reconnectToReport(this.props.report.reportID); } } From b22e7f74290629586e558c15f1c82345ec07b958 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Mon, 13 Feb 2023 20:03:36 -0500 Subject: [PATCH 04/34] Change function name back to reconnect --- src/libs/actions/Report.js | 6 +++--- src/pages/home/report/ReportActionsView.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index a60a6f3098e7..2d0755a4f540 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -422,7 +422,7 @@ function navigateToAndOpenReport(userLogins) { * * @param {String} reportID */ -function reconnectToReport(reportID) { +function reconnect(reportID) { API.write('ReconnectToReport', { reportID, @@ -661,7 +661,7 @@ function handleReportChanged(report) { // A report can be missing a name if a comment is received via pusher event // and the report does not yet exist in Onyx (eg. a new DM created with the logged in person) if (report.reportID && report.reportName === undefined) { - reconnectToReport(report.reportID); + reconnect(report.reportID); } } @@ -1180,7 +1180,7 @@ function clearIOUError(reportID) { export { addComment, addAttachment, - reconnectToReport, + reconnect, updateNotificationPreference, subscribeToReportTypingEvents, subscribeToReportCommentPushNotifications, diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 80836e787867..4bbeaa997ae2 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -187,7 +187,7 @@ class ReportActionsView extends React.Component { if (isReportFullyVisible) { this.openReportIfNecessary(); } else { - Report.reconnectToReport(this.props.report.reportID); + Report.reconnect(this.props.report.reportID); } } From 9baa084f38a61c1d4bd2a107ec92e50bc041970f Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Tue, 14 Feb 2023 15:02:50 -0500 Subject: [PATCH 05/34] Add comment explaining why we call reconnect --- src/libs/actions/Report.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 2d0755a4f540..72cfe6e15df1 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -658,8 +658,8 @@ function handleReportChanged(report) { } } - // A report can be missing a name if a comment is received via pusher event - // and the report does not yet exist in Onyx (eg. a new DM created with the logged in person) + // A report can be missing a name if a comment is received via pusher event and the report does not yet exist in Onyx (eg. a new DM created with the logged in person) + // In this case, we call reconnect so that we can fetch the report data without marking it as read if (report.reportID && report.reportName === undefined) { reconnect(report.reportID); } From 7d2a8567420ad12a839ea90d0067cc04a2c7591d Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Tue, 21 Feb 2023 19:20:04 +0500 Subject: [PATCH 06/34] feat: added conditional styles --- src/components/LHNOptionsList/OptionRowLHN.js | 5 +++-- src/components/LHNOptionsList/styles.js | 10 ++++++++++ src/components/LHNOptionsList/styles.native.js | 10 ++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/components/LHNOptionsList/styles.js create mode 100644 src/components/LHNOptionsList/styles.native.js diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index c57d51d29eb2..d47dc41326f8 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -6,6 +6,7 @@ import { View, StyleSheet, } from 'react-native'; +import * as localStyles from './styles'; import styles from '../../styles/styles'; import * as StyleUtils from '../../styles/StyleUtils'; import Icon from '../Icon'; @@ -72,10 +73,10 @@ const OptionRowLHN = (props) => { ? [styles.ml1, StyleUtils.getBackgroundColorWithOpacityStyle(themeColors.icon, 0.5)] : [styles.ml1]; const alternateTextStyle = StyleUtils.combineStyles(props.viewMode === CONST.OPTION_MODE.COMPACT - ? [textStyle, styles.optionAlternateText, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] + ? [textStyle, localStyles.compactAlternateTextStyle, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] : [textStyle, styles.optionAlternateText, styles.textLabelSupporting], props.style); const contentContainerStyles = props.viewMode === CONST.OPTION_MODE.COMPACT - ? [styles.flex1, styles.flexRow, styles.overflowHidden, styles.alignItemsCenter] + ? [styles.flex1, styles.flexRow, styles.overflowHidden, localStyles.compactContentContainerStyles] : [styles.flex1]; const sidebarInnerRowStyle = StyleSheet.flatten(props.viewMode === CONST.OPTION_MODE.COMPACT ? [ styles.chatLinkRowPressable, diff --git a/src/components/LHNOptionsList/styles.js b/src/components/LHNOptionsList/styles.js new file mode 100644 index 000000000000..e1447090b061 --- /dev/null +++ b/src/components/LHNOptionsList/styles.js @@ -0,0 +1,10 @@ +import styles from '../../styles/styles'; + +const compactAlternateTextStyle = styles.alternateTextStyle; + +const compactContentContainerStyles = styles.alignItemsBaseline; + +export { + compactAlternateTextStyle, + compactContentContainerStyles, +}; diff --git a/src/components/LHNOptionsList/styles.native.js b/src/components/LHNOptionsList/styles.native.js new file mode 100644 index 000000000000..edb205165a26 --- /dev/null +++ b/src/components/LHNOptionsList/styles.native.js @@ -0,0 +1,10 @@ +import styles from '../../styles/styles'; + +const compactAlternateTextStyle = {}; + +const compactContentContainerStyles = styles.alignItemsCenter; + +export { + compactAlternateTextStyle, + compactContentContainerStyles, +}; From 97b68483cfd75020869c1ce77609f1cba657549e Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Wed, 22 Feb 2023 18:59:29 +0500 Subject: [PATCH 07/34] fix(14148): refactored style location --- src/components/LHNOptionsList/OptionRowLHN.js | 2 +- src/components/LHNOptionsList/styles.native.js | 10 ---------- .../getOptionRowStyles/index.js} | 2 +- src/styles/getOptionRowStyles/index.native.js | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 12 deletions(-) delete mode 100644 src/components/LHNOptionsList/styles.native.js rename src/{components/LHNOptionsList/styles.js => styles/getOptionRowStyles/index.js} (83%) create mode 100644 src/styles/getOptionRowStyles/index.native.js diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index d47dc41326f8..03764084e04d 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -6,7 +6,7 @@ import { View, StyleSheet, } from 'react-native'; -import * as localStyles from './styles'; +import * as localStyles from '../../styles/getOptionRowStyles'; import styles from '../../styles/styles'; import * as StyleUtils from '../../styles/StyleUtils'; import Icon from '../Icon'; diff --git a/src/components/LHNOptionsList/styles.native.js b/src/components/LHNOptionsList/styles.native.js deleted file mode 100644 index edb205165a26..000000000000 --- a/src/components/LHNOptionsList/styles.native.js +++ /dev/null @@ -1,10 +0,0 @@ -import styles from '../../styles/styles'; - -const compactAlternateTextStyle = {}; - -const compactContentContainerStyles = styles.alignItemsCenter; - -export { - compactAlternateTextStyle, - compactContentContainerStyles, -}; diff --git a/src/components/LHNOptionsList/styles.js b/src/styles/getOptionRowStyles/index.js similarity index 83% rename from src/components/LHNOptionsList/styles.js rename to src/styles/getOptionRowStyles/index.js index e1447090b061..41f43e2620d6 100644 --- a/src/components/LHNOptionsList/styles.js +++ b/src/styles/getOptionRowStyles/index.js @@ -1,4 +1,4 @@ -import styles from '../../styles/styles'; +import styles from '../styles'; const compactAlternateTextStyle = styles.alternateTextStyle; diff --git a/src/styles/getOptionRowStyles/index.native.js b/src/styles/getOptionRowStyles/index.native.js new file mode 100644 index 000000000000..a3ac065c7152 --- /dev/null +++ b/src/styles/getOptionRowStyles/index.native.js @@ -0,0 +1,18 @@ +import styles from '../styles'; + +/** + * On native platforms, alignItemsBaseline does not work correctly + * in lining the items together. As such, on native platform, we're + * removing the line height of the elements in line. This causes + * the elements to be displayed in line correctly. + * https://github.com/Expensify/App/issues/14148 +*/ + +const compactAlternateTextStyle = {}; + +const compactContentContainerStyles = styles.alignItemsCenter; + +export { + compactAlternateTextStyle, + compactContentContainerStyles, +}; From e109f78266887aa2ee9b77a83a1c129711a204a9 Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Wed, 22 Feb 2023 19:39:06 +0500 Subject: [PATCH 08/34] fix: handled more refactors --- src/components/LHNOptionsList/OptionRowLHN.js | 6 +++--- src/styles/{getOptionRowStyles => optionRowStyles}/index.js | 0 .../{getOptionRowStyles => optionRowStyles}/index.native.js | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename src/styles/{getOptionRowStyles => optionRowStyles}/index.js (100%) rename src/styles/{getOptionRowStyles => optionRowStyles}/index.native.js (100%) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 03764084e04d..1533eb3c4aca 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -6,7 +6,7 @@ import { View, StyleSheet, } from 'react-native'; -import * as localStyles from '../../styles/getOptionRowStyles'; +import * as optionRowStyles from '../../styles/optionRowStyles'; import styles from '../../styles/styles'; import * as StyleUtils from '../../styles/StyleUtils'; import Icon from '../Icon'; @@ -73,10 +73,10 @@ const OptionRowLHN = (props) => { ? [styles.ml1, StyleUtils.getBackgroundColorWithOpacityStyle(themeColors.icon, 0.5)] : [styles.ml1]; const alternateTextStyle = StyleUtils.combineStyles(props.viewMode === CONST.OPTION_MODE.COMPACT - ? [textStyle, localStyles.compactAlternateTextStyle, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] + ? [textStyle, optionRowStyles.compactAlternateTextStyle, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] : [textStyle, styles.optionAlternateText, styles.textLabelSupporting], props.style); const contentContainerStyles = props.viewMode === CONST.OPTION_MODE.COMPACT - ? [styles.flex1, styles.flexRow, styles.overflowHidden, localStyles.compactContentContainerStyles] + ? [styles.flex1, styles.flexRow, styles.overflowHidden, optionRowStyles.compactContentContainerStyles] : [styles.flex1]; const sidebarInnerRowStyle = StyleSheet.flatten(props.viewMode === CONST.OPTION_MODE.COMPACT ? [ styles.chatLinkRowPressable, diff --git a/src/styles/getOptionRowStyles/index.js b/src/styles/optionRowStyles/index.js similarity index 100% rename from src/styles/getOptionRowStyles/index.js rename to src/styles/optionRowStyles/index.js diff --git a/src/styles/getOptionRowStyles/index.native.js b/src/styles/optionRowStyles/index.native.js similarity index 100% rename from src/styles/getOptionRowStyles/index.native.js rename to src/styles/optionRowStyles/index.native.js From 9cab69d79c0c6bd84f4d8e0b2b460dbc221cdf5e Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Fri, 3 Mar 2023 13:58:06 +0500 Subject: [PATCH 09/34] fix: removed native styles for compact alternate text --- src/components/LHNOptionsList/OptionRowLHN.js | 2 +- src/styles/optionRowStyles/index.js | 4 +--- src/styles/optionRowStyles/index.native.js | 7 ++----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 1533eb3c4aca..5352e80db7f8 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -73,7 +73,7 @@ const OptionRowLHN = (props) => { ? [styles.ml1, StyleUtils.getBackgroundColorWithOpacityStyle(themeColors.icon, 0.5)] : [styles.ml1]; const alternateTextStyle = StyleUtils.combineStyles(props.viewMode === CONST.OPTION_MODE.COMPACT - ? [textStyle, optionRowStyles.compactAlternateTextStyle, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] + ? [textStyle, styles.optionAlternateText, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] : [textStyle, styles.optionAlternateText, styles.textLabelSupporting], props.style); const contentContainerStyles = props.viewMode === CONST.OPTION_MODE.COMPACT ? [styles.flex1, styles.flexRow, styles.overflowHidden, optionRowStyles.compactContentContainerStyles] diff --git a/src/styles/optionRowStyles/index.js b/src/styles/optionRowStyles/index.js index 41f43e2620d6..2bef2a0cd094 100644 --- a/src/styles/optionRowStyles/index.js +++ b/src/styles/optionRowStyles/index.js @@ -1,10 +1,8 @@ import styles from '../styles'; -const compactAlternateTextStyle = styles.alternateTextStyle; - const compactContentContainerStyles = styles.alignItemsBaseline; export { - compactAlternateTextStyle, + // eslint-disable-next-line import/prefer-default-export compactContentContainerStyles, }; diff --git a/src/styles/optionRowStyles/index.native.js b/src/styles/optionRowStyles/index.native.js index a3ac065c7152..2ffeca3c419d 100644 --- a/src/styles/optionRowStyles/index.native.js +++ b/src/styles/optionRowStyles/index.native.js @@ -3,16 +3,13 @@ import styles from '../styles'; /** * On native platforms, alignItemsBaseline does not work correctly * in lining the items together. As such, on native platform, we're - * removing the line height of the elements in line. This causes - * the elements to be displayed in line correctly. + * keeping compactContentContainerStyles as it is. * https://github.com/Expensify/App/issues/14148 */ -const compactAlternateTextStyle = {}; - const compactContentContainerStyles = styles.alignItemsCenter; export { - compactAlternateTextStyle, + // eslint-disable-next-line import/prefer-default-export compactContentContainerStyles, }; From cebd6b3a4f3a8062e6d4a474ed3618bb6d88f014 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 6 Mar 2023 16:54:03 +0200 Subject: [PATCH 10/34] New method for getting thumbnail avatar --- src/libs/ReportUtils.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 83a84f7be041..72a953985b22 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -547,6 +547,26 @@ function getFullSizeAvatar(avatarURL, login) { return source.replace('_128', ''); } +/** + * Small sized avatars end with _128.. This adds the _128 at the end of the + * source URL (before the file type) if it doesn't exist there already. + * + * @param {String} avatarURL + * @param {String} login + * @returns {String|Function} + */ +function getSmallSizeAvatar(avatarURL, login) { + const source = getAvatar(avatarURL, login); + const lastPeriodIndex = source.lastIndexOf('.'); + + // If image source is not a String (so wouldn't have _128) or already has _128 at the end, + // given avatar URL is already what we want to use here. + if (!_.isString(source) || source.substring(lastPeriodIndex - 4, lastPeriodIndex) === '_128') { + return source; + } + return source.substring(0, lastPeriodIndex) + '_128' + source.substring(lastPeriodIndex); +} + /** * Returns the appropriate icons for the given chat report using the stored personalDetails. * The Avatar sources can be URLs or Icon components according to the chat type. @@ -1647,5 +1667,6 @@ export { getCommentLength, openReportFromDeepLink, getFullSizeAvatar, + getSmallSizeAvatar, getIOUOptions, }; From 9ecf98646159d6bd3b69536d9a660f5d727782e1 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 6 Mar 2023 16:54:29 +0200 Subject: [PATCH 11/34] Make sure thumbnail avatar shows here --- src/components/AvatarWithIndicator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/AvatarWithIndicator.js b/src/components/AvatarWithIndicator.js index 6430d463a712..4a04231c805e 100644 --- a/src/components/AvatarWithIndicator.js +++ b/src/components/AvatarWithIndicator.js @@ -15,6 +15,7 @@ import {policyPropTypes} from '../pages/workspace/withPolicy'; import walletTermsPropTypes from '../pages/EnablePayments/walletTermsPropTypes'; import * as PolicyUtils from '../libs/PolicyUtils'; import * as PaymentMethods from '../libs/actions/PaymentMethods'; +import * as ReportUtils from '../libs/ReportUtils'; const propTypes = { /** URL for the avatar */ @@ -89,7 +90,7 @@ const AvatarWithIndicator = (props) => { {shouldShowIndicator && ( From d9967787e8139334149a02ff75669e7e9683e517 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 6 Mar 2023 17:03:51 +0200 Subject: [PATCH 12/34] Use correct string concat --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 72a953985b22..d8a8ffff17d7 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -564,7 +564,7 @@ function getSmallSizeAvatar(avatarURL, login) { if (!_.isString(source) || source.substring(lastPeriodIndex - 4, lastPeriodIndex) === '_128') { return source; } - return source.substring(0, lastPeriodIndex) + '_128' + source.substring(lastPeriodIndex); + return `${source.substring(0, lastPeriodIndex)}_128${source.substring(lastPeriodIndex)}`; } /** From 331b2579f65eaf4e2d759da16155dcebddd02095 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 7 Mar 2023 17:46:17 -0500 Subject: [PATCH 13/34] rename getEnvironmentURL to getEnvironmentURLAsync --- src/CONST.js | 2 +- src/libs/Environment/Environment.js | 4 ++-- src/pages/home/report/ContextMenu/ContextMenuActions.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index b8c26f163376..822299186cc1 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -281,7 +281,7 @@ const CONST = { STAGING_NEW_EXPENSIFY_URL: 'https://staging.new.expensify.com', NEWHELP_URL: 'https://help.expensify.com', - // Use Environment.getEnvironmentURL to get the complete URL with port number + // Use Environment.getEnvironmentURLAsync to get the complete URL with port number DEV_NEW_EXPENSIFY_URL: 'http://localhost:', OPTION_TYPE: { diff --git a/src/libs/Environment/Environment.js b/src/libs/Environment/Environment.js index a14300520bb5..bd5287c6eccd 100644 --- a/src/libs/Environment/Environment.js +++ b/src/libs/Environment/Environment.js @@ -24,7 +24,7 @@ function isDevelopment() { * * @returns {Promise} */ -function getEnvironmentURL() { +function getEnvironmentURLAsync() { return new Promise((resolve) => { getEnvironment() .then(environment => resolve(ENVIRONMENT_URLS[environment])); @@ -34,5 +34,5 @@ function getEnvironmentURL() { export { getEnvironment, isDevelopment, - getEnvironmentURL, + getEnvironmentURLAsync, }; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 490c2153399f..25aec4e725a3 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -139,7 +139,7 @@ export default [ return Permissions.canUseCommentLinking(betas) && type === CONTEXT_MENU_TYPES.REPORT_ACTION && !isAttachmentTarget; }, onPress: (closePopover, {reportAction, reportID}) => { - Environment.getEnvironmentURL() + Environment.getEnvironmentURLAsync() .then((environmentURL) => { const reportActionID = parseInt(lodashGet(reportAction, 'reportActionID'), 10); Clipboard.setString(`${environmentURL}/r/${reportID}/${reportActionID}`); From 185a102c064ba9672a55ed1a7996d636abd27b3f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 7 Mar 2023 17:47:17 -0500 Subject: [PATCH 14/34] create getEnvironmentURL --- src/libs/Environment/Environment.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libs/Environment/Environment.js b/src/libs/Environment/Environment.js index bd5287c6eccd..33981a5073e5 100644 --- a/src/libs/Environment/Environment.js +++ b/src/libs/Environment/Environment.js @@ -20,7 +20,7 @@ function isDevelopment() { } /** - * Get the URL based on the environment we are in + * Asynchornously get the URL based on the environment we are in * * @returns {Promise} */ @@ -31,8 +31,18 @@ function getEnvironmentURLAsync() { }); } +/** + * Get the URL based on the environment we are in + * + * @returns {String} + */ +function getEnvironmentURL() { + return ENVIRONMENT_URLS[CONFIG.ENVIRONMENT]; +} + export { getEnvironment, isDevelopment, getEnvironmentURLAsync, + getEnvironmentURL, }; From 702d6c3a2029c4e297e2e7d7d7bbe7621f43a322 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 7 Mar 2023 17:48:19 -0500 Subject: [PATCH 15/34] update login page urls --- src/pages/signin/SignInPageLayout/Footer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index 0f6e099bc8c0..a21821bc9d3e 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -13,6 +13,7 @@ import Licenses from '../Licenses'; import Socials from '../Socials'; import Hoverable from '../../../components/Hoverable'; import CONST from '../../../CONST'; +import * as Environment from '../../../libs/Environment/Environment'; const propTypes = { ...windowDimensionsPropTypes, @@ -123,11 +124,11 @@ const columns = [ translationPath: 'footer.getStarted', rows: [ { - link: CONST.NEW_EXPENSIFY_URL, + link: Environment.getEnvironmentURL(), translationPath: 'footer.createAccount', }, { - link: CONST.NEW_EXPENSIFY_URL, + link: Environment.getEnvironmentURL(), translationPath: 'footer.logIn', }, ], From 7d38122927914915b0699203165d3c45cc45c7a0 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 14:08:26 -0500 Subject: [PATCH 16/34] add navigation --- src/pages/signin/SignInPageLayout/Footer.js | 41 ++++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index a21821bc9d3e..572e6e981c42 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -1,4 +1,4 @@ -import {View} from 'react-native'; +import {View, Pressable} from 'react-native'; import React from 'react'; import _ from 'underscore'; import Text from '../../../components/Text'; @@ -14,6 +14,7 @@ import Socials from '../Socials'; import Hoverable from '../../../components/Hoverable'; import CONST from '../../../CONST'; import * as Environment from '../../../libs/Environment/Environment'; +import Navigation from '../../../libs/Navigation/Navigation'; const propTypes = { ...windowDimensionsPropTypes, @@ -124,11 +125,11 @@ const columns = [ translationPath: 'footer.getStarted', rows: [ { - link: Environment.getEnvironmentURL(), + navigateRoute: Environment.getEnvironmentURL(), translationPath: 'footer.createAccount', }, { - link: Environment.getEnvironmentURL(), + navigateRoute: Environment.getEnvironmentURL(), translationPath: 'footer.logIn', }, ], @@ -159,18 +160,30 @@ const Footer = (props) => { {_.map(column.rows, row => ( - - {hovered => ( - + _.has(row, 'navigateRoute') ? ( + Navigation.navigate(row.navigateRoute)} + > + {props.translate(row.translationPath)} - - )} - + + + ) + : ( + + {hovered => ( + + {props.translate(row.translationPath)} + + )} + + ) ))} {(i === 2) && ( From 2eba71146979c7b6ca21913da9be92556833869a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:25:36 -0500 Subject: [PATCH 17/34] update home screen navigation --- src/libs/Navigation/Navigation.js | 4 ++-- src/pages/signin/SignInPageLayout/Footer.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index 6c3dcfa618b4..bd58b99c95d3 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -1,7 +1,7 @@ import _ from 'underscore'; import lodashGet from 'lodash/get'; import {Keyboard} from 'react-native'; -import {DrawerActions, getPathFromState, StackActions} from '@react-navigation/native'; +import {CommonActions, DrawerActions, getPathFromState} from '@react-navigation/native'; import Onyx from 'react-native-onyx'; import Log from '../Log'; import DomUtils from '../DomUtils'; @@ -173,7 +173,7 @@ function navigate(route = ROUTES.HOME) { // If we're navigating to the signIn page while logged out, pop whatever screen is on top // since it's guaranteed that the sign in page will be underneath (since it's the initial route). // Also, if we're coming from a link to validate login (pendingRoute is not null), we want to pop the loading screen. - navigationRef.current.dispatch(StackActions.pop()); + navigationRef.current.dispatch(CommonActions.reset({index: 0, routes: [{name: 'Home'}]})); return; } diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index 572e6e981c42..7e41e84fd078 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -15,6 +15,8 @@ import Hoverable from '../../../components/Hoverable'; import CONST from '../../../CONST'; import * as Environment from '../../../libs/Environment/Environment'; import Navigation from '../../../libs/Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; +import * as Session from '../../../libs/actions/Session'; const propTypes = { ...windowDimensionsPropTypes, @@ -163,7 +165,10 @@ const Footer = (props) => { _.has(row, 'navigateRoute') ? ( Navigation.navigate(row.navigateRoute)} + onPress={() => { + Navigation.navigate(ROUTES.HOME); + Session.clearSignInData(); + }} > {props.translate(row.translationPath)} From c837bc2884ac948a7ff9256023a04bbef385879c Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:26:33 -0500 Subject: [PATCH 18/34] revert changes to getEnvironmentURL --- src/CONST.js | 2 +- src/libs/Environment/Environment.js | 12 +----------- .../home/report/ContextMenu/ContextMenuActions.js | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index 76c9062f27e0..83935778bad4 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -284,7 +284,7 @@ const CONST = { STAGING_EXPENSIFY_URL: 'https://staging.expensify.com', EXPENSIFY_URL: 'https://www.expensify.com', - // Use Environment.getEnvironmentURLAsync to get the complete URL with port number + // Use Environment.getEnvironmentURL to get the complete URL with port number DEV_NEW_EXPENSIFY_URL: 'http://localhost:', OPTION_TYPE: { diff --git a/src/libs/Environment/Environment.js b/src/libs/Environment/Environment.js index b02b7ca469a5..c46e21bf63da 100644 --- a/src/libs/Environment/Environment.js +++ b/src/libs/Environment/Environment.js @@ -30,22 +30,13 @@ function isDevelopment() { * * @returns {Promise} */ -function getEnvironmentURLAsync() { +function getEnvironmentURL() { return new Promise((resolve) => { getEnvironment() .then(environment => resolve(ENVIRONMENT_URLS[environment])); }); } -/** - * Get the URL based on the environment we are in - * - * @returns {String} - */ -function getEnvironmentURL() { - return ENVIRONMENT_URLS[CONFIG.ENVIRONMENT]; -} - /** * Get the corresponding oldDot URL based on the environment we are in * @@ -59,7 +50,6 @@ function getOldDotEnvironmentURL() { export { getEnvironment, isDevelopment, - getEnvironmentURLAsync, getEnvironmentURL, getOldDotEnvironmentURL, }; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 9bd71fcd6697..cab49dcc3c9c 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -186,7 +186,7 @@ export default [ return Permissions.canUseCommentLinking(betas) && type === CONTEXT_MENU_TYPES.REPORT_ACTION && !isAttachmentTarget; }, onPress: (closePopover, {reportAction, reportID}) => { - Environment.getEnvironmentURLAsync() + Environment.getEnvironmentURL() .then((environmentURL) => { const reportActionID = parseInt(lodashGet(reportAction, 'reportActionID'), 10); Clipboard.setString(`${environmentURL}/r/${reportID}/${reportActionID}`); From ca28187594fae26ef968ca853e185bf84825e36f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:27:08 -0500 Subject: [PATCH 19/34] revert comment --- src/libs/Environment/Environment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Environment/Environment.js b/src/libs/Environment/Environment.js index c46e21bf63da..bdba9f20d12d 100644 --- a/src/libs/Environment/Environment.js +++ b/src/libs/Environment/Environment.js @@ -26,7 +26,7 @@ function isDevelopment() { } /** - * Asynchornously get the URL based on the environment we are in + * Get the URL based on the environment we are in * * @returns {Promise} */ From 441d800db738823bc4b758b7185ccb87cb5364c8 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:28:08 -0500 Subject: [PATCH 20/34] use screen const --- src/libs/Navigation/Navigation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index bd58b99c95d3..da096d50bd54 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -11,6 +11,7 @@ import DeprecatedCustomActions from './DeprecatedCustomActions'; import ONYXKEYS from '../../ONYXKEYS'; import linkingConfig from './linkingConfig'; import navigationRef from './navigationRef'; +import SCREENS from '../../SCREENS'; let resolveNavigationIsReadyPromise; const navigationIsReadyPromise = new Promise((resolve) => { @@ -173,7 +174,7 @@ function navigate(route = ROUTES.HOME) { // If we're navigating to the signIn page while logged out, pop whatever screen is on top // since it's guaranteed that the sign in page will be underneath (since it's the initial route). // Also, if we're coming from a link to validate login (pendingRoute is not null), we want to pop the loading screen. - navigationRef.current.dispatch(CommonActions.reset({index: 0, routes: [{name: 'Home'}]})); + navigationRef.current.dispatch(CommonActions.reset({index: 0, routes: [{name: SCREENS.HOME}]})); return; } From f9a7df395b2b52f19d612e869563ad3999edbff2 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:31:15 -0500 Subject: [PATCH 21/34] use onPress --- src/pages/signin/SignInPageLayout/Footer.js | 48 ++++++++------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index 7e41e84fd078..476d097dcde1 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -13,7 +13,6 @@ import Licenses from '../Licenses'; import Socials from '../Socials'; import Hoverable from '../../../components/Hoverable'; import CONST from '../../../CONST'; -import * as Environment from '../../../libs/Environment/Environment'; import Navigation from '../../../libs/Navigation/Navigation'; import ROUTES from '../../../ROUTES'; import * as Session from '../../../libs/actions/Session'; @@ -23,6 +22,11 @@ const propTypes = { ...withLocalizePropTypes, }; +const navigateHome = () => { + Navigation.navigate(ROUTES.HOME); + Session.clearSignInData(); +} + const columns = [ { translationPath: 'footer.features', @@ -127,11 +131,11 @@ const columns = [ translationPath: 'footer.getStarted', rows: [ { - navigateRoute: Environment.getEnvironmentURL(), + onPress: navigateHome, translationPath: 'footer.createAccount', }, { - navigateRoute: Environment.getEnvironmentURL(), + onPress: navigateHome, translationPath: 'footer.logIn', }, ], @@ -162,33 +166,19 @@ const Footer = (props) => { {_.map(column.rows, row => ( - _.has(row, 'navigateRoute') ? ( - { - Navigation.navigate(ROUTES.HOME); - Session.clearSignInData(); - }} - > - - {props.translate(row.translationPath)} - - - ) - : ( - + {hovered => ( + - {hovered => ( - - {props.translate(row.translationPath)} - - )} - - ) + {props.translate(row.translationPath)} + + )} + ))} {(i === 2) && ( From 730ac2373849a70611224f2f94bc3ac4cee3d63b Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:33:57 -0500 Subject: [PATCH 22/34] clean up --- src/pages/signin/SignInPageLayout/Footer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index 476d097dcde1..4b00cc7c256b 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -1,4 +1,4 @@ -import {View, Pressable} from 'react-native'; +import {View} from 'react-native'; import React from 'react'; import _ from 'underscore'; import Text from '../../../components/Text'; @@ -24,8 +24,10 @@ const propTypes = { const navigateHome = () => { Navigation.navigate(ROUTES.HOME); + + // We need to clear sign in data in case the user is already in the ValidateCodeForm or PasswordForm pages Session.clearSignInData(); -} +}; const columns = [ { From 6f0902e74c062e9bf95aec34a384dc5140113adc Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 9 Mar 2023 17:34:46 -0500 Subject: [PATCH 23/34] rm routes --- src/pages/signin/SignInPageLayout/Footer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js index 4b00cc7c256b..99ace5d47176 100644 --- a/src/pages/signin/SignInPageLayout/Footer.js +++ b/src/pages/signin/SignInPageLayout/Footer.js @@ -14,7 +14,6 @@ import Socials from '../Socials'; import Hoverable from '../../../components/Hoverable'; import CONST from '../../../CONST'; import Navigation from '../../../libs/Navigation/Navigation'; -import ROUTES from '../../../ROUTES'; import * as Session from '../../../libs/actions/Session'; const propTypes = { @@ -23,7 +22,7 @@ const propTypes = { }; const navigateHome = () => { - Navigation.navigate(ROUTES.HOME); + Navigation.navigate(); // We need to clear sign in data in case the user is already in the ValidateCodeForm or PasswordForm pages Session.clearSignInData(); From be8ea3b200413dae9d7680c9a8c691057f35139a Mon Sep 17 00:00:00 2001 From: christianwenifr Date: Sat, 11 Mar 2023 15:54:33 +0700 Subject: [PATCH 24/34] fix: issue --- src/libs/Navigation/AppNavigator/PublicScreens.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/PublicScreens.js b/src/libs/Navigation/AppNavigator/PublicScreens.js index ea209b043307..855efccad709 100644 --- a/src/libs/Navigation/AppNavigator/PublicScreens.js +++ b/src/libs/Navigation/AppNavigator/PublicScreens.js @@ -4,7 +4,6 @@ import SignInPage from '../../../pages/signin/SignInPage'; import SetPasswordPage from '../../../pages/SetPasswordPage'; import ValidateLoginPage from '../../../pages/ValidateLoginPage'; import LogInWithShortLivedAuthTokenPage from '../../../pages/LogInWithShortLivedAuthTokenPage'; -import ConciergePage from '../../../pages/ConciergePage'; import SCREENS from '../../../SCREENS'; import defaultScreenOptions from './defaultScreenOptions'; @@ -32,11 +31,6 @@ const PublicScreens = () => ( options={defaultScreenOptions} component={SetPasswordPage} /> - ); From e7259a2bae74dabc449303bd704b8c3d7053a8ed Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Sun, 12 Mar 2023 15:00:44 -0400 Subject: [PATCH 25/34] Fix crash if getAvatar returns function --- src/libs/ReportUtils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 7bcb9b34c6be..1b087e6727cd 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -568,11 +568,13 @@ function getFullSizeAvatar(avatarURL, login) { */ function getSmallSizeAvatar(avatarURL, login) { const source = getAvatar(avatarURL, login); - const lastPeriodIndex = source.lastIndexOf('.'); + if (!_.isString(source)) { + return source; + } - // If image source is not a String (so wouldn't have _128) or already has _128 at the end, - // given avatar URL is already what we want to use here. - if (!_.isString(source) || source.substring(lastPeriodIndex - 4, lastPeriodIndex) === '_128') { + // If image source already has _128 at the end, the given avatar URL is already what we want to use here. + const lastPeriodIndex = source.lastIndexOf('.'); + if (source.substring(lastPeriodIndex - 4, lastPeriodIndex) === '_128') { return source; } return `${source.substring(0, lastPeriodIndex)}_128${source.substring(lastPeriodIndex)}`; From 2ce9dc7643e1f1a13e613fcb4dbf64da63c9e998 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 14 Mar 2023 21:29:45 -0700 Subject: [PATCH 26/34] fix inconsistent phone number validation --- src/libs/LoginUtils.js | 22 ++++++++++++++++++++++ src/libs/OptionsListUtils.js | 12 +++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/libs/LoginUtils.js b/src/libs/LoginUtils.js index 4c7e8a7d3d48..c467e8488d72 100644 --- a/src/libs/LoginUtils.js +++ b/src/libs/LoginUtils.js @@ -1,4 +1,13 @@ +import Str from 'expensify-common/lib/str'; +import Onyx from 'react-native-onyx'; import CONST from '../CONST'; +import ONYXKEYS from '../ONYXKEYS'; + +let countryCodeByIP; +Onyx.connect({ + key: ONYXKEYS.COUNTRY_CODE, + callback: val => countryCodeByIP = val || 1, +}); /** * Remove the special chars from the phone number @@ -20,7 +29,20 @@ function getPhoneNumberWithoutUSCountryCodeAndSpecialChars(phone) { return getPhoneNumberWithoutSpecialChars(phone.replace(/^\+1/, '')); } +/** + * Append user country code to the phone number + * + * @param {String} phone + * @return {String} + */ +function appendCountryCode(phone) { + return (Str.isValidPhone(phone) && !phone.includes('+')) + ? `+${countryCodeByIP}${phone}` + : phone; +} + export { getPhoneNumberWithoutSpecialChars, getPhoneNumberWithoutUSCountryCodeAndSpecialChars, + appendCountryCode, }; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index bf88721ae0a0..2589c2ed620c 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -10,6 +10,7 @@ import * as Localize from './Localize'; import Permissions from './Permissions'; import * as CollectionUtils from './CollectionUtils'; import Navigation from './Navigation/Navigation'; +import * as LoginUtils from './LoginUtils'; /** * OptionsListUtils is used to build a list options passed to the OptionsList component. Several different UI views can @@ -580,9 +581,8 @@ function getOptions(reports, personalDetails, { // If the phone number doesn't have an international code then let's prefix it with the // current user's international code based on their IP address. - const login = (Str.isValidPhone(searchValue) && !searchValue.includes('+')) - ? `+${countryCodeByIP}${searchValue}` - : searchValue; + const login = LoginUtils.appendCountryCode(searchValue); + if (login && (noOptions || noOptionsMatchExactly) && !isCurrentUser({login}) && _.every(selectedOptions, option => option.login !== login) @@ -764,14 +764,16 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma return Localize.translate(preferredLocale, 'common.maxParticipantsReached', {count: CONST.REPORT.MAXIMUM_PARTICIPANTS}); } - if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !Str.isValidPhone(searchValue)) { + const isValidPhone = Str.isValidPhone(LoginUtils.appendCountryCode(searchValue)); + + if (searchValue && !isValidPhone) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidPhone'); } // Without a search value, it would be very confusing to see a search validation message. // Therefore, this skips the validation when there is no search value. if (searchValue && !hasSelectableOptions && !hasUserToInvite) { - if (/^\d+$/.test(searchValue) && !Str.isValidPhone(searchValue)) { + if (!isValidPhone) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidPhone'); } From b4ec721a56bfd8de5cd4a149655d26d2c87b4990 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 14 Mar 2023 23:16:43 -0700 Subject: [PATCH 27/34] adding back removed condition --- src/libs/OptionsListUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 2589c2ed620c..2b91b20462a4 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -766,14 +766,14 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma const isValidPhone = Str.isValidPhone(LoginUtils.appendCountryCode(searchValue)); - if (searchValue && !isValidPhone) { + if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !isValidPhone) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidPhone'); } // Without a search value, it would be very confusing to see a search validation message. // Therefore, this skips the validation when there is no search value. if (searchValue && !hasSelectableOptions && !hasUserToInvite) { - if (!isValidPhone) { + if (/^\d+$/.test(searchValue) && !isValidPhone) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidPhone'); } From cffd93893407983e0ed6d7ae96790b96068267ef Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 14 Mar 2023 23:18:58 -0700 Subject: [PATCH 28/34] fix lint --- src/libs/LoginUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/LoginUtils.js b/src/libs/LoginUtils.js index c467e8488d72..c4f160f8cf40 100644 --- a/src/libs/LoginUtils.js +++ b/src/libs/LoginUtils.js @@ -31,7 +31,7 @@ function getPhoneNumberWithoutUSCountryCodeAndSpecialChars(phone) { /** * Append user country code to the phone number - * + * * @param {String} phone * @return {String} */ From 0e0b962dbf33d1c945812f9655836b3f87e879a9 Mon Sep 17 00:00:00 2001 From: PrashantKumar Mangukiya Date: Thu, 16 Mar 2023 21:24:55 +0530 Subject: [PATCH 29/34] Make r small within Add reaction tooltip --- src/languages/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.js b/src/languages/en.js index 13e7af912018..d9d9df4b0258 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -228,7 +228,7 @@ export default { editComment: 'Edit comment', deleteComment: 'Delete comment', deleteConfirmation: 'Are you sure you want to delete this comment?', - addReactionTooltip: 'Add Reaction', + addReactionTooltip: 'Add reaction', }, reportActionsView: { beginningOfArchivedRoomPartOne: 'You missed the party in ', From 1dca0766790919cf74610aa9981fecbfe00b2458 Mon Sep 17 00:00:00 2001 From: Abdul Rahuman Date: Fri, 17 Mar 2023 00:05:27 +0530 Subject: [PATCH 30/34] Updating secondary action validation to use markdown email regex --- .../AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js index 18d3fbf25960..5d705c0db6e7 100644 --- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js +++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js @@ -54,7 +54,7 @@ const BaseAnchorForCommentsOnly = (props) => { onSecondaryInteraction={ (event) => { ReportActionContextMenu.showContextMenu( - Str.isValidEmail(props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK, + Str.isValidEmailMarkdown(props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK, event, props.href, lodashGet(linkRef, 'current'), @@ -65,7 +65,7 @@ const BaseAnchorForCommentsOnly = (props) => { onPressIn={props.onPressIn} onPressOut={props.onPressOut} > - + linkRef = el} style={StyleSheet.flatten([props.style, defaultTextStyle])} From d4a64233dd84d33389572d12229083ffc8b5b4f3 Mon Sep 17 00:00:00 2001 From: Abdul Rahuman Date: Fri, 17 Mar 2023 02:47:44 +0530 Subject: [PATCH 31/34] Updating expensify-common package --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0783598be011..18212ac3204e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,7 @@ "babel-polyfill": "^6.26.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+https://github.com/Expensify/expensify-common.git#8451a7d7b9ebe1b7d127cc35793c95b37df2d0e7", + "expensify-common": "git+https://github.com/Expensify/expensify-common.git#64a085ac69c6944c13dee89aa36f061e11d59aab", "fbjs": "^3.0.2", "html-entities": "^1.3.1", "htmlparser2": "^7.2.0", @@ -25230,8 +25230,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#8451a7d7b9ebe1b7d127cc35793c95b37df2d0e7", - "integrity": "sha512-89a5XBVRjDCTG3hXREssghX1rA9Mov5Rjf+CWfw1wEj7KIXh+j6zI/9bC7qCnQdC5z4pZd6Wn/yHESTV6NLfDA==", + "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#64a085ac69c6944c13dee89aa36f061e11d59aab", + "integrity": "sha512-ooInMJUIErlgESVzBRLFU6s2DfKtRHXBZfwm3HFvLVYGgjpVXoSV4gVLRNEw8uXZq+c3rD3u+gIjlmtki1yOxA==", "license": "MIT", "dependencies": { "classnames": "2.3.1", @@ -64003,9 +64003,9 @@ } }, "expensify-common": { - "version": "git+ssh://git@github.com/Expensify/expensify-common.git#8451a7d7b9ebe1b7d127cc35793c95b37df2d0e7", - "integrity": "sha512-89a5XBVRjDCTG3hXREssghX1rA9Mov5Rjf+CWfw1wEj7KIXh+j6zI/9bC7qCnQdC5z4pZd6Wn/yHESTV6NLfDA==", - "from": "expensify-common@git+https://github.com/Expensify/expensify-common.git#8451a7d7b9ebe1b7d127cc35793c95b37df2d0e7", + "version": "git+ssh://git@github.com/Expensify/expensify-common.git#64a085ac69c6944c13dee89aa36f061e11d59aab", + "integrity": "sha512-ooInMJUIErlgESVzBRLFU6s2DfKtRHXBZfwm3HFvLVYGgjpVXoSV4gVLRNEw8uXZq+c3rD3u+gIjlmtki1yOxA==", + "from": "expensify-common@git+https://github.com/Expensify/expensify-common.git#64a085ac69c6944c13dee89aa36f061e11d59aab", "requires": { "classnames": "2.3.1", "clipboard": "2.0.4", diff --git a/package.json b/package.json index ba5dbd9dbbda..c63777456a43 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "babel-polyfill": "^6.26.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+https://github.com/Expensify/expensify-common.git#8451a7d7b9ebe1b7d127cc35793c95b37df2d0e7", + "expensify-common": "git+https://github.com/Expensify/expensify-common.git#64a085ac69c6944c13dee89aa36f061e11d59aab", "fbjs": "^3.0.2", "html-entities": "^1.3.1", "htmlparser2": "^7.2.0", From 356ff0925aa024150876deb7aa10e784f0cebe41 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 17 Mar 2023 13:05:58 +0700 Subject: [PATCH 32/34] fix: emoji prefix in cap is not highlighted in suggestion list --- src/libs/GetStyledTextArray.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/GetStyledTextArray.js b/src/libs/GetStyledTextArray.js index 463bed6aba26..795c8dfc41d2 100644 --- a/src/libs/GetStyledTextArray.js +++ b/src/libs/GetStyledTextArray.js @@ -8,10 +8,11 @@ import Str from 'expensify-common/lib/str'; */ const getStyledTextArray = (name, prefix) => { const texts = []; - const prefixLocation = name.search(Str.escapeForRegExp(prefix)); + const prefixLowercase = prefix.toLowerCase(); + const prefixLocation = name.search(Str.escapeForRegExp(prefixLowercase)); if (prefixLocation === 0 && prefix.length === name.length) { - texts.push({text: prefix, isColored: true}); + texts.push({text: prefixLowercase, isColored: true}); } else if (prefixLocation === 0 && prefix.length !== name.length) { texts.push( {text: name.slice(0, prefix.length), isColored: true}, From 2ad6a574f6dd177b1fc441d1a9f3e70edb987ea6 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Fri, 17 Mar 2023 08:43:40 +0000 Subject: [PATCH 33/34] Update version to 1.2.87-0 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 4 ++-- ios/NewExpensifyTests/Info.plist | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index a0f5c4c7f557..8cfa789b9417 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -156,8 +156,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001028601 - versionName "1.2.86-1" + versionCode 1001028700 + versionName "1.2.87-0" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() if (isNewArchitectureEnabled()) { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 8d10e2586eb7..97200fabe36f 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.86 + 1.2.87 CFBundleSignature ???? CFBundleURLTypes @@ -30,7 +30,7 @@ CFBundleVersion - 1.2.86.1 + 1.2.87.0 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index b3eaf609fd80..71785a31ac6a 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.2.86 + 1.2.87 CFBundleSignature ???? CFBundleVersion - 1.2.86.1 + 1.2.87.0 diff --git a/package-lock.json b/package-lock.json index 0783598be011..2cfa06d0801b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.2.86-1", + "version": "1.2.87-0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.2.86-1", + "version": "1.2.87-0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index ba5dbd9dbbda..2c5ebec4f9a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.2.86-1", + "version": "1.2.87-0", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From abd6826256a7d76d9740e691087c7e2fe56957f0 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Fri, 17 Mar 2023 10:23:38 -0400 Subject: [PATCH 34/34] Update root AASA content-type --- .github/workflows/platformDeploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 24f3b6aa9aeb..4a8a3fd732c0 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -264,11 +264,11 @@ jobs: - name: Deploy production to S3 if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }} - run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://expensify-cash/.well-known/apple-app-site-association s3://expensify-cash/.well-known/apple-app-site-association + run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://expensify-cash/.well-known/apple-app-site-association s3://expensify-cash/.well-known/apple-app-site-association && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://expensify-cash/.well-known/apple-app-site-association s3://expensify-cash/apple-app-site-association - name: Deploy staging to S3 if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }} - run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://staging-expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://staging-expensify-cash/.well-known/apple-app-site-association s3://staging-expensify-cash/.well-known/apple-app-site-association + run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://staging-expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://staging-expensify-cash/.well-known/apple-app-site-association s3://staging-expensify-cash/.well-known/apple-app-site-association && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://staging-expensify-cash/.well-known/apple-app-site-association s3://staging-expensify-cash/apple-app-site-association - name: Purge production Cloudflare cache if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}