diff --git a/android/app/build.gradle b/android/app/build.gradle index 96991561c30..34b757dc284 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 1001031303 - versionName "1.3.13-3" + versionCode 1001031304 + versionName "1.3.13-4" } splits { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index a895873eba4..2a6cbff48ca 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1.3.13.3 + 1.3.13.4 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index b9079083e65..341ee7c5936 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.13.3 + 1.3.13.4 diff --git a/package-lock.json b/package-lock.json index 22c988d36ea..df85519afb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.13-3", + "version": "1.3.13-4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.13-3", + "version": "1.3.13-4", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 8b0fb937a7a..8f3c78e1bb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.13-3", + "version": "1.3.13-4", "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/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 9839482efca..92bff8cbcb5 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -192,10 +192,10 @@ function getPersonalDetailsForLogins(logins, personalDetails) { /** * Return true if personal details data is ready, i.e. report list options can be created. * @param {Object} personalDetails - * @returns {boolean} + * @returns {Boolean} */ function isPersonalDetailsReady(personalDetails) { - return !_.isEmpty(personalDetails) && !_.some(_.keys(personalDetails), (key) => !personalDetails[key].login); + return !_.isEmpty(personalDetails) && _.some(_.keys(personalDetails), (key) => personalDetails[key].login); } /** diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index fb9adecf663..9c29161cf35 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1885,6 +1885,31 @@ function getWhisperDisplayNames(participants) { return _.map(participants, (login) => getDisplayNameForParticipant(login, !isWhisperOnlyVisibleToCurrentUSer)).join(', '); } +/** + * Show subscript on IOU or expense report + * @param {Object} report + * @returns {Boolean} + */ +function shouldReportShowSubscript(report) { + if (isArchivedRoom(report)) { + return false; + } + + if (isPolicyExpenseChat(report) && !report.isOwnPolicyExpenseChat) { + return true; + } + + return isExpenseReport(report); +} + +/** + * Return true if reports data exists + * @returns {Boolean} + */ +function isReportDataReady() { + return !_.isEmpty(allReports) && _.some(_.keys(allReports), (key) => allReports[key].reportID); +} + export { getReportParticipantsTitle, isReportMessageAttachment, @@ -1964,5 +1989,7 @@ export { canRequestMoney, getWhisperDisplayNames, getWorkspaceAvatar, + shouldReportShowSubscript, + isReportDataReady, isSettled, }; diff --git a/src/pages/NewChatPage.js b/src/pages/NewChatPage.js index 7ef2836b3e1..1765c700221 100755 --- a/src/pages/NewChatPage.js +++ b/src/pages/NewChatPage.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import OptionsSelector from '../components/OptionsSelector'; import * as OptionsListUtils from '../libs/OptionsListUtils'; +import * as ReportUtils from '../libs/ReportUtils'; import ONYXKEYS from '../ONYXKEYS'; import styles from '../styles/styles'; import * as Report from '../libs/actions/Report'; @@ -31,9 +32,6 @@ const propTypes = { /** All reports shared with the user */ reports: PropTypes.objectOf(reportPropTypes), - /** Indicates whether the reports data is ready */ - isLoadingReportData: PropTypes.bool, - ...windowDimensionsPropTypes, ...withLocalizePropTypes, @@ -44,7 +42,6 @@ const defaultProps = { betas: [], personalDetails: {}, reports: {}, - isLoadingReportData: true, }; class NewChatPage extends Component { @@ -226,7 +223,7 @@ class NewChatPage extends Component { this.state.searchTerm, maxParticipantsReached, ); - const isOptionsDataReady = !this.props.isLoadingReportData && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails); + const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails); return ( @@ -218,8 +215,5 @@ export default compose( betas: { key: ONYXKEYS.BETAS, }, - isLoadingReportData: { - key: ONYXKEYS.IS_LOADING_REPORT_DATA, - }, }), )(SearchPage); diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index a3a7ee6e33f..74a7c7961a9 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import * as OptionsListUtils from '../../../../libs/OptionsListUtils'; +import * as ReportUtils from '../../../../libs/ReportUtils'; import OptionsSelector from '../../../../components/OptionsSelector'; import ONYXKEYS from '../../../../ONYXKEYS'; import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize'; @@ -27,9 +28,6 @@ const propTypes = { /** All reports shared with the user */ reports: PropTypes.objectOf(reportPropTypes), - /** Indicates whether report data is ready */ - isLoadingReportData: PropTypes.bool, - /** padding bottom style of safe area */ safeAreaPaddingBottomStyle: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]), @@ -44,7 +42,6 @@ const defaultProps = { personalDetails: {}, reports: {}, betas: [], - isLoadingReportData: true, }; class MoneyRequestParticipantsSelector extends Component { @@ -154,7 +151,7 @@ class MoneyRequestParticipantsSelector extends Component { Boolean(this.state.userToInvite), this.state.searchTerm, ); - const isOptionsDataReady = !this.props.isLoadingReportData && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails); + const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails); return ( 0 ? this.props.safeAreaPaddingBottomStyle : {}]}> @@ -254,8 +251,5 @@ export default compose( betas: { key: ONYXKEYS.BETAS, }, - isLoadingReportData: { - key: ONYXKEYS.IS_LOADING_REPORT_DATA, - }, }), )(MoneyRequestParticipantsSplitSelector);