Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into fix/34003
Browse files Browse the repository at this point in the history
  • Loading branch information
brunovjk authored Feb 21, 2024
2 parents 338972f + c1e73ec commit 938eeb3
Show file tree
Hide file tree
Showing 57 changed files with 477 additions and 194 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001044307
versionName "1.4.43-7"
versionCode 1001044309
versionName "1.4.43-9"
}

flavorDimensions "default"
Expand Down
1 change: 1 addition & 0 deletions docs/redirects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ https://help.expensify.com/articles/expensify-classic/getting-started/Employees,
https://help.expensify.com/articles/expensify-classic/getting-started/Using-The-App,https://help.expensify.com/articles/expensify-classic/getting-started/Join-your-company's-workspace
https://help.expensify.com/articles/expensify-classic/getting-started/support/Expensify-Support,https://use.expensify.com/support
https://help.expensify.com/articles/expensify-classic/getting-started/Plan-Types,https://use.expensify.com/
https://help.expensify.com/articles/new-expensify/payments/Referral-Program,https://help.expensify.com/articles/expensify-classic/get-paid-back/Referral-Program
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>1.4.43.7</string>
<string>1.4.43.9</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.4.43.7</string>
<string>1.4.43.9</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>1.4.43</string>
<key>CFBundleVersion</key>
<string>1.4.43.7</string>
<string>1.4.43.9</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
`<rootDir>/?(*.)+(spec|test).${testFileExtension}`,
],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.[jt]sx?$': 'babel-jest',
'^.+\\.svg?$': 'jest-transformer-svg',
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-native)/'],
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": "1.4.43-7",
"version": "1.4.43-9",
"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
32 changes: 18 additions & 14 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,28 @@ const ROUTES = {
SETTINGS_APP_DOWNLOAD_LINKS: 'settings/about/app-download-links',
SETTINGS_WALLET: 'settings/wallet',
SETTINGS_WALLET_DOMAINCARD: {
route: '/settings/wallet/card/:domain',
getRoute: (domain: string) => `/settings/wallet/card/${domain}` as const,
route: 'settings/wallet/card/:domain',
getRoute: (domain: string) => `settings/wallet/card/${domain}` as const,
},
SETTINGS_REPORT_FRAUD: {
route: '/settings/wallet/card/:domain/report-virtual-fraud',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/report-virtual-fraud` as const,
route: 'settings/wallet/card/:domain/report-virtual-fraud',
getRoute: (domain: string) => `settings/wallet/card/${domain}/report-virtual-fraud` as const,
},
SETTINGS_WALLET_CARD_GET_PHYSICAL_NAME: {
route: '/settings/wallet/card/:domain/get-physical/name',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/get-physical/name` as const,
route: 'settings/wallet/card/:domain/get-physical/name',
getRoute: (domain: string) => `settings/wallet/card/${domain}/get-physical/name` as const,
},
SETTINGS_WALLET_CARD_GET_PHYSICAL_PHONE: {
route: '/settings/wallet/card/:domain/get-physical/phone',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/get-physical/phone` as const,
route: 'settings/wallet/card/:domain/get-physical/phone',
getRoute: (domain: string) => `settings/wallet/card/${domain}/get-physical/phone` as const,
},
SETTINGS_WALLET_CARD_GET_PHYSICAL_ADDRESS: {
route: '/settings/wallet/card/:domain/get-physical/address',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/get-physical/address` as const,
route: 'settings/wallet/card/:domain/get-physical/address',
getRoute: (domain: string) => `settings/wallet/card/${domain}/get-physical/address` as const,
},
SETTINGS_WALLET_CARD_GET_PHYSICAL_CONFIRM: {
route: '/settings/wallet/card/:domain/get-physical/confirm',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/get-physical/confirm` as const,
route: 'settings/wallet/card/:domain/get-physical/confirm',
getRoute: (domain: string) => `settings/wallet/card/${domain}/get-physical/confirm` as const,
},
SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card',
SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account',
Expand All @@ -117,8 +117,8 @@ const ROUTES = {
SETTINGS_WALLET_TRANSFER_BALANCE: 'settings/wallet/transfer-balance',
SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT: 'settings/wallet/choose-transfer-account',
SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED: {
route: '/settings/wallet/card/:domain/report-card-lost-or-damaged',
getRoute: (domain: string) => `/settings/wallet/card/${domain}/report-card-lost-or-damaged` as const,
route: 'settings/wallet/card/:domain/report-card-lost-or-damaged',
getRoute: (domain: string) => `settings/wallet/card/${domain}/report-card-lost-or-damaged` as const,
},
SETTINGS_WALLET_CARD_ACTIVATE: {
route: 'settings/wallet/card/:domain/activate',
Expand Down Expand Up @@ -219,6 +219,10 @@ const ROUTES = {
route: 'r/:reportID/settings/who-can-post',
getRoute: (reportID: string) => `r/${reportID}/settings/who-can-post` as const,
},
REPORT_SETTINGS_VISIBILITY: {
route: 'r/:reportID/settings/visibility',
getRoute: (reportID: string) => `r/${reportID}/settings/visibility` as const,
},
SPLIT_BILL_DETAILS: {
route: 'r/:reportID/split/:reportActionID',
getRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}` as const,
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const SCREENS = {
ROOM_NAME: 'Report_Settings_Room_Name',
NOTIFICATION_PREFERENCES: 'Report_Settings_Notification_Preferences',
WRITE_CAPABILITY: 'Report_Settings_Write_Capability',
VISIBILITY: 'Report_Settings_Visibility',
},

NEW_TASK: {
Expand Down
19 changes: 17 additions & 2 deletions src/components/CountrySelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {forwardRef, useEffect} from 'react';
import {useIsFocused} from '@react-navigation/native';
import React, {forwardRef, useEffect, useRef} from 'react';
import type {ForwardedRef} from 'react';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -23,15 +24,28 @@ type CountrySelectorProps = {
/** inputID used by the Form component */
// eslint-disable-next-line react/no-unused-prop-types
inputID: string;

/** Callback to call when the picker modal is dismissed */
onBlur?: () => void;
};

function CountrySelector({errorText = '', value: countryCode, onInputChange}: CountrySelectorProps, ref: ForwardedRef<View>) {
function CountrySelector({errorText = '', value: countryCode, onInputChange, onBlur}: CountrySelectorProps, ref: ForwardedRef<View>) {
const styles = useThemeStyles();
const {translate} = useLocalize();

const title = countryCode ? translate(`allCountries.${countryCode}`) : '';
const countryTitleDescStyle = title.length === 0 ? styles.textNormal : null;

const didOpenContrySelector = useRef(false);
const isFocused = useIsFocused();
useEffect(() => {
if (!isFocused || !didOpenContrySelector.current) {
return;
}
didOpenContrySelector.current = false;
onBlur?.();
}, [isFocused, onBlur]);

useEffect(() => {
// This will cause the form to revalidate and remove any error related to country name
onInputChange(countryCode);
Expand All @@ -48,6 +62,7 @@ function CountrySelector({errorText = '', value: countryCode, onInputChange}: Co
description={translate('common.country')}
onPress={() => {
const activeRoute = Navigation.getActiveRouteWithoutParams();
didOpenContrySelector.current = true;
Navigation.navigate(ROUTES.SETTINGS_ADDRESS_COUNTRY.getRoute(countryCode ?? '', activeRoute));
}}
/>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import React, {useEffect, useMemo} from 'react';
import {Image as RNImage} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import useNetwork from '@hooks/useNetwork';
import ONYXKEYS from '@src/ONYXKEYS';
import {defaultProps, imagePropTypes} from './imagePropTypes';
import RESIZE_MODES from './resizeModes';

function Image(props) {
const {source: propsSource, isAuthTokenRequired, onLoad, session} = props;
const {isOffline} = useNetwork();

/**
* Check if the image source is a URL - if so the `encryptedAuthToken` is appended
* to the source.
Expand Down Expand Up @@ -39,7 +42,7 @@ function Image(props) {
RNImage.getSize(source.uri, (width, height) => {
onLoad({nativeEvent: {width, height}});
});
}, [onLoad, source]);
}, [onLoad, source, isOffline]);

// Omit the props which the underlying RNImage won't use
const forwardedProps = _.omit(props, ['source', 'onLoad', 'session', 'isAuthTokenRequired']);
Expand Down
16 changes: 12 additions & 4 deletions src/components/ImageWithSizeCalculation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import delay from 'lodash/delay';
import React, {useEffect, useMemo, useRef, useState} from 'react';
import type {ImageSourcePropType, StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import Log from '@libs/Log';
import FullscreenLoadingIndicator from './FullscreenLoadingIndicator';
Expand Down Expand Up @@ -44,16 +45,27 @@ function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthT
const isLoadedRef = useRef<boolean | null>(null);
const [isImageCached, setIsImageCached] = useState(true);
const [isLoading, setIsLoading] = useState(false);
const {isOffline} = useNetwork();

const source = useMemo(() => ({uri: url}), [url]);

const onError = () => {
Log.hmmm('Unable to fetch image to calculate size', {url});
onLoadFailure?.();
if (isLoadedRef.current) {
isLoadedRef.current = false;
setIsImageCached(false);
}
if (isOffline) {
return;
}
setIsLoading(false);
};

const imageLoadedSuccessfully = (event: OnLoadNativeEvent) => {
isLoadedRef.current = true;
setIsLoading(false);
setIsImageCached(true);
onMeasure({
width: event.nativeEvent.width,
height: event.nativeEvent.height,
Expand Down Expand Up @@ -87,10 +99,6 @@ function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthT
}
setIsLoading(true);
}}
onLoadEnd={() => {
setIsLoading(false);
setIsImageCached(true);
}}
onError={onError}
onLoad={imageLoadedSuccessfully}
/>
Expand Down
9 changes: 1 addition & 8 deletions src/components/QRShare/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import QRCode from '@components/QRCode';
import Text from '@components/Text';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {QRShareHandle, QRShareProps} from './types';

function QRShare({url, title, subtitle, logo, logoRatio, logoMarginRatio}: QRShareProps, ref: ForwardedRef<QRShareHandle>) {
const styles = useThemeStyles();
const theme = useTheme();
const {isSmallScreenWidth} = useWindowDimensions();

const [qrCodeSize, setQrCodeSize] = useState(1);
const svgRef = useRef<Svg>();
Expand All @@ -32,11 +29,7 @@ function QRShare({url, title, subtitle, logo, logoRatio, logoMarginRatio}: QRSha

const onLayout = (event: LayoutChangeEvent) => {
const containerWidth = event.nativeEvent.layout.width - variables.qrShareHorizontalPadding * 2 || 0;
if (isSmallScreenWidth) {
setQrCodeSize(Math.max(1, containerWidth));
return;
}
setQrCodeSize(Math.max(1, Math.min(containerWidth, CONST.CENTRAL_PANE_ANIMATION_HEIGHT)));
setQrCodeSize(Math.max(1, containerWidth));
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import lodashSortBy from 'lodash/sortBy';
import React from 'react';
import {View} from 'react-native';
import type {GestureResponderEvent} from 'react-native';
import ConfirmedRoute from '@components/ConfirmedRoute';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import MoneyRequestSkeletonView from '@components/MoneyRequestSkeletonView';
Expand Down Expand Up @@ -114,6 +115,9 @@ function MoneyRequestPreviewContent({

const receiptImages = hasReceipt ? [ReceiptUtils.getThumbnailAndImageURIs(transaction)] : [];

const hasPendingWaypoints = transaction?.pendingFields?.waypoints;
const showMapAsImage = isDistanceRequest && hasPendingWaypoints;

const getSettledMessage = (): string => {
if (isCardTransaction) {
return translate('common.done');
Expand Down Expand Up @@ -206,7 +210,12 @@ function MoneyRequestPreviewContent({
!onPreviewPressed ? [styles.moneyRequestPreviewBox, containerStyles] : {},
]}
>
{hasReceipt && (
{showMapAsImage && (
<View style={styles.reportActionItemImages}>
<ConfirmedRoute transaction={transaction} />
</View>
)}
{!showMapAsImage && hasReceipt && (
<ReportActionItemImages
images={receiptImages}
isHovered={isHovered || isScanning}
Expand Down
28 changes: 18 additions & 10 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import ConfirmedRoute from '@components/ConfirmedRoute';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -109,6 +110,8 @@ function MoneyRequestView({
const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction);
const formattedTransactionAmount = transactionAmount ? CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency) : '';
const hasPendingWaypoints = transaction?.pendingFields?.waypoints;
const showMapAsImage = isDistanceRequest && hasPendingWaypoints;
const formattedOriginalAmount = transactionOriginalAmount && transactionOriginalCurrency && CurrencyUtils.convertToDisplayString(transactionOriginalAmount, transactionOriginalCurrency);
const isCardTransaction = TransactionUtils.isCardTransaction(transaction);
const cardProgramName = isCardTransaction && transactionCardID !== undefined ? CardUtils.getCardDescription(transactionCardID) : '';
Expand Down Expand Up @@ -239,7 +242,8 @@ function MoneyRequestView({
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(isSmallScreenWidth)]}>
{hasReceipt && (
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
{(showMapAsImage || hasReceipt) && (
<OfflineWithFeedback
pendingAction={pendingAction}
errors={transaction?.errors}
Expand All @@ -252,15 +256,19 @@ function MoneyRequestView({
}}
>
<View style={styles.moneyRequestViewImage}>
<ReportActionItemImage
thumbnail={receiptURIs?.thumbnail}
image={receiptURIs?.image}
isLocalFile={receiptURIs?.isLocalFile}
filename={receiptURIs?.filename}
transaction={transaction}
enablePreviewModal
canEditReceipt={canEditReceipt}
/>
{showMapAsImage ? (
<ConfirmedRoute transaction={transaction} />
) : (
<ReportActionItemImage
thumbnail={receiptURIs?.thumbnail}
image={receiptURIs?.image}
isLocalFile={receiptURIs?.isLocalFile}
filename={receiptURIs?.filename}
transaction={transaction}
enablePreviewModal
canEditReceipt={canEditReceipt}
/>
)}
</View>
</OfflineWithFeedback>
)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/__mocks__/ConfirmedRoute.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {View} from 'react-native';

// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
function ConfirmedRoute(props: any) {
return <View />;
}

export default ConfirmedRoute;
8 changes: 8 additions & 0 deletions src/libs/API/parameters/UpdateRoomVisibilityParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type {RoomVisibility} from '@src/types/onyx/Report';

type UpdateRoomVisibilityParams = {
reportID: string;
visibility: RoomVisibility;
};

export default UpdateRoomVisibilityParams;
Loading

0 comments on commit 938eeb3

Please sign in to comment.