Skip to content

Commit

Permalink
Merge pull request #7243 from Expensify/update-staging-from-main
Browse files Browse the repository at this point in the history
  • Loading branch information
OSBotify authored Jan 14, 2022
2 parents 772de34 + a5439dc commit 91c7972
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 37 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001012907
versionName "1.1.29-7"
versionCode 1001012908
versionName "1.1.29-8"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.29.7</string>
<string>1.1.29.8</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.1.29.7</string>
<string>1.1.29.8</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion 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.1.29-7",
"version": "1.1.29-8",
"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
38 changes: 23 additions & 15 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ function getOptions(reports, personalDetails, activeReportID, {
includeRecentReports = false,
prioritizePinnedReports = false,
prioritizeDefaultRoomsInSearch = false,

// When sortByReportTypeInSearch flag is true, recentReports will include the personalDetails options as well.
sortByReportTypeInSearch = false,
sortByLastMessageTimestamp = false,
searchValue = '',
Expand All @@ -371,7 +373,7 @@ function getOptions(reports, personalDetails, activeReportID, {
}) {
let recentReportOptions = [];
const pinnedReportOptions = [];
const personalDetailsOptions = [];
let personalDetailsOptions = [];
const iouDebtReportOptions = [];
const draftReportOptions = [];

Expand All @@ -383,7 +385,10 @@ function getOptions(reports, personalDetails, activeReportID, {
sortProperty = ['reportName'];
}
const sortDirection = [sortByAlphaAsc ? 'asc' : 'desc'];
const orderedReports = lodashOrderBy(reports, sortProperty, sortDirection);
let orderedReports = lodashOrderBy(reports, sortProperty, sortDirection);

// Move the archived Rooms to the last
orderedReports = _.sortBy(orderedReports, report => ReportUtils.isArchivedRoom(report));

const allReportOptions = [];
_.each(orderedReports, (report) => {
Expand Down Expand Up @@ -517,19 +522,6 @@ function getOptions(reports, personalDetails, activeReportID, {
recentReportOptions = reportsSplitByDefaultChatRoom[0].concat(reportsSplitByDefaultChatRoom[1]);
}

// If we are prioritizing 1:1 chats in search, do it only once we started searching
if (sortByReportTypeInSearch && searchValue !== '') {
recentReportOptions = lodashOrderBy(recentReportOptions, [(option) => {
if (option.isChatRoom || option.isArchivedRoom) {
return 3;
}
if (!option.login) {
return 2;
}
return 1;
}], ['asc']);
}

if (includePersonalDetails) {
// Next loop over all personal details removing any that are selectedUsers or recentChats
_.each(allPersonalDetailsOptions, (personalDetailOption) => {
Expand Down Expand Up @@ -569,6 +561,22 @@ function getOptions(reports, personalDetails, activeReportID, {
userToInvite.icons = [defaultAvatarForUserToInvite];
}

// If we are prioritizing 1:1 chats in search, do it only once we started searching
if (sortByReportTypeInSearch && searchValue !== '') {
// When sortByReportTypeInSearch is true, recentReports will be returned with all the reports including personalDetailsOptions in the correct Order.
recentReportOptions.push(...personalDetailsOptions);
personalDetailsOptions = [];
recentReportOptions = lodashOrderBy(recentReportOptions, [(option) => {
if (option.isChatRoom || option.isArchivedRoom) {
return 3;
}
if (!option.login) {
return 2;
}
return 1;
}], ['asc']);
}

return {
personalDetails: personalDetailsOptions,
recentReports: recentReportOptions,
Expand Down
38 changes: 22 additions & 16 deletions src/pages/SearchPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,18 @@ class SearchPage extends Component {
* @returns {Array}
*/
getSections() {
const sections = [{
title: this.props.translate('common.recents'),
data: this.state.recentReports.concat(this.state.personalDetails),
shouldShow: true,
indexOffset: 0,
}];
const sections = [
{
data: this.state.recentReports,
shouldShow: true,
indexOffset: 0,
},
{
data: this.state.personalDetails,
shouldShow: true,
indexOffset: this.state.recentReports.length,
},
];

if (this.state.userToInvite) {
sections.push(({
Expand Down Expand Up @@ -169,16 +175,16 @@ class SearchPage extends Component {
<View style={[styles.flex1, styles.w100, styles.pRelative]}>
<FullScreenLoadingIndicator visible={!didScreenTransitionEnd} />
{didScreenTransitionEnd && (
<OptionsSelector
sections={sections}
value={this.state.searchValue}
onSelectRow={this.selectReport}
onChangeText={this.onChangeText}
headerMessage={headerMessage}
hideSectionHeaders
hideAdditionalOptionStates
showTitleTooltip
/>
<OptionsSelector
sections={sections}
value={this.state.searchValue}
onSelectRow={this.selectReport}
onChangeText={this.onChangeText}
headerMessage={headerMessage}
hideSectionHeaders
hideAdditionalOptionStates
showTitleTooltip
/>
)}
</View>
<KeyboardSpacer />
Expand Down

0 comments on commit 91c7972

Please sign in to comment.