Skip to content

Commit

Permalink
Merge branch 'main' into marcaaron-fixReportCount
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Jan 26, 2024
2 parents e83fc3d + d261165 commit 30ef139
Show file tree
Hide file tree
Showing 200 changed files with 2,190 additions and 1,772 deletions.
1 change: 1 addition & 0 deletions .github/workflows/reassurePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
npx reassure --baseline
git switch --force --detach -
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
git checkout --ours .
npm install --force
npx reassure --branch
Expand Down
2 changes: 1 addition & 1 deletion contributingGuides/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Additionally if you want to discuss an idea with the open source community witho
```
11. [Open a pull request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork), and make sure to fill in the required fields.
12. An Expensify engineer and a member from the Contributor-Plus team will be assigned to your pull request automatically to review.
13. Daily updates on weekdays are highly recommended. If you know you won’t be able to provide updates for > 1 week, please comment on the PR or issue how long you plan to be out so that we may plan accordingly. We understand everyone needs a little vacation here and there. Any issue that doesn't receive an update for 1 full week may be considered abandoned and the original contract terminated.
13. Daily updates on weekdays are highly recommended. If you know you won’t be able to provide updates within 48 hours, please comment on the PR or issue stating how long you plan to be out so that we may plan accordingly. We understand everyone needs a little vacation here and there. Any issue that doesn't receive an update for 5 days (including weekend days) may be considered abandoned and the original contract terminated.
#### Submit your pull request for final review
14. When you are ready to submit your pull request for final review, make sure the following checks pass:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Expensify’s Budgets feature allows you to:

{% include faq-begin.md %}
## Can I import budgets as a CSV?
At this time, you cannot import budgets via CSV since we don’t import categories or tags from direct accounting integrations.
At this time, you cannot import budgets via CSV.

## When will I be notified as a budget is hit?
Notifications are sent twice:
Expand Down
7 changes: 0 additions & 7 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3057,13 +3057,6 @@ const CONST = {
*/
MAX_OPTIONS_SELECTOR_PAGE_LENGTH: 500,

/**
* Performance test setup - run the same test multiple times to get a more accurate result
*/
PERFORMANCE_TESTS: {
RUNS: 20,
},

/**
* Bank account names
*/
Expand Down
4 changes: 0 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ const ROUTES = {
route: ':iouType/new/participants/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}` as const,
},
MONEY_REQUEST_CONFIRMATION: {
route: ':iouType/new/confirmation/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}` as const,
},
MONEY_REQUEST_DATE: {
route: ':iouType/new/date/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}` as const,
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const SCREENS = {
ROOT: 'Money_Request',
AMOUNT: 'Money_Request_Amount',
PARTICIPANTS: 'Money_Request_Participants',
CONFIRMATION: 'Money_Request_Confirmation',
CURRENCY: 'Money_Request_Currency',
DATE: 'Money_Request_Date',
DESCRIPTION: 'Money_Request_Description',
Expand Down
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ type OptionRowLHNDataProps = {

/** A function that is called when an option is selected. Selected option is passed as a param */
onSelectRow?: (optionItem: OptionData, popoverAnchor: RefObject<View>) => void;

/** Callback to execute when the OptionList lays out */
onLayout?: (event: LayoutChangeEvent) => void;
};

type OptionRowLHNProps = {
Expand Down
16 changes: 8 additions & 8 deletions src/components/PurposeForUsingExpensifyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ const messageCopy = {
[CONST.INTRO_CHOICES.CHAT_SPLIT]:
'Hi there, to split an expense such as with a friend, please:\n' +
'\n' +
'Press the big green + button\n' +
'Choose *Request money*\n' +
'Indicate how much was spent, either manually, by scanning a receipt, or by tracking distance\n' +
'Enter the email address or phone number of your friend\n' +
'Press *Split* next to their name\n' +
'Repeat as many times as you like for each of your friends\n' +
'Press *Add to split* when done adding friends\n' +
'Press Split to split the bill\n' +
'1. Press the big green + button\n' +
'2. Choose *Request money*\n' +
'3. Indicate how much was spent, either manually, by scanning a receipt, or by tracking distance\n' +
'4. Enter the email address or phone number of your friend\n' +
'5. Press *Split* next to their name\n' +
'6. Repeat as many times as you like for each of your friends\n' +
'7. Press *Add to split* when done adding friends\n' +
'8. Press Split to split the bill\n' +
'\n' +
"This will send a money request to each of your friends for however much they owe you, and we'll take care of getting you paid back. Thanks for asking, and let me know how it goes!",
};
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 @@ -43,7 +43,7 @@ function BaseSelectionList<TItem extends User | RadioItem>(
onScrollBeginDrag,
headerMessage = '',
confirmButtonText = '',
onConfirm = () => {},
onConfirm,
headerContent,
footerContent,
showScrollIndicator = false,
Expand Down Expand Up @@ -363,6 +363,11 @@ function BaseSelectionList<TItem extends User | RadioItem>(
return;
}

// scroll is unnecessary if multiple options cannot be selected
if (!canSelectMultiple) {
return;
}

// set the focus on the first item when the sections list is changed
if (sections.length > 0) {
updateAndScrollToFocusedIndex(0);
Expand All @@ -379,10 +384,10 @@ function BaseSelectionList<TItem extends User | RadioItem>(
});

/** Calls confirm action when pressing CTRL (CMD) + Enter */
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, onConfirm, {
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, onConfirm ?? selectFocusedOption, {
captureOnInputs: true,
shouldBubble: !flattenedSections.allOptions[focusedIndex],
isActive: !disableKeyboardShortcuts && !!onConfirm && isFocused,
isActive: !disableKeyboardShortcuts && isFocused,
});

return (
Expand Down
7 changes: 4 additions & 3 deletions src/components/TextInput/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,9 @@ function BaseTextInput(
*/}
{(!!autoGrow || autoGrowHeight) && (
// Add +2 to width on Safari browsers so that text is not cut off due to the cursor or when changing the value
// https://github.com/Expensify/App/issues/8158
// https://github.com/Expensify/App/issues/26628
// Reference: https://github.com/Expensify/App/issues/8158, https://github.com/Expensify/App/issues/26628
// For mobile Chrome, ensure proper display of the text selection handle (blue bubble down).
// Reference: https://github.com/Expensify/App/issues/34921
<Text
style={[
inputStyle,
Expand All @@ -447,7 +448,7 @@ function BaseTextInput(
]}
onLayout={(e) => {
let additionalWidth = 0;
if (Browser.isMobileSafari() || Browser.isSafari()) {
if (Browser.isMobileSafari() || Browser.isSafari() || Browser.isMobileChrome()) {
additionalWidth = 2;
}
setTextInputWidth(e.nativeEvent.layout.width + additionalWidth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import AmountTextInput from '@components/AmountTextInput';
import CurrencySymbolButton from '@components/CurrencySymbolButton';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import * as textInputWithCurrencySymbolPropTypes from './textInputWithCurrencySymbolPropTypes';
Expand All @@ -10,6 +11,7 @@ function BaseTextInputWithCurrencySymbol(props) {
const {fromLocaleDigit} = useLocalize();
const currencySymbol = CurrencyUtils.getLocalizedCurrencySymbol(props.selectedCurrencyCode);
const isCurrencySymbolLTR = CurrencyUtils.isCurrencySymbolLTR(props.selectedCurrencyCode);
const styles = useThemeStyles();

const currencySymbolButton = (
<CurrencySymbolButton
Expand Down Expand Up @@ -39,6 +41,7 @@ function BaseTextInputWithCurrencySymbol(props) {
props.onSelectionChange(e);
}}
onKeyPress={props.onKeyPress}
style={[styles.pr1]}
/>
);

Expand Down
26 changes: 11 additions & 15 deletions src/hooks/useResponsiveLayout.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import type {ParamListBase, RouteProp} from '@react-navigation/native';
import {useRoute} from '@react-navigation/native';
import {navigationRef} from '@libs/Navigation/Navigation';
import NAVIGATORS from '@src/NAVIGATORS';
import useWindowDimensions from './useWindowDimensions';

type RouteParams = ParamListBase & {
params: {isInRHP?: boolean};
};
type ResponsiveLayoutResult = {
shouldUseNarrowLayout: boolean;
isSmallScreenWidth: boolean;
isInModal: boolean;
};
/**
* Hook to determine if we are on mobile devices or in the RHP
* Hook to determine if we are on mobile devices or in the Modal Navigator
*/
export default function useResponsiveLayout(): ResponsiveLayoutResult {
const {isSmallScreenWidth} = useWindowDimensions();
try {
// eslint-disable-next-line react-hooks/rules-of-hooks
const {params} = useRoute<RouteProp<RouteParams, 'params'>>();
return {shouldUseNarrowLayout: isSmallScreenWidth || (params?.isInRHP ?? false)};
} catch (error) {
return {
shouldUseNarrowLayout: isSmallScreenWidth,
};
}
const state = navigationRef?.getRootState();
const lastRoute = state?.routes?.at(-1);
const lastRouteName = lastRoute?.name;
const isInModal = lastRouteName === NAVIGATORS.LEFT_MODAL_NAVIGATOR || lastRouteName === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;
const shouldUseNarrowLayout = isSmallScreenWidth || isInModal;
return {shouldUseNarrowLayout, isSmallScreenWidth, isInModal};
}
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,8 @@ export default {
dob: 'Please select a valid date of birth',
age: 'Must be over 18 years old',
ssnLast4: 'Please enter valid last 4 digits of SSN',
firstName: 'Please enter valid first name',
lastName: 'Please enter valid last name',
firstName: 'Please enter a valid first name',
lastName: 'Please enter a valid last name',
noDefaultDepositAccountOrDebitCardAvailable: 'Please add a default deposit bank account or debit card',
validationAmounts: 'The validation amounts you entered are incorrect. Please double-check your bank statement and try again.',
},
Expand Down
28 changes: 13 additions & 15 deletions src/libs/API.ts → src/libs/API/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type {OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import Log from '@libs/Log';
import * as Middleware from '@libs/Middleware';
import * as SequentialQueue from '@libs/Network/SequentialQueue';
import * as Pusher from '@libs/Pusher/pusher';
import * as Request from '@libs/Request';
import CONST from '@src/CONST';
import type OnyxRequest from '@src/types/onyx/Request';
import type Response from '@src/types/onyx/Response';
import pkg from '../../package.json';
import Log from './Log';
import * as Middleware from './Middleware';
import * as SequentialQueue from './Network/SequentialQueue';
import * as Pusher from './Pusher/pusher';
import * as Request from './Request';
import pkg from '../../../package.json';
import type {ApiRequest, ApiRequestCommandParameters, ReadCommand, SideEffectRequestCommand, WriteCommand} from './types';

// Setup API middlewares. Each request made will pass through a series of middleware functions that will get called in sequence (each one passing the result of the previous to the next).
// Note: The ordering here is intentional as we want to Log, Recheck Connection, Reauthenticate, and Save the Response in Onyx. Errors thrown in one middleware will bubble to the next.
Expand Down Expand Up @@ -38,8 +38,6 @@ type OnyxData = {
finallyData?: OnyxUpdate[];
};

type ApiRequestType = ValueOf<typeof CONST.API_REQUEST_TYPE>;

/**
* All calls to API.write() will be persisted to disk as JSON with the params, successData, and failureData (or finallyData, if included in place of the former two values).
* This is so that if the network is unavailable or the app is closed, we can send the WRITE request later.
Expand All @@ -54,7 +52,7 @@ type ApiRequestType = ValueOf<typeof CONST.API_REQUEST_TYPE>;
* @param [onyxData.failureData] - Onyx instructions that will be passed to Onyx.update() when the response has jsonCode !== 200.
* @param [onyxData.finallyData] - Onyx instructions that will be passed to Onyx.update() when the response has jsonCode === 200 or jsonCode !== 200.
*/
function write(command: string, apiCommandParameters: Record<string, unknown> = {}, onyxData: OnyxData = {}) {
function write<TCommand extends WriteCommand>(command: TCommand, apiCommandParameters: ApiRequestCommandParameters[TCommand], onyxData: OnyxData = {}) {
Log.info('Called API write', false, {command, ...apiCommandParameters});
const {optimisticData, ...onyxDataWithoutOptimisticData} = onyxData;

Expand Down Expand Up @@ -112,11 +110,11 @@ function write(command: string, apiCommandParameters: Record<string, unknown> =
* response back to the caller or to trigger reconnection callbacks when re-authentication is required.
* @returns
*/
function makeRequestWithSideEffects(
command: string,
apiCommandParameters = {},
function makeRequestWithSideEffects<TCommand extends SideEffectRequestCommand | WriteCommand | ReadCommand>(
command: TCommand,
apiCommandParameters: ApiRequestCommandParameters[TCommand],
onyxData: OnyxData = {},
apiRequestType: ApiRequestType = CONST.API_REQUEST_TYPE.MAKE_REQUEST_WITH_SIDE_EFFECTS,
apiRequestType: ApiRequest = CONST.API_REQUEST_TYPE.MAKE_REQUEST_WITH_SIDE_EFFECTS,
): Promise<void | Response> {
Log.info('Called API makeRequestWithSideEffects', false, {command, ...apiCommandParameters});
const {optimisticData, ...onyxDataWithoutOptimisticData} = onyxData;
Expand Down Expand Up @@ -157,7 +155,7 @@ function makeRequestWithSideEffects(
* @param [onyxData.failureData] - Onyx instructions that will be passed to Onyx.update() when the response has jsonCode !== 200.
* @param [onyxData.finallyData] - Onyx instructions that will be passed to Onyx.update() when the response has jsonCode === 200 or jsonCode !== 200.
*/
function read(command: string, apiCommandParameters: Record<string, unknown>, onyxData: OnyxData = {}) {
function read<TCommand extends ReadCommand>(command: TCommand, apiCommandParameters: ApiRequestCommandParameters[TCommand], onyxData: OnyxData = {}) {
// Ensure all write requests on the sequential queue have finished responding before running read requests.
// Responses from read requests can overwrite the optimistic data inserted by
// write requests that use the same Onyx keys and haven't responded yet.
Expand Down
6 changes: 6 additions & 0 deletions src/libs/API/parameters/AcceptWalletTermsParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type AcceptWalletTermsParams = {
hasAcceptedTerms: boolean;
reportID: string;
};

export default AcceptWalletTermsParams;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type ActivatePhysicalExpensifyCardParams = {
cardLastFourDigits: string;
cardID: number;
};
export default ActivatePhysicalExpensifyCardParams;
13 changes: 13 additions & 0 deletions src/libs/API/parameters/AddCommentOrAttachementParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type AddCommentOrAttachementParams = {
reportID: string;
reportActionID?: string;
commentReportActionID?: string | null;
reportComment?: string;
file?: File;
timezone?: string;
shouldAllowActionableMentionWhispers?: boolean;
clientCreatedTime?: string;
isOldDotConciergeChat?: boolean;
};

export default AddCommentOrAttachementParams;
10 changes: 10 additions & 0 deletions src/libs/API/parameters/AddEmojiReactionParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type AddEmojiReactionParams = {
reportID: string;
skinTone: string | number;
emojiCode: string;
reportActionID: string;
createdAt: string;
useEmojiReactions: boolean;
};

export default AddEmojiReactionParams;
8 changes: 8 additions & 0 deletions src/libs/API/parameters/AddMembersToWorkspaceParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type AddMembersToWorkspaceParams = {
employees: string;
welcomeNote: string;
policyID: string;
reportCreationData?: string;
};

export default AddMembersToWorkspaceParams;
3 changes: 3 additions & 0 deletions src/libs/API/parameters/AddNewContactMethodParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type AddNewContactMethodParams = {partnerUserID: string};

export default AddNewContactMethodParams;
14 changes: 14 additions & 0 deletions src/libs/API/parameters/AddPaymentCardParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';

type AddPaymentCardParams = {
cardNumber: string;
cardYear: string;
cardMonth: string;
cardCVV: string;
addressName: string;
addressZip: string;
currency: ValueOf<typeof CONST.CURRENCY>;
isP2PDebitCard: boolean;
};
export default AddPaymentCardParams;
Loading

0 comments on commit 30ef139

Please sign in to comment.