diff --git a/android/app/build.gradle b/android/app/build.gradle index 323f9011a0bb..be725a09e9a2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -106,8 +106,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001033004 - versionName "1.3.30-4" + versionCode 1001033005 + versionName "1.3.30-5" } splits { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 2e21547e0153..0da3e5b8286a 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -32,7 +32,7 @@ CFBundleVersion - 1.3.30.4 + 1.3.30.5 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index f0c72b026d1c..b6ccaca2a2bd 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.30.4 + 1.3.30.5 diff --git a/package-lock.json b/package-lock.json index 445f8dfd3065..bf1d1e1a22e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.30-4", + "version": "1.3.30-5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.30-4", + "version": "1.3.30-5", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e42e7d95ce15..8c96da4b423c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.30-4", + "version": "1.3.30-5", "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.", diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 3e541b1dd854..c5c5aa2250c3 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -346,8 +346,9 @@ function addComment(reportID, text) { * @param {Object} newReportObject The optimistic report object created when making a new chat, saved as optimistic data * @param {String} parentReportActionID The parent report action that a thread was created from (only passed for new threads) * @param {Boolean} isFromDeepLink Whether or not this report is being opened from a deep link + * @param {Array} participantAccountIDList The list of accountIDs that are included in a new chat, not including the user creating it */ -function openReport(reportID, participantLoginList = [], newReportObject = {}, parentReportActionID = '0', isFromDeepLink = false) { +function openReport(reportID, participantLoginList = [], newReportObject = {}, parentReportActionID = '0', isFromDeepLink = false, participantAccountIDList = []) { const optimisticReportData = { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, @@ -388,6 +389,7 @@ function openReport(reportID, participantLoginList = [], newReportObject = {}, p const params = { reportID, emailList: participantLoginList ? participantLoginList.join(',') : '', + accountIDList: participantAccountIDList ? participantAccountIDList.join(',') : '', parentReportActionID, }; @@ -494,6 +496,24 @@ function navigateToAndOpenReport(userLogins) { Navigation.dismissModal(reportID); } +/** + * This will find an existing chat, or create a new one if none exists, for the given accountID or set of accountIDs. It will then navigate to this chat. + * + * @param {Array} participantAccountIDs of user logins to start a chat report with. + */ +function navigateToAndOpenReportWithAccountIDs(participantAccountIDs) { + let newChat = {}; + const chat = ReportUtils.getChatByParticipants(participantAccountIDs); + if (!chat) { + newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs); + } + const reportID = chat ? chat.reportID : newChat.reportID; + + // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server + openReport(reportID, [], newChat, '0', false, participantAccountIDs); + Navigation.dismissModal(reportID); +} + /** * This will navigate to an existing thread, or create a new one if necessary * @@ -1827,6 +1847,7 @@ export { openReport, openReportFromDeepLink, navigateToAndOpenReport, + navigateToAndOpenReportWithAccountIDs, navigateToAndOpenChildReport, updatePolicyRoomNameAndNavigate, clearPolicyRoomNameErrors, diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 41a5d153f0cc..2b69c541c44d 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -6,6 +6,7 @@ import {withOnyx} from 'react-native-onyx'; import Str from 'expensify-common/lib/str'; import lodashGet from 'lodash/get'; import {parsePhoneNumber} from 'awesome-phonenumber'; +import * as Session from '../libs/actions/Session'; import styles from '../styles/styles'; import Text from '../components/Text'; import ONYXKEYS from '../ONYXKEYS'; @@ -90,7 +91,7 @@ const getPhoneNumber = (details) => { }; function ProfilePage(props) { - const accountID = lodashGet(props.route.params, 'accountID', 0); + const accountID = Number(lodashGet(props.route.params, 'accountID', 0)); // eslint-disable-next-line rulesdir/prefer-early-return useEffect(() => { @@ -200,11 +201,11 @@ function ProfilePage(props) { ) : null} {shouldShowLocalTime && } - {!isCurrentUser && Boolean(login) && ( + {!isCurrentUser && !Session.isAnonymousUser() && ( Report.navigateToAndOpenReport([login])} + onPress={() => Report.navigateToAndOpenReportWithAccountIDs([accountID])} wrapperStyle={styles.breakAll} shouldShowRightIcon />