Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mobile-Expensify
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009028102
versionName "9.2.81-2"
versionCode 1009028103
versionName "9.2.81-3"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.2.81.2</string>
<string>9.2.81.3</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.2.81</string>
<key>CFBundleVersion</key>
<string>9.2.81.2</string>
<string>9.2.81.3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ShareViewController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.2.81</string>
<key>CFBundleVersion</key>
<string>9.2.81.2</string>
<string>9.2.81.3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
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": "9.2.81-2",
"version": "9.2.81-3",
"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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6692,6 +6692,7 @@ const CONST = {
APPROVED: this.TABLE_COLUMNS.APPROVED,
POSTED: this.TABLE_COLUMNS.POSTED,
MERCHANT: this.TABLE_COLUMNS.MERCHANT,
DESCRIPTION: this.TABLE_COLUMNS.DESCRIPTION,
FROM: this.TABLE_COLUMNS.FROM,
TO: this.TABLE_COLUMNS.TO,
CATEGORY: this.TABLE_COLUMNS.CATEGORY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {View} from 'react-native';
import type {TupleToUnion} from 'type-fest';
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
import Checkbox from '@components/Checkbox';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import Modal from '@components/Modal';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -65,7 +64,6 @@ import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {columnsSelector} from '@src/selectors/AdvancedSearchFiltersForm';
import type * as OnyxTypes from '@src/types/onyx';
import type {PendingAction} from '@src/types/onyx/OnyxCommon';
import MoneyRequestReportGroupHeader from './MoneyRequestReportGroupHeader';
Expand Down Expand Up @@ -165,7 +163,7 @@ function MoneyRequestReportTransactionList({
useCopySelectionHelper();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Location']);
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Location', 'CheckSquare']);
const {translate, localeCompare} = useLocalize();
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
Expand All @@ -184,7 +182,6 @@ function MoneyRequestReportTransactionList({
const shouldShowAddExpenseButton = canAddTransaction(report, isReportArchived) && isCurrentUserSubmitter(report);
const [lastDistanceExpenseType] = useOnyx(ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE, {canBeMissing: true});
const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY, {canBeMissing: true});
const [visibleColumns] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true, selector: columnsSelector});

const shouldShowGroupedTransactions = isExpenseReport(report) && !isIOUReport(report);

Expand Down Expand Up @@ -268,9 +265,9 @@ function MoneyRequestReportTransactionList({
}, [newTransactions, sortBy, sortOrder, transactions, localeCompare, report]);

const columnsToShow = useMemo(() => {
const columns = getColumnsToShow(currentUserDetails?.accountID, transactions, visibleColumns, true);
const columns = getColumnsToShow(currentUserDetails?.accountID, transactions, [], true);
return (Object.keys(columns) as SearchColumnType[]).filter((column) => columns[column]);
}, [transactions, currentUserDetails?.accountID, visibleColumns]);
}, [transactions, currentUserDetails?.accountID]);

const currentGroupBy = getReportLayoutGroupBy(reportLayoutGroupBy);

Expand Down Expand Up @@ -638,7 +635,7 @@ function MoneyRequestReportTransactionList({
>
<MenuItem
title={translate('common.select')}
icon={Expensicons.CheckSquare}
icon={expensifyIcons.CheckSquare}
onPress={() => {
if (!isMobileSelectionModeEnabled) {
turnOnMobileSelectionMode();
Expand Down
31 changes: 27 additions & 4 deletions src/components/Search/SearchList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {isUserValidatedSelector} from '@selectors/Account';
import {accountIDSelector} from '@selectors/Session';
import {tierNameSelector} from '@selectors/UserWallet';
import type {FlashListProps, FlashListRef, ViewToken} from '@shopify/flash-list';
import React, {useCallback, useContext, useImperativeHandle, useMemo, useRef, useState} from 'react';
import React, {useCallback, useContext, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState} from 'react';
import type {ForwardedRef} from 'react';
import {View} from 'react-native';
import type {NativeSyntheticEvent, StyleProp, ViewStyle} from 'react-native';
// eslint-disable-next-line no-restricted-imports
import type {NativeScrollEvent, NativeSyntheticEvent, ScrollView as RNScrollView, StyleProp, ViewStyle} from 'react-native';
import Animated, {Easing, FadeOutUp, LinearTransition} from 'react-native-reanimated';
import Checkbox from '@components/Checkbox';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import Modal from '@components/Modal';
import {usePersonalDetails} from '@components/OnyxListItemProvider';
Expand All @@ -31,6 +31,7 @@ import type {
} from '@components/SelectionListWithSections/types';
import Text from '@components/Text';
import useKeyboardState from '@hooks/useKeyboardState';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -51,6 +52,9 @@ import BaseSearchList from './BaseSearchList';

const easing = Easing.bezier(0.76, 0.0, 0.24, 1.0);

// Keep a ref to the horizontal scroll offset so we can restore it if users change the search query
let savedHorizontalScrollOffset = 0;

type SearchListItem = TransactionListItemType | TransactionGroupListItemType | ReportActionListItemType | TaskListItemType;
type SearchListItemComponentType = typeof TransactionListItem | typeof ChatListItem | typeof TransactionGroupListItem | typeof TaskListItem;

Expand Down Expand Up @@ -175,6 +179,7 @@ function SearchList({
ref,
}: SearchListProps) {
const styles = useThemeStyles();
const expensifyIcons = useMemoizedLazyExpensifyIcons(['CheckSquare']);

const {hash, groupBy, type} = queryJSON;
const flattenedItems = useMemo(() => {
Expand Down Expand Up @@ -233,6 +238,20 @@ function SearchList({
const minTableWidth = getTableMinWidth(columns);
const shouldScrollHorizontally = !!SearchTableHeader && minTableWidth > windowWidth;

const horizontalScrollViewRef = useRef<RNScrollView>(null);

const handleHorizontalScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
savedHorizontalScrollOffset = event.nativeEvent.contentOffset.x;
}, []);

// Restore horizontal scroll position synchronously before paint using useLayoutEffect to avoid a visible shift on the table
useLayoutEffect(() => {
if (!shouldScrollHorizontally || savedHorizontalScrollOffset <= 0) {
return;
}
horizontalScrollViewRef.current?.scrollTo({x: savedHorizontalScrollOffset, animated: false});
}, [data, shouldScrollHorizontally]);

const handleLongPressRow = useCallback(
(item: SearchListItem, itemTransactions?: TransactionListItemType[]) => {
const currentRoute = navigationRef.current?.getCurrentRoute();
Expand Down Expand Up @@ -442,7 +461,7 @@ function SearchList({
>
<MenuItem
title={translate('common.select')}
icon={Expensicons.CheckSquare}
icon={expensifyIcons.CheckSquare}
onPress={turnOnSelectionMode}
/>
</Modal>
Expand All @@ -452,10 +471,14 @@ function SearchList({
if (shouldScrollHorizontally) {
return (
<ScrollView
ref={horizontalScrollViewRef}
horizontal
showsHorizontalScrollIndicator
style={styles.flex1}
contentContainerStyle={{width: minTableWidth}}
contentOffset={{x: savedHorizontalScrollOffset, y: 0}}
onScroll={handleHorizontalScroll}
scrollEventThrottle={16}
>
{content}
</ScrollView>
Expand Down
39 changes: 7 additions & 32 deletions src/components/Search/SearchPageHeader/SearchFiltersBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {useIsFocused} from '@react-navigation/native';
import {isUserValidatedSelector} from '@selectors/Account';
import {emailSelector} from '@selectors/Session';
import {searchResultsErrorSelector} from '@selectors/Snapshot';
import React, {useCallback, useContext, useEffect, useMemo, useRef} from 'react';
import React, {useCallback, useContext, useMemo, useRef} from 'react';
import type {ReactNode} from 'react';
import {FlatList, View} from 'react-native';
import Button from '@components/Button';
Expand Down Expand Up @@ -36,14 +35,14 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWorkspaceList from '@hooks/useWorkspaceList';
import {close} from '@libs/actions/Modal';
import {handleBulkPayItemSelected, updateAdvancedFilters} from '@libs/actions/Search';
import {handleBulkPayItemSelected} from '@libs/actions/Search';
import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
import DateUtils from '@libs/DateUtils';
import Navigation from '@libs/Navigation/Navigation';
import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
import {getActiveAdminWorkspaces, getAllTaxRates, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {getActiveAdminWorkspaces, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {isExpenseReport} from '@libs/ReportUtils';
import {buildFilterFormValuesFromQuery, buildQueryStringFromFilterFormValues, isFilterSupported, isSearchDatePreset} from '@libs/SearchQueryUtils';
import {buildQueryStringFromFilterFormValues, isFilterSupported, isSearchDatePreset} from '@libs/SearchQueryUtils';
import {getDatePresets, getFeedOptions, getGroupByOptions, getGroupCurrencyOptions, getHasOptions, getStatusOptions, getTypeOptions, getWithdrawalTypeOptions} from '@libs/SearchUIUtils';
import shouldAdjustScroll from '@libs/shouldAdjustScroll';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -84,10 +83,10 @@ function SearchFiltersBar({
confirmPayment,
latestBankItems,
}: SearchFiltersBarProps) {
const isFocused = useIsFocused();
const scrollRef = useRef<FlatList<FilterItem>>(null);
const currentPolicy = usePolicy(currentSelectedPolicyID);
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector, canBeMissing: true});
const [filterFormValues = getEmptyObject<Partial<SearchAdvancedFiltersForm>>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
// type, groupBy and status values are not guaranteed to respect the ts type as they come from user input
const {hash, type: unsafeType, groupBy: unsafeGroupBy, status: unsafeStatus, flatFilters} = queryJSON;
const [selectedIOUReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentSelectedReportID}`, {canBeMissing: true});
Expand All @@ -104,19 +103,14 @@ function SearchFiltersBar({

const [email] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true, selector: emailSelector});
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
const [currencyList = getEmptyObject<CurrencyList>()] = useOnyx(ONYXKEYS.CURRENCY_LIST, {canBeMissing: true});
const [policyTagsLists] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {canBeMissing: true});
const [policyCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_CATEGORIES, {canBeMissing: true});
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER, {canBeMissing: true});
const [currencyList = getEmptyObject<CurrencyList>()] = useOnyx(ONYXKEYS.CURRENCY_LIST, {canBeMissing: true});
const {isAccountLocked, showLockedAccountModal} = useContext(LockedAccountContext);
const [searchResultsErrors] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, {canBeMissing: true, selector: searchResultsErrorSelector});
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Filter', 'Columns']);

const taxRates = getAllTaxRates(allPolicies);

// Get workspace data for the filter
const {sections: workspaces, shouldShowSearchInput: shouldShowWorkspaceSearchInput} = useWorkspaceList({
policies: allPolicies,
Expand Down Expand Up @@ -148,10 +142,6 @@ function SearchFiltersBar({
return policies.some((policy) => policy.outputCurrency !== outputCurrency);
}, [allPolicies]);

const filterFormValues = useMemo(() => {
return buildFilterFormValuesFromQuery(queryJSON, policyCategories, policyTagsLists, currencyList, personalDetails, allCards, reports, taxRates);
}, [allCards, currencyList, personalDetails, policyCategories, policyTagsLists, queryJSON, reports, taxRates]);

// Get selected workspace options from filterFormValues or queryJSON
const selectedWorkspaceOptions = useMemo(() => {
const policyIDs = filterFormValues.policyID ?? queryJSON.policyID;
Expand Down Expand Up @@ -321,28 +311,13 @@ function SearchFiltersBar({
);

const openAdvancedFilters = useCallback(() => {
updateAdvancedFilters(filterFormValues, true);
Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute());
}, [filterFormValues]);
}, []);

const openSearchColumns = () => {
Navigation.navigate(ROUTES.SEARCH_COLUMNS);
};

const isFormInitializedRef = useRef(false);

useEffect(() => {
if (isFormInitializedRef.current) {
return;
}
if (filterFormValues && Object.keys(filterFormValues).length > 0) {
if (isFocused) {
updateAdvancedFilters(filterFormValues, true);
}
isFormInitializedRef.current = true;
}
}, [queryJSON, filterFormValues, isFocused]);

const typeComponent = useCallback(
({closeOverlay}: PopoverComponentProps) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {navigateToAndOpenReport} from '@libs/actions/Report';
import {clearAllFilters} from '@libs/actions/Search';
import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -214,7 +213,6 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
hideSearchRouterList?.();
setIsAutocompleteListVisible(false);
if (updatedQuery !== originalInputQuery) {
clearAllFilters();
setTextInputValue('');
setAutocompleteQueryValue('');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ActivityIndicator from '@components/ActivityIndicator';
import Button from '@components/Button';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import {PressableWithFeedback} from '@components/Pressable';
import ScrollView from '@components/ScrollView';
import type {SearchColumnType} from '@components/Search/types';
import SearchTableHeader, {getExpenseHeaders} from '@components/SelectionListWithSections/SearchTableHeader';
import type {ListItem, TransactionGroupListExpandedProps, TransactionListItemType} from '@components/SelectionListWithSections/types';
Expand All @@ -16,9 +17,10 @@ import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {getReportIDForTransaction} from '@libs/MoneyRequestReportUtils';
import Navigation from '@libs/Navigation/Navigation';
import {createAndOpenSearchTransactionThread, getColumnsToShow} from '@libs/SearchUIUtils';
import {createAndOpenSearchTransactionThread, getColumnsToShow, getTableMinWidth} from '@libs/SearchUIUtils';
import {getTransactionViolations} from '@libs/TransactionUtils';
import {setActiveTransactionIDs} from '@userActions/TransactionThreadNavigation';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -50,6 +52,7 @@ function TransactionGroupListExpanded<TItem extends ListItem>({
}: TransactionGroupListExpandedProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
const {windowWidth} = useWindowDimensions();
const currentUserDetails = useCurrentUserPersonalDetails();
const {translate} = useLocalize();
const [isMobileSelectionModeEnabled] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE, {canBeMissing: true});
Expand Down Expand Up @@ -174,8 +177,11 @@ function TransactionGroupListExpanded<TItem extends ListItem>({
openReportInRHP(transaction);
};

return (
<>
const minTableWidth = getTableMinWidth(columns ?? []);
const shouldScrollHorizontally = isLargeScreenWidth && minTableWidth > windowWidth;

const content = (
<View style={[styles.flexColumn, styles.flex1]}>
{isLargeScreenWidth && (
<View style={[styles.searchListHeaderContainerStyle, styles.groupSearchListTableContainerStyle, styles.bgTransparent, styles.pl9, styles.pr11]}>
<SearchTableHeader
Expand Down Expand Up @@ -270,7 +276,20 @@ function TransactionGroupListExpanded<TItem extends ListItem>({
/>
</View>
)}
</>
</View>
);

return shouldScrollHorizontally ? (
<ScrollView
horizontal
showsHorizontalScrollIndicator
style={styles.flex1}
contentContainerStyle={{width: minTableWidth}}
>
{content}
</ScrollView>
) : (
content
);
}

Expand Down
Loading