Skip to content

Commit

Permalink
Merge pull request #18901 from Expensify/OSBotify-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-18788

🍒 Cherry pick PR #18788 to staging 🍒
  • Loading branch information
mountiny committed May 14, 2023
2 parents 010ca0f + 0dcc2dc commit cfd4858
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 41 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.13.3</string>
<string>1.3.13.4</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.13.3</string>
<string>1.3.13.4</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
27 changes: 27 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1964,5 +1989,7 @@ export {
canRequestMoney,
getWhisperDisplayNames,
getWorkspaceAvatar,
shouldReportShowSubscript,
isReportDataReady,
isSettled,
};
10 changes: 2 additions & 8 deletions src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand All @@ -44,7 +42,6 @@ const defaultProps = {
betas: [],
personalDetails: {},
reports: {},
isLoadingReportData: true,
};

class NewChatPage extends Component {
Expand Down Expand Up @@ -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 (
<ScreenWrapper
Expand Down Expand Up @@ -281,8 +278,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isLoadingReportData: {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
},
}),
)(NewChatPage);
10 changes: 2 additions & 8 deletions src/pages/SearchPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 Navigation from '../libs/Navigation/Navigation';
Expand Down Expand Up @@ -33,9 +34,6 @@ const propTypes = {
/** All reports shared with the user */
reports: PropTypes.objectOf(reportPropTypes),

/** Indicates whether report data is ready */
isLoadingReportData: PropTypes.bool,

/** Window Dimensions Props */
...windowDimensionsPropTypes,

Expand All @@ -46,7 +44,6 @@ const defaultProps = {
betas: [],
personalDetails: {},
reports: {},
isLoadingReportData: true,
};

class SearchPage extends Component {
Expand Down Expand Up @@ -170,7 +167,7 @@ class SearchPage extends Component {

render() {
const sections = this.getSections();
const isOptionsDataReady = !this.props.isLoadingReportData && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails);
const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(this.props.personalDetails);

return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
Expand Down Expand Up @@ -218,8 +215,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isLoadingReportData: {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
},
}),
)(SearchPage);
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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]),

Expand All @@ -44,7 +42,6 @@ const defaultProps = {
personalDetails: {},
reports: {},
betas: [],
isLoadingReportData: true,
};

class MoneyRequestParticipantsSelector extends Component {
Expand Down Expand Up @@ -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 (
<OptionsSelector
Expand Down Expand Up @@ -187,8 +184,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isLoadingReportData: {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
},
}),
)(MoneyRequestParticipantsSelector);
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ONYXKEYS from '../../../../ONYXKEYS';
import styles from '../../../../styles/styles';
import OptionsSelector from '../../../../components/OptionsSelector';
import * as OptionsListUtils from '../../../../libs/OptionsListUtils';
import * as ReportUtils from '../../../../libs/ReportUtils';
import CONST from '../../../../CONST';
import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize';
import compose from '../../../../libs/compose';
Expand Down Expand Up @@ -48,9 +49,6 @@ const propTypes = {
/** padding bottom style of safe area */
safeAreaPaddingBottomStyle: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),

/** Indicates whether report data is ready */
isLoadingReportData: PropTypes.bool,

...withLocalizePropTypes,
};

Expand All @@ -60,7 +58,6 @@ const defaultProps = {
personalDetails: {},
reports: {},
safeAreaPaddingBottomStyle: {},
isLoadingReportData: true,
};

class MoneyRequestParticipantsSplitSelector extends Component {
Expand Down Expand Up @@ -213,7 +210,7 @@ class MoneyRequestParticipantsSplitSelector 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 (
<View style={[styles.flex1, styles.w100, this.props.participants.length > 0 ? this.props.safeAreaPaddingBottomStyle : {}]}>
Expand Down Expand Up @@ -254,8 +251,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isLoadingReportData: {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
},
}),
)(MoneyRequestParticipantsSplitSelector);

0 comments on commit cfd4858

Please sign in to comment.