Skip to content

Commit

Permalink
Merge branch 'main' into fix/29712
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Jan 28, 2024
2 parents d3773d7 + c5ca9a8 commit f9b2f6d
Show file tree
Hide file tree
Showing 193 changed files with 2,241 additions and 1,241 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9.0
20.10.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ If you're using another operating system, you will need to ensure `mkcert` is in
## Running the iOS app 📱
For an M1 Mac, read this [SO](https://stackoverflow.com/questions/64901180/how-to-run-cocoapods-on-apple-silicon-m1) for installing cocoapods.

* If you haven't already, install Xcode tools and make sure to install the optional "iOS Platform" package as well. This installation may take awhile.
* Install project gems, including cocoapods, using bundler to ensure everyone uses the same versions. In the project root, run: `bundle install`
* If you get the error `Could not find 'bundler'`, install the bundler gem first: `gem install bundler` and try again.
* If you are using MacOS and get the error `Gem::FilePermissionError` when trying to install the bundler gem, you're likely using system Ruby, which requires administrator permission to modify. To get around this, install another version of Ruby with a version manager like [rbenv](https://github.com/rbenv/rbenv#installation).
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
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"react-native-linear-gradient": "^2.8.1",
"react-native-localize": "^2.2.6",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.118",
"react-native-onyx": "1.0.118-1",
"react-native-pager-view": "6.2.2",
"react-native-pdf": "6.7.3",
"react-native-performance": "^5.1.0",
Expand Down Expand Up @@ -316,7 +316,7 @@
]
},
"engines": {
"node": "20.9.0",
"npm": "10.1.0"
"node": "20.10.0",
"npm": "10.2.3"
}
}
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
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
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,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;
12 changes: 12 additions & 0 deletions src/libs/API/parameters/AddPersonalBankAccountParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type AddPersonalBankAccountParams = {
addressName: string;
routingNumber: string;
accountNumber: string;
isSavings: boolean;
setupType: string;
bank?: string;
plaidAccountID: string;
plaidAccessToken: string;
};

export default AddPersonalBankAccountParams;
9 changes: 9 additions & 0 deletions src/libs/API/parameters/AddSchoolPrincipalParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type AddSchoolPrincipalParams = {
firstName: string;
lastName: string;
partnerUserID: string;
policyID: string;
reportCreationData: string;
};

export default AddSchoolPrincipalParams;
15 changes: 15 additions & 0 deletions src/libs/API/parameters/AddWorkspaceRoomParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';
import type {WriteCapability} from '@src/types/onyx/Report';

type AddWorkspaceRoomParams = {
reportID: string;
createdReportActionID: string;
policyID?: string;
reportName?: string;
visibility?: ValueOf<typeof CONST.REPORT.VISIBILITY>;
writeCapability?: WriteCapability;
welcomeMessage?: string;
};

export default AddWorkspaceRoomParams;
6 changes: 6 additions & 0 deletions src/libs/API/parameters/AnswerQuestionsForWalletParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type AnswerQuestionsForWalletParams = {
idologyAnswers: string;
idNumber: string;
};

export default AnswerQuestionsForWalletParams;
10 changes: 10 additions & 0 deletions src/libs/API/parameters/AuthenticatePusherParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type AuthenticatePusherParams = {
// eslint-disable-next-line @typescript-eslint/naming-convention
socket_id: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
channel_name: string;
shouldRetry: boolean;
forceNetworkRequest: boolean;
};

export default AuthenticatePusherParams;
7 changes: 7 additions & 0 deletions src/libs/API/parameters/BankAccountHandlePlaidErrorParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type BankAccountHandlePlaidErrorParams = {
bankAccountID: number;
error: string;
errorDescription: string;
plaidRequestID: string;
};
export default BankAccountHandlePlaidErrorParams;
9 changes: 9 additions & 0 deletions src/libs/API/parameters/BeginAppleSignInParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';

type BeginAppleSignInParams = {
idToken: string | undefined | null;
preferredLocale: ValueOf<typeof CONST.LOCALES> | null;
};

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

type BeginGoogleSignInParams = {
token: string | null;
preferredLocale: ValueOf<typeof CONST.LOCALES> | null;
};

export default BeginGoogleSignInParams;
Loading

0 comments on commit f9b2f6d

Please sign in to comment.