Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Expensify/App into nikki-saml-use-post
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkiWines committed Nov 28, 2024
2 parents 3f678b6 + ba9f9d5 commit 4d57937
Show file tree
Hide file tree
Showing 47 changed files with 391 additions and 746 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009006800
versionName "9.0.68-0"
versionCode 1009006801
versionName "9.0.68-1"
// 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 @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.0.68.0</string>
<string>9.0.68.1</string>
<key>FullStory</key>
<dict>
<key>OrgId</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>9.0.68.0</string>
<string>9.0.68.1</string>
</dict>
</plist>
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.0.68</string>
<key>CFBundleVersion</key>
<string>9.0.68.0</string>
<string>9.0.68.1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</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.0.68-0",
"version": "9.0.68-1",
"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: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,6 @@ const CONST = {
CONFIGURE_REIMBURSEMENT_SETTINGS_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/workspaces/Configure-Reimbursement-Settings',
COPILOT_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Assign-or-remove-a-Copilot',
DELAYED_SUBMISSION_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/reports/Automatically-submit-employee-reports',
PLAN_TYPES_AND_PRICING_HELP_URL: 'https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Plan-types-and-pricing',
// Use Environment.getEnvironmentURL to get the complete URL with port number
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
NAVATTIC: {
Expand Down
10 changes: 3 additions & 7 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,6 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/profile/address',
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`settings/workspaces/${policyID}/profile/address` as const, backTo),
},
WORKSPACE_PROFILE_PLAN: {
route: 'settings/workspaces/:policyID/profile/plan',
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`settings/workspaces/${policyID}/profile/plan` as const, backTo),
},
WORKSPACE_ACCOUNTING: {
route: 'settings/workspaces/:policyID/accounting',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const,
Expand Down Expand Up @@ -978,9 +974,9 @@ const ROUTES = {
getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}` as const,
},
WORKSPACE_UPGRADE: {
route: 'settings/workspaces/:policyID/upgrade/:featureName?',
getRoute: (policyID: string, featureName?: string, backTo?: string) =>
getUrlWithBackToParam(`settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName ?? '')}` as const, backTo),
route: 'settings/workspaces/:policyID/upgrade/:featureName',
getRoute: (policyID: string, featureName: string, backTo?: string) =>
getUrlWithBackToParam(`settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName)}` as const, backTo),
},
WORKSPACE_DOWNGRADE: {
route: 'settings/workspaces/:policyID/downgrade/',
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ const SCREENS = {
TAG_GL_CODE: 'Tag_GL_Code',
CURRENCY: 'Workspace_Profile_Currency',
ADDRESS: 'Workspace_Profile_Address',
PLAN: 'Workspace_Profile_Plan_Type',
WORKFLOWS: 'Workspace_Workflows',
WORKFLOWS_PAYER: 'Workspace_Workflows_Payer',
WORKFLOWS_APPROVALS_NEW: 'Workspace_Approvals_New',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchFiltersChatsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
if (!areOptionsInitialized || !isScreenTransitionEnd) {
return defaultListOptions;
}
return OptionsListUtils.getSearchOptions(options, '', undefined, false);
return OptionsListUtils.getSearchOptions(options, undefined, false);
}, [areOptionsInitialized, isScreenTransitionEnd, options]);

const chatOptions = useMemo(() => {
Expand Down
18 changes: 11 additions & 7 deletions src/components/Search/SearchFiltersParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate}:
return defaultListOptions;
}

return OptionsListUtils.getFilteredOptions({
reports: options.reports,
personalDetails: options.personalDetails,
selectedOptions,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: 0,
});
return OptionsListUtils.getOptions(
{
reports: options.reports,
personalDetails: options.personalDetails,
},
{
selectedOptions,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: 0,
},
);
}, [areOptionsInitialized, options.personalDetails, options.reports, selectedOptions]);

const chatOptions = useMemo(() => {
Expand Down
62 changes: 36 additions & 26 deletions src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type Report from '@src/types/onyx/Report';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
import {getQueryWithSubstitutions} from './getQueryWithSubstitutions';
import type {SubstitutionMap} from './getQueryWithSubstitutions';
import {getUpdatedSubstitutionsMap} from './getUpdatedSubstitutionsMap';
Expand Down Expand Up @@ -75,15 +76,15 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
const styles = useThemeStyles();
const {translate} = useLocalize();
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [recentSearches] = useOnyx(ONYXKEYS.RECENT_SEARCHES);
const [recentSearches, recentSearchesMetadata] = useOnyx(ONYXKEYS.RECENT_SEARCHES);
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
const [autocompleteSubstitutions, setAutocompleteSubstitutions] = useState<SubstitutionMap>({});

const personalDetails = usePersonalDetails();
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const taxRates = getAllTaxRates();

const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isLargeScreenWidth} = useResponsiveLayout();
const listRef = useRef<SelectionListHandle>(null);

// The actual input text that the user sees
Expand All @@ -104,7 +105,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
if (!areOptionsInitialized) {
return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null};
}
return OptionsListUtils.getSearchOptions(options, '', betas ?? []);
return OptionsListUtils.getSearchOptions(options, betas ?? []);
}, [areOptionsInitialized, betas, options]);

const filteredOptions = useMemo(() => {
Expand Down Expand Up @@ -310,6 +311,10 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)

const modalWidth = shouldUseNarrowLayout ? styles.w100 : {width: variables.searchRouterPopoverWidth};

const isDataLoaded = useMemo(() => {
return (!contextualReportID || contextualReportID !== undefined) && !isLoadingOnyxValue(recentSearchesMetadata) && recentReports.length > 0;
}, [contextualReportID, recentSearchesMetadata, recentReports]);

return (
<View
style={[styles.flex1, modalWidth, styles.h100, !shouldUseNarrowLayout && styles.mh85vh]}
Expand All @@ -321,29 +326,34 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
onBackButtonPress={() => onRouterClose()}
/>
)}
<SearchRouterInput
value={textInputValue}
isFullWidth={shouldUseNarrowLayout}
onSearchQueryChange={onSearchQueryChange}
onSubmit={() => {
submitSearch(textInputValue);
}}
caretHidden={shouldHideInputCaret}
routerListRef={listRef}
shouldShowOfflineMessage
wrapperStyle={[styles.border, styles.alignItemsCenter]}
outerWrapperStyle={[shouldUseNarrowLayout ? styles.mv3 : styles.mv2, shouldUseNarrowLayout ? styles.mh5 : styles.mh2]}
wrapperFocusedStyle={[styles.borderColorFocus]}
isSearchingForReports={isSearchingForReports}
/>
<SearchRouterList
autocompleteQueryValue={autocompleteQueryValue}
searchQueryItem={searchQueryItem}
additionalSections={sections}
onListItemPress={onListItemPress}
onListItemFocus={onListItemFocus}
ref={listRef}
/>
{(isDataLoaded || !!debouncedInputValue) && (
<>
<SearchRouterInput
value={textInputValue}
isFullWidth={shouldUseNarrowLayout}
onSearchQueryChange={onSearchQueryChange}
onSubmit={() => {
submitSearch(textInputValue);
}}
caretHidden={shouldHideInputCaret}
routerListRef={listRef}
shouldShowOfflineMessage
wrapperStyle={[styles.border, styles.alignItemsCenter]}
outerWrapperStyle={[shouldUseNarrowLayout ? styles.mv3 : styles.mv2, shouldUseNarrowLayout ? styles.mh5 : styles.mh2]}
wrapperFocusedStyle={[styles.borderColorFocus]}
isSearchingForReports={isSearchingForReports}
/>
<SearchRouterList
autocompleteQueryValue={autocompleteQueryValue}
searchQueryItem={searchQueryItem}
additionalSections={sections}
onListItemPress={onListItemPress}
onListItemFocus={onListItemFocus}
initiallyFocusedOptionKey={isLargeScreenWidth ? styledRecentReports.at(0)?.keyForList : undefined}
ref={listRef}
/>
</>
)}
</View>
);
}
Expand Down
35 changes: 24 additions & 11 deletions src/components/Search/SearchRouter/SearchRouterList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Str} from 'expensify-common';
import React, {forwardRef, useMemo} from 'react';
import React, {forwardRef, useMemo, useState} from 'react';
import type {ForwardedRef} from 'react';
import {useOnyx} from 'react-native-onyx';
import * as Expensicons from '@components/Icon/Expensicons';
Expand Down Expand Up @@ -58,6 +58,9 @@ type SearchRouterListProps = {

/** Callback to call when an item is focused via arrow buttons */
onListItemFocus: (item: SearchQueryItem) => void;

/** Item `keyForList` to focus initially */
initiallyFocusedOptionKey?: string | null;
};

const defaultListOptions = {
Expand Down Expand Up @@ -106,7 +109,7 @@ function SearchRouterItem(props: UserListItemProps<OptionData> | SearchQueryList

// Todo rename to SearchAutocompleteList once it's used in both Router and SearchPage
function SearchRouterList(
{autocompleteQueryValue, searchQueryItem, additionalSections, shouldPreventDefault = true, onListItemFocus, onListItemPress}: SearchRouterListProps,
{autocompleteQueryValue, searchQueryItem, additionalSections, shouldPreventDefault = true, onListItemFocus, onListItemPress, initiallyFocusedOptionKey}: SearchRouterListProps,
ref: ForwardedRef<SelectionListHandle>,
) {
const styles = useThemeStyles();
Expand All @@ -122,7 +125,7 @@ function SearchRouterList(
if (!areOptionsInitialized) {
return defaultListOptions;
}
return OptionsListUtils.getSearchOptions(options, '', betas ?? []);
return OptionsListUtils.getSearchOptions(options, betas ?? []);
}, [areOptionsInitialized, betas, options]);

const typeAutocompleteList = Object.values(CONST.SEARCH.DATA_TYPES);
Expand All @@ -137,13 +140,16 @@ function SearchRouterList(
return [];
}

const filteredOptions = OptionsListUtils.getFilteredOptions({
reports: options.reports,
personalDetails: options.personalDetails,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: 0,
includeSelfDM: true,
});
const filteredOptions = OptionsListUtils.getOptions(
{
reports: options.reports,
personalDetails: options.personalDetails,
},
{
excludeLogins: CONST.EXPENSIFY_EMAILS,
includeSelfDM: true,
},
);

// This cast is needed as something is incorrect in types OptionsListUtils.getOptions around l1490 and includeRecentReports types
const personalDetailsFromOptions = filteredOptions.personalDetails.map((option) => (option as SearchOption<PersonalDetails>).item);
Expand Down Expand Up @@ -345,6 +351,8 @@ function SearchRouterList(

const sections: Array<SectionListDataType<OptionData | SearchQueryItem>> = [];

const [isInitialRender, setIsInitialRender] = useState(true);

if (searchQueryItem) {
sections.push({data: [searchQueryItem]});
}
Expand Down Expand Up @@ -385,13 +393,18 @@ function SearchRouterList(
sectionListStyle={[shouldUseNarrowLayout ? styles.ph5 : styles.ph2, styles.pb2]}
listItemWrapperStyle={[styles.pr0, styles.pl0]}
getItemHeight={getItemHeight}
onLayout={setPerformanceTimersEnd}
onLayout={() => {
setPerformanceTimersEnd();
setIsInitialRender(false);
}}
showScrollIndicator={!shouldUseNarrowLayout}
sectionTitleStyles={styles.mhn2}
shouldSingleExecuteRowSelect
onArrowFocus={onArrowFocus}
shouldPreventDefault={shouldPreventDefault}
ref={ref}
initiallyFocusedOptionKey={initiallyFocusedOptionKey}
shouldScrollToFocusedIndex={!isInitialRender}
/>
);
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldKeepFocusedItemAtTopOfViewableArea = false,
shouldDebounceScrolling = false,
shouldPreventActiveCellVirtualization = false,
shouldScrollToFocusedIndex = true,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -323,7 +324,9 @@ function BaseSelectionList<TItem extends ListItem>(
if (focusedItem) {
onArrowFocus(focusedItem);
}
(shouldDebounceScrolling ? debouncedScrollToIndex : scrollToIndex)(index, true);
if (shouldScrollToFocusedIndex) {
(shouldDebounceScrolling ? debouncedScrollToIndex : scrollToIndex)(index, true);
}
},
isFocused,
});
Expand Down Expand Up @@ -592,10 +595,12 @@ function BaseSelectionList<TItem extends ListItem>(
if (!isInitialSectionListRender) {
return;
}
scrollToIndex(focusedIndex, false);
if (shouldScrollToFocusedIndex) {
scrollToIndex(focusedIndex, false);
}
setIsInitialSectionListRender(false);
},
[focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch],
[focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch, shouldScrollToFocusedIndex],
);

const onSectionListLayout = useCallback(
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Whether to prevent the active cell from being virtualized and losing focus in browsers */
shouldPreventActiveCellVirtualization?: boolean;

/** Whether to scroll to the focused index */
shouldScrollToFocusedIndex?: boolean;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down
Loading

0 comments on commit 4d57937

Please sign in to comment.