Skip to content

Commit

Permalink
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
Browse files Browse the repository at this point in the history
…to fix/attempt-to-fix-cycular-dependecies-1
  • Loading branch information
kubabutkiewicz committed Jan 13, 2025
2 parents a214b7c + eca6fa9 commit 7b7876e
Show file tree
Hide file tree
Showing 33 changed files with 870 additions and 159 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/commentOnNativeFileChanged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Comment on native files changed

on:
pull_request:
branches:
- 'main'
paths:
- '**.kt'
- '**.java'
- '**.swift'
- '**.mm'
- '**.h'
- '**.cpp'
- 'AndroidManifest.xml'
- 'project.pbxproj'

jobs:
commentOnNativeFilesChanged:
name: Create comment
runs-on: ubuntu-latest
steps:
- name: Comment
run: |
gh pr comment ${{ github.event.number }} --body \
":warning: This PR is possibly changing native code. It may cause problems in Hybrid App. Please ask Hybrid App team to review those changes in the Slack open-source channel. The C+ can help you with that. :warning:"
env:
GITHUB_TOKEN: ${{ github.token }}
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 @@ -110,8 +110,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009008401
versionName "9.0.84-1"
versionCode 1009008404
versionName "9.0.84-4"
// 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.84.1</string>
<string>9.0.84.4</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.84.1</string>
<string>9.0.84.4</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.84</string>
<key>CFBundleVersion</key>
<string>9.0.84.1</string>
<string>9.0.84.4</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.84-1",
"version": "9.0.84-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
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,21 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
}}
shouldUseHapticsOnLongPress
accessibilityLabel={displayName}
role={CONST.ROLE.BUTTON}
>
<AttachmentView
source={sourceURLWithAuth}
source={source}
file={{name: displayName}}
shouldShowDownloadIcon={!!sourceID && !isOffline}
shouldShowLoadingSpinnerIcon={isDownloading}
isUsedAsChatAttachment
isDeleted={!!isDeleted}
isUploading={!sourceID}
isAuthTokenRequired={!!sourceID}
/>
</PressableWithoutFeedback>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachments/AttachmentView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function AttachmentView({
// will appear with a source that is a blob
const isSourcePDF = typeof source === 'string' && Str.isPDF(source);
const isFilePDF = file && Str.isPDF(file.name ?? translate('attachmentView.unknownFilename'));
if (!hasPDFFailedToLoad && (isSourcePDF || isFilePDF)) {
if (!hasPDFFailedToLoad && !isUploading && (isSourcePDF || isFilePDF)) {
const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source as string) : (source as string);

const onPDFLoadComplete = (path: string) => {
Expand Down
100 changes: 53 additions & 47 deletions src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {useNavigationState} from '@react-navigation/native';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import React, {useCallback, useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import type {TextInputProps} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import {useOptionsList} from '@components/OptionListContextProvider';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import type {SearchQueryString} from '@components/Search/types';
import {isSearchQueryItem} from '@components/SelectionList/Search/SearchQueryListItem';
Expand All @@ -19,7 +18,6 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import * as InputUtils from '@libs/InputUtils';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import type {SearchOption} from '@libs/OptionsListUtils';
import type {OptionData} from '@libs/ReportUtils';
import * as SearchAutocompleteUtils from '@libs/SearchAutocompleteUtils';
Expand All @@ -36,6 +34,7 @@ import {getQueryWithSubstitutions} from './getQueryWithSubstitutions';
import type {SubstitutionMap} from './getQueryWithSubstitutions';
import {getUpdatedSubstitutionsMap} from './getUpdatedSubstitutionsMap';
import SearchRouterInput from './SearchRouterInput';
import type {GetAdditionalSectionsCallback} from './SearchRouterList';
import SearchRouterList from './SearchRouterList';

function getContextualSearchAutocompleteKey(item: SearchQueryItem) {
Expand Down Expand Up @@ -75,7 +74,6 @@ type SearchRouterProps = {
function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [, recentSearchesMetadata] = useOnyx(ONYXKEYS.RECENT_SEARCHES);
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
const {activeWorkspaceID} = useActiveWorkspace();
Expand All @@ -94,57 +92,65 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
return state?.routes.at(-1)?.params?.reportID;
});

const {options, areOptionsInitialized} = useOptionsList();
const searchOptions = useMemo(() => {
if (!areOptionsInitialized) {
return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null};
}
return OptionsListUtils.getSearchOptions(options, betas ?? []);
}, [areOptionsInitialized, betas, options]);
const getAdditionalSections: GetAdditionalSectionsCallback = useCallback(
({recentReports}) => {
if (!contextualReportID) {
return undefined;
}

// We will only show the contextual search suggestion if the user has not typed anything
if (textInputValue) {
return undefined;
}

const reportForContextualSearch = contextualReportID ? searchOptions.recentReports?.find((option) => option.reportID === contextualReportID) : undefined;
const reportForContextualSearch = recentReports.find((option) => option.reportID === contextualReportID);
if (!reportForContextualSearch) {
return undefined;
}

const additionalSections = [];
const reportQueryValue = reportForContextualSearch.text ?? reportForContextualSearch.alternateText ?? reportForContextualSearch.reportID;

if (reportForContextualSearch && !textInputValue) {
const reportQueryValue = reportForContextualSearch.text ?? reportForContextualSearch.alternateText ?? reportForContextualSearch.reportID;
let roomType: ValueOf<typeof CONST.SEARCH.DATA_TYPES> = CONST.SEARCH.DATA_TYPES.CHAT;
let autocompleteID: string | undefined = reportForContextualSearch.reportID;

let roomType: ValueOf<typeof CONST.SEARCH.DATA_TYPES> = CONST.SEARCH.DATA_TYPES.CHAT;
let autocompleteID = reportForContextualSearch.reportID;
if (reportForContextualSearch.isInvoiceRoom) {
roomType = CONST.SEARCH.DATA_TYPES.INVOICE;
const report = reportForContextualSearch as SearchOption<Report>;
if (report.item && report.item?.invoiceReceiver && report.item.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL) {
autocompleteID = report.item.invoiceReceiver.accountID.toString();
} else {
autocompleteID = '';
if (reportForContextualSearch.isInvoiceRoom) {
roomType = CONST.SEARCH.DATA_TYPES.INVOICE;
const report = reportForContextualSearch as SearchOption<Report>;
if (report.item && report.item?.invoiceReceiver && report.item.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL) {
autocompleteID = report.item.invoiceReceiver.accountID.toString();
} else {
autocompleteID = '';
}
}
}
if (reportForContextualSearch.isPolicyExpenseChat) {
roomType = CONST.SEARCH.DATA_TYPES.EXPENSE;
if (reportForContextualSearch.policyID) {
autocompleteID = reportForContextualSearch.policyID;
} else {
autocompleteID = '';
if (reportForContextualSearch.isPolicyExpenseChat) {
roomType = CONST.SEARCH.DATA_TYPES.EXPENSE;
if (reportForContextualSearch.policyID) {
autocompleteID = reportForContextualSearch.policyID;
} else {
autocompleteID = '';
}
}
}

additionalSections.push({
data: [
return [
{
text: `${translate('search.searchIn')} ${reportForContextualSearch.text ?? reportForContextualSearch.alternateText}`,
singleIcon: Expensicons.MagnifyingGlass,
searchQuery: reportQueryValue,
autocompleteID,
itemStyle: styles.activeComponentBG,
keyForList: 'contextualSearch',
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.CONTEXTUAL_SUGGESTION,
roomType,
policyID: reportForContextualSearch.policyID,
data: [
{
text: `${translate('search.searchIn')} ${reportForContextualSearch.text ?? reportForContextualSearch.alternateText}`,
singleIcon: Expensicons.MagnifyingGlass,
searchQuery: reportQueryValue,
autocompleteID,
itemStyle: styles.activeComponentBG,
keyForList: 'contextualSearch',
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.CONTEXTUAL_SUGGESTION,
roomType,
policyID: reportForContextualSearch.policyID,
},
],
},
],
});
}
];
},
[contextualReportID, styles.activeComponentBG, textInputValue, translate],
);

const searchQueryItem = textInputValue
? {
Expand Down Expand Up @@ -308,7 +314,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
<SearchRouterList
autocompleteQueryValue={autocompleteQueryValue || textInputValue}
searchQueryItem={searchQueryItem}
additionalSections={additionalSections}
getAdditionalSections={getAdditionalSections}
onListItemPress={onListItemPress}
setTextQuery={setTextInputValue}
updateAutocompleteSubstitutions={updateAutocompleteSubstitutions}
Expand Down
13 changes: 10 additions & 3 deletions src/components/Search/SearchRouter/SearchRouterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ type AutocompleteItemData = {
mapKey?: SearchFilterKey;
};

type GetAdditionalSectionsCallback = (options: OptionsListUtils.Options) => Array<SectionListDataType<OptionData | SearchQueryItem>> | undefined;

type SearchRouterListProps = {
/** Value of TextInput */
autocompleteQueryValue: string;

/** An optional item to always display on the top of the router list */
searchQueryItem?: SearchQueryItem;

/** Any extra sections that should be displayed in the router list */
additionalSections?: Array<SectionListDataType<OptionData | SearchQueryItem>>;
/** Any extra sections that should be displayed in the router list. */
getAdditionalSections?: GetAdditionalSectionsCallback;

/** Callback to call when an item is clicked/selected */
onListItemPress: (item: OptionData | SearchQueryItem) => void;
Expand Down Expand Up @@ -117,7 +119,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, onListItemPress, setTextQuery, updateAutocompleteSubstitutions}: SearchRouterListProps,
{autocompleteQueryValue, searchQueryItem, getAdditionalSections, onListItemPress, setTextQuery, updateAutocompleteSubstitutions}: SearchRouterListProps,
ref: ForwardedRef<SelectionListHandle>,
) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -419,6 +421,10 @@ function SearchRouterList(
sections.push({data: [searchQueryItem]});
}

const additionalSections = useMemo(() => {
return getAdditionalSections?.(searchOptions);
}, [getAdditionalSections, searchOptions]);

if (additionalSections) {
sections.push(...additionalSections);
}
Expand Down Expand Up @@ -485,3 +491,4 @@ function SearchRouterList(

export default forwardRef(SearchRouterList);
export {SearchRouterItem};
export type {GetAdditionalSectionsCallback};
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4607,6 +4607,8 @@ const translations = {
other: `removed you from ${joinedNames}'s approval workflows and workspace chats. Previously submitted reports will remain available for approval in your Inbox.`,
};
},
upgradedWorkspace: 'upgraded this workspace to the Control plan',
downgradedWorkspace: 'downgraded this workspace to the Collect plan',
},
roomMembersPage: {
memberNotFound: 'Member not found.',
Expand Down
6 changes: 4 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4363,8 +4363,8 @@ const translations = {
description: 'Elige el plan adecuado para ti. Para ver una lista detallada de funciones y precios, consulta nuestra',
subscriptionLink: 'página de ayuda sobre tipos de planes y precios',
lockedPlanDescription: ({count, annualSubscriptionEndDate}: WorkspaceLockedPlanTypeParams) => ({
one: `Tienes un compromiso anual de 1 miembro activo en el plan Control hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
other: `Tienes un compromiso anual de ${count} miembros activos en el plan Control hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
one: `Tienes un compromiso anual de 1 miembro activo en el plan Controlar hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
other: `Tienes un compromiso anual de ${count} miembros activos en el plan Controlar hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
}),
subscriptions: 'Suscripciones',
},
Expand Down Expand Up @@ -4655,6 +4655,8 @@ const translations = {
other: `te eliminó de los flujos de trabajo de aprobaciones y de los chats del espacio de trabajo de ${joinedNames}. Los informes enviados anteriormente seguirán estando disponibles para su aprobación en tu bandeja de entrada.`,
};
},
upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar',
downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar',
},
roomMembersPage: {
memberNotFound: 'Miembro no encontrado.',
Expand Down
Loading

0 comments on commit 7b7876e

Please sign in to comment.