From 8b78aa1fe8b1b1e032c4eb385b17c9e7fcdb4a8a Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Wed, 19 Jul 2023 16:56:17 -0700 Subject: [PATCH 001/211] Send debtor accountID in RequestMoney --- src/libs/actions/IOU.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index e480120a7323..3d66d8e2b511 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -411,6 +411,7 @@ function requestMoney(report, amount, currency, payeeEmail, payeeAccountID, part 'RequestMoney', { debtorEmail: payerEmail, + debtorAccountID: payerAccountID, amount, currency, comment, From 593df794004f2cf8b16eb99983c6ee9ce33cd7fc Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Fri, 25 Aug 2023 14:50:40 +0200 Subject: [PATCH 002/211] Prepare POC --- src/components/DummyComponentWithStateHook.js | 16 ++ src/hooks/form/FormWrapper.js | 206 ++++++++++++++++++ src/hooks/form/useForm.js | 112 ++++++++++ src/pages/settings/Profile/DisplayNamePage.js | 52 +++-- 4 files changed, 364 insertions(+), 22 deletions(-) create mode 100644 src/components/DummyComponentWithStateHook.js create mode 100644 src/hooks/form/FormWrapper.js create mode 100644 src/hooks/form/useForm.js diff --git a/src/components/DummyComponentWithStateHook.js b/src/components/DummyComponentWithStateHook.js new file mode 100644 index 000000000000..1ed2f8dab43b --- /dev/null +++ b/src/components/DummyComponentWithStateHook.js @@ -0,0 +1,16 @@ +import {Text} from 'react-native'; +import React, {useState} from 'react'; + +const propTypes = {}; +const defaultProps = {}; + +function DummyComponentWithStateHook() { + const [state] = useState(''); + return {state}; +} + +DummyComponentWithStateHook.propTypes = propTypes; +DummyComponentWithStateHook.defaultProps = defaultProps; +DummyComponentWithStateHook.displayName = 'DummyComponentWithStateHook'; + +export default DummyComponentWithStateHook; diff --git a/src/hooks/form/FormWrapper.js b/src/hooks/form/FormWrapper.js new file mode 100644 index 000000000000..a63d282efb7e --- /dev/null +++ b/src/hooks/form/FormWrapper.js @@ -0,0 +1,206 @@ +import React, {useCallback, useMemo, useRef} from 'react'; +import {Keyboard, ScrollView, StyleSheet} from 'react-native'; +import _ from 'underscore'; +import PropTypes from 'prop-types'; +import {withOnyx} from 'react-native-onyx'; +import * as ErrorUtils from '../../libs/ErrorUtils'; +import FormSubmit from '../../components/FormSubmit'; +import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButton'; +import styles from '../../styles/styles'; +import SafeAreaConsumer from '../../components/SafeAreaConsumer'; +import ScrollViewWithContext from '../../components/ScrollViewWithContext'; + +import stylePropTypes from '../../styles/stylePropTypes'; +import networkPropTypes from '../../components/networkPropTypes'; +import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; +import compose from '../../libs/compose'; +import {withNetwork} from '../../components/OnyxProvider'; + +const propTypes = { + /** A unique Onyx key identifying the form */ + formID: PropTypes.string.isRequired, + + /** Text to be displayed in the submit button */ + submitButtonText: PropTypes.string.isRequired, + + /** Controls the submit button's visibility */ + isSubmitButtonVisible: PropTypes.bool, + + /** Callback to validate the form */ + validate: PropTypes.func, + + /** Callback to submit the form */ + onSubmit: PropTypes.func.isRequired, + + /** Children to render. */ + children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, + + /* Onyx Props */ + + /** Contains the form state that must be accessed outside of the component */ + formState: PropTypes.shape({ + /** Controls the loading state of the form */ + isLoading: PropTypes.bool, + + /** Server side errors keyed by microtime */ + errors: PropTypes.objectOf(PropTypes.string), + + /** Field-specific server side errors keyed by microtime */ + errorFields: PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)), + }), + + /** Should the button be enabled when offline */ + enabledWhenOffline: PropTypes.bool, + + /** Whether the form submit action is dangerous */ + isSubmitActionDangerous: PropTypes.bool, + + /** Whether ScrollWithContext should be used instead of regular ScrollView. + * Set to true when there's a nested Picker component in Form. + */ + scrollContextEnabled: PropTypes.bool, + + /** Container styles */ + style: stylePropTypes, + + /** Custom content to display in the footer after submit button */ + footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), + + /** Information about the network */ + network: networkPropTypes.isRequired, + + ...withLocalizePropTypes, +}; + +const defaultProps = { + isSubmitButtonVisible: true, + formState: { + isLoading: false, + }, + enabledWhenOffline: false, + isSubmitActionDangerous: false, + scrollContextEnabled: false, + footerContent: null, + style: [], + validate: () => ({}), +}; + +function FormWrapper(props) { + const formRef = useRef(null); + const formContentRef = useRef(null); + const {onSubmit, children, formState, errors, inputRefs, submitButtonText, footerContent, isSubmitButtonVisible, style, enabledWhenOffline, isSubmitActionDangerous, formID} = props; + + const errorMessage = useMemo(() => { + const latestErrorMessage = ErrorUtils.getLatestErrorMessage(props.formState); + return typeof latestErrorMessage === 'string' ? latestErrorMessage : ''; + }, [formState]); + + const scrollViewContent = useCallback( + (safeAreaPaddingBottomStyle) => ( + + {children} + {isSubmitButtonVisible && ( + 0 || Boolean(errorMessage) || !_.isEmpty(formState.errorFields)} + isLoading={formState.isLoading} + message={_.isEmpty(formState.errorFields) ? errorMessage : null} + onSubmit={onSubmit} + footerContent={footerContent} + onFixTheErrorsLinkPressed={() => { + const errorFields = !_.isEmpty(errors) ? errors : formState.errorFields; + const focusKey = _.find(_.keys(inputRefs), (key) => _.keys(errorFields).includes(key)); + const focusInput = inputRefs[focusKey].current; + + // Dismiss the keyboard for non-text fields by checking if the component has the isFocused method, as only TextInput has this method. + if (typeof focusInput.isFocused !== 'function') { + Keyboard.dismiss(); + } + + // We subtract 10 to scroll slightly above the input + if (focusInput.measureLayout && typeof focusInput.measureLayout === 'function') { + // We measure relative to the content root, not the scroll view, as that gives + // consistent results across mobile and web + focusInput.measureLayout(formContentRef.current, (x, y) => + formRef.current.scrollTo({ + y: y - 10, + animated: false, + }), + ); + } + + // Focus the input after scrolling, as on the Web it gives a slightly better visual result + if (focusInput.focus && typeof focusInput.focus === 'function') { + focusInput.focus(); + } + }} + containerStyles={[styles.mh0, styles.mt5, styles.flex1]} + enabledWhenOffline={enabledWhenOffline} + isSubmitActionDangerous={isSubmitActionDangerous} + disablePressOnEnter + /> + )} + + ), + [ + style, + onSubmit, + children, + isSubmitButtonVisible, + submitButtonText, + errors, + errorMessage, + formState.errorFields, + formState.isLoading, + footerContent, + enabledWhenOffline, + isSubmitActionDangerous, + inputRefs, + ], + ); + + return ( + + {({safeAreaPaddingBottomStyle}) => + props.scrollContextEnabled ? ( + + {scrollViewContent(safeAreaPaddingBottomStyle)} + + ) : ( + + {scrollViewContent(safeAreaPaddingBottomStyle)} + + ) + } + + ); +} + +FormWrapper.displayName = 'Form'; +FormWrapper.propTypes = propTypes; +FormWrapper.defaultProps = defaultProps; + +export default compose( + withLocalize, + withNetwork(), + withOnyx({ + formState: { + key: (props) => props.formID, + }, + }), +)(FormWrapper); diff --git a/src/hooks/form/useForm.js b/src/hooks/form/useForm.js new file mode 100644 index 000000000000..5fc13f701441 --- /dev/null +++ b/src/hooks/form/useForm.js @@ -0,0 +1,112 @@ +import React, {createRef, useCallback, useRef, useState} from 'react'; +import _ from 'underscore'; +import FormWrapper from './FormWrapper'; +import Visibility from '../../libs/Visibility'; +import * as FormActions from '../../libs/actions/FormActions'; + +/* eslint-disable react/jsx-props-no-spreading */ +function useForm({validate, shouldValidateOnBlur = true, shouldValidateOnChange = true}) { + const refs = useRef({}); + const touchedInputs = useRef({}); + const [inputValues, setInputValues] = useState({}); + const [errors, setErrors] = useState([]); + + const onValidate = (values) => { + const validateErrors = validate(values); + setErrors(validateErrors); + }; + /** + * @param {String} inputID - The inputID of the input being touched + */ + const setTouchedInput = useCallback( + (inputID) => { + touchedInputs.current[inputID] = true; + }, + [touchedInputs], + ); + + const registerInput = (inputID, props = {}) => { + const newRef = props.ref || createRef(); + refs[inputID] = newRef; + + // We want to initialize the input value if it's undefined + if (_.isUndefined(inputValues[inputID])) { + inputValues[inputID] = props.defaultValue || ''; + } + + // We force the form to set the input value from the defaultValue props if there is a saved valid value + if (props.shouldUseDefaultValue) { + inputValues[inputID] = props.defaultValue; + } + + if (!_.isUndefined(props.value)) { + inputValues[inputID] = props.value; + } + + return { + ...props, + ref: newRef, + inputID, + errorText: errors[inputID], + value: inputValues[inputID], + // As the text input is controlled, we never set the defaultValue prop + // as this is already happening by the value prop. + defaultValue: undefined, + onTouched: (event) => { + setTouchedInput(inputID); + if (_.isFunction(props.onTouched)) { + props.onTouched(event); + } + }, + onBlur: (event) => { + // Only run validation when user proactively blurs the input. + if (Visibility.isVisible() && Visibility.hasFocus()) { + // We delay the validation in order to prevent Checkbox loss of focus when + // the user are focusing a TextInput and proceeds to toggle a CheckBox in + // web and mobile web platforms. + setTimeout(() => { + setTouchedInput(inputID); + if (shouldValidateOnBlur) { + onValidate(inputValues); + } + }, 200); + } + + if (_.isFunction(props.onBlur)) { + props.onBlur(event); + } + }, + onInputChange: (value, key) => { + const inputKey = key || inputID; + setInputValues((prevState) => { + const newState = { + ...prevState, + [inputKey]: value, + }; + + if (shouldValidateOnChange) { + onValidate(newState); + } + return newState; + }); + + if (props.shouldSaveDraft) { + FormActions.setDraftValues(props.formID, {[inputKey]: value}); + } + + if (_.isFunction(props.onValueChange)) { + props.onValueChange(value, inputKey); + } + }, + }; + }; + + const Form = useCallback((props) => { + const {children, ...rest} = props; + return {children}; + }, []); + + return {registerInput, Form}; +} + +export default useForm; diff --git a/src/pages/settings/Profile/DisplayNamePage.js b/src/pages/settings/Profile/DisplayNamePage.js index 31ec955ed0c6..b872e494ce39 100644 --- a/src/pages/settings/Profile/DisplayNamePage.js +++ b/src/pages/settings/Profile/DisplayNamePage.js @@ -1,11 +1,10 @@ import lodashGet from 'lodash/get'; import React from 'react'; import {View} from 'react-native'; -import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../components/withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../../components/withCurrentUserPersonalDetails'; import ScreenWrapper from '../../../components/ScreenWrapper'; import HeaderWithBackButton from '../../../components/HeaderWithBackButton'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; -import Form from '../../../components/Form'; import ONYXKEYS from '../../../ONYXKEYS'; import CONST from '../../../CONST'; import * as ValidationUtils from '../../../libs/ValidationUtils'; @@ -13,10 +12,12 @@ import TextInput from '../../../components/TextInput'; import Text from '../../../components/Text'; import styles from '../../../styles/styles'; import * as PersonalDetails from '../../../libs/actions/PersonalDetails'; +import DummyComponentWithStateHook from '../../../components/DummyComponentWithStateHook'; import compose from '../../../libs/compose'; import * as ErrorUtils from '../../../libs/ErrorUtils'; import ROUTES from '../../../ROUTES'; import Navigation from '../../../libs/Navigation/Navigation'; +import useForm from '../../../hooks/form/useForm'; const propTypes = { ...withLocalizePropTypes, @@ -47,7 +48,8 @@ function DisplayNamePage(props) { * @returns {Object} - An object containing the errors for each inputID */ const validate = (values) => { - const errors = {}; + const requiredFields = ['firstName']; + const errors = ValidationUtils.getFieldRequiredErrors(values, requiredFields); // First we validate the first name field if (!ValidationUtils.isValidDisplayName(values.firstName)) { @@ -61,10 +63,13 @@ function DisplayNamePage(props) { if (!ValidationUtils.isValidDisplayName(values.lastName)) { errors.lastName = 'personalDetails.error.hasInvalidCharacter'; } - return errors; }; + // register input requires props spreading + /* eslint-disable react/jsx-props-no-spreading */ + const {Form, registerInput} = useForm({validate}); + return ( + {props.translate('displayNamePage.isShownOnProfile')} From 32beaafcc9f01bd54a7ad779b871ad79dcf6fd33 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Tue, 5 Sep 2023 11:23:08 +0200 Subject: [PATCH 003/211] POC of Form using custom input components --- src/hooks/form/useForm.js | 112 --------- src/hooks/useForm/FormContext.js | 4 + src/hooks/useForm/FormProvider.js | 235 ++++++++++++++++++ src/hooks/{form => useForm}/FormWrapper.js | 2 +- src/hooks/useForm/InputWrapper.js | 11 + src/hooks/useForm/index.js | 11 + src/pages/settings/Profile/DisplayNamePage.js | 53 ++-- 7 files changed, 289 insertions(+), 139 deletions(-) delete mode 100644 src/hooks/form/useForm.js create mode 100644 src/hooks/useForm/FormContext.js create mode 100644 src/hooks/useForm/FormProvider.js rename src/hooks/{form => useForm}/FormWrapper.js (99%) create mode 100644 src/hooks/useForm/InputWrapper.js create mode 100644 src/hooks/useForm/index.js diff --git a/src/hooks/form/useForm.js b/src/hooks/form/useForm.js deleted file mode 100644 index 5fc13f701441..000000000000 --- a/src/hooks/form/useForm.js +++ /dev/null @@ -1,112 +0,0 @@ -import React, {createRef, useCallback, useRef, useState} from 'react'; -import _ from 'underscore'; -import FormWrapper from './FormWrapper'; -import Visibility from '../../libs/Visibility'; -import * as FormActions from '../../libs/actions/FormActions'; - -/* eslint-disable react/jsx-props-no-spreading */ -function useForm({validate, shouldValidateOnBlur = true, shouldValidateOnChange = true}) { - const refs = useRef({}); - const touchedInputs = useRef({}); - const [inputValues, setInputValues] = useState({}); - const [errors, setErrors] = useState([]); - - const onValidate = (values) => { - const validateErrors = validate(values); - setErrors(validateErrors); - }; - /** - * @param {String} inputID - The inputID of the input being touched - */ - const setTouchedInput = useCallback( - (inputID) => { - touchedInputs.current[inputID] = true; - }, - [touchedInputs], - ); - - const registerInput = (inputID, props = {}) => { - const newRef = props.ref || createRef(); - refs[inputID] = newRef; - - // We want to initialize the input value if it's undefined - if (_.isUndefined(inputValues[inputID])) { - inputValues[inputID] = props.defaultValue || ''; - } - - // We force the form to set the input value from the defaultValue props if there is a saved valid value - if (props.shouldUseDefaultValue) { - inputValues[inputID] = props.defaultValue; - } - - if (!_.isUndefined(props.value)) { - inputValues[inputID] = props.value; - } - - return { - ...props, - ref: newRef, - inputID, - errorText: errors[inputID], - value: inputValues[inputID], - // As the text input is controlled, we never set the defaultValue prop - // as this is already happening by the value prop. - defaultValue: undefined, - onTouched: (event) => { - setTouchedInput(inputID); - if (_.isFunction(props.onTouched)) { - props.onTouched(event); - } - }, - onBlur: (event) => { - // Only run validation when user proactively blurs the input. - if (Visibility.isVisible() && Visibility.hasFocus()) { - // We delay the validation in order to prevent Checkbox loss of focus when - // the user are focusing a TextInput and proceeds to toggle a CheckBox in - // web and mobile web platforms. - setTimeout(() => { - setTouchedInput(inputID); - if (shouldValidateOnBlur) { - onValidate(inputValues); - } - }, 200); - } - - if (_.isFunction(props.onBlur)) { - props.onBlur(event); - } - }, - onInputChange: (value, key) => { - const inputKey = key || inputID; - setInputValues((prevState) => { - const newState = { - ...prevState, - [inputKey]: value, - }; - - if (shouldValidateOnChange) { - onValidate(newState); - } - return newState; - }); - - if (props.shouldSaveDraft) { - FormActions.setDraftValues(props.formID, {[inputKey]: value}); - } - - if (_.isFunction(props.onValueChange)) { - props.onValueChange(value, inputKey); - } - }, - }; - }; - - const Form = useCallback((props) => { - const {children, ...rest} = props; - return {children}; - }, []); - - return {registerInput, Form}; -} - -export default useForm; diff --git a/src/hooks/useForm/FormContext.js b/src/hooks/useForm/FormContext.js new file mode 100644 index 000000000000..40edaa7cca69 --- /dev/null +++ b/src/hooks/useForm/FormContext.js @@ -0,0 +1,4 @@ +import {createContext} from 'react'; + +const FormContext = createContext({}); +export default FormContext; diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js new file mode 100644 index 000000000000..0961dce91df6 --- /dev/null +++ b/src/hooks/useForm/FormProvider.js @@ -0,0 +1,235 @@ +import React, {createRef, useCallback, useRef, useState} from 'react'; +import _ from 'underscore'; +import {withOnyx} from 'react-native-onyx'; +import PropTypes from 'prop-types'; +import Visibility from '../../libs/Visibility'; +import * as FormActions from '../../libs/actions/FormActions'; +import FormContext from './FormContext'; +import FormWrapper from './FormWrapper'; +import compose from '../../libs/compose'; +import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; +import {withNetwork} from '../../components/OnyxProvider'; +import stylePropTypes from '../../styles/stylePropTypes'; +import networkPropTypes from '../../components/networkPropTypes'; + +const propTypes = { + /** A unique Onyx key identifying the form */ + formID: PropTypes.string.isRequired, + + /** Text to be displayed in the submit button */ + submitButtonText: PropTypes.string.isRequired, + + /** Controls the submit button's visibility */ + isSubmitButtonVisible: PropTypes.bool, + + /** Callback to validate the form */ + validate: PropTypes.func, + + /** Callback to submit the form */ + onSubmit: PropTypes.func.isRequired, + + /** Children to render. */ + children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, + + /* Onyx Props */ + + /** Contains the form state that must be accessed outside of the component */ + formState: PropTypes.shape({ + /** Controls the loading state of the form */ + isLoading: PropTypes.bool, + + /** Server side errors keyed by microtime */ + errors: PropTypes.objectOf(PropTypes.string), + + /** Field-specific server side errors keyed by microtime */ + errorFields: PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)), + }), + + /** Should the button be enabled when offline */ + enabledWhenOffline: PropTypes.bool, + + /** Whether the form submit action is dangerous */ + isSubmitActionDangerous: PropTypes.bool, + + /** Whether ScrollWithContext should be used instead of regular ScrollView. + * Set to true when there's a nested Picker component in Form. + */ + scrollContextEnabled: PropTypes.bool, + + /** Container styles */ + style: stylePropTypes, + + /** Custom content to display in the footer after submit button */ + footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), + + /** Information about the network */ + network: networkPropTypes.isRequired, + + ...withLocalizePropTypes, +}; + +const defaultProps = { + isSubmitButtonVisible: true, + formState: { + isLoading: false, + }, + enabledWhenOffline: false, + isSubmitActionDangerous: false, + scrollContextEnabled: false, + footerContent: null, + style: [], + validate: () => ({}), +}; + +function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, children, formState, network, enabledWhenOffline, onSubmit, ...rest}) { + const inputRefs = useRef({}); + const touchedInputs = useRef({}); + const [inputValues, setInputValues] = useState({}); + const [errors, setErrors] = useState([]); + + const onValidate = useCallback( + (values) => { + const validateErrors = validate(values); + setErrors(validateErrors); + }, + [validate], + ); + + /** + * @param {String} inputID - The inputID of the input being touched + */ + const setTouchedInput = useCallback( + (inputID) => { + touchedInputs.current[inputID] = true; + }, + [touchedInputs], + ); + + const submit = useCallback(() => { + // Return early if the form is already submitting to avoid duplicate submission + if (formState.isLoading) { + return; + } + + // Touches all form inputs so we can validate the entire form + _.each(inputRefs.current, (inputRef, inputID) => (touchedInputs.current[inputID] = true)); + + // Validate form and return early if any errors are found + if (!_.isEmpty(onValidate(inputValues))) { + return; + } + + // Do not submit form if network is offline and the form is not enabled when offline + if (network.isOffline && !enabledWhenOffline) { + return; + } + // Call submit handler + onSubmit(inputValues); + }, [enabledWhenOffline, formState.isLoading, inputValues, network.isOffline, onSubmit, onValidate]); + + const registerInput = useCallback( + (inputID, propsToParse = {}) => { + const newRef = propsToParse.ref || createRef(); + inputRefs[inputID] = newRef; + + // We want to initialize the input value if it's undefined + if (_.isUndefined(inputValues[inputID])) { + inputValues[inputID] = propsToParse.defaultValue || ''; + } + + // We force the form to set the input value from the defaultValue props if there is a saved valid value + if (propsToParse.shouldUseDefaultValue) { + inputValues[inputID] = propsToParse.defaultValue; + } + + if (!_.isUndefined(propsToParse.value)) { + inputValues[inputID] = propsToParse.value; + } + + return { + ...propsToParse, + ref: newRef, + inputID, + key: propsToParse.key || inputID, + errorText: errors[inputID], + value: inputValues[inputID], + // As the text input is controlled, we never set the defaultValue prop + // as this is already happening by the value prop. + defaultValue: undefined, + onTouched: (event) => { + setTouchedInput(inputID); + if (_.isFunction(propsToParse.onTouched)) { + propsToParse.onTouched(event); + } + }, + onBlur: (event) => { + // Only run validation when user proactively blurs the input. + if (Visibility.isVisible() && Visibility.hasFocus()) { + // We delay the validation in order to prevent Checkbox loss of focus when + // the user are focusing a TextInput and proceeds to toggle a CheckBox in + // web and mobile web platforms. + setTimeout(() => { + setTouchedInput(inputID); + if (shouldValidateOnBlur) { + onValidate(inputValues); + } + }, 200); + } + + if (_.isFunction(propsToParse.onBlur)) { + propsToParse.onBlur(event); + } + }, + onInputChange: (value, key) => { + const inputKey = key || inputID; + setInputValues((prevState) => { + const newState = { + ...prevState, + [inputKey]: value, + }; + + if (shouldValidateOnChange) { + onValidate(newState); + } + return newState; + }); + + if (propsToParse.shouldSaveDraft) { + FormActions.setDraftValues(propsToParse.formID, {[inputKey]: value}); + } + + if (_.isFunction(propsToParse.onValueChange)) { + propsToParse.onValueChange(value, inputKey); + } + }, + }; + }, + [errors, inputValues, onValidate, setTouchedInput, shouldValidateOnBlur, shouldValidateOnChange], + ); + + return ( + + {/* eslint-disable react/jsx-props-no-spreading */} + + {children} + + + ); +} + +FormProvider.displayName = 'Form'; +FormProvider.propTypes = propTypes; +FormProvider.defaultProps = defaultProps; + +export default compose( + withLocalize, + withNetwork(), + withOnyx({ + formState: { + key: (props) => props.formID, + }, + }), +)(FormProvider); diff --git a/src/hooks/form/FormWrapper.js b/src/hooks/useForm/FormWrapper.js similarity index 99% rename from src/hooks/form/FormWrapper.js rename to src/hooks/useForm/FormWrapper.js index a63d282efb7e..221eb2b152f0 100644 --- a/src/hooks/form/FormWrapper.js +++ b/src/hooks/useForm/FormWrapper.js @@ -191,7 +191,7 @@ function FormWrapper(props) { ); } -FormWrapper.displayName = 'Form'; +FormWrapper.displayName = 'FormWrapper'; FormWrapper.propTypes = propTypes; FormWrapper.defaultProps = defaultProps; diff --git a/src/hooks/useForm/InputWrapper.js b/src/hooks/useForm/InputWrapper.js new file mode 100644 index 000000000000..ad3d4a2f0fc8 --- /dev/null +++ b/src/hooks/useForm/InputWrapper.js @@ -0,0 +1,11 @@ +import React, {forwardRef, useContext} from 'react'; +import FormContext from './FormContext'; + +const InputWrapper = forwardRef((props, ref) => { + const {RenderInput, inputID, ...rest} = props; + const {registerInput} = useContext(FormContext); + // eslint-disable-next-line react/jsx-props-no-spreading + return ; +}); + +export default InputWrapper; diff --git a/src/hooks/useForm/index.js b/src/hooks/useForm/index.js new file mode 100644 index 000000000000..5e3a2b480172 --- /dev/null +++ b/src/hooks/useForm/index.js @@ -0,0 +1,11 @@ +import React, {useContext} from 'react'; +import InputWrapper from './InputWrapper'; +import FormContext from './FormContext'; +import FormProvider from './FormProvider'; + +function useForm() { + const formContext = useContext(FormContext); + return {Input: InputWrapper, Form: FormProvider, formContext}; +} + +export default useForm; diff --git a/src/pages/settings/Profile/DisplayNamePage.js b/src/pages/settings/Profile/DisplayNamePage.js index b872e494ce39..d13920881034 100644 --- a/src/pages/settings/Profile/DisplayNamePage.js +++ b/src/pages/settings/Profile/DisplayNamePage.js @@ -17,7 +17,7 @@ import compose from '../../../libs/compose'; import * as ErrorUtils from '../../../libs/ErrorUtils'; import ROUTES from '../../../ROUTES'; import Navigation from '../../../libs/Navigation/Navigation'; -import useForm from '../../../hooks/form/useForm'; +import useForm from '../../../hooks/useForm'; const propTypes = { ...withLocalizePropTypes, @@ -66,9 +66,7 @@ function DisplayNamePage(props) { return errors; }; - // register input requires props spreading - /* eslint-disable react/jsx-props-no-spreading */ - const {Form, registerInput} = useForm({validate}); + const {Form, Input} = useForm(); return ( {props.translate('displayNamePage.isShownOnProfile')} - - From 750ac4886592330f7eef581fc96c15a4f53a47a9 Mon Sep 17 00:00:00 2001 From: Sam Hariri <137707942+samh-nl@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:14:57 +0200 Subject: [PATCH 004/211] feat: support accountid attribute in user mentions --- .../HTMLRenderers/MentionUserRenderer.js | 58 +++++++++++++------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js index 7f7753dfea44..992f8494dc1f 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js @@ -1,6 +1,8 @@ import React from 'react'; import _ from 'underscore'; import {TNodeChildrenRenderer} from 'react-native-render-html'; +import {withOnyx} from 'react-native-onyx'; +import lodashGet from 'lodash/get'; import Navigation from '../../../libs/Navigation/Navigation'; import ROUTES from '../../../ROUTES'; import Text from '../../Text'; @@ -10,52 +12,63 @@ import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails import personalDetailsPropType from '../../../pages/personalDetailsPropType'; import * as StyleUtils from '../../../styles/StyleUtils'; import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils'; +import compose from '../../../libs/compose'; import TextLink from '../../TextLink'; +import ONYXKEYS from '../../../ONYXKEYS'; +import useLocalize from '../../../hooks/useLocalize'; const propTypes = { ...htmlRendererPropTypes, - /** - * Current user personal details - */ + /** Current user personal details */ currentUserPersonalDetails: personalDetailsPropType.isRequired, -}; -/** - * Navigates to user details screen based on email - * @param {String} email - * @returns {void} - * */ -const showUserDetails = (email) => Navigation.navigate(ROUTES.getDetailsRoute(email)); + /** Personal details of all users */ + personalDetails: personalDetailsPropType.isRequired, +}; function MentionUserRenderer(props) { + const {translate} = useLocalize(); const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']); + const htmlAttribAccountID = lodashGet(props.tnode.attributes, 'accountid'); + + let accountID; + let displayNameOrLogin; + let navigationRoute; - // We need to remove the leading @ from data as it is not part of the login - const loginWithoutLeadingAt = props.tnode.data ? props.tnode.data.slice(1) : ''; + if (!_.isEmpty(htmlAttribAccountID)) { + const user = lodashGet(props.personalDetails, htmlAttribAccountID); + accountID = parseInt(htmlAttribAccountID, 10); + displayNameOrLogin = lodashGet(user, 'login', '') || lodashGet(user, 'displayName', '') || translate('common.hidden'); + navigationRoute = ROUTES.getProfileRoute(htmlAttribAccountID); + } else { + // We need to remove the leading @ from data as it is not part of the login + displayNameOrLogin = props.tnode.data ? props.tnode.data.slice(1) : ''; - const accountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([loginWithoutLeadingAt])); + accountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([displayNameOrLogin])); + navigationRoute = ROUTES.getDetailsRoute(displayNameOrLogin); + } - const isOurMention = loginWithoutLeadingAt === props.currentUserPersonalDetails.login; + const isOurMention = accountID === props.currentUserPersonalDetails.accountID; return ( showUserDetails(loginWithoutLeadingAt)} + onPress={() => Navigation.navigate(navigationRoute)} // Add testID so it is NOT selected as an anchor tag by SelectionScraper testID="span" > - + {!_.isEmpty(htmlAttribAccountID) ? `@${displayNameOrLogin}` : } @@ -65,4 +78,11 @@ function MentionUserRenderer(props) { MentionUserRenderer.propTypes = propTypes; MentionUserRenderer.displayName = 'MentionUserRenderer'; -export default withCurrentUserPersonalDetails(MentionUserRenderer); +export default compose( + withCurrentUserPersonalDetails, + withOnyx({ + personalDetails: { + key: ONYXKEYS.PERSONAL_DETAILS_LIST, + }, + }), +)(MentionUserRenderer); From d1b15ea7a3e80ba4130efc936d468be1d70d622b Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Tue, 5 Sep 2023 15:31:24 -0700 Subject: [PATCH 005/211] Pass payer account id --- src/libs/actions/IOU.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 780222d3060c..8b6175625cda 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -480,6 +480,7 @@ function getMoneyRequestInformation( ); return { + payerAccountID, payerEmail, iouReport, chatReport, @@ -554,7 +555,7 @@ function createDistanceRequest(report, participant, comment, created, transactio * @param {Object} [receipt] */ function requestMoney(report, amount, currency, created, merchant, payeeEmail, payeeAccountID, participant, comment, receipt = undefined) { - const {payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation( + const {payerAccountID, payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation( report, participant, comment, From a55d51fb04d474a4c8bf4c4ac7efedc3a4677d4b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 6 Sep 2023 13:25:23 +0800 Subject: [PATCH 006/211] fix send button is enabled with empty comment --- .../report/ReportActionCompose/ReportActionCompose.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index c7517977aa27..a0c72cf5896f 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -36,6 +36,7 @@ import useLocalize from '../../../../hooks/useLocalize'; import getModalState from '../../../../libs/getModalState'; import useWindowDimensions from '../../../../hooks/useWindowDimensions'; import * as EmojiPickerActions from '../../../../libs/actions/EmojiPickerAction'; +import getDraftComment from '../../../../libs/ComposerUtils/getDraftComment'; const propTypes = { /** A method to call when the form is submitted */ @@ -105,7 +106,6 @@ function ReportActionCompose({ reportID, reportActions, shouldShowComposeInput, - isCommentEmpty: isCommentEmptyProp, }) { const {translate} = useLocalize(); const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions(); @@ -125,7 +125,10 @@ function ReportActionCompose({ * Updates the should clear state of the composer */ const [textInputShouldClear, setTextInputShouldClear] = useState(false); - const [isCommentEmpty, setIsCommentEmpty] = useState(isCommentEmptyProp); + const [isCommentEmpty, setIsCommentEmpty] = useState(() => { + const draftComment = getDraftComment(reportID); + return !draftComment || !!draftComment.match(/^(\s)*$/); + }); /** * Updates the visibility state of the menu @@ -431,10 +434,6 @@ export default compose( withNetwork(), withCurrentUserPersonalDetails, withOnyx({ - isCommentEmpty: { - key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`, - selector: (comment) => _.isEmpty(comment), - }, blockedFromConcierge: { key: ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE, }, From 19faf7deb3ed7043108a3ad7162fcbd90bb45901 Mon Sep 17 00:00:00 2001 From: Sam Hariri <137707942+samh-nl@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:52:57 +0200 Subject: [PATCH 007/211] feat: remove navigation and tooltip when hidden --- .../HTMLRenderers/MentionUserRenderer.js | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js index 992f8494dc1f..087334061fa2 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js @@ -10,6 +10,7 @@ import UserDetailsTooltip from '../../UserDetailsTooltip'; import htmlRendererPropTypes from './htmlRendererPropTypes'; import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails'; import personalDetailsPropType from '../../../pages/personalDetailsPropType'; +import styles from '../../../styles/styles'; import * as StyleUtils from '../../../styles/StyleUtils'; import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils'; import compose from '../../../libs/compose'; @@ -39,8 +40,13 @@ function MentionUserRenderer(props) { if (!_.isEmpty(htmlAttribAccountID)) { const user = lodashGet(props.personalDetails, htmlAttribAccountID); accountID = parseInt(htmlAttribAccountID, 10); - displayNameOrLogin = lodashGet(user, 'login', '') || lodashGet(user, 'displayName', '') || translate('common.hidden'); - navigationRoute = ROUTES.getProfileRoute(htmlAttribAccountID); + displayNameOrLogin = lodashGet(user, 'login', '') || lodashGet(user, 'displayName', ''); + + if (_.isEmpty(displayNameOrLogin)) { + displayNameOrLogin = translate('common.hidden'); + } else { + navigationRoute = ROUTES.getProfileRoute(htmlAttribAccountID); + } } else { // We need to remove the leading @ from data as it is not part of the login displayNameOrLogin = props.tnode.data ? props.tnode.data.slice(1) : ''; @@ -50,26 +56,33 @@ function MentionUserRenderer(props) { } const isOurMention = accountID === props.currentUserPersonalDetails.accountID; + const TextLinkComponent = _.isEmpty(navigationRoute) ? Text : TextLink; return ( - Navigation.navigate(navigationRoute)} + style={[ + _.omit(props.style, 'color'), + StyleUtils.getMentionStyle(isOurMention), + {color: StyleUtils.getMentionTextColor(isOurMention)}, + _.isEmpty(navigationRoute) && styles.cursorDefault, + ]} + href={_.isEmpty(navigationRoute) ? undefined : `/${navigationRoute}`} + onPress={_.isEmpty(navigationRoute) ? undefined : () => Navigation.navigate(navigationRoute)} // Add testID so it is NOT selected as an anchor tag by SelectionScraper testID="span" > {!_.isEmpty(htmlAttribAccountID) ? `@${displayNameOrLogin}` : } - + ); From 2af817dfd68a3d0b34b50a52de8c34edb58ba515 Mon Sep 17 00:00:00 2001 From: Sam Hariri <137707942+samh-nl@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:28:07 +0200 Subject: [PATCH 008/211] fix: ensure proptype is adhered to --- .../HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js index 087334061fa2..155596fb23b0 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js @@ -74,7 +74,7 @@ function MentionUserRenderer(props) { _.omit(props.style, 'color'), StyleUtils.getMentionStyle(isOurMention), {color: StyleUtils.getMentionTextColor(isOurMention)}, - _.isEmpty(navigationRoute) && styles.cursorDefault, + _.isEmpty(navigationRoute) ? styles.cursorDefault : {}, ]} href={_.isEmpty(navigationRoute) ? undefined : `/${navigationRoute}`} onPress={_.isEmpty(navigationRoute) ? undefined : () => Navigation.navigate(navigationRoute)} From 118ec38f2cfc2d406a0a5ead0339bae50c4aa335 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Wed, 6 Sep 2023 21:00:18 +0200 Subject: [PATCH 009/211] ref: inital migration to TS --- .../{Transaction.js => Transaction.ts} | 50 ++++++++----------- src/types/onyx/Transaction.ts | 5 ++ 2 files changed, 26 insertions(+), 29 deletions(-) rename src/libs/actions/{Transaction.js => Transaction.ts} (81%) diff --git a/src/libs/actions/Transaction.js b/src/libs/actions/Transaction.ts similarity index 81% rename from src/libs/actions/Transaction.js rename to src/libs/actions/Transaction.ts index b16e8c8753ac..f58db4915e77 100644 --- a/src/libs/actions/Transaction.js +++ b/src/libs/actions/Transaction.ts @@ -5,14 +5,15 @@ import lodashHas from 'lodash/has'; import ONYXKEYS from '../../ONYXKEYS'; import * as CollectionUtils from '../CollectionUtils'; import * as API from '../API'; +import {RecentWaypoints, Transaction} from '../../types/onyx'; -let recentWaypoints = []; +let recentWaypoints: RecentWaypoints[] = []; Onyx.connect({ key: ONYXKEYS.NVP_RECENT_WAYPOINTS, - callback: (val) => (recentWaypoints = val || []), + callback: (val) => (recentWaypoints = val ?? []), }); -const allTransactions = {}; +const allTransactions: Record = {}; Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transaction, key) => { @@ -24,10 +25,7 @@ Onyx.connect({ }, }); -/** - * @param {String} transactionID - */ -function createInitialWaypoints(transactionID) { +function createInitialWaypoints(transactionID: string) { Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints: { @@ -40,14 +38,11 @@ function createInitialWaypoints(transactionID) { /** * Add a stop to the transaction - * - * @param {String} transactionID - * @param {Number} newLastIndex */ -function addStop(transactionID) { - const transaction = lodashGet(allTransactions, transactionID, {}); - const existingWaypoints = lodashGet(transaction, 'comment.waypoints', {}); - const newLastIndex = _.size(existingWaypoints); +function addStop(transactionID: string) { + const transaction = allTransactions?.[transactionID] ?? {}; + const existingWaypoints = transaction?.comment?.waypoints ?? {}; + const newLastIndex = Object.keys(existingWaypoints).length; Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { @@ -69,11 +64,8 @@ function addStop(transactionID) { /** * Saves the selected waypoint to the transaction - * @param {String} transactionID - * @param {String} index - * @param {Object} waypoint */ -function saveWaypoint(transactionID, index, waypoint) { +function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoints) { Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints: { @@ -82,7 +74,8 @@ function saveWaypoint(transactionID, index, waypoint) { }, // Empty out errors when we're saving a new waypoint as this indicates the user is updating their input errorFields: { - route: null, + // TODO: check if its ok to put undefined + route: undefined, }, // Clear the existing route so that we don't show an old route @@ -102,20 +95,21 @@ function saveWaypoint(transactionID, index, waypoint) { return; } - const recentWaypointAlreadyExists = _.find(recentWaypoints, (recentWaypoint) => recentWaypoint.address === waypoint.address); + const recentWaypointAlreadyExists = recentWaypoints.find((recentWaypoint) => recentWaypoint.address === waypoint.address); if (!recentWaypointAlreadyExists) { + // TODO: Should we leave this? const clonedWaypoints = _.clone(recentWaypoints); clonedWaypoints.unshift(waypoint); Onyx.merge(ONYXKEYS.NVP_RECENT_WAYPOINTS, clonedWaypoints.slice(0, 5)); } } -function removeWaypoint(transactionID, currentIndex) { +function removeWaypoint(transactionID: string, currentIndex: string) { // Index comes from the route params and is a string const index = Number(currentIndex); - const transaction = lodashGet(allTransactions, transactionID, {}); - const existingWaypoints = lodashGet(transaction, 'comment.waypoints', {}); - const totalWaypoints = _.size(existingWaypoints); + const transaction = allTransactions?.[transactionID] ?? {}; + const existingWaypoints = transaction?.comment?.waypoints ?? {}; + const totalWaypoints = Object.keys(existingWaypoints).length; // Prevents removing the starting or ending waypoint but clear the stored address only if there are only two waypoints if (totalWaypoints === 2 && (index === 0 || index === totalWaypoints - 1)) { @@ -123,10 +117,10 @@ function removeWaypoint(transactionID, currentIndex) { return; } - const waypointValues = _.values(existingWaypoints); + const waypointValues = Object.values(existingWaypoints); waypointValues.splice(index, 1); - const reIndexedWaypoints = {}; + const reIndexedWaypoints: Record = {}; waypointValues.forEach((waypoint, idx) => { reIndexedWaypoints[`waypoint${idx}`] = waypoint; }); @@ -155,10 +149,8 @@ function removeWaypoint(transactionID, currentIndex) { /** * Gets the route for a set of waypoints * Used so we can generate a map view of the provided waypoints - * @param {String} transactionID - * @param {Object} waypoints */ -function getRoute(transactionID, waypoints) { +function getRoute(transactionID: string, waypoints: RecentWaypoints) { API.read( 'GetRoute', { diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 9e6cd603472f..2314b6230506 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -1,9 +1,11 @@ import {ValueOf} from 'type-fest'; import * as OnyxCommon from './OnyxCommon'; import CONST from '../../CONST'; +import RecentWaypoints from './RecentWaypoints'; type Comment = { comment?: string; + waypoints?: Record; }; type Transaction = { @@ -25,6 +27,9 @@ type Transaction = { source?: string; state?: ValueOf; }; + // TODO: fix unknown type + routes: Record; + errorFields: OnyxCommon.ErrorFields; }; export default Transaction; From 51b1ab3ec537d0586f22abbb4ba99e3187eb4db6 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Thu, 7 Sep 2023 13:16:44 +0200 Subject: [PATCH 010/211] Cleanup input wrapper --- src/hooks/useForm/InputWrapper.js | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/hooks/useForm/InputWrapper.js b/src/hooks/useForm/InputWrapper.js index ad3d4a2f0fc8..009bb762f270 100644 --- a/src/hooks/useForm/InputWrapper.js +++ b/src/hooks/useForm/InputWrapper.js @@ -1,11 +1,32 @@ import React, {forwardRef, useContext} from 'react'; +import PropTypes from 'prop-types'; import FormContext from './FormContext'; -const InputWrapper = forwardRef((props, ref) => { - const {RenderInput, inputID, ...rest} = props; +const propTypes = { + RenderInput: PropTypes.node.isRequired, + inputID: PropTypes.string.isRequired, + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]), +}; + +const defaultProps = { + forwardedRef: undefined, +}; + +function InputWrapper(props) { + const {RenderInput, inputID, forwardedRef, ...rest} = props; const {registerInput} = useContext(FormContext); // eslint-disable-next-line react/jsx-props-no-spreading - return ; -}); + return ; +} + +InputWrapper.propTypes = propTypes; +InputWrapper.defaultProps = defaultProps; +InputWrapper.displayName = 'InputWrapper'; -export default InputWrapper; +export default forwardRef((props, ref) => ( + +)); From 620b48c6975494e7c3a350acd325e83bbb70f1f6 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Thu, 7 Sep 2023 13:17:50 +0200 Subject: [PATCH 011/211] Remove redundant testing component --- src/components/DummyComponentWithStateHook.js | 16 ---------------- src/pages/settings/Profile/DisplayNamePage.js | 2 -- 2 files changed, 18 deletions(-) delete mode 100644 src/components/DummyComponentWithStateHook.js diff --git a/src/components/DummyComponentWithStateHook.js b/src/components/DummyComponentWithStateHook.js deleted file mode 100644 index 1ed2f8dab43b..000000000000 --- a/src/components/DummyComponentWithStateHook.js +++ /dev/null @@ -1,16 +0,0 @@ -import {Text} from 'react-native'; -import React, {useState} from 'react'; - -const propTypes = {}; -const defaultProps = {}; - -function DummyComponentWithStateHook() { - const [state] = useState(''); - return {state}; -} - -DummyComponentWithStateHook.propTypes = propTypes; -DummyComponentWithStateHook.defaultProps = defaultProps; -DummyComponentWithStateHook.displayName = 'DummyComponentWithStateHook'; - -export default DummyComponentWithStateHook; diff --git a/src/pages/settings/Profile/DisplayNamePage.js b/src/pages/settings/Profile/DisplayNamePage.js index d13920881034..4eb9e44f30ae 100644 --- a/src/pages/settings/Profile/DisplayNamePage.js +++ b/src/pages/settings/Profile/DisplayNamePage.js @@ -12,7 +12,6 @@ import TextInput from '../../../components/TextInput'; import Text from '../../../components/Text'; import styles from '../../../styles/styles'; import * as PersonalDetails from '../../../libs/actions/PersonalDetails'; -import DummyComponentWithStateHook from '../../../components/DummyComponentWithStateHook'; import compose from '../../../libs/compose'; import * as ErrorUtils from '../../../libs/ErrorUtils'; import ROUTES from '../../../ROUTES'; @@ -87,7 +86,6 @@ function DisplayNamePage(props) { shouldValidateOnBlur shouldValidateOnChange > - {props.translate('displayNamePage.isShownOnProfile')} Date: Thu, 7 Sep 2023 14:55:10 +0200 Subject: [PATCH 012/211] Cleanup form wrapper --- src/hooks/useForm/FormWrapper.js | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/hooks/useForm/FormWrapper.js b/src/hooks/useForm/FormWrapper.js index 221eb2b152f0..9ec4492f97aa 100644 --- a/src/hooks/useForm/FormWrapper.js +++ b/src/hooks/useForm/FormWrapper.js @@ -11,10 +11,8 @@ import SafeAreaConsumer from '../../components/SafeAreaConsumer'; import ScrollViewWithContext from '../../components/ScrollViewWithContext'; import stylePropTypes from '../../styles/stylePropTypes'; -import networkPropTypes from '../../components/networkPropTypes'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; -import {withNetwork} from '../../components/OnyxProvider'; const propTypes = { /** A unique Onyx key identifying the form */ @@ -26,9 +24,6 @@ const propTypes = { /** Controls the submit button's visibility */ isSubmitButtonVisible: PropTypes.bool, - /** Callback to validate the form */ - validate: PropTypes.func, - /** Callback to submit the form */ onSubmit: PropTypes.func.isRequired, @@ -66,9 +61,6 @@ const propTypes = { /** Custom content to display in the footer after submit button */ footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), - /** Information about the network */ - network: networkPropTypes.isRequired, - ...withLocalizePropTypes, }; @@ -82,7 +74,6 @@ const defaultProps = { scrollContextEnabled: false, footerContent: null, style: [], - validate: () => ({}), }; function FormWrapper(props) { @@ -91,7 +82,7 @@ function FormWrapper(props) { const {onSubmit, children, formState, errors, inputRefs, submitButtonText, footerContent, isSubmitButtonVisible, style, enabledWhenOffline, isSubmitActionDangerous, formID} = props; const errorMessage = useMemo(() => { - const latestErrorMessage = ErrorUtils.getLatestErrorMessage(props.formState); + const latestErrorMessage = ErrorUtils.getLatestErrorMessage(formState); return typeof latestErrorMessage === 'string' ? latestErrorMessage : ''; }, [formState]); @@ -148,19 +139,20 @@ function FormWrapper(props) { ), [ - style, - onSubmit, children, - isSubmitButtonVisible, - submitButtonText, - errors, + enabledWhenOffline, errorMessage, + errors, + footerContent, + formID, formState.errorFields, formState.isLoading, - footerContent, - enabledWhenOffline, - isSubmitActionDangerous, inputRefs, + isSubmitActionDangerous, + isSubmitButtonVisible, + onSubmit, + style, + submitButtonText, ], ); @@ -197,7 +189,6 @@ FormWrapper.defaultProps = defaultProps; export default compose( withLocalize, - withNetwork(), withOnyx({ formState: { key: (props) => props.formID, From 59652ce37082ee122e8cc3de704e922474b6aa56 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Thu, 7 Sep 2023 16:14:59 +0200 Subject: [PATCH 013/211] Cleanup DisplayNamePage --- src/pages/settings/Profile/DisplayNamePage.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/settings/Profile/DisplayNamePage.js b/src/pages/settings/Profile/DisplayNamePage.js index 8f031d87e162..ec8f96cd210e 100644 --- a/src/pages/settings/Profile/DisplayNamePage.js +++ b/src/pages/settings/Profile/DisplayNamePage.js @@ -47,8 +47,7 @@ function DisplayNamePage(props) { * @returns {Object} - An object containing the errors for each inputID */ const validate = (values) => { - const requiredFields = ['firstName']; - const errors = ValidationUtils.getFieldRequiredErrors(values, requiredFields); + const errors = {}; // First we validate the first name field if (!ValidationUtils.isValidDisplayName(values.firstName)) { @@ -92,7 +91,6 @@ function DisplayNamePage(props) { RenderInput={TextInput} inputID="firstName" name="fname" - key="iuadgbkj" label={props.translate('common.firstName')} accessibilityLabel={props.translate('common.firstName')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} From 0491bc3e3b92797ea2a65df650c158d60274d3e4 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Fri, 8 Sep 2023 13:46:38 +0200 Subject: [PATCH 014/211] Cleanup FormProvider --- src/hooks/useForm/FormProvider.js | 33 +++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index 0961dce91df6..03095d8f74f5 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -1,4 +1,4 @@ -import React, {createRef, useCallback, useRef, useState} from 'react'; +import React, {createRef, useCallback, useMemo, useRef, useState} from 'react'; import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; @@ -11,6 +11,8 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize import {withNetwork} from '../../components/OnyxProvider'; import stylePropTypes from '../../styles/stylePropTypes'; import networkPropTypes from '../../components/networkPropTypes'; +import * as ErrorUtils from '../../libs/ErrorUtils'; +import lodashGet from 'lodash/get'; const propTypes = { /** A unique Onyx key identifying the form */ @@ -81,6 +83,19 @@ const defaultProps = { validate: () => ({}), }; +function getInitialValueByType(valueType) { + switch (valueType) { + case 'string': + return ''; + case 'boolean': + return false; + case 'date': + return new Date(); + default: + return ''; + } +} + function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, children, formState, network, enabledWhenOffline, onSubmit, ...rest}) { const inputRefs = useRef({}); const touchedInputs = useRef({}); @@ -134,7 +149,7 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c // We want to initialize the input value if it's undefined if (_.isUndefined(inputValues[inputID])) { - inputValues[inputID] = propsToParse.defaultValue || ''; + inputValues[inputID] = propsToParse.defaultValue || getInitialValueByType(propsToParse.valueType); } // We force the form to set the input value from the defaultValue props if there is a saved valid value @@ -146,12 +161,22 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c inputValues[inputID] = propsToParse.value; } + const errorFields = lodashGet(formState, 'errorFields', {}); + const fieldErrorMessage = + _.chain(errorFields[inputID]) + .keys() + .sortBy() + .reverse() + .map((key) => errorFields[inputID][key]) + .first() + .value() || ''; + return { ...propsToParse, ref: newRef, inputID, key: propsToParse.key || inputID, - errorText: errors[inputID], + errorText: errors[inputID] || fieldErrorMessage, value: inputValues[inputID], // As the text input is controlled, we never set the defaultValue prop // as this is already happening by the value prop. @@ -204,7 +229,7 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c }, }; }, - [errors, inputValues, onValidate, setTouchedInput, shouldValidateOnBlur, shouldValidateOnChange], + [errors, formState, inputValues, onValidate, setTouchedInput, shouldValidateOnBlur, shouldValidateOnChange], ); return ( From 74f69a552ca2c288f60e1ab3076eb0bd8b0f97e2 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Fri, 8 Sep 2023 17:12:03 +0200 Subject: [PATCH 015/211] Fix lint --- src/hooks/useForm/FormProvider.js | 3 +-- src/hooks/useForm/index.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index 03095d8f74f5..e28c8543f6ab 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -1,4 +1,4 @@ -import React, {createRef, useCallback, useMemo, useRef, useState} from 'react'; +import React, {createRef, useCallback, useRef, useState} from 'react'; import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; @@ -11,7 +11,6 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize import {withNetwork} from '../../components/OnyxProvider'; import stylePropTypes from '../../styles/stylePropTypes'; import networkPropTypes from '../../components/networkPropTypes'; -import * as ErrorUtils from '../../libs/ErrorUtils'; import lodashGet from 'lodash/get'; const propTypes = { diff --git a/src/hooks/useForm/index.js b/src/hooks/useForm/index.js index 5e3a2b480172..faf102e5fd16 100644 --- a/src/hooks/useForm/index.js +++ b/src/hooks/useForm/index.js @@ -1,4 +1,4 @@ -import React, {useContext} from 'react'; +import {useContext} from 'react'; import InputWrapper from './InputWrapper'; import FormContext from './FormContext'; import FormProvider from './FormProvider'; From b74d73f18ceec1db82a733d669101a2f440d2e3b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 11 Sep 2023 12:58:02 +0200 Subject: [PATCH 016/211] ref: small refactors --- src/libs/actions/Transaction.ts | 10 ++++------ src/types/onyx/RecentWaypoints.ts | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index f58db4915e77..2d250cfc3902 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -1,7 +1,6 @@ -import _ from 'underscore'; import Onyx from 'react-native-onyx'; -import lodashGet from 'lodash/get'; import lodashHas from 'lodash/has'; +import lodashClone from 'lodash/clone'; import ONYXKEYS from '../../ONYXKEYS'; import * as CollectionUtils from '../CollectionUtils'; import * as API from '../API'; @@ -95,10 +94,9 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp return; } - const recentWaypointAlreadyExists = recentWaypoints.find((recentWaypoint) => recentWaypoint.address === waypoint.address); + const recentWaypointAlreadyExists = recentWaypoints.find((recentWaypoint) => recentWaypoint?.address === waypoint?.address); if (!recentWaypointAlreadyExists) { - // TODO: Should we leave this? - const clonedWaypoints = _.clone(recentWaypoints); + const clonedWaypoints = lodashClone(recentWaypoints); clonedWaypoints.unshift(waypoint); Onyx.merge(ONYXKEYS.NVP_RECENT_WAYPOINTS, clonedWaypoints.slice(0, 5)); } @@ -113,7 +111,7 @@ function removeWaypoint(transactionID: string, currentIndex: string) { // Prevents removing the starting or ending waypoint but clear the stored address only if there are only two waypoints if (totalWaypoints === 2 && (index === 0 || index === totalWaypoints - 1)) { - saveWaypoint(transactionID, index, null); + saveWaypoint(transactionID, index.toString(), null); return; } diff --git a/src/types/onyx/RecentWaypoints.ts b/src/types/onyx/RecentWaypoints.ts index 75780ef861e5..2b33997982c5 100644 --- a/src/types/onyx/RecentWaypoints.ts +++ b/src/types/onyx/RecentWaypoints.ts @@ -7,6 +7,6 @@ type RecentWaypoints = { /** The longitude of the waypoint */ lng: number; -}; +} | null; export default RecentWaypoints; From b6c8a6212582cad7d9df5f1eb1b1666dda40820c Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Mon, 11 Sep 2023 15:39:54 +0200 Subject: [PATCH 017/211] Cleanup --- src/hooks/useForm/FormProvider.js | 2 +- src/hooks/useForm/InputWrapper.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index e28c8543f6ab..c29597f48028 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -2,6 +2,7 @@ import React, {createRef, useCallback, useRef, useState} from 'react'; import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; +import lodashGet from 'lodash/get'; import Visibility from '../../libs/Visibility'; import * as FormActions from '../../libs/actions/FormActions'; import FormContext from './FormContext'; @@ -11,7 +12,6 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize import {withNetwork} from '../../components/OnyxProvider'; import stylePropTypes from '../../styles/stylePropTypes'; import networkPropTypes from '../../components/networkPropTypes'; -import lodashGet from 'lodash/get'; const propTypes = { /** A unique Onyx key identifying the form */ diff --git a/src/hooks/useForm/InputWrapper.js b/src/hooks/useForm/InputWrapper.js index 009bb762f270..31dc3edb02e8 100644 --- a/src/hooks/useForm/InputWrapper.js +++ b/src/hooks/useForm/InputWrapper.js @@ -5,11 +5,13 @@ import FormContext from './FormContext'; const propTypes = { RenderInput: PropTypes.node.isRequired, inputID: PropTypes.string.isRequired, + valueType: PropTypes.string, forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]), }; const defaultProps = { forwardedRef: undefined, + valueType: 'string', }; function InputWrapper(props) { From 0b9ca6ddc4513dba1f49223dc960fba9077810e8 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 11 Sep 2023 15:59:22 +0200 Subject: [PATCH 018/211] fix: added a errorFields field into Transaction type --- src/types/onyx/Transaction.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 6011120d2d45..398f808842b0 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -31,6 +31,7 @@ type Transaction = { created: string; pendingAction: OnyxCommon.PendingAction; errors: OnyxCommon.Errors; + errorFields: OnyxCommon.ErrorFields; modifiedAmount?: number; modifiedCreated?: string; modifiedCurrency?: string; From 1b995a9495829526209d2163e9b8a015fe876466 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 11 Sep 2023 16:41:59 +0200 Subject: [PATCH 019/211] fix: added null to coordinates type --- src/types/onyx/Transaction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 398f808842b0..85fe51e58b4f 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -9,7 +9,7 @@ type Comment = { }; type Geometry = { - coordinates: number[][]; + coordinates: number[][] | null; type: 'LineString'; }; From 61009460ef6fbea15fea9462f9b74e8afd406397 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 11 Sep 2023 17:35:49 +0200 Subject: [PATCH 020/211] fix: added needed fields into newTransaction object --- src/libs/actions/Transaction.ts | 4 +++- src/types/onyx/Transaction.ts | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 2d250cfc3902..6d2387143e99 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -126,7 +126,7 @@ function removeWaypoint(transactionID: string, currentIndex: string) { // Onyx.merge won't remove the null nested object values, this is a workaround // to remove nested keys while also preserving other object keys // Doing a deep clone of the transaction to avoid mutating the original object and running into a cache issue when using Onyx.set - const newTransaction = { + const newTransaction: Transaction = { ...transaction, comment: { ...transaction.comment, @@ -135,8 +135,10 @@ function removeWaypoint(transactionID: string, currentIndex: string) { // Clear the existing route so that we don't show an old route routes: { route0: { + distance: null, geometry: { coordinates: null, + type: '', }, }, }, diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 85fe51e58b4f..3a7bf3ac2eb7 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -8,13 +8,15 @@ type Comment = { waypoints?: Record; }; +type GeometryType = 'LineString' | ''; + type Geometry = { coordinates: number[][] | null; - type: 'LineString'; + type: GeometryType; }; type Route = { - distance: number; + distance: number | null; geometry: Geometry; }; From 1ddba1be4b590cf0c4d52417dbe353fc2ba016a8 Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Mon, 11 Sep 2023 21:41:50 +0200 Subject: [PATCH 021/211] Bump reanimated to 3.5.0 --- ios/Podfile.lock | 4 ++-- package-lock.json | 14 +++++++------- package.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2bea672171fe..1c041db94691 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -783,7 +783,7 @@ PODS: - React-Core - RNReactNativeHapticFeedback (1.14.0): - React-Core - - RNReanimated (3.4.0): + - RNReanimated (3.5.0): - DoubleConversion - FBLazyVector - glog @@ -1298,7 +1298,7 @@ SPEC CHECKSUMS: rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c - RNReanimated: 020859659f64be2d30849a1fe88c821a7c3e0cbf + RNReanimated: fd0dc9a5889bfac6c45a922b26c902dc6185b4dc RNScreens: d037903436160a4b039d32606668350d2a808806 RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d diff --git a/package-lock.json b/package-lock.json index cd763dffefbe..aa5702b52e34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -94,7 +94,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "3.4.0", + "react-native-reanimated": "^3.5.0", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", @@ -41013,9 +41013,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.4.0.tgz", - "integrity": "sha512-B5cZJseoIkYlZTRBRN0xuU1NBxUza/6GSHhiEBQfbOufWVlUMMcWUecIRVglW49l8d2wXbfCdQlNyVoFqmHkaQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.0.tgz", + "integrity": "sha512-om2AfxCD0YyBvGADJ5Ql38CKIJ8MXZTTpve1jt94TcRjLHXui24wYomoumSnnBQEfeRDzjwpmFdqcLtJ5mU5Pg==", "dependencies": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", @@ -76740,9 +76740,9 @@ "requires": {} }, "react-native-reanimated": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.4.0.tgz", - "integrity": "sha512-B5cZJseoIkYlZTRBRN0xuU1NBxUza/6GSHhiEBQfbOufWVlUMMcWUecIRVglW49l8d2wXbfCdQlNyVoFqmHkaQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.0.tgz", + "integrity": "sha512-om2AfxCD0YyBvGADJ5Ql38CKIJ8MXZTTpve1jt94TcRjLHXui24wYomoumSnnBQEfeRDzjwpmFdqcLtJ5mU5Pg==", "requires": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", diff --git a/package.json b/package.json index 6666fd19cf7a..59ef49d40199 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "3.4.0", + "react-native-reanimated": "3.5.0", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", From 54f479b4b42993379797b7d411eee6ba6021e1d8 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Tue, 12 Sep 2023 10:09:29 +0200 Subject: [PATCH 022/211] fix: resolved review comments --- src/libs/actions/Transaction.ts | 5 ++--- src/types/onyx/OnyxCommon.ts | 2 +- src/types/onyx/Transaction.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 6d2387143e99..1e4d85bc126e 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -73,8 +73,7 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp }, // Empty out errors when we're saving a new waypoint as this indicates the user is updating their input errorFields: { - // TODO: check if its ok to put undefined - route: undefined, + route: null, }, // Clear the existing route so that we don't show an old route @@ -150,7 +149,7 @@ function removeWaypoint(transactionID: string, currentIndex: string) { * Gets the route for a set of waypoints * Used so we can generate a map view of the provided waypoints */ -function getRoute(transactionID: string, waypoints: RecentWaypoints) { +function getRoute(transactionID: string, waypoints: Record) { API.read( 'GetRoute', { diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index 36e9c6ae74ea..db82edcb98ff 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -4,7 +4,7 @@ import CONST from '../../CONST'; type PendingAction = ValueOf; -type ErrorFields = Record>; +type ErrorFields = Record | null>; type Errors = Record; diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 3a7bf3ac2eb7..8e1449906cbf 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -33,7 +33,7 @@ type Transaction = { created: string; pendingAction: OnyxCommon.PendingAction; errors: OnyxCommon.Errors; - errorFields: OnyxCommon.ErrorFields; + errorFields?: OnyxCommon.ErrorFields; modifiedAmount?: number; modifiedCreated?: string; modifiedCurrency?: string; From f7c72f115740a969a10d030b0d98b051892a28f4 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 16:11:42 +0800 Subject: [PATCH 023/211] add three dot menu to confirmation page --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 8db5140d1092..3d1a10adc967 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -26,6 +26,7 @@ import * as Policy from '../../../libs/actions/Policy'; import useWindowDimensions from '../../../hooks/useWindowDimensions'; import * as StyleUtils from '../../../styles/StyleUtils'; import {iouPropTypes, iouDefaultProps} from '../propTypes'; +import * as Expensicons from '../../../components/Icon/Expensicons'; const propTypes = { /** React Navigation route */ @@ -254,6 +255,16 @@ function MoneyRequestConfirmPage(props) { {}, + }, { + icon: Expensicons.Gallery, + text: props.translate('attachmentPicker.chooseFromGallery'), + onSelected: () => {}, + }]} /> {/* * The MoneyRequestConfirmationList component uses a SectionList which uses a VirtualizedList internally. From 5ca20acb2961b43705f6b677425d65dc99234328 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 16:24:40 +0800 Subject: [PATCH 024/211] add attachment picker support --- .../iou/steps/MoneyRequestConfirmPage.js | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 3d1a10adc967..e82771b9bc31 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -27,6 +27,7 @@ import useWindowDimensions from '../../../hooks/useWindowDimensions'; import * as StyleUtils from '../../../styles/StyleUtils'; import {iouPropTypes, iouDefaultProps} from '../propTypes'; import * as Expensicons from '../../../components/Icon/Expensicons'; +import AttachmentPicker from '../../../components/AttachmentPicker'; const propTypes = { /** React Navigation route */ @@ -252,20 +253,26 @@ function MoneyRequestConfirmPage(props) { {({safeAreaPaddingBottomStyle}) => ( - {}, - }, { - icon: Expensicons.Gallery, - text: props.translate('attachmentPicker.chooseFromGallery'), - onSelected: () => {}, - }]} - /> + + {({openPicker}) => ( + {}, + }, { + icon: Expensicons.Gallery, + text: props.translate('attachmentPicker.chooseFromGallery'), + onSelected: () => openPicker({ + onPicked: (file) => {}, + }), + }]} + /> + )} + {/* * The MoneyRequestConfirmationList component uses a SectionList which uses a VirtualizedList internally. * VirtualizedList cannot be directly nested within ScrollViews of the same orientation. From 513c5fc3ac3ee5f3fe4ecbde29f4a32bb19b28c7 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 16:34:23 +0800 Subject: [PATCH 025/211] fix dropdown position anchor --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index e82771b9bc31..1383bff1214d 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -61,7 +61,7 @@ const defaultProps = { }; function MoneyRequestConfirmPage(props) { - const {windowHeight} = useWindowDimensions(); + const {windowHeight, windowWidth} = useWindowDimensions(); const prevMoneyRequestId = useRef(props.iou.id); const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); const isDistanceRequest = MoneyRequestUtils.isDistanceRequest(iouType.current, props.selectedTab); @@ -259,6 +259,7 @@ function MoneyRequestConfirmPage(props) { title={isDistanceRequest ? props.translate('common.distance') : props.translate('iou.cash')} onBackButtonPress={navigateBack} shouldShowThreeDotsButton={!isDistanceRequest} + threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} threeDotsMenuItems={[{ icon: Expensicons.Camera, text: props.translate('receipt.takePhoto'), From 37d9bc27dfab5a0641dd319c4904f728bd46f5ca Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 16:48:01 +0800 Subject: [PATCH 026/211] add logic to select receipt file --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 1383bff1214d..6a1898aa358f 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -28,6 +28,7 @@ import * as StyleUtils from '../../../styles/StyleUtils'; import {iouPropTypes, iouDefaultProps} from '../propTypes'; import * as Expensicons from '../../../components/Icon/Expensicons'; import AttachmentPicker from '../../../components/AttachmentPicker'; +import * as ReceiptUtils from '../../../libs/ReceiptUtils'; const propTypes = { /** React Navigation route */ @@ -268,7 +269,14 @@ function MoneyRequestConfirmPage(props) { icon: Expensicons.Gallery, text: props.translate('attachmentPicker.chooseFromGallery'), onSelected: () => openPicker({ - onPicked: (file) => {}, + onPicked: (file) => { + if (!ReceiptUtils.validateReceipt(file)) { + return; + } + + const filePath = URL.createObjectURL(file); + IOU.setMoneyRequestReceipt(filePath, file.name); + }, }), }]} /> From 05a4da1fe106987c5a4bfa5af9641cc5b3def57a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 17:43:36 +0800 Subject: [PATCH 027/211] use only add receipt option --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/pages/iou/steps/MoneyRequestConfirmPage.js | 18 ++---------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index bd518f1fdda9..e13d0461fd4b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -481,6 +481,7 @@ export default { flash: 'flash', shutter: 'shutter', gallery: 'gallery', + addReceipt: 'Add receipt', }, iou: { amount: 'Amount', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3c5d98b724d2..a4b131d8f74d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -482,6 +482,7 @@ export default { flash: 'flash', shutter: 'obturador', gallery: 'galería', + addReceipt: 'Añadir recibo', }, iou: { amount: 'Importe', diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 6a1898aa358f..038e22417472 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -28,7 +28,6 @@ import * as StyleUtils from '../../../styles/StyleUtils'; import {iouPropTypes, iouDefaultProps} from '../propTypes'; import * as Expensicons from '../../../components/Icon/Expensicons'; import AttachmentPicker from '../../../components/AttachmentPicker'; -import * as ReceiptUtils from '../../../libs/ReceiptUtils'; const propTypes = { /** React Navigation route */ @@ -262,22 +261,9 @@ function MoneyRequestConfirmPage(props) { shouldShowThreeDotsButton={!isDistanceRequest} threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} threeDotsMenuItems={[{ - icon: Expensicons.Camera, - text: props.translate('receipt.takePhoto'), + icon: Expensicons.Receipt, + text: props.translate('receipt.addReceipt'), onSelected: () => {}, - }, { - icon: Expensicons.Gallery, - text: props.translate('attachmentPicker.chooseFromGallery'), - onSelected: () => openPicker({ - onPicked: (file) => { - if (!ReceiptUtils.validateReceipt(file)) { - return; - } - - const filePath = URL.createObjectURL(file); - IOU.setMoneyRequestReceipt(filePath, file.name); - }, - }), }]} /> )} From 287566678976c197418c13c774552150dcf06fb7 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 17:50:02 +0800 Subject: [PATCH 028/211] create edit receipt route, navigator --- src/ROUTES.ts | 2 ++ src/libs/Navigation/AppNavigator/ModalStackNavigators.js | 7 +++++++ src/libs/Navigation/linkingConfig.js | 1 + src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ed4fbb97a41a..c65327aca285 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -103,6 +103,7 @@ export default { MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan', MONEY_REQUEST_DISTANCE_TAB: ':iouType/new/:reportID?/distance', MONEY_REQUEST_WAYPOINT: ':iouType/new/waypoint/:waypointIndex', + MONEY_REQUEST_RECEIPT: ':iouType/new/receipt/:reportID?', IOU_SEND_ADD_BANK_ACCOUNT: `${IOU_SEND}/add-bank-account`, IOU_SEND_ADD_DEBIT_CARD: `${IOU_SEND}/add-debit-card`, IOU_SEND_ENABLE_PAYMENTS: `${IOU_SEND}/enable-payments`, @@ -117,6 +118,7 @@ export default { getMoneyRequestMerchantRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`, getMoneyRequestDistanceTabRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`, getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`, + getMoneyRequestReceiptRoute: (iouType: string, reportID = '') => `${iouType}/new/receipt/${reportID}`, SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`, getSplitBillDetailsRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`, getNewTaskRoute: (reportID: string) => `${NEW_TASK}/${reportID}`, diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 2adaf0397a2c..eff5de37cee1 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -125,6 +125,13 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([ }, name: 'Money_Request_Waypoint', }, + { + getComponent: () => { + const EditRequestReceiptPage = require('../../../pages/iou/EditRequestReceiptPage').default; + return EditRequestReceiptPage; + }, + name: 'Money_Request_Receipt', + }, ]); const SplitDetailsModalStackNavigator = createModalStackNavigator([ diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js index ee3054e02f96..268bf409fff5 100644 --- a/src/libs/Navigation/linkingConfig.js +++ b/src/libs/Navigation/linkingConfig.js @@ -320,6 +320,7 @@ export default { Money_Request_Category: ROUTES.MONEY_REQUEST_CATEGORY, Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT, Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT, + Money_Request_Receipt: ROUTES.MONEY_REQUEST_RECEIPT, IOU_Send_Enable_Payments: ROUTES.IOU_SEND_ENABLE_PAYMENTS, IOU_Send_Add_Bank_Account: ROUTES.IOU_SEND_ADD_BANK_ACCOUNT, IOU_Send_Add_Debit_Card: ROUTES.IOU_SEND_ADD_DEBIT_CARD, diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 038e22417472..e11608c94462 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -263,7 +263,7 @@ function MoneyRequestConfirmPage(props) { threeDotsMenuItems={[{ icon: Expensicons.Receipt, text: props.translate('receipt.addReceipt'), - onSelected: () => {}, + onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(props.iouType, reportID)), }]} /> )} From 85a12fa4f260eee0d86e3dba590a545d344a70fc Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Tue, 12 Sep 2023 12:13:46 +0200 Subject: [PATCH 029/211] fix: rename type to RecentWaypoint --- src/ONYXKEYS.ts | 2 +- src/libs/actions/Transaction.ts | 11 ++++++----- .../onyx/{RecentWaypoints.ts => RecentWaypoint.ts} | 6 +++--- src/types/onyx/Transaction.ts | 6 ++++-- src/types/onyx/index.ts | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) rename src/types/onyx/{RecentWaypoints.ts => RecentWaypoint.ts} (73%) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index b978f06dbfd9..cacdc9545ca8 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -330,7 +330,7 @@ type OnyxValues = { [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; - [ONYXKEYS.NVP_RECENT_WAYPOINTS]: OnyxTypes.RecentWaypoints[]; + [ONYXKEYS.NVP_RECENT_WAYPOINTS]: OnyxTypes.RecentWaypoint[]; [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; [ONYXKEYS.IS_PLAID_DISABLED]: boolean; diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 1e4d85bc126e..47010ba275b3 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -4,9 +4,10 @@ import lodashClone from 'lodash/clone'; import ONYXKEYS from '../../ONYXKEYS'; import * as CollectionUtils from '../CollectionUtils'; import * as API from '../API'; -import {RecentWaypoints, Transaction} from '../../types/onyx'; +import {RecentWaypoint, Transaction} from '../../types/onyx'; +import {WaypointCollection} from '../../types/onyx/Transaction'; -let recentWaypoints: RecentWaypoints[] = []; +let recentWaypoints: RecentWaypoint[] = []; Onyx.connect({ key: ONYXKEYS.NVP_RECENT_WAYPOINTS, callback: (val) => (recentWaypoints = val ?? []), @@ -64,7 +65,7 @@ function addStop(transactionID: string) { /** * Saves the selected waypoint to the transaction */ -function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoints) { +function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoint | null) { Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints: { @@ -117,7 +118,7 @@ function removeWaypoint(transactionID: string, currentIndex: string) { const waypointValues = Object.values(existingWaypoints); waypointValues.splice(index, 1); - const reIndexedWaypoints: Record = {}; + const reIndexedWaypoints: WaypointCollection = {}; waypointValues.forEach((waypoint, idx) => { reIndexedWaypoints[`waypoint${idx}`] = waypoint; }); @@ -149,7 +150,7 @@ function removeWaypoint(transactionID: string, currentIndex: string) { * Gets the route for a set of waypoints * Used so we can generate a map view of the provided waypoints */ -function getRoute(transactionID: string, waypoints: Record) { +function getRoute(transactionID: string, waypoints: WaypointCollection) { API.read( 'GetRoute', { diff --git a/src/types/onyx/RecentWaypoints.ts b/src/types/onyx/RecentWaypoint.ts similarity index 73% rename from src/types/onyx/RecentWaypoints.ts rename to src/types/onyx/RecentWaypoint.ts index 2b33997982c5..79aded8ede98 100644 --- a/src/types/onyx/RecentWaypoints.ts +++ b/src/types/onyx/RecentWaypoint.ts @@ -1,4 +1,4 @@ -type RecentWaypoints = { +type RecentWaypoint = { /** The full address of the waypoint */ address: string; @@ -7,6 +7,6 @@ type RecentWaypoints = { /** The longitude of the waypoint */ lng: number; -} | null; +}; -export default RecentWaypoints; +export default RecentWaypoint; diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 8e1449906cbf..4df5377d309b 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -1,11 +1,12 @@ import {ValueOf} from 'type-fest'; import * as OnyxCommon from './OnyxCommon'; import CONST from '../../CONST'; -import RecentWaypoints from './RecentWaypoints'; +import RecentWaypoint from './RecentWaypoint'; +type WaypointCollection = Record; type Comment = { comment?: string; - waypoints?: Record; + waypoints?: WaypointCollection; }; type GeometryType = 'LineString' | ''; @@ -46,3 +47,4 @@ type Transaction = { }; export default Transaction; +export type {WaypointCollection}; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index d908c0b36ce1..97909da5fb47 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -43,7 +43,7 @@ import ReportActionReactions from './ReportActionReactions'; import SecurityGroup from './SecurityGroup'; import Transaction from './Transaction'; import Form, {AddDebitCardForm} from './Form'; -import RecentWaypoints from './RecentWaypoints'; +import RecentWaypoint from './RecentWaypoint'; import RecentlyUsedCategories from './RecentlyUsedCategories'; export type { @@ -93,6 +93,6 @@ export type { Form, AddDebitCardForm, OnyxUpdatesFromServer, - RecentWaypoints, + RecentWaypoint, RecentlyUsedCategories, }; From ef7fb9e0c3a653aaa99c9c235b95dc87adc3d4e4 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 18:14:52 +0800 Subject: [PATCH 030/211] create edit receipt page, navigate to edit page --- .../AppNavigator/ModalStackNavigators.js | 2 +- src/pages/EditRequestReceiptPage.js | 57 +++++++++++++++++++ .../iou/steps/MoneyRequestConfirmPage.js | 2 +- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/pages/EditRequestReceiptPage.js diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index eff5de37cee1..b9b57b3262eb 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -127,7 +127,7 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([ }, { getComponent: () => { - const EditRequestReceiptPage = require('../../../pages/iou/EditRequestReceiptPage').default; + const EditRequestReceiptPage = require('../../../pages/EditRequestReceiptPage').default; return EditRequestReceiptPage; }, name: 'Money_Request_Receipt', diff --git a/src/pages/EditRequestReceiptPage.js b/src/pages/EditRequestReceiptPage.js new file mode 100644 index 000000000000..8c4067713705 --- /dev/null +++ b/src/pages/EditRequestReceiptPage.js @@ -0,0 +1,57 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ScreenWrapper from '../components/ScreenWrapper'; +import HeaderWithBackButton from '../components/HeaderWithBackButton'; +import Navigation from '../libs/Navigation/Navigation'; +import useLocalize from '../hooks/useLocalize'; +import ReceiptSelector from './iou/ReceiptSelector'; +import DragAndDropProvider from '../components/DragAndDrop/Provider'; + +const propTypes = { + /** React Navigation route */ + route: PropTypes.shape({ + /** Params from the route */ + params: PropTypes.shape({ + /** The type of IOU report, i.e. bill, request, send */ + iouType: PropTypes.string, + + /** The report ID of the IOU */ + reportID: PropTypes.string, + }), + }).isRequired, + + /** The callback fired when we confirm to replace the receipt */ + replaceReceipt: PropTypes.func, +}; + +const defaultProps = { + replaceReceipt: () => {} +} + +function EditRequestReceiptPage({route, replaceReceipt}) { + const {translate} = useLocalize(); + + return ( + + + + + + + ); +} + +EditRequestReceiptPage.propTypes = propTypes; +EditRequestReceiptPage.defaultProps = defaultProps; +EditRequestReceiptPage.displayName = 'EditRequestReceiptPage'; + +export default EditRequestReceiptPage; diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index e11608c94462..d0b558984d97 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -263,7 +263,7 @@ function MoneyRequestConfirmPage(props) { threeDotsMenuItems={[{ icon: Expensicons.Receipt, text: props.translate('receipt.addReceipt'), - onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(props.iouType, reportID)), + onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), }]} /> )} From 0ab130ce7e0d5243b55f84d6652e59a0c762c2a2 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 12 Sep 2023 18:29:46 +0800 Subject: [PATCH 031/211] update logic in navigateToNextPage --- src/libs/actions/IOU.js | 9 ++++++++- src/pages/iou/ReceiptSelector/index.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 2102ed9223c8..f8eeaa96fd0a 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1863,8 +1863,9 @@ function createEmptyTransaction() { * @param {String} iouType * @param {String} reportID * @param {Object} report + * @param {Object} route */ -function navigateToNextPage(iou, iouType, reportID, report) { +function navigateToNextPage(iou, iouType, reportID, report, route = '') { const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; @@ -1874,6 +1875,12 @@ function navigateToNextPage(iou, iouType, reportID, report) { resetMoneyRequestInfo(moneyRequestID); } + // If we're adding a receipt, that means the user came from the confirmation page and we navigate back to it. + if (route.slice(1) === ROUTES.getMoneyRequestReceiptRoute(iouType, reportID)) { + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + return; + } + // If a request is initiated on a report, skip the participants selection step and navigate to the confirmation page. if (report.reportID) { // Reinitialize the participants when the money request ID in Onyx does not match the ID from params diff --git a/src/pages/iou/ReceiptSelector/index.js b/src/pages/iou/ReceiptSelector/index.js index 94246b1e6fd1..847b68c79242 100644 --- a/src/pages/iou/ReceiptSelector/index.js +++ b/src/pages/iou/ReceiptSelector/index.js @@ -83,7 +83,7 @@ function ReceiptSelector(props) { const filePath = URL.createObjectURL(file); IOU.setMoneyRequestReceipt(filePath, file.name); - IOU.navigateToNextPage(iou, iouType, reportID, report); + IOU.navigateToNextPage(iou, iouType, reportID, report, props.route.path); }; return ( From 34760eb7852235bee549808bb6cb38d7eb19ae78 Mon Sep 17 00:00:00 2001 From: Thiago Brezinski Date: Tue, 12 Sep 2023 13:08:23 +0100 Subject: [PATCH 032/211] fix(selection-list): highlight on lists with 1 section --- .../SelectionList/BaseSelectionList.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index b76ded8a542f..1b45f0d42e5c 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -167,15 +167,13 @@ function BaseSelectionList({ listRef.current.scrollToLocation({sectionIndex: adjustedSectionIndex, itemIndex, animated, viewOffset: variables.contentHeaderHeight}); }; - const selectRow = (item, index) => { + const selectRow = (item) => { // In single-selection lists we don't care about updating the focused index, because the list is closed after selecting an item if (canSelectMultiple) { - if (sections.length === 1) { - // If the list has only 1 section (e.g. Workspace Members list), we always focus the next available item - const nextAvailableIndex = _.findIndex(flattenedSections.allOptions, (option, i) => i > index && !option.isDisabled); - setFocusedIndex(nextAvailableIndex); - } else { - // If the list has multiple sections (e.g. Workspace Invite list), we focus the first one after all the selected (selected items are always at the top) + if (sections.length > 1) { + // If the list has only 1 section (e.g. Workspace Members list), we do nothing. + // If the list has multiple sections (e.g. Workspace Invite list), we focus the first one after all the selected (selected items are always at the top). + const selectedOptionsCount = item.isSelected ? flattenedSections.selectedOptions.length - 1 : flattenedSections.selectedOptions.length + 1; setFocusedIndex(selectedOptionsCount); @@ -196,7 +194,7 @@ function BaseSelectionList({ return; } - selectRow(focusedOption, focusedIndex); + selectRow(focusedOption); }; /** @@ -250,7 +248,7 @@ function BaseSelectionList({ selectRow(item, index)} + onSelectRow={() => selectRow(item)} onDismissError={onDismissError} /> ); @@ -261,7 +259,7 @@ function BaseSelectionList({ item={item} isFocused={isFocused} isDisabled={isDisabled} - onSelectRow={() => selectRow(item, index)} + onSelectRow={() => selectRow(item)} /> ); }; From 0a4b9501e3519dc877d8706d61c7ab5c9bfaa786 Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Tue, 12 Sep 2023 14:27:04 +0200 Subject: [PATCH 033/211] Bump to 3.5.1 --- ios/Podfile.lock | 4 ++-- package-lock.json | 14 +++++++------- package.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1c041db94691..99f77ea908d1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -783,7 +783,7 @@ PODS: - React-Core - RNReactNativeHapticFeedback (1.14.0): - React-Core - - RNReanimated (3.5.0): + - RNReanimated (3.5.1): - DoubleConversion - FBLazyVector - glog @@ -1298,7 +1298,7 @@ SPEC CHECKSUMS: rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c - RNReanimated: fd0dc9a5889bfac6c45a922b26c902dc6185b4dc + RNReanimated: 99aa8c96151abbc2d7e737a56ec62aca709f0c92 RNScreens: d037903436160a4b039d32606668350d2a808806 RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d diff --git a/package-lock.json b/package-lock.json index aa5702b52e34..3784b4a01e9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -94,7 +94,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.5.0", + "react-native-reanimated": "^3.5.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", @@ -41013,9 +41013,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.0.tgz", - "integrity": "sha512-om2AfxCD0YyBvGADJ5Ql38CKIJ8MXZTTpve1jt94TcRjLHXui24wYomoumSnnBQEfeRDzjwpmFdqcLtJ5mU5Pg==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.1.tgz", + "integrity": "sha512-ZBTOKibTn1IR5IaoQkpPCibuao5SjXR6Pzx+KHM50wrvBnL1PecsnQjmL2VEj8hbwshrzgRGgGt1XM82DKrykw==", "dependencies": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", @@ -76740,9 +76740,9 @@ "requires": {} }, "react-native-reanimated": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.0.tgz", - "integrity": "sha512-om2AfxCD0YyBvGADJ5Ql38CKIJ8MXZTTpve1jt94TcRjLHXui24wYomoumSnnBQEfeRDzjwpmFdqcLtJ5mU5Pg==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.1.tgz", + "integrity": "sha512-ZBTOKibTn1IR5IaoQkpPCibuao5SjXR6Pzx+KHM50wrvBnL1PecsnQjmL2VEj8hbwshrzgRGgGt1XM82DKrykw==", "requires": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", diff --git a/package.json b/package.json index 59ef49d40199..fbdc85a4ba63 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "3.5.0", + "react-native-reanimated": "^3.5.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", From 2e71d6530c664746954087c09366346ef9c31a30 Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Tue, 12 Sep 2023 14:29:18 +0200 Subject: [PATCH 034/211] Add patch to fix typecheck --- patches/react-native-reanimated+3.5.1.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 patches/react-native-reanimated+3.5.1.patch diff --git a/patches/react-native-reanimated+3.5.1.patch b/patches/react-native-reanimated+3.5.1.patch new file mode 100644 index 000000000000..69c8f7028a58 --- /dev/null +++ b/patches/react-native-reanimated+3.5.1.patch @@ -0,0 +1,11 @@ +diff --git a/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts b/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts +index 4df2481..cca7f1a 100644 +--- a/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts ++++ b/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts +@@ -40,5 +40,5 @@ export function isReducedMotion() { + ? isWindowAvailable() + ? !window.matchMedia('(prefers-reduced-motion: no-preference)').matches + : false +- : global._REANIMATED_IS_REDUCED_MOTION ?? false; ++ : (global as any)._REANIMATED_IS_REDUCED_MOTION ?? false; + } From 67c2a5f7fe67c2dfe2574af00056dc07885418a2 Mon Sep 17 00:00:00 2001 From: Thiago Brezinski Date: Tue, 12 Sep 2023 13:59:40 +0100 Subject: [PATCH 035/211] chore: make function call concise --- src/components/SelectionList/BaseSelectionList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index 1b45f0d42e5c..230de8e75dcc 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -248,7 +248,7 @@ function BaseSelectionList({ selectRow(item)} + onSelectRow={selectRow} onDismissError={onDismissError} /> ); @@ -259,7 +259,7 @@ function BaseSelectionList({ item={item} isFocused={isFocused} isDisabled={isDisabled} - onSelectRow={() => selectRow(item)} + onSelectRow={selectRow} /> ); }; From 6a86285381622159f3f91239c212945cf52752f4 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Tue, 12 Sep 2023 21:15:30 +0200 Subject: [PATCH 036/211] fix: check if waypoint is not null --- src/libs/actions/Transaction.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 47010ba275b3..16a974db25ff 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -93,9 +93,8 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp if (!lodashHas(waypoint, 'lat') || !lodashHas(waypoint, 'lng')) { return; } - const recentWaypointAlreadyExists = recentWaypoints.find((recentWaypoint) => recentWaypoint?.address === waypoint?.address); - if (!recentWaypointAlreadyExists) { + if (!recentWaypointAlreadyExists && waypoint !== null) { const clonedWaypoints = lodashClone(recentWaypoints); clonedWaypoints.unshift(waypoint); Onyx.merge(ONYXKEYS.NVP_RECENT_WAYPOINTS, clonedWaypoints.slice(0, 5)); @@ -108,7 +107,6 @@ function removeWaypoint(transactionID: string, currentIndex: string) { const transaction = allTransactions?.[transactionID] ?? {}; const existingWaypoints = transaction?.comment?.waypoints ?? {}; const totalWaypoints = Object.keys(existingWaypoints).length; - // Prevents removing the starting or ending waypoint but clear the stored address only if there are only two waypoints if (totalWaypoints === 2 && (index === 0 || index === totalWaypoints - 1)) { saveWaypoint(transactionID, index.toString(), null); From 63e92eed9a23e66c6f386ebb03bba63bf750b237 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 09:51:31 +0800 Subject: [PATCH 037/211] update native implementation --- src/pages/iou/ReceiptSelector/index.js | 3 +++ src/pages/iou/ReceiptSelector/index.native.js | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/ReceiptSelector/index.js b/src/pages/iou/ReceiptSelector/index.js index 847b68c79242..43f1b965d33c 100644 --- a/src/pages/iou/ReceiptSelector/index.js +++ b/src/pages/iou/ReceiptSelector/index.js @@ -43,6 +43,9 @@ const propTypes = { /** The report ID of the IOU */ reportID: PropTypes.string, }), + + /** The current route path */ + path: PropTypes.string, }).isRequired, /** Holds data related to Money Request view state, rather than the underlying Money Request data. */ diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js index 4ff32d940c9f..e96109deba01 100644 --- a/src/pages/iou/ReceiptSelector/index.native.js +++ b/src/pages/iou/ReceiptSelector/index.native.js @@ -35,6 +35,9 @@ const propTypes = { /** The report ID of the IOU */ reportID: PropTypes.string, }), + + /** The current route path */ + path: PropTypes.string, }).isRequired, /** The report on which the request is initiated on */ @@ -196,7 +199,7 @@ function ReceiptSelector(props) { }) .then((photo) => { IOU.setMoneyRequestReceipt(`file://${photo.path}`, photo.path); - IOU.navigateToNextPage(props.iou, iouType, reportID, props.report); + IOU.navigateToNextPage(props.iou, iouType, reportID, props.report, props.route.path); }) .catch((error) => { showCameraAlert(); @@ -261,7 +264,7 @@ function ReceiptSelector(props) { showImagePicker(launchImageLibrary) .then((receiptImage) => { IOU.setMoneyRequestReceipt(receiptImage[0].uri, receiptImage[0].fileName); - IOU.navigateToNextPage(props.iou, iouType, reportID, props.report); + IOU.navigateToNextPage(props.iou, iouType, reportID, props.report, props.route.path); }) .catch(() => { Log.info('User did not select an image from gallery'); From 2ba6f182454704d4bb04c957d6387fa284924b50 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 10:18:42 +0800 Subject: [PATCH 038/211] use correct optimistic receipt state --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index d0b558984d97..8c9a93663581 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -195,6 +195,9 @@ function MoneyRequestConfirmPage(props) { if (props.iou.receiptPath && props.iou.receiptSource) { FileUtils.readFileAsync(props.iou.receiptPath, props.iou.receiptSource).then((receipt) => { + if (receipt && iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST) { + receipt.state = CONST.IOU.RECEIPT_STATE.OPEN; + } requestMoney(selectedParticipants, trimmedComment, receipt); }); return; From 4cf4ffd4095d498cb1f04a9d198404e3da54b98f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 10:33:13 +0800 Subject: [PATCH 039/211] pass receipt state to API --- src/libs/actions/IOU.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index f8eeaa96fd0a..836ae9e55acc 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -596,6 +596,7 @@ function requestMoney(report, amount, currency, created, merchant, payeeEmail, p createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction.reportActionID, receipt, + receiptState: receipt.state, }, onyxData, ); From b3df1cb48207ef5ed5b74fad142d6fc07bb88663 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 11:26:24 +0800 Subject: [PATCH 040/211] rm attachmentpicker --- .../iou/steps/MoneyRequestConfirmPage.js | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 8c9a93663581..7ea23db3a45e 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -27,7 +27,6 @@ import useWindowDimensions from '../../../hooks/useWindowDimensions'; import * as StyleUtils from '../../../styles/StyleUtils'; import {iouPropTypes, iouDefaultProps} from '../propTypes'; import * as Expensicons from '../../../components/Icon/Expensicons'; -import AttachmentPicker from '../../../components/AttachmentPicker'; const propTypes = { /** React Navigation route */ @@ -256,21 +255,17 @@ function MoneyRequestConfirmPage(props) { {({safeAreaPaddingBottomStyle}) => ( - - {({openPicker}) => ( - Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), - }]} - /> - )} - + Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), + }]} + /> {/* * The MoneyRequestConfirmationList component uses a SectionList which uses a VirtualizedList internally. * VirtualizedList cannot be directly nested within ScrollViews of the same orientation. From c85695bef0348aa0bccb87d1d40653a2169068f5 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 11:27:42 +0800 Subject: [PATCH 041/211] fix condition to display threeDotMenu --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 7ea23db3a45e..5ec933ab47ea 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -258,7 +258,7 @@ function MoneyRequestConfirmPage(props) { Date: Wed, 13 Sep 2023 13:51:22 +0800 Subject: [PATCH 042/211] add receipt state --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 5ec933ab47ea..3c5094a28817 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -64,6 +64,7 @@ function MoneyRequestConfirmPage(props) { const prevMoneyRequestId = useRef(props.iou.id); const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); const isDistanceRequest = MoneyRequestUtils.isDistanceRequest(iouType.current, props.selectedTab); + const isManualRequest = props.selectedTab === CONST.TAB.MANUAL; const reportID = useRef(lodashGet(props.route, 'params.reportID', '')); const participants = useMemo( () => @@ -193,10 +194,9 @@ function MoneyRequestConfirmPage(props) { } if (props.iou.receiptPath && props.iou.receiptSource) { - FileUtils.readFileAsync(props.iou.receiptPath, props.iou.receiptSource).then((receipt) => { - if (receipt && iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST) { - receipt.state = CONST.IOU.RECEIPT_STATE.OPEN; - } + FileUtils.readFileAsync(props.iou.receiptPath, props.iou.receiptSource).then((file) => { + const receipt = file; + receipt.state = (file && isManualRequest) ? CONST.IOU.RECEIPT_STATE.OPEN : CONST.IOU.RECEIPT_STATE.SCANREADY; requestMoney(selectedParticipants, trimmedComment, receipt); }); return; @@ -220,6 +220,7 @@ function MoneyRequestConfirmPage(props) { isDistanceRequest, requestMoney, createDistanceRequest, + isManualRequest, ], ); @@ -258,7 +259,7 @@ function MoneyRequestConfirmPage(props) { Date: Wed, 13 Sep 2023 13:55:43 +0800 Subject: [PATCH 043/211] update whisper logic --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 8b84555ca2a9..658f07156e36 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2141,7 +2141,7 @@ function buildOptimisticIOUReportAction( created: DateUtils.getDBTime(), pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, receipt, - whisperedToAccountIDs: !_.isEmpty(receipt) ? [currentUserAccountID] : [], + whisperedToAccountIDs: lodashGet(receipt, 'state', '') === CONST.IOU.RECEIPT_STATE.SCANREADY ? [currentUserAccountID] : [], }; } /** From db82a3e0f0e4cabda5baa7cab0373fc4397bbc2f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 14:00:39 +0800 Subject: [PATCH 044/211] add safe object access --- src/libs/actions/IOU.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 836ae9e55acc..4df5395a59bb 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -596,7 +596,7 @@ function requestMoney(report, amount, currency, created, merchant, payeeEmail, p createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction.reportActionID, receipt, - receiptState: receipt.state, + receiptState: lodashGet(receipt, 'state'), }, onyxData, ); From 0836a758e9a6efff43eb668c948426e28cbf893b Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 14:23:14 +0800 Subject: [PATCH 045/211] add attach option to transaction thread --- src/components/MoneyRequestHeader.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index f04a41ae1153..28b0ed2f89e3 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -13,6 +13,7 @@ import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimen import compose from '../libs/compose'; import Navigation from '../libs/Navigation/Navigation'; import ROUTES from '../ROUTES'; +import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; import * as IOU from '../libs/actions/IOU'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; @@ -83,6 +84,11 @@ function MoneyRequestHeader(props) { shouldShowPinButton={false} shouldShowThreeDotsButton={isActionOwner && !isSettled} threeDotsMenuItems={[ + ...(TransactionUtils.hasReceipt(transaction) ? [] : [{ + icon: Expensicons.Receipt, + text: translate('receipt.addReceipt'), + onSelected: () => Navigation.navigate(ROUTES.getEditRequestRoute(props.report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)), + }]), { icon: Expensicons.Trashcan, text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}), From 698a17a6e0307f7653961ccb4f430de2a162de9e Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 15:10:16 +0800 Subject: [PATCH 046/211] fix style --- src/components/MoneyRequestHeader.js | 14 +++++++++----- src/pages/EditRequestReceiptPage.js | 4 ++-- src/pages/iou/steps/MoneyRequestConfirmPage.js | 14 ++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index 28b0ed2f89e3..f72e7a395b85 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -84,11 +84,15 @@ function MoneyRequestHeader(props) { shouldShowPinButton={false} shouldShowThreeDotsButton={isActionOwner && !isSettled} threeDotsMenuItems={[ - ...(TransactionUtils.hasReceipt(transaction) ? [] : [{ - icon: Expensicons.Receipt, - text: translate('receipt.addReceipt'), - onSelected: () => Navigation.navigate(ROUTES.getEditRequestRoute(props.report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)), - }]), + ...(TransactionUtils.hasReceipt(transaction) + ? [] + : [ + { + icon: Expensicons.Receipt, + text: translate('receipt.addReceipt'), + onSelected: () => Navigation.navigate(ROUTES.getEditRequestRoute(props.report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)), + }, + ]), { icon: Expensicons.Trashcan, text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}), diff --git a/src/pages/EditRequestReceiptPage.js b/src/pages/EditRequestReceiptPage.js index 8c4067713705..a901f8d919b3 100644 --- a/src/pages/EditRequestReceiptPage.js +++ b/src/pages/EditRequestReceiptPage.js @@ -25,8 +25,8 @@ const propTypes = { }; const defaultProps = { - replaceReceipt: () => {} -} + replaceReceipt: () => {}, +}; function EditRequestReceiptPage({route, replaceReceipt}) { const {translate} = useLocalize(); diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 62e82d814b39..953e670e0919 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -207,7 +207,7 @@ function MoneyRequestConfirmPage(props) { if (props.iou.receiptPath && props.iou.receiptSource) { FileUtils.readFileAsync(props.iou.receiptPath, props.iou.receiptSource).then((file) => { const receipt = file; - receipt.state = (file && isManualRequest) ? CONST.IOU.RECEIPT_STATE.OPEN : CONST.IOU.RECEIPT_STATE.SCANREADY; + receipt.state = file && isManualRequest ? CONST.IOU.RECEIPT_STATE.OPEN : CONST.IOU.RECEIPT_STATE.SCANREADY; requestMoney(selectedParticipants, trimmedComment, receipt); }); return; @@ -272,11 +272,13 @@ function MoneyRequestConfirmPage(props) { onBackButtonPress={navigateBack} shouldShowThreeDotsButton={isManualRequest} threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} - threeDotsMenuItems={[{ - icon: Expensicons.Receipt, - text: props.translate('receipt.addReceipt'), - onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), - }]} + threeDotsMenuItems={[ + { + icon: Expensicons.Receipt, + text: props.translate('receipt.addReceipt'), + onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), + }, + ]} /> {/* * The MoneyRequestConfirmationList component uses a SectionList which uses a VirtualizedList internally. From 492c4a54a043f04c840fc5e4b3adea2ee2170dfe Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 15:16:45 +0800 Subject: [PATCH 047/211] fix whisper for report preview --- src/libs/ReportUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 9b35d1b8a20a..74ebf853fe1c 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2198,7 +2198,7 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) * @returns {Object} */ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', transaction = undefined) { - const hasReceipt = TransactionUtils.hasReceipt(transaction); + const isReceiptBeingScanned = TransactionUtils.isReceiptBeingScanned(transaction); const message = getReportPreviewMessage(iouReport); return { reportActionID: NumberUtils.rand64(), @@ -2219,11 +2219,11 @@ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', trans created: DateUtils.getDBTime(), accountID: iouReport.managerID || 0, // The preview is initially whispered if created with a receipt, so the actor is the current user as well - actorAccountID: hasReceipt ? currentUserAccountID : iouReport.managerID || 0, + actorAccountID: isReceiptBeingScanned ? currentUserAccountID : iouReport.managerID || 0, childMoneyRequestCount: 1, childLastMoneyRequestComment: comment, childLastReceiptTransactionIDs: hasReceipt ? transaction.transactionID : '', - whisperedToAccountIDs: hasReceipt ? [currentUserAccountID] : [], + whisperedToAccountIDs: isReceiptBeingScanned ? [currentUserAccountID] : [], }; } From dcf2bb62c96583fd024077f02a252fa053b3d766 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 15:32:40 +0800 Subject: [PATCH 048/211] fix undefined variable --- src/libs/ReportUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 74ebf853fe1c..0d562ca60c03 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2198,6 +2198,7 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) * @returns {Object} */ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', transaction = undefined) { + const hasReceipt = TransactionUtils.hasReceipt(transaction); const isReceiptBeingScanned = TransactionUtils.isReceiptBeingScanned(transaction); const message = getReportPreviewMessage(iouReport); return { @@ -2219,7 +2220,7 @@ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', trans created: DateUtils.getDBTime(), accountID: iouReport.managerID || 0, // The preview is initially whispered if created with a receipt, so the actor is the current user as well - actorAccountID: isReceiptBeingScanned ? currentUserAccountID : iouReport.managerID || 0, + actorAccountID: hasReceipt ? currentUserAccountID : iouReport.managerID || 0, childMoneyRequestCount: 1, childLastMoneyRequestComment: comment, childLastReceiptTransactionIDs: hasReceipt ? transaction.transactionID : '', From 076f7c8b3555e64e9829e3315666f27571429f35 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 15:56:04 +0800 Subject: [PATCH 049/211] fix tests --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 0d562ca60c03..8ef210542e55 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2199,7 +2199,7 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) */ function buildOptimisticReportPreview(chatReport, iouReport, comment = '', transaction = undefined) { const hasReceipt = TransactionUtils.hasReceipt(transaction); - const isReceiptBeingScanned = TransactionUtils.isReceiptBeingScanned(transaction); + const isReceiptBeingScanned = hasReceipt && TransactionUtils.isReceiptBeingScanned(transaction); const message = getReportPreviewMessage(iouReport); return { reportActionID: NumberUtils.rand64(), From ba0232c664ad8b253c53dfefc81e46414b6aa6f8 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 13 Sep 2023 16:05:46 +0800 Subject: [PATCH 050/211] add useCallback dependency --- src/pages/iou/ReceiptSelector/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js index e96109deba01..3aa6da4415c3 100644 --- a/src/pages/iou/ReceiptSelector/index.native.js +++ b/src/pages/iou/ReceiptSelector/index.native.js @@ -205,7 +205,7 @@ function ReceiptSelector(props) { showCameraAlert(); Log.warn('Error taking photo', error); }); - }, [flash, iouType, props.iou, props.report, reportID, translate]); + }, [flash, iouType, props.iou, props.report, reportID, translate, props.route.path]); CameraPermission.getCameraPermissionStatus().then((permissionStatus) => { setPermissions(permissionStatus); From 43d8080e810b61155f1096f9cd6e6fb9e3c348be Mon Sep 17 00:00:00 2001 From: Kamil Owczarz <91068263+kowczarz@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:59:30 +0200 Subject: [PATCH 051/211] Apply suggestions from code review Co-authored-by: Carlos Martins --- src/hooks/useForm/FormProvider.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index c29597f48028..2709f68b906d 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -79,7 +79,7 @@ const defaultProps = { scrollContextEnabled: false, footerContent: null, style: [], - validate: () => ({}), + validate: () => {}, }; function getInitialValueByType(valueType) { @@ -137,6 +137,7 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c if (network.isOffline && !enabledWhenOffline) { return; } + // Call submit handler onSubmit(inputValues); }, [enabledWhenOffline, formState.isLoading, inputValues, network.isOffline, onSubmit, onValidate]); @@ -190,7 +191,7 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c // Only run validation when user proactively blurs the input. if (Visibility.isVisible() && Visibility.hasFocus()) { // We delay the validation in order to prevent Checkbox loss of focus when - // the user are focusing a TextInput and proceeds to toggle a CheckBox in + // the user is focusing a TextInput and proceeds to toggle a CheckBox in // web and mobile web platforms. setTimeout(() => { setTouchedInput(inputID); From 01a455f38706530a7589398708f037960d66f5ee Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Wed, 13 Sep 2023 18:26:16 +0200 Subject: [PATCH 052/211] Code review changes --- src/hooks/useForm/FormProvider.js | 24 ++++++++++++++---------- src/hooks/useForm/FormWrapper.js | 19 ++++++++----------- src/hooks/useForm/InputWrapper.js | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index 2709f68b906d..ddc59b63bf0b 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -8,7 +8,6 @@ import * as FormActions from '../../libs/actions/FormActions'; import FormContext from './FormContext'; import FormWrapper from './FormWrapper'; import compose from '../../libs/compose'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import {withNetwork} from '../../components/OnyxProvider'; import stylePropTypes from '../../styles/stylePropTypes'; import networkPropTypes from '../../components/networkPropTypes'; @@ -66,7 +65,9 @@ const propTypes = { /** Information about the network */ network: networkPropTypes.isRequired, - ...withLocalizePropTypes, + shouldValidateOnBlur: PropTypes.bool, + + shouldValidateOnChange: PropTypes.bool, }; const defaultProps = { @@ -80,6 +81,8 @@ const defaultProps = { footerContent: null, style: [], validate: () => {}, + shouldValidateOnBlur: false, + shouldValidateOnChange: false, }; function getInitialValueByType(valueType) { @@ -99,7 +102,7 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c const inputRefs = useRef({}); const touchedInputs = useRef({}); const [inputValues, setInputValues] = useState({}); - const [errors, setErrors] = useState([]); + const [errors, setErrors] = useState({}); const onValidate = useCallback( (values) => { @@ -147,18 +150,18 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c const newRef = propsToParse.ref || createRef(); inputRefs[inputID] = newRef; - // We want to initialize the input value if it's undefined - if (_.isUndefined(inputValues[inputID])) { - inputValues[inputID] = propsToParse.defaultValue || getInitialValueByType(propsToParse.valueType); + if (!_.isUndefined(propsToParse.value)) { + inputValues[inputID] = propsToParse.value; } // We force the form to set the input value from the defaultValue props if there is a saved valid value - if (propsToParse.shouldUseDefaultValue) { + else if (propsToParse.shouldUseDefaultValue) { inputValues[inputID] = propsToParse.defaultValue; } - if (!_.isUndefined(propsToParse.value)) { - inputValues[inputID] = propsToParse.value; + // We want to initialize the input value if it's undefined + else if (_.isUndefined(inputValues[inputID])) { + inputValues[inputID] = _.isUndefined(propsToParse.defaultValue) ? getInitialValueByType(propsToParse.valueType) : propsToParse.defaultValue; } const errorFields = lodashGet(formState, 'errorFields', {}); @@ -238,6 +241,8 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c {children} @@ -250,7 +255,6 @@ FormProvider.propTypes = propTypes; FormProvider.defaultProps = defaultProps; export default compose( - withLocalize, withNetwork(), withOnyx({ formState: { diff --git a/src/hooks/useForm/FormWrapper.js b/src/hooks/useForm/FormWrapper.js index 9ec4492f97aa..b8d1dc999ef9 100644 --- a/src/hooks/useForm/FormWrapper.js +++ b/src/hooks/useForm/FormWrapper.js @@ -11,8 +11,6 @@ import SafeAreaConsumer from '../../components/SafeAreaConsumer'; import ScrollViewWithContext from '../../components/ScrollViewWithContext'; import stylePropTypes from '../../styles/stylePropTypes'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; -import compose from '../../libs/compose'; const propTypes = { /** A unique Onyx key identifying the form */ @@ -61,7 +59,9 @@ const propTypes = { /** Custom content to display in the footer after submit button */ footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), - ...withLocalizePropTypes, + errors: PropTypes.objectOf(PropTypes.string).isRequired, + + inputRefs: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(Element)})])).isRequired, }; const defaultProps = { @@ -187,11 +187,8 @@ FormWrapper.displayName = 'FormWrapper'; FormWrapper.propTypes = propTypes; FormWrapper.defaultProps = defaultProps; -export default compose( - withLocalize, - withOnyx({ - formState: { - key: (props) => props.formID, - }, - }), -)(FormWrapper); +export default withOnyx({ + formState: { + key: (props) => props.formID, + }, +})(FormWrapper); diff --git a/src/hooks/useForm/InputWrapper.js b/src/hooks/useForm/InputWrapper.js index 31dc3edb02e8..83fede5a0a89 100644 --- a/src/hooks/useForm/InputWrapper.js +++ b/src/hooks/useForm/InputWrapper.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import FormContext from './FormContext'; const propTypes = { - RenderInput: PropTypes.node.isRequired, + RenderInput: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired, inputID: PropTypes.string.isRequired, valueType: PropTypes.string, forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]), From 9f28189ca9b747ea3c4052c63bca006d5589929c Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Wed, 13 Sep 2023 18:27:44 +0200 Subject: [PATCH 053/211] Code review changes --- src/hooks/useForm/FormProvider.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index ddc59b63bf0b..3ebda7edecae 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -141,7 +141,6 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c return; } - // Call submit handler onSubmit(inputValues); }, [enabledWhenOffline, formState.isLoading, inputValues, network.isOffline, onSubmit, onValidate]); From 74a8de34a7aa01a55e428ce5cdb503a9cb9bbaf4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 14 Sep 2023 12:47:16 +0800 Subject: [PATCH 054/211] use default style --- src/components/AvatarWithDisplayName.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/AvatarWithDisplayName.js b/src/components/AvatarWithDisplayName.js index e82dbe05a6d0..6151775aaf3f 100644 --- a/src/components/AvatarWithDisplayName.js +++ b/src/components/AvatarWithDisplayName.js @@ -112,7 +112,6 @@ function AvatarWithDisplayName(props) { )} From 007ff215ff5d0b2f7de5fa42d1655b065274262a Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 14 Sep 2023 13:51:15 +0800 Subject: [PATCH 055/211] remove unused import --- src/components/AvatarWithDisplayName.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/AvatarWithDisplayName.js b/src/components/AvatarWithDisplayName.js index 6151775aaf3f..a6c630b775f7 100644 --- a/src/components/AvatarWithDisplayName.js +++ b/src/components/AvatarWithDisplayName.js @@ -17,7 +17,6 @@ import DisplayNames from './DisplayNames'; import compose from '../libs/compose'; import * as OptionsListUtils from '../libs/OptionsListUtils'; import Text from './Text'; -import * as StyleUtils from '../styles/StyleUtils'; import ParentNavigationSubtitle from './ParentNavigationSubtitle'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; import Navigation from '../libs/Navigation/Navigation'; From 7ee8ee39fa072917bee1cb7ac1bfc21e7125ca57 Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Thu, 14 Sep 2023 10:45:15 +0200 Subject: [PATCH 056/211] Code style fixes --- src/hooks/useForm/FormProvider.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hooks/useForm/FormProvider.js b/src/hooks/useForm/FormProvider.js index 3ebda7edecae..545916c1d71f 100644 --- a/src/hooks/useForm/FormProvider.js +++ b/src/hooks/useForm/FormProvider.js @@ -151,15 +151,11 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c if (!_.isUndefined(propsToParse.value)) { inputValues[inputID] = propsToParse.value; - } - - // We force the form to set the input value from the defaultValue props if there is a saved valid value - else if (propsToParse.shouldUseDefaultValue) { + } else if (propsToParse.shouldUseDefaultValue) { + // We force the form to set the input value from the defaultValue props if there is a saved valid value inputValues[inputID] = propsToParse.defaultValue; - } - - // We want to initialize the input value if it's undefined - else if (_.isUndefined(inputValues[inputID])) { + } else if (_.isUndefined(inputValues[inputID])) { + // We want to initialize the input value if it's undefined inputValues[inputID] = _.isUndefined(propsToParse.defaultValue) ? getInitialValueByType(propsToParse.valueType) : propsToParse.defaultValue; } From cc0c7e2d1eabc828a0abb61fc9cbebc8692cc1e2 Mon Sep 17 00:00:00 2001 From: Thiago Brezinski Date: Thu, 14 Sep 2023 11:29:26 +0100 Subject: [PATCH 057/211] fix(selection-list): remove active item highlight --- src/components/SelectionList/RadioListItem.js | 1 - src/components/SelectionList/UserListItem.js | 1 - 2 files changed, 2 deletions(-) diff --git a/src/components/SelectionList/RadioListItem.js b/src/components/SelectionList/RadioListItem.js index 92e3e84b66c8..4adf582b30d4 100644 --- a/src/components/SelectionList/RadioListItem.js +++ b/src/components/SelectionList/RadioListItem.js @@ -17,7 +17,6 @@ function RadioListItem({item, isFocused = false, isDisabled = false, onSelectRow accessibilityRole="button" hoverDimmingValue={1} hoverStyle={styles.hoveredComponentBG} - focusStyle={styles.hoveredComponentBG} > diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index dd90fc750510..f701b1873cbe 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -62,7 +62,6 @@ function UserListItem({item, isFocused = false, showTooltip, onSelectRow, onDism accessibilityState={{checked: item.isSelected}} hoverDimmingValue={1} hoverStyle={styles.hoveredComponentBG} - focusStyle={styles.hoveredComponentBG} > Date: Thu, 14 Sep 2023 21:40:37 +0800 Subject: [PATCH 058/211] fix second avatar border color does not match the background if the option is focused --- src/components/OptionRow.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 50aff23dc9d0..8c4d52f79c13 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -206,18 +206,14 @@ class OptionRow extends Component { ) : ( ))} From a8cc185eb6a164979a08371dc2548433d653dc1f Mon Sep 17 00:00:00 2001 From: Thiago Brezinski Date: Thu, 14 Sep 2023 16:15:15 +0100 Subject: [PATCH 059/211] fix(selection-list): remove active item highlight --- src/components/Button/index.js | 1 + src/components/SelectionList/BaseSelectionList.js | 5 ++++- src/components/SelectionList/RadioListItem.js | 1 - src/components/SelectionList/UserListItem.js | 1 - src/hooks/useActiveElement/index.js | 6 ++++++ src/hooks/useActiveElement/index.native.js | 5 +++++ 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/Button/index.js b/src/components/Button/index.js index bfde528a4750..0d19691d1256 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -305,6 +305,7 @@ class Button extends Component { ]} nativeID={this.props.nativeID} accessibilityLabel={this.props.accessibilityLabel} + accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} hoverDimmingValue={1} > {this.renderContent()} diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index 6699e56e54f6..895272ba18ef 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -135,6 +135,9 @@ function BaseSelectionList({ }; }, [canSelectMultiple, sections]); + // Disable `Enter` hotkey if the active element is a button or checkbox + const shouldDisableHotkeys = activeElement && [CONST.ACCESSIBILITY_ROLE.BUTTON, CONST.ACCESSIBILITY_ROLE.CHECKBOX].includes(activeElement.role); + // If `initiallyFocusedOptionKey` is not passed, we fall back to `-1`, to avoid showing the highlight on the first member const [focusedIndex, setFocusedIndex] = useState(() => _.findIndex(flattenedSections.allOptions, (option) => option.keyForList === initiallyFocusedOptionKey)); @@ -287,7 +290,7 @@ function BaseSelectionList({ useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedOption, { captureOnInputs: true, shouldBubble: () => !flattenedSections.allOptions[focusedIndex], - isActive: !activeElement, + isActive: !shouldDisableHotkeys, }); /** Calls confirm action when pressing CTRL (CMD) + Enter */ diff --git a/src/components/SelectionList/RadioListItem.js b/src/components/SelectionList/RadioListItem.js index 92e3e84b66c8..4adf582b30d4 100644 --- a/src/components/SelectionList/RadioListItem.js +++ b/src/components/SelectionList/RadioListItem.js @@ -17,7 +17,6 @@ function RadioListItem({item, isFocused = false, isDisabled = false, onSelectRow accessibilityRole="button" hoverDimmingValue={1} hoverStyle={styles.hoveredComponentBG} - focusStyle={styles.hoveredComponentBG} > diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index dd90fc750510..f701b1873cbe 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -62,7 +62,6 @@ function UserListItem({item, isFocused = false, showTooltip, onSelectRow, onDism accessibilityState={{checked: item.isSelected}} hoverDimmingValue={1} hoverStyle={styles.hoveredComponentBG} - focusStyle={styles.hoveredComponentBG} > Date: Fri, 15 Sep 2023 14:00:02 +0200 Subject: [PATCH 060/211] fix focus on different scenarios --- src/components/CategoryPicker/index.js | 26 ++++++++++--------- .../OptionsSelector/BaseOptionsSelector.js | 4 +-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/CategoryPicker/index.js b/src/components/CategoryPicker/index.js index 91c7e82e7887..4ee429a2e389 100644 --- a/src/components/CategoryPicker/index.js +++ b/src/components/CategoryPicker/index.js @@ -34,21 +34,23 @@ function CategoryPicker({policyCategories, reportID, iouType, iou, policyRecentl ]; }, [iou.category]); + const sections = useMemo(() => { + const {categoryOptions} = OptionsListUtils.getNewChatOptions({}, {}, [], searchValue, selectedOptions, [], false, false, true, policyCategories, policyRecentlyUsedCategories, false); + + return categoryOptions; + }, [policyCategories, policyRecentlyUsedCategories, searchValue, selectedOptions]); + const initialFocusedIndex = useMemo(() => { - if (isCategoriesCountBelowThreshold && selectedOptions.length > 0) { - return _.chain(policyCategories) - .values() - .findIndex((category) => category.name === selectedOptions[0].name, true) - .value(); - } + let categoryInitialFocusedIndex = 0; - return 0; - }, [policyCategories, selectedOptions, isCategoriesCountBelowThreshold]); + if (!_.isEmpty(searchValue) || isCategoriesCountBelowThreshold) { + const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === iou.category); - const sections = useMemo( - () => OptionsListUtils.getNewChatOptions({}, {}, [], searchValue, selectedOptions, [], false, false, true, policyCategories, policyRecentlyUsedCategories, false).categoryOptions, - [policyCategories, policyRecentlyUsedCategories, searchValue, selectedOptions], - ); + categoryInitialFocusedIndex = index === -1 ? 0 : index; + } + + return categoryInitialFocusedIndex; + }, [iou.category, searchValue, isCategoriesCountBelowThreshold, sections]); const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, searchValue); const shouldShowTextInput = !isCategoriesCountBelowThreshold; diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index bff9f8b6d7d0..aa02701b1c98 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -107,13 +107,13 @@ class BaseOptionsSelector extends Component { }); return; } - const newFocusedIndex = this.props.selectedOptions.length; + const newFocusedIndex = this.props.selectedOptions.length; // eslint-disable-next-line react/no-did-update-set-state this.setState( { allOptions: newOptions, - focusedIndex: newFocusedIndex, + focusedIndex: _.isNumber(this.props.initialFocusedIndex) ? this.props.initialFocusedIndex : newFocusedIndex, }, () => { // If we just toggled an option on a multi-selection page or cleared the search input, scroll to top From ac3ffe3fb2d3d3fece48fd9fb11eb6d13484fbef Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 15 Sep 2023 14:26:46 +0200 Subject: [PATCH 061/211] ref: migrate ReportActions to TS --- .../actions/{ReportActions.js => ReportActions.ts} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/libs/actions/{ReportActions.js => ReportActions.ts} (86%) diff --git a/src/libs/actions/ReportActions.js b/src/libs/actions/ReportActions.ts similarity index 86% rename from src/libs/actions/ReportActions.js rename to src/libs/actions/ReportActions.ts index d270876840ac..9a1e27b010cd 100644 --- a/src/libs/actions/ReportActions.js +++ b/src/libs/actions/ReportActions.ts @@ -3,14 +3,14 @@ import ONYXKEYS from '../../ONYXKEYS'; import CONST from '../../CONST'; import * as ReportActionUtils from '../ReportActionsUtils'; import * as ReportUtils from '../ReportUtils'; +import {ReportAction} from '../../types/onyx'; -/** - * @param {String} reportID - * @param {Object} reportAction - */ -function clearReportActionErrors(reportID, reportAction) { +function clearReportActionErrors(reportID: string, reportAction: ReportAction) { const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction); + if (!reportAction.reportActionID) { + return; + } if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { // Delete the optimistic action Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, { From e052a02f65675d2a98e1632aa923fa44802194f9 Mon Sep 17 00:00:00 2001 From: Dustin Stringer Date: Fri, 15 Sep 2023 10:34:55 -0400 Subject: [PATCH 062/211] Fix: portion of text shown when changing IOU value --- src/components/TextInput/BaseTextInput.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 9d122fb7ccf1..7487efe4c3eb 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -398,11 +398,10 @@ function BaseTextInput(props) { This Text component is intentionally positioned out of the screen. */} {(props.autoGrow || props.autoGrowHeight) && ( - // Add +2 to width so that the first digit of amount do not cut off on mWeb - https://github.com/Expensify/App/issues/8158. { - setTextInputWidth(e.nativeEvent.layout.width + 2); + setTextInputWidth(e.nativeEvent.layout.width); setTextInputHeight(e.nativeEvent.layout.height); }} > From d385296c394ec73967850e0e42f5ddd5ff537564 Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Fri, 15 Sep 2023 18:11:58 +0200 Subject: [PATCH 063/211] Bump to 3.5.2 to fix release crash --- ios/Podfile.lock | 4 ++-- package-lock.json | 14 +++++++------- package.json | 6 +++--- ...1.patch => react-native-reanimated+3.5.2.patch} | 0 4 files changed, 12 insertions(+), 12 deletions(-) rename patches/{react-native-reanimated+3.5.1.patch => react-native-reanimated+3.5.2.patch} (100%) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1b39c43809f6..1d20b93a3a39 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -783,7 +783,7 @@ PODS: - React-Core - RNReactNativeHapticFeedback (1.14.0): - React-Core - - RNReanimated (3.5.1): + - RNReanimated (3.5.2): - DoubleConversion - FBLazyVector - glog @@ -1298,7 +1298,7 @@ SPEC CHECKSUMS: rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c - RNReanimated: 99aa8c96151abbc2d7e737a56ec62aca709f0c92 + RNReanimated: 2491645f0883526f4470d8b5c761308709ba31f8 RNScreens: d037903436160a4b039d32606668350d2a808806 RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d diff --git a/package-lock.json b/package-lock.json index 9ca93346d61f..bfb5ad3518e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.5.1", + "react-native-reanimated": "^3.5.2", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", @@ -40696,9 +40696,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.1.tgz", - "integrity": "sha512-ZBTOKibTn1IR5IaoQkpPCibuao5SjXR6Pzx+KHM50wrvBnL1PecsnQjmL2VEj8hbwshrzgRGgGt1XM82DKrykw==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.2.tgz", + "integrity": "sha512-Uv9imJ6ZC7F/tTSpjjfo/0AZlw19Lag63+MUqF6p483LOoRkYtYP3JmtVV402mQWfhL1LPMeyAu/1spRjPKCCQ==", "dependencies": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", @@ -76177,9 +76177,9 @@ "requires": {} }, "react-native-reanimated": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.1.tgz", - "integrity": "sha512-ZBTOKibTn1IR5IaoQkpPCibuao5SjXR6Pzx+KHM50wrvBnL1PecsnQjmL2VEj8hbwshrzgRGgGt1XM82DKrykw==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.2.tgz", + "integrity": "sha512-Uv9imJ6ZC7F/tTSpjjfo/0AZlw19Lag63+MUqF6p483LOoRkYtYP3JmtVV402mQWfhL1LPMeyAu/1spRjPKCCQ==", "requires": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", diff --git a/package.json b/package.json index 3fcbe801e47a..48e9c878dd44 100644 --- a/package.json +++ b/package.json @@ -61,9 +61,9 @@ "@formatjs/intl-pluralrules": "^5.2.2", "@gorhom/portal": "^1.0.14", "@invertase/react-native-apple-authentication": "^2.2.2", - "@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52", "@kie/act-js": "^2.0.1", "@kie/mock-github": "^1.0.0", + "@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52", "@onfido/react-native-sdk": "7.4.0", "@react-native-async-storage/async-storage": "^1.17.10", "@react-native-camera-roll/camera-roll": "5.4.0", @@ -81,9 +81,9 @@ "@react-navigation/stack": "6.3.16", "@react-ng/bounds-observer": "^0.2.1", "@rnmapbox/maps": "^10.0.11", + "@types/node": "^18.14.0", "@ua/react-native-airship": "^15.2.6", "awesome-phonenumber": "^5.4.0", - "@types/node": "^18.14.0", "babel-plugin-transform-remove-console": "^6.9.4", "babel-polyfill": "^6.26.0", "canvas-size": "^1.2.6", @@ -141,7 +141,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.5.1", + "react-native-reanimated": "^3.5.2", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", diff --git a/patches/react-native-reanimated+3.5.1.patch b/patches/react-native-reanimated+3.5.2.patch similarity index 100% rename from patches/react-native-reanimated+3.5.1.patch rename to patches/react-native-reanimated+3.5.2.patch From 1e2afb2362be1f8f4d821163fd10eac79e1457f3 Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Fri, 15 Sep 2023 18:49:55 +0200 Subject: [PATCH 064/211] Remove autogenerated imports in patch --- patches/react-native-reanimated+3.5.2.patch | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/patches/react-native-reanimated+3.5.2.patch b/patches/react-native-reanimated+3.5.2.patch index 69c8f7028a58..c509e4c4cd2e 100644 --- a/patches/react-native-reanimated+3.5.2.patch +++ b/patches/react-native-reanimated+3.5.2.patch @@ -1,3 +1,44 @@ +diff --git a/node_modules/react-native-reanimated/lib/module/reanimated2/index.js b/node_modules/react-native-reanimated/lib/module/reanimated2/index.js +index 0027008..2aea2ff 100644 +--- a/node_modules/react-native-reanimated/lib/module/reanimated2/index.js ++++ b/node_modules/react-native-reanimated/lib/module/reanimated2/index.js +@@ -1,15 +1,15 @@ + import './publicGlobals'; +-export { runOnJS, runOnUI, createWorkletRuntime, WorkletRuntime, makeMutable, makeShareableCloneRecursive, isReanimated3, isConfigured, enableLayoutAnimations, getViewProp } from './core'; +-export { useAnimatedProps, useEvent, useHandler, useWorkletCallback, useSharedValue, useReducedMotion, useAnimatedStyle, useAnimatedGestureHandler, GestureHandlers, useAnimatedReaction, AnimatedRef, useAnimatedRef, useAnimatedScrollHandler, ScrollHandler, ScrollHandlers, useDerivedValue, DerivedValue, useAnimatedSensor, useFrameCallback, FrameCallback, useAnimatedKeyboard, useScrollViewOffset } from './hook'; +-export { DelayAnimation, RepeatAnimation, SequenceAnimation, StyleLayoutAnimation, cancelAnimation, defineAnimation, withTiming, WithTimingConfig, TimingAnimation, withSpring, WithSpringConfig, SpringAnimation, withDecay, WithDecayConfig, DecayAnimation, withDelay, withRepeat, withSequence } from './animation'; +-export { Extrapolation, ExtrapolationConfig, ExtrapolationType, interpolate, clamp } from './interpolation'; +-export { Extrapolate, InterpolationOptions, interpolateColor, ColorSpace, InterpolateConfig, useInterpolateConfig, InterpolateRGB, InterpolateHSV } from './interpolateColor'; +-export { EasingFunction, EasingFn, EasingFunctionFactory, EasingFactoryFn, Easing } from './Easing'; ++export { runOnJS, runOnUI, createWorkletRuntime, makeMutable, makeShareableCloneRecursive, isReanimated3, isConfigured, enableLayoutAnimations, getViewProp } from './core'; ++export { useAnimatedProps, useEvent, useHandler, useWorkletCallback, useSharedValue, useReducedMotion, useAnimatedStyle, useAnimatedGestureHandler, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useDerivedValue, useAnimatedSensor, useFrameCallback, useAnimatedKeyboard, useScrollViewOffset } from './hook'; ++export { cancelAnimation, defineAnimation, withTiming, withSpring, withDecay, withDelay, withRepeat, withSequence } from './animation'; ++export { interpolate, clamp } from './interpolation'; ++export { Extrapolate, interpolateColor, useInterpolateConfig } from './interpolateColor'; ++export { Easing } from './Easing'; + export { measure, dispatchCommand, scrollTo, setGestureState } from './NativeMethods'; + export { setNativeProps } from './SetNativeProps'; +-export { isColor, processColor, ParsedColorArray, convertToRGBA } from './Colors'; ++export { isColor, processColor, convertToRGBA } from './Colors'; + export { createAnimatedPropAdapter } from './PropAdapters'; +-export { BaseAnimationBuilder, ComplexAnimationBuilder, Keyframe, LayoutAnimation, EntryAnimationsValues, ExitAnimationsValues, EntryExitAnimationFunction, LayoutAnimationsValues, LayoutAnimationFunction, ILayoutAnimationBuilder, IEntryExitAnimationBuilder, ++export { BaseAnimationBuilder, ComplexAnimationBuilder, Keyframe, + // Flip + FlipInXUp, FlipInYLeft, FlipInXDown, FlipInYRight, FlipInEasyX, FlipInEasyY, FlipOutXUp, FlipOutYLeft, FlipOutXDown, FlipOutYRight, FlipOutEasyX, FlipOutEasyY, + // Stretch +@@ -34,9 +34,7 @@ RollInLeft, RollInRight, RollOutLeft, RollOutRight, + Layout, LinearTransition, FadingTransition, SequencedTransition, JumpingTransition, CurvedTransition, EntryExitTransition, combineTransition, + // SET + SharedTransition, SharedTransitionType } from './layoutReanimation'; +-export { getRelativeCoords, ComponentCoords, isSharedValue } from './utils'; +-export { StyleProps, SharedValue, AnimatableValueObject, AnimatableValue, AnimationObject, Animation, SensorType, IOSReferenceFrame, SensorConfig, AnimatedSensor, AnimationCallback, Value3D, ValueRotation, InterfaceOrientation, KeyboardState, AnimatedKeyboardInfo, MeasuredDimensions, AnimatedKeyboardOptions, ReduceMotion } from './commonTypes'; +-export { FrameInfo } from './frameCallback'; ++export { getRelativeCoords, isSharedValue } from './utils'; ++export { SensorType, IOSReferenceFrame, InterfaceOrientation, KeyboardState, ReduceMotion } from './commonTypes'; + export { getUseOfValueInStyleWarning } from './pluginUtils'; +-export { withReanimatedTimer, advanceAnimationByTime, advanceAnimationByFrame, setUpTests, getAnimatedStyle } from './jestUtils'; + //# sourceMappingURL=index.js.map +\ No newline at end of file diff --git a/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts b/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts index 4df2481..cca7f1a 100644 --- a/node_modules/react-native-reanimated/src/reanimated2/PlatformChecker.ts From 8abc7dd30504483df5134224ec98f0e357b6b0a4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 16 Sep 2023 16:28:19 +0800 Subject: [PATCH 065/211] use different border color for anonymous report footer --- src/components/AvatarWithDisplayName.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/AvatarWithDisplayName.js b/src/components/AvatarWithDisplayName.js index a6c630b775f7..97ef5ac741f5 100644 --- a/src/components/AvatarWithDisplayName.js +++ b/src/components/AvatarWithDisplayName.js @@ -17,6 +17,7 @@ import DisplayNames from './DisplayNames'; import compose from '../libs/compose'; import * as OptionsListUtils from '../libs/OptionsListUtils'; import Text from './Text'; +import * as StyleUtils from '../styles/StyleUtils'; import ParentNavigationSubtitle from './ParentNavigationSubtitle'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; import Navigation from '../libs/Navigation/Navigation'; @@ -90,6 +91,7 @@ function AvatarWithDisplayName(props) { const shouldShowSubscriptAvatar = ReportUtils.shouldReportShowSubscript(props.report); const isExpenseRequest = ReportUtils.isExpenseRequest(props.report); const defaultSubscriptSize = isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : props.size; + const avatarBorderColor = props.isAnonymous ? themeColors.highlightBG : themeColors.componentBG; return ( @@ -102,7 +104,7 @@ function AvatarWithDisplayName(props) { > {shouldShowSubscriptAvatar ? ( )} From 55d4bc978260e01089a4325d959d7f81bb70cf48 Mon Sep 17 00:00:00 2001 From: Majid Date: Sat, 16 Sep 2023 22:21:11 +0200 Subject: [PATCH 066/211] Uses policyID to correctly generate bankAccountRout --- src/pages/ReimbursementAccount/BankAccountStep.js | 7 ++++++- src/pages/ReimbursementAccount/ReimbursementAccountPage.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/BankAccountStep.js b/src/pages/ReimbursementAccount/BankAccountStep.js index 8e718e193efe..64caf08d4027 100644 --- a/src/pages/ReimbursementAccount/BankAccountStep.js +++ b/src/pages/ReimbursementAccount/BankAccountStep.js @@ -28,6 +28,7 @@ import ScreenWrapper from '../../components/ScreenWrapper'; import StepPropTypes from './StepPropTypes'; import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; import * as Link from '../../libs/actions/Link'; +import { getBankAccountRoute } from '../../libs/ReportUtils'; const propTypes = { ...StepPropTypes, @@ -49,6 +50,9 @@ const propTypes = { /* The workspace name */ policyName: PropTypes.string, + + /* The workspace ID */ + policyID: PropTypes.string, }; const defaultProps = { @@ -57,6 +61,7 @@ const defaultProps = { user: {}, isPlaidDisabled: false, policyName: '', + policyID: '', }; function BankAccountStep(props) { @@ -66,7 +71,7 @@ function BankAccountStep(props) { subStep = CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID; } const plaidDesktopMessage = getPlaidDesktopMessage(); - const bankAccountRoute = `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.BANK_ACCOUNT}`; + const bankAccountRoute = `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.getBankAccountRoute('new', props.policyID, ROUTES.getWorkspaceInitialRoute(props.policyID))}`; if (subStep === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL) { return ( diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index 3160ad590c50..a31f9ae8037a 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -421,6 +421,7 @@ class ReimbursementAccountPage extends React.Component { plaidLinkOAuthToken={this.props.plaidLinkToken} getDefaultStateForField={this.getDefaultStateForField} policyName={policyName} + policyID={policyID} /> ); } From 5671e36517609466dc91a30a34b0d984b69e3faf Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Mon, 18 Sep 2023 05:17:49 +0530 Subject: [PATCH 067/211] Make the footer button part of the ScrollView in 2FA Verify Step This makes the Footer button a child of the ScrollView container. The footer button will now be scrollable below the content. --- .../TwoFactorAuth/Steps/VerifyStep.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/VerifyStep.js b/src/pages/settings/Security/TwoFactorAuth/Steps/VerifyStep.js index 8c3d9689cfcd..01258f8dff3b 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/VerifyStep.js +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/VerifyStep.js @@ -110,20 +110,20 @@ function VerifyStep({account = defaultAccount}) { + + + + +

{{ platform.description }}

-
{{ platform.href }}
+ + From a69315c80a52657a75b255d28b66ada019083ed4 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Fri, 22 Sep 2023 23:15:50 +0530 Subject: [PATCH 182/211] enable push to production --- .github/workflows/deployExpensifyHelp.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 11f4897ab322..ca7345ef9462 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -2,6 +2,10 @@ name: Deploy ExpensifyHelp on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 168329018c6d0cb6579adcad7bc602eb943c7a1f Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Fri, 22 Sep 2023 23:25:19 +0530 Subject: [PATCH 183/211] change hub font weight --- docs/_sass/_main.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index 75922c7704f9..3a5be400854d 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -708,8 +708,9 @@ button { } h3.title { - font-size: 1.2em; font-family: "ExpensifyNewKansas", "Helvetica Neue", "Helvetica", Arial, sans-serif; + font-size: 1.2em; + font-weight: normal; } h3.title, From 728440d0511dd19c8e34a48ed93c59b1d1d66c1f Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Fri, 22 Sep 2023 23:42:00 +0530 Subject: [PATCH 184/211] remove overlayopacity --- src/CONST.ts | 2 -- src/styles/styles.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index e6ef4a3db427..b25859c78530 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -123,8 +123,6 @@ const CONST = { }, }, - RIGHT_MODAL_BACKGROUND_OVERLAY_OPACITY: 0.72, - NEW_EXPENSIFY_URL: ACTIVE_EXPENSIFY_URL, APP_DOWNLOAD_LINKS: { ANDROID: `https://play.google.com/store/apps/details?id=${ANDROID_PACKAGE_NAME}`, diff --git a/src/styles/styles.js b/src/styles/styles.js index a44190b0ead1..a08380d3cd6b 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1557,7 +1557,7 @@ const styles = (theme) => ({ backgroundColor: theme.overlay, opacity: current.progress.interpolate({ inputRange: [0, 1], - outputRange: [0, CONST.RIGHT_MODAL_BACKGROUND_OVERLAY_OPACITY], + outputRange: [0, variables.overlayOpacity], extrapolate: 'clamp', }), }), From 1e3e7525031aaa1aa6f2653b8b69630e12876343 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 23 Sep 2023 01:19:36 +0530 Subject: [PATCH 185/211] rm whitespace --- docs/_includes/platform-card.html | 2 -- docs/_sass/_main.scss | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/_includes/platform-card.html b/docs/_includes/platform-card.html index 1d341a7d331d..7123f18a679a 100644 --- a/docs/_includes/platform-card.html +++ b/docs/_includes/platform-card.html @@ -20,5 +20,3 @@

{{ platform.title }}

- - diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index 3a5be400854d..fcecc0846ce7 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -533,8 +533,6 @@ button { } } - - p.description { padding: 0; margin: 0; @@ -710,7 +708,7 @@ button { h3.title { font-family: "ExpensifyNewKansas", "Helvetica Neue", "Helvetica", Arial, sans-serif; font-size: 1.2em; - font-weight: normal; + font-weight: normala; } h3.title, From 72cd4f7b41154fffbc0f784ccd2f71da34d826c0 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 23 Sep 2023 01:20:44 +0530 Subject: [PATCH 186/211] fix typo --- docs/_sass/_main.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index fcecc0846ce7..b4cb8a1f3ac5 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -708,7 +708,7 @@ button { h3.title { font-family: "ExpensifyNewKansas", "Helvetica Neue", "Helvetica", Arial, sans-serif; font-size: 1.2em; - font-weight: normala; + font-weight: normal; } h3.title, From 7fb66cdd840ba14f5c958dd60fc1bb4f75d58bab Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Sat, 23 Sep 2023 09:48:25 +0800 Subject: [PATCH 187/211] Organize and cleanup --- src/ROUTES.ts | 323 ++++++++---------- src/components/AttachmentModal.js | 2 +- src/components/AvatarWithDisplayName.js | 8 +- src/components/DistanceRequest.js | 8 +- .../HTMLRenderers/AnchorRenderer.js | 2 +- .../HTMLRenderers/ImageRenderer.js | 2 +- .../HTMLRenderers/MentionUserRenderer.js | 4 +- src/components/HeaderWithBackButton/index.js | 2 +- .../MoneyRequestConfirmationList.js | 14 +- src/components/ParentNavigationSubtitle.js | 2 +- .../ReportActionItem/MoneyRequestAction.js | 6 +- .../ReportActionItem/MoneyRequestView.js | 10 +- .../ReportActionItem/ReportActionItemImage.js | 2 +- .../ReportActionItem/ReportPreview.js | 2 +- .../ReportActionItem/TaskPreview.js | 2 +- src/components/ReportActionItem/TaskView.js | 8 +- src/components/ReportWelcomeText.js | 4 +- src/libs/Navigation/Navigation.js | 2 +- src/libs/Navigation/linkingConfig.js | 100 +++--- ...bscribeToReportCommentPushNotifications.js | 2 +- src/libs/ReportUtils.js | 8 +- src/libs/actions/App.js | 4 +- src/libs/actions/IOU.js | 10 +- .../ReimbursementAccount/navigation.js | 2 +- src/libs/actions/Report.js | 28 +- src/libs/actions/Welcome.js | 2 +- src/pages/EditRequestAmountPage.js | 2 +- .../PrivateNotes/PrivateNotesListPage.js | 2 +- .../PrivateNotes/PrivateNotesViewPage.js | 2 +- src/pages/ProfilePage.js | 2 +- .../ReimbursementAccount/Enable2FAPrompt.js | 4 +- .../ReimbursementAccountPage.js | 2 +- src/pages/ReportDetailsPage.js | 10 +- src/pages/ReportParticipantsPage.js | 2 +- src/pages/ShareCodePage.js | 6 +- src/pages/home/ReportScreen.js | 2 +- .../report/ContextMenu/ContextMenuActions.js | 8 +- .../report/ReactionList/BaseReactionList.js | 2 +- .../home/report/ReportActionItemSingle.js | 6 +- src/pages/home/report/ReportAttachments.js | 2 +- src/pages/home/sidebar/SidebarLinks.js | 2 +- src/pages/iou/IOUCurrencySelection.js | 2 +- src/pages/iou/MoneyRequestCategoryPage.js | 4 +- src/pages/iou/MoneyRequestDatePage.js | 4 +- src/pages/iou/MoneyRequestDescriptionPage.js | 4 +- src/pages/iou/MoneyRequestMerchantPage.js | 4 +- src/pages/iou/MoneyRequestTagPage.js | 2 +- src/pages/iou/WaypointEditor.js | 8 +- .../iou/steps/MoneyRequestConfirmPage.js | 8 +- .../MoneyRequestParticipantsPage.js | 8 +- src/pages/iou/steps/NewRequestAmountPage.js | 10 +- .../Profile/Contacts/ContactMethodsPage.js | 2 +- .../Report/NotificationPreferencePage.js | 2 +- .../settings/Report/ReportSettingsPage.js | 10 +- src/pages/settings/Report/RoomNamePage.js | 2 +- .../settings/Report/WriteCapabilityPage.js | 2 +- src/pages/workspace/WorkspaceInitialPage.js | 16 +- .../workspace/WorkspaceInviteMessagePage.js | 4 +- src/pages/workspace/WorkspaceInvitePage.js | 4 +- src/pages/workspace/WorkspaceMembersPage.js | 4 +- .../workspace/WorkspacePageWithSections.js | 2 +- src/pages/workspace/WorkspaceSettingsPage.js | 2 +- src/pages/workspace/WorkspacesListPage.js | 2 +- .../reimburse/WorkspaceRateAndUnitPage.js | 4 +- .../reimburse/WorkspaceReimburseView.js | 2 +- tests/actions/IOUTest.js | 4 +- tests/e2e/ADDING_TESTS.md | 8 +- 67 files changed, 341 insertions(+), 396 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index feead4890114..09d237a6e2e9 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -11,204 +11,147 @@ type ParseReportRouteParams = { isSubReportPageRoute: boolean; }; -const REPORT = 'r'; -const IOU_REQUEST = 'request/new'; -const IOU_SEND = 'send/new'; -const NEW_TASK = 'new/task'; -const SETTINGS_PERSONAL_DETAILS = 'settings/profile/personal-details'; -const SETTINGS_CONTACT_METHODS = 'settings/profile/contact-methods'; -const SETTINGS_STATUS = 'settings/profile/status'; -const SETTINGS_STATUS_SET = 'settings/profile/status/set'; - +// prettier-ignore export default { - BANK_ACCOUNT: 'bank-account', - BANK_ACCOUNT_NEW: 'bank-account/new', - BANK_ACCOUNT_WITH_STEP_TO_OPEN: 'bank-account/:stepToOpen?', - BANK_ACCOUNT_PERSONAL: 'bank-account/personal', - getBankAccountRoute: (stepToOpen = '', policyID = '', backTo = ''): string => { - const backToParam = backTo ? `&backTo=${encodeURIComponent(backTo)}` : ''; - return `bank-account/${stepToOpen}?policyID=${policyID}${backToParam}`; - }, - HOME: '', - SETTINGS: 'settings', - SETTINGS_PROFILE: 'settings/profile', - SETTINGS_SHARE_CODE: 'settings/shareCode', - SETTINGS_DISPLAY_NAME: 'settings/profile/display-name', - SETTINGS_TIMEZONE: 'settings/profile/timezone', - SETTINGS_TIMEZONE_SELECT: 'settings/profile/timezone/select', - SETTINGS_PRONOUNS: 'settings/profile/pronouns', - SETTINGS_LOUNGE_ACCESS: 'settings/profile/lounge-access', - SETTINGS_PREFERENCES: 'settings/preferences', - SETTINGS_PRIORITY_MODE: 'settings/preferences/priority-mode', - SETTINGS_LANGUAGE: 'settings/preferences/language', - SETTINGS_THEME: 'settings/preferences/theme', - SETTINGS_WORKSPACES: 'settings/workspaces', - SETTINGS_SECURITY: 'settings/security', - SETTINGS_CLOSE: 'settings/security/closeAccount', - SETTINGS_ABOUT: 'settings/about', - SETTINGS_APP_DOWNLOAD_LINKS: 'settings/about/app-download-links', - SETTINGS_WALLET: 'settings/wallet', - SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card', - SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account', - SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments', - getSettingsAddLoginRoute: (type: string) => `settings/addlogin/${type}`, - SETTINGS_WALLET_TRANSFER_BALANCE: 'settings/wallet/transfer-balance', - SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT: 'settings/wallet/choose-transfer-account', - SETTINGS_PERSONAL_DETAILS, - SETTINGS_PERSONAL_DETAILS_LEGAL_NAME: `${SETTINGS_PERSONAL_DETAILS}/legal-name`, - SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH: `${SETTINGS_PERSONAL_DETAILS}/date-of-birth`, - SETTINGS_PERSONAL_DETAILS_ADDRESS: `${SETTINGS_PERSONAL_DETAILS}/address`, - SETTINGS_CONTACT_METHODS, - SETTINGS_CONTACT_METHOD_DETAILS: `${SETTINGS_CONTACT_METHODS}/:contactMethod/details`, - getEditContactMethodRoute: (contactMethod: string) => `${SETTINGS_CONTACT_METHODS}/${encodeURIComponent(contactMethod)}/details`, - SETTINGS_NEW_CONTACT_METHOD: `${SETTINGS_CONTACT_METHODS}/new`, - SETTINGS_2FA: 'settings/security/two-factor-auth', - SETTINGS_STATUS, - SETTINGS_STATUS_SET, - NEW: 'new', - NEW_CHAT: 'new/chat', - NEW_ROOM: 'new/room', - NEW_TASK, - REPORT, - REPORT_WITH_ID: 'r/:reportID?/:reportActionID?', - EDIT_REQUEST: 'r/:threadReportID/edit/:field', - getEditRequestRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`, - EDIT_CURRENCY_REQUEST: 'r/:threadReportID/edit/currency', - getEditRequestCurrencyRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`, - getReportRoute: (reportID: string) => `r/${reportID}`, - REPORT_WITH_ID_DETAILS_SHARE_CODE: 'r/:reportID/details/shareCode', - getReportShareCodeRoute: (reportID: string) => `r/${reportID}/details/shareCode`, - REPORT_ATTACHMENTS: 'r/:reportID/attachment', - getReportAttachmentRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURI(source)}`, - + HOME: '', /** This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated */ CONCIERGE: 'concierge', - - IOU_REQUEST, - IOU_SEND, - - // To see the available iouType, please refer to CONST.IOU.MONEY_REQUEST_TYPE - MONEY_REQUEST: ':iouType/new/:reportID?', - MONEY_REQUEST_AMOUNT: ':iouType/new/amount/:reportID?', - MONEY_REQUEST_PARTICIPANTS: ':iouType/new/participants/:reportID?', - MONEY_REQUEST_CONFIRMATION: ':iouType/new/confirmation/:reportID?', - MONEY_REQUEST_DATE: ':iouType/new/date/:reportID?', - MONEY_REQUEST_CURRENCY: ':iouType/new/currency/:reportID?', - MONEY_REQUEST_DESCRIPTION: ':iouType/new/description/:reportID?', - MONEY_REQUEST_CATEGORY: ':iouType/new/category/:reportID?', - MONEY_REQUEST_TAG: ':iouType/new/tag/:reportID?', - MONEY_REQUEST_MERCHANT: ':iouType/new/merchant/:reportID?', - MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual', - MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan', - MONEY_REQUEST_DISTANCE_TAB: ':iouType/new/:reportID?/distance', - MONEY_REQUEST_WAYPOINT: ':iouType/new/waypoint/:waypointIndex', - MONEY_REQUEST_ADDRESS: ':iouType/new/address/:reportID?', - IOU_SEND_ADD_BANK_ACCOUNT: `${IOU_SEND}/add-bank-account`, - IOU_SEND_ADD_DEBIT_CARD: `${IOU_SEND}/add-debit-card`, - IOU_SEND_ENABLE_PAYMENTS: `${IOU_SEND}/enable-payments`, - getMoneyRequestRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}`, - getMoneyRequestAmountRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}`, - getMoneyRequestParticipantsRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`, - getMoneyRequestConfirmationRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`, - getMoneyRequestCreatedRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`, - getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, - getMoneyRequestDescriptionRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`, - getMoneyRequestCategoryRoute: (iouType: string, reportID = '') => `${iouType}/new/category/${reportID}`, - getMoneyRequestMerchantRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`, - getMoneyRequestDistanceTabRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`, - getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`, - getMoneyRequestAddressRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}`, - getMoneyRequestTagRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}`, - SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`, - getSplitBillDetailsRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`, - getNewTaskRoute: (reportID: string) => `${NEW_TASK}/${reportID}`, - NEW_TASK_WITH_REPORT_ID: `${NEW_TASK}/:reportID?`, - TASK_TITLE: 'r/:reportID/title', - TASK_DESCRIPTION: 'r/:reportID/description', - TASK_ASSIGNEE: 'r/:reportID/assignee', - getTaskReportTitleRoute: (reportID: string) => `r/${reportID}/title`, - getTaskReportDescriptionRoute: (reportID: string) => `r/${reportID}/description`, - getTaskReportAssigneeRoute: (reportID: string) => `r/${reportID}/assignee`, - NEW_TASK_ASSIGNEE: `${NEW_TASK}/assignee`, - NEW_TASK_SHARE_DESTINATION: `${NEW_TASK}/share-destination`, - NEW_TASK_DETAILS: `${NEW_TASK}/details`, - NEW_TASK_TITLE: `${NEW_TASK}/title`, - NEW_TASK_DESCRIPTION: `${NEW_TASK}/description`, - FLAG_COMMENT: `flag/:reportID/:reportActionID`, - getFlagCommentRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`, - SEARCH: 'search', - TEACHERS_UNITE: 'teachersunite', - I_KNOW_A_TEACHER: 'teachersunite/i-know-a-teacher', - I_AM_A_TEACHER: 'teachersunite/i-am-a-teacher', - INTRO_SCHOOL_PRINCIPAL: 'teachersunite/intro-school-principal', - DETAILS: 'details', - getDetailsRoute: (login: string) => `details?login=${encodeURIComponent(login)}`, - PROFILE: 'a/:accountID', - getProfileRoute: (accountID: string | number, backTo = '') => { + FLAG_COMMENT: { route: 'flag/:reportID/:reportActionID', getRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`}, + SEARCH: 'search', + DETAILS: { route: 'details', getRoute: (login: string) => `details?login=${encodeURIComponent(login)}`}, + PROFILE: { route: 'a/:accountID', getRoute: (accountID: string | number, backTo = '') => { const backToParam = backTo ? `?backTo=${encodeURIComponent(backTo)}` : ''; return `a/${accountID}${backToParam}`; - }, - REPORT_PARTICIPANTS: 'r/:reportID/participants', - getReportParticipantsRoute: (reportID: string) => `r/${reportID}/participants`, - REPORT_WITH_ID_DETAILS: 'r/:reportID/details', - getReportDetailsRoute: (reportID: string) => `r/${reportID}/details`, - REPORT_SETTINGS: 'r/:reportID/settings', - getReportSettingsRoute: (reportID: string) => `r/${reportID}/settings`, - REPORT_SETTINGS_ROOM_NAME: 'r/:reportID/settings/room-name', - getReportSettingsRoomNameRoute: (reportID: string) => `r/${reportID}/settings/room-name`, - REPORT_SETTINGS_NOTIFICATION_PREFERENCES: 'r/:reportID/settings/notification-preferences', - getReportSettingsNotificationPreferencesRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences`, - REPORT_WELCOME_MESSAGE: 'r/:reportID/welcomeMessage', - getReportWelcomeMessageRoute: (reportID: string) => `r/${reportID}/welcomeMessage`, - REPORT_SETTINGS_WRITE_CAPABILITY: 'r/:reportID/settings/who-can-post', - getReportSettingsWriteCapabilityRoute: (reportID: string) => `r/${reportID}/settings/who-can-post`, - TRANSITION_BETWEEN_APPS: 'transition', - VALIDATE_LOGIN: 'v/:accountID/:validateCode', - GET_ASSISTANCE: 'get-assistance/:taskID', - getGetAssistanceRoute: (taskID: string) => `get-assistance/${taskID}`, - UNLINK_LOGIN: 'u/:accountID/:validateCode', - - APPLE_SIGN_IN: 'sign-in-with-apple', - GOOGLE_SIGN_IN: 'sign-in-with-google', - DESKTOP_SIGN_IN_REDIRECT: 'desktop-signin-redirect', - - // Routes related to private notes added to the report - PRIVATE_NOTES_VIEW: 'r/:reportID/notes/:accountID', - getPrivateNotesViewRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}`, - PRIVATE_NOTES_LIST: 'r/:reportID/notes', - getPrivateNotesListRoute: (reportID: string) => `r/${reportID}/notes`, - PRIVATE_NOTES_EDIT: 'r/:reportID/notes/:accountID/edit', - getPrivateNotesEditRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}/edit`, + }}, + TRANSITION_BETWEEN_APPS: 'transition', + VALIDATE_LOGIN: 'v/:accountID/:validateCode', + GET_ASSISTANCE: { route: 'get-assistance/:taskID', getRoute: (taskID: string) => `get-assistance/${taskID}`}, + UNLINK_LOGIN: 'u/:accountID/:validateCode', + APPLE_SIGN_IN: 'sign-in-with-apple', + GOOGLE_SIGN_IN: 'sign-in-with-google', + DESKTOP_SIGN_IN_REDIRECT: 'desktop-signin-redirect', // This is a special validation URL that will take the user to /workspace/new after validation. This is used // when linking users from e.com in order to share a session in this app. - ENABLE_PAYMENTS: 'enable-payments', - WALLET_STATEMENT_WITH_DATE: 'statements/:yearMonth', - getWalletStatementWithDateRoute: (yearMonth: string) => `statements/${yearMonth}`, - WORKSPACE_NEW: 'workspace/new', - WORKSPACE_INITIAL: 'workspace/:policyID', - WORKSPACE_INVITE: 'workspace/:policyID/invite', - WORKSPACE_INVITE_MESSAGE: 'workspace/:policyID/invite-message', - WORKSPACE_SETTINGS: 'workspace/:policyID/settings', - WORKSPACE_CARD: 'workspace/:policyID/card', - WORKSPACE_REIMBURSE: 'workspace/:policyID/reimburse', - WORKSPACE_RATE_AND_UNIT: 'workspace/:policyID/rateandunit', - WORKSPACE_BILLS: 'workspace/:policyID/bills', - WORKSPACE_INVOICES: 'workspace/:policyID/invoices', - WORKSPACE_TRAVEL: 'workspace/:policyID/travel', - WORKSPACE_MEMBERS: 'workspace/:policyID/members', - WORKSPACE_NEW_ROOM: 'workspace/new-room', - getWorkspaceInitialRoute: (policyID: string) => `workspace/${policyID}`, - getWorkspaceInviteRoute: (policyID: string) => `workspace/${policyID}/invite`, - getWorkspaceInviteMessageRoute: (policyID: string) => `workspace/${policyID}/invite-message`, - getWorkspaceSettingsRoute: (policyID: string) => `workspace/${policyID}/settings`, - getWorkspaceCardRoute: (policyID: string) => `workspace/${policyID}/card`, - getWorkspaceReimburseRoute: (policyID: string) => `workspace/${policyID}/reimburse`, - getWorkspaceRateAndUnitRoute: (policyID: string) => `workspace/${policyID}/rateandunit`, - getWorkspaceBillsRoute: (policyID: string) => `workspace/${policyID}/bills`, - getWorkspaceInvoicesRoute: (policyID: string) => `workspace/${policyID}/invoices`, - getWorkspaceTravelRoute: (policyID: string) => `workspace/${policyID}/travel`, - getWorkspaceMembersRoute: (policyID: string) => `workspace/${policyID}/members`, + ENABLE_PAYMENTS: 'enable-payments', + WALLET_STATEMENT_WITH_DATE: 'statements/:yearMonth', + + BANK_ACCOUNT: 'bank-account', + BANK_ACCOUNT_NEW: 'bank-account/new', + BANK_ACCOUNT_PERSONAL: 'bank-account/personal', + BANK_ACCOUNT_WITH_STEP_TO_OPEN: { route: 'bank-account/:stepToOpen?', getRoute: (stepToOpen = '', policyID = '', backTo = ''): string => { + const backToParam = backTo ? `&backTo=${encodeURIComponent(backTo)}` : ''; + return `bank-account/${stepToOpen}?policyID=${policyID}${backToParam}`; + }}, + + SETTINGS: 'settings', + SETTINGS_PROFILE: 'settings/profile', + SETTINGS_SHARE_CODE: 'settings/shareCode', + SETTINGS_DISPLAY_NAME: 'settings/profile/display-name', + SETTINGS_TIMEZONE: 'settings/profile/timezone', + SETTINGS_TIMEZONE_SELECT: 'settings/profile/timezone/select', + SETTINGS_PRONOUNS: 'settings/profile/pronouns', + SETTINGS_LOUNGE_ACCESS: 'settings/profile/lounge-access', + SETTINGS_PREFERENCES: 'settings/preferences', + SETTINGS_PRIORITY_MODE: 'settings/preferences/priority-mode', + SETTINGS_LANGUAGE: 'settings/preferences/language', + SETTINGS_THEME: 'settings/preferences/theme', + SETTINGS_WORKSPACES: 'settings/workspaces', + SETTINGS_SECURITY: 'settings/security', + SETTINGS_CLOSE: 'settings/security/closeAccount', + SETTINGS_ABOUT: 'settings/about', + SETTINGS_APP_DOWNLOAD_LINKS: 'settings/about/app-download-links', + SETTINGS_WALLET: 'settings/wallet', + SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card', + SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account', + SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments', + SETTINGS_WALLET_TRANSFER_BALANCE: 'settings/wallet/transfer-balance', + SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT: 'settings/wallet/choose-transfer-account', + SETTINGS_PERSONAL_DETAILS: 'settings/profile/personal-details', + SETTINGS_PERSONAL_DETAILS_LEGAL_NAME: 'settings/profile/personal-details/legal-name', + SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH: 'settings/profile/personal-details/date-of-birth', + SETTINGS_PERSONAL_DETAILS_ADDRESS: 'settings/profile/personal-details/address', + SETTINGS_CONTACT_METHODS: 'settings/profile/contact-methods', + SETTINGS_CONTACT_METHOD_DETAILS: { route: 'settings/profile/contact-methods/:contactMethod/details', getRoute: (contactMethod: string) => `settings/profile/contact-methods/${encodeURIComponent(contactMethod)}/details`}, + SETTINGS_NEW_CONTACT_METHOD: 'settings/profile/contact-methods/new', + SETTINGS_2FA: 'settings/security/two-factor-auth', + SETTINGS_STATUS: 'settings/profile/status', + SETTINGS_STATUS_SET: 'settings/profile/status/set', + + NEW: 'new', + NEW_CHAT: 'new/chat', + NEW_ROOM: 'new/room', + + REPORT: 'r', + REPORT_WITH_ID: { route: 'r/:reportID?/:reportActionID?', getRoute: (reportID: string) => `r/${reportID}`}, + EDIT_REQUEST: { route: 'r/:threadReportID/edit/:field', getRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`}, + EDIT_CURRENCY_REQUEST: { route: 'r/:threadReportID/edit/currency', getRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`}, + REPORT_WITH_ID_DETAILS_SHARE_CODE: { route: 'r/:reportID/details/shareCode', getRoute: (reportID: string) => `r/${reportID}/details/shareCode`}, + REPORT_ATTACHMENTS: { route: 'r/:reportID/attachment', getRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURI(source)}`}, + REPORT_PARTICIPANTS: { route: 'r/:reportID/participants', getRoute: (reportID: string) => `r/${reportID}/participants`}, + REPORT_WITH_ID_DETAILS: { route: 'r/:reportID/details', getRoute: (reportID: string) => `r/${reportID}/details`}, + REPORT_SETTINGS: { route: 'r/:reportID/settings', getRoute: (reportID: string) => `r/${reportID}/settings`}, + REPORT_SETTINGS_ROOM_NAME: { route: 'r/:reportID/settings/room-name', getRoute: (reportID: string) => `r/${reportID}/settings/room-name`}, + REPORT_SETTINGS_NOTIFICATION_PREFERENCES: {route: 'r/:reportID/settings/notification-preferences', getRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences`}, + REPORT_SETTINGS_WRITE_CAPABILITY: { route: 'r/:reportID/settings/who-can-post', getRoute: (reportID: string) => `r/${reportID}/settings/who-can-post`}, + REPORT_WELCOME_MESSAGE: { route: 'r/:reportID/welcomeMessage', getRoute: (reportID: string) => `r/${reportID}/welcomeMessage`}, + SPLIT_BILL_DETAILS: { route: 'r/:reportID/split/:reportActionID', getRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`}, + TASK_TITLE: { route: 'r/:reportID/title', getRoute: (reportID: string) => `r/${reportID}/title`}, + TASK_DESCRIPTION: { route: 'r/:reportID/description', getRoute: (reportID: string) => `r/${reportID}/description`}, + TASK_ASSIGNEE: { route: 'r/:reportID/assignee', getRoute: (reportID: string) => `r/${reportID}/assignee`}, + PRIVATE_NOTES_VIEW: { route: 'r/:reportID/notes/:accountID', getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}`}, + PRIVATE_NOTES_LIST: { route: 'r/:reportID/notes', getRoute: (reportID: string) => `r/${reportID}/notes`}, + PRIVATE_NOTES_EDIT: { route: 'r/:reportID/notes/:accountID/edit', getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}/edit`}, + + // To see the available iouType, please refer to CONST.IOU.MONEY_REQUEST_TYPE + MONEY_REQUEST: { route: ':iouType/new/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}`}, + MONEY_REQUEST_AMOUNT: { route: ':iouType/new/amount/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}`}, + MONEY_REQUEST_PARTICIPANTS: { route: ':iouType/new/participants/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`}, + MONEY_REQUEST_CONFIRMATION: { route: ':iouType/new/confirmation/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`}, + MONEY_REQUEST_DATE: { route: ':iouType/new/date/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`}, + MONEY_REQUEST_CURRENCY: { route: ':iouType/new/currency/:reportID?', getRoute: (iouType: string, reportID: string, currency: string, backTo: string) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`}, + MONEY_REQUEST_DESCRIPTION: { route: ':iouType/new/description/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`}, + MONEY_REQUEST_CATEGORY: { route: ':iouType/new/category/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/category/${reportID}`}, + MONEY_REQUEST_TAG: { route: ':iouType/new/tag/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}`}, + MONEY_REQUEST_MERCHANT: { route: ':iouType/new/merchant/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`}, + MONEY_REQUEST_WAYPOINT: { route: ':iouType/new/waypoint/:waypointIndex', getRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`}, + MONEY_REQUEST_ADDRESS: { route: ':iouType/new/address/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}`}, + MONEY_REQUEST_DISTANCE_TAB: { route: ':iouType/new/:reportID?/distance', getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`}, + MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual', + MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan', + + IOU_REQUEST: 'request/new', + IOU_SEND: 'send/new', + IOU_SEND_ADD_BANK_ACCOUNT: 'send/new/add-bank-account', + IOU_SEND_ADD_DEBIT_CARD: 'send/new/add-debit-card', + IOU_SEND_ENABLE_PAYMENTS: 'send/new/enable-payments', + + NEW_TASK: 'new/task', + NEW_TASK_WITH_REPORT_ID: 'new/task/:reportID?', + NEW_TASK_ASSIGNEE: 'new/task/assignee', + NEW_TASK_SHARE_DESTINATION: 'new/task/share-destination', + NEW_TASK_DETAILS: 'new/task/details', + NEW_TASK_TITLE: 'new/task/title', + NEW_TASK_DESCRIPTION: 'new/task/description', + + TEACHERS_UNITE: 'teachersunite', + I_KNOW_A_TEACHER: 'teachersunite/i-know-a-teacher', + I_AM_A_TEACHER: 'teachersunite/i-am-a-teacher', + INTRO_SCHOOL_PRINCIPAL: 'teachersunite/intro-school-principal', + + WORKSPACE_NEW: 'workspace/new', + WORKSPACE_NEW_ROOM: 'workspace/new-room', + WORKSPACE_INITIAL: { route: 'workspace/:policyID', getRoute: (policyID: string) => `workspace/${policyID}`}, + WORKSPACE_INVITE: { route: 'workspace/:policyID/invite', getRoute: (policyID: string) => `workspace/${policyID}/invite`}, + WORKSPACE_INVITE_MESSAGE: { route: 'workspace/:policyID/invite-message', getRoute: (policyID: string) => `workspace/${policyID}/invite-message`}, + WORKSPACE_SETTINGS: { route: 'workspace/:policyID/settings', getRoute: (policyID: string) => `workspace/${policyID}/settings`}, + WORKSPACE_CARD: { route: 'workspace/:policyID/card', getRoute: (policyID: string) => `workspace/${policyID}/card`}, + WORKSPACE_REIMBURSE: { route: 'workspace/:policyID/reimburse', getRoute: (policyID: string) => `workspace/${policyID}/reimburse`}, + WORKSPACE_RATE_AND_UNIT: { route: 'workspace/:policyID/rateandunit', getRoute: (policyID: string) => `workspace/${policyID}/rateandunit`}, + WORKSPACE_BILLS: { route: 'workspace/:policyID/bills', getRoute: (policyID: string) => `workspace/${policyID}/bills`}, + WORKSPACE_INVOICES: { route: 'workspace/:policyID/invoices', getRoute: (policyID: string) => `workspace/${policyID}/invoices`}, + WORKSPACE_TRAVEL: { route: 'workspace/:policyID/travel', getRoute: (policyID: string) => `workspace/${policyID}/travel`}, + WORKSPACE_MEMBERS: { route: 'workspace/:policyID/members', getRoute: (policyID: string) => `workspace/${policyID}/members`}, // These are some on-off routes that will be removed once they're no longer needed (see GH issues for details) SAASTR: 'saastr', diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 946b5e2ddec9..3f89f4032061 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -363,7 +363,7 @@ function AttachmentModal(props) { icon: Expensicons.Camera, text: props.translate('common.replace'), onSelected: () => { - onModalHideCallbackRef.current = () => Navigation.navigate(ROUTES.getEditRequestRoute(props.report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)); + onModalHideCallbackRef.current = () => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(props.report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)); closeModal(); }, }, diff --git a/src/components/AvatarWithDisplayName.js b/src/components/AvatarWithDisplayName.js index e82dbe05a6d0..63a148f9d8b6 100644 --- a/src/components/AvatarWithDisplayName.js +++ b/src/components/AvatarWithDisplayName.js @@ -57,12 +57,12 @@ const defaultProps = { const showActorDetails = (report) => { if (ReportUtils.isExpenseReport(report)) { - Navigation.navigate(ROUTES.getProfileRoute(report.ownerAccountID)); + Navigation.navigate(ROUTES.PROFILE.getRoute(report.ownerAccountID)); return; } if (ReportUtils.isIOUReport(report)) { - Navigation.navigate(ROUTES.getReportParticipantsRoute(report.reportID)); + Navigation.navigate(ROUTES.REPORT_PARTICIPANTS.getRoute(report.reportID)); return; } @@ -71,13 +71,13 @@ const showActorDetails = (report) => { const actorAccountID = lodashGet(parentReportAction, 'actorAccountID', -1); // in an ideal situation account ID won't be 0 if (actorAccountID > 0) { - Navigation.navigate(ROUTES.getProfileRoute(actorAccountID)); + Navigation.navigate(ROUTES.PROFILE.getRoute(actorAccountID)); return; } } // report detail route is added as fallback but based on the current implementation this route won't be executed - Navigation.navigate(ROUTES.getReportDetailsRoute(report.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID)); }; function AvatarWithDisplayName(props) { diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js index 4ac49a5889a8..888b1fd7f6d8 100644 --- a/src/components/DistanceRequest.js +++ b/src/components/DistanceRequest.js @@ -189,12 +189,12 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken, useEffect(updateGradientVisibility, [scrollContainerHeight, scrollContentHeight]); const navigateBack = () => { - Navigation.goBack(isEditing ? ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID) : ROUTES.HOME); + Navigation.goBack(isEditing ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME); }; const navigateToNextPage = () => { if (isEditing) { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); return; } @@ -237,7 +237,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken, secondaryIcon={waypointIcon} secondaryIconFill={theme.icon} shouldShowRightIcon - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestWaypointRoute('request', index))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_WAYPOINT.getRoute('request', index))} key={key} /> ); @@ -263,7 +263,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken, icon={Expensicons.Plus} onPress={() => { const newIndex = _.size(lodashGet(transaction, 'comment.waypoints', {})); - Navigation.navigate(ROUTES.getMoneyRequestWaypointRoute('request', newIndex)); + Navigation.navigate(ROUTES.MONEY_REQUEST_WAYPOINT.getRoute('request', newIndex)); }} text={translate('distance.addStop')} isDisabled={numberOfWaypoints === MAX_WAYPOINTS} diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js index f8c5bbc066a6..92a313cf1e0a 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js @@ -44,7 +44,7 @@ function AnchorRenderer(props) { // the reportID is extracted from the URL and then opened as an internal link, taking the user straight to the chat in the same tab. if (hasExpensifyOrigin && attrHref.indexOf('newdotreport?reportID=') > -1) { const reportID = attrHref.split('newdotreport?reportID=').pop(); - const reportRoute = ROUTES.getReportRoute(reportID); + const reportRoute = ROUTES.REPORT_WITH_ID.getRoute(reportID); Navigation.navigate(reportRoute); return; } diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js index 74cf83a4a6f0..f5fac7b49e0f 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js @@ -62,7 +62,7 @@ function ImageRenderer(props) { { - const route = ROUTES.getReportAttachmentRoute(report.reportID, source); + const route = ROUTES.REPORT_ATTACHMENTS.getRoute(report.reportID, source); Navigation.navigate(route); }} onLongPress={(event) => diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js index 947a15ac6efb..a6b3fe02b891 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js @@ -27,7 +27,7 @@ const propTypes = { * @param {String} email * @returns {void} * */ -const showUserDetails = (email) => Navigation.navigate(ROUTES.getDetailsRoute(email)); +const showUserDetails = (email) => Navigation.navigate(ROUTES.DETAILS.getRoute(email)); function MentionUserRenderer(props) { const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']); @@ -50,7 +50,7 @@ function MentionUserRenderer(props) { showUserDetails(loginWithoutLeadingAt)} // Add testID so it is NOT selected as an anchor tag by SelectionScraper diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js index 7bcd57385d5f..c720529371d7 100755 --- a/src/components/HeaderWithBackButton/index.js +++ b/src/components/HeaderWithBackButton/index.js @@ -121,7 +121,7 @@ function HeaderWithBackButton({ {shouldShowGetAssistanceButton && ( Navigation.navigate(ROUTES.getGetAssistanceRoute(guidesCallTaskID))} + onPress={() => Navigation.navigate(ROUTES.GET_ASSISTANCE.getRoute(guidesCallTaskID))} style={[styles.touchableButtonImage]} accessibilityRole="button" accessibilityLabel={translate('getAssistancePage.questionMarkButtonTooltip')} diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 13471407914f..06e21f70c9d5 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -364,9 +364,9 @@ function MoneyRequestConfirmationList(props) { if (option.accountID) { const activeRoute = Navigation.getActiveRoute().replace(/\?.*/, ''); - Navigation.navigate(ROUTES.getProfileRoute(option.accountID, activeRoute)); + Navigation.navigate(ROUTES.PROFILE.getRoute(option.accountID, activeRoute)); } else if (option.reportID) { - Navigation.navigate(ROUTES.getReportDetailsRoute(option.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(option.reportID)); } }; @@ -474,7 +474,7 @@ function MoneyRequestConfirmationList(props) { shouldParseTitle title={props.iouComment} description={translate('common.description')} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestDescriptionRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_DESCRIPTION.getRoute(props.iouType, props.reportID))} style={[styles.moneyRequestMenuItem, styles.mb2]} titleStyle={styles.flex1} disabled={didConfirm || props.isReadOnly} @@ -503,7 +503,7 @@ function MoneyRequestConfirmationList(props) { description={translate('common.date')} style={[styles.moneyRequestMenuItem, styles.mb2]} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestCreatedRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_DATE.getRoute(props.iouType, props.reportID))} disabled={didConfirm || props.isReadOnly || !isTypeRequest} /> {props.isDistanceRequest ? ( @@ -523,7 +523,7 @@ function MoneyRequestConfirmationList(props) { description={translate('common.merchant')} style={[styles.moneyRequestMenuItem, styles.mb2]} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestMerchantRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_MERCHANT.getRoute(props.iouType, props.reportID))} disabled={didConfirm || props.isReadOnly || !isTypeRequest} /> )} @@ -532,7 +532,7 @@ function MoneyRequestConfirmationList(props) { shouldShowRightIcon={!props.isReadOnly} title={props.iouCategory} description={translate('common.category')} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestCategoryRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_CATEGORY.getRoute(props.iouType, props.reportID))} style={[styles.moneyRequestMenuItem, styles.mb2]} disabled={didConfirm || props.isReadOnly} /> @@ -542,7 +542,7 @@ function MoneyRequestConfirmationList(props) { shouldShowRightIcon={!props.isReadOnly} title={props.iouTag} description={tagListName || translate('common.tag')} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestTagRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_TAG.getRoute(props.iouType, props.reportID))} style={[styles.moneyRequestMenuItem, styles.mb2]} disabled={didConfirm || props.isReadOnly} /> diff --git a/src/components/ParentNavigationSubtitle.js b/src/components/ParentNavigationSubtitle.js index fd388b00a8a7..037489294073 100644 --- a/src/components/ParentNavigationSubtitle.js +++ b/src/components/ParentNavigationSubtitle.js @@ -38,7 +38,7 @@ function ParentNavigationSubtitle(props) { return ( { - Navigation.navigate(ROUTES.getReportRoute(props.parentReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(props.parentReportID)); }} accessibilityLabel={translate('threads.parentNavigationSummary', {rootReportName, workspaceName})} accessibilityRole={CONST.ACCESSIBILITY_ROLE.LINK} diff --git a/src/components/ReportActionItem/MoneyRequestAction.js b/src/components/ReportActionItem/MoneyRequestAction.js index 3b310bb6b4fa..b4a5e010b7a8 100644 --- a/src/components/ReportActionItem/MoneyRequestAction.js +++ b/src/components/ReportActionItem/MoneyRequestAction.js @@ -98,7 +98,7 @@ function MoneyRequestAction({ const onMoneyRequestPreviewPressed = () => { if (isSplitBillAction) { const reportActionID = lodashGet(action, 'reportActionID', '0'); - Navigation.navigate(ROUTES.getSplitBillDetailsRoute(chatReportID, reportActionID)); + Navigation.navigate(ROUTES.SPLIT_BILL_DETAILS.getRoute(chatReportID, reportActionID)); return; } @@ -108,11 +108,11 @@ function MoneyRequestAction({ const thread = ReportUtils.buildTransactionThread(action, requestReportID); const userLogins = PersonalDetailsUtils.getLoginsByAccountIDs(thread.participantAccountIDs); Report.openReport(thread.reportID, userLogins, thread, action.reportActionID); - Navigation.navigate(ROUTES.getReportRoute(thread.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(thread.reportID)); return; } Report.openReport(childReportID); - Navigation.navigate(ROUTES.getReportRoute(childReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID)); }; let shouldShowPendingConversionMessage = false; diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index 178cab75a0c2..cbfa8e88d950 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -143,7 +143,7 @@ function MoneyRequestView({betas, report, parentReport, policyCategories, should titleStyle={styles.newKansasLarge} interactive={canEdit} shouldShowRightIcon={canEdit} - onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))} brickRoadIndicator={hasErrors && transactionAmount === 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} subtitle={hasErrors && transactionAmount === 0 ? translate('common.error.enterAmount') : ''} subtitleTextStyle={styles.textLabelError} @@ -157,7 +157,7 @@ function MoneyRequestView({betas, report, parentReport, policyCategories, should interactive={canEdit} shouldShowRightIcon={canEdit} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))} wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]} numberOfLinesTitle={0} /> @@ -169,7 +169,7 @@ function MoneyRequestView({betas, report, parentReport, policyCategories, should interactive={canEdit} shouldShowRightIcon={canEdit} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))} brickRoadIndicator={hasErrors && transactionDate === '' ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} subtitle={hasErrors && transactionDate === '' ? translate('common.error.enterDate') : ''} subtitleTextStyle={styles.textLabelError} @@ -182,7 +182,7 @@ function MoneyRequestView({betas, report, parentReport, policyCategories, should interactive={canEdit} shouldShowRightIcon={canEdit} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))} brickRoadIndicator={hasErrors && isEmptyMerchant ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} subtitle={hasErrors && isEmptyMerchant ? translate('common.error.enterMerchant') : ''} subtitleTextStyle={styles.textLabelError} @@ -196,7 +196,7 @@ function MoneyRequestView({betas, report, parentReport, policyCategories, should interactive={canEdit} shouldShowRightIcon={canEdit} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.CATEGORY))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.CATEGORY))} /> )} diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 070f534f4924..98bdede0fe26 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -59,7 +59,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal}) { { - const route = ROUTES.getReportAttachmentRoute(report.reportID, imageSource); + const route = ROUTES.REPORT_ATTACHMENTS.getRoute(report.reportID, imageSource); Navigation.navigate(route); }} accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js index 1350c62bda88..a79cfd315b12 100644 --- a/src/components/ReportActionItem/ReportPreview.js +++ b/src/components/ReportActionItem/ReportPreview.js @@ -170,7 +170,7 @@ function ReportPreview(props) { { - Navigation.navigate(ROUTES.getReportRoute(props.iouReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(props.iouReportID)); }} onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} onPressOut={() => ControlSelection.unblock()} diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index d0181e3d736a..1da348bb067b 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -81,7 +81,7 @@ function TaskPreview(props) { return ( Navigation.navigate(ROUTES.getReportRoute(props.taskReportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(props.taskReportID))} style={[styles.flexRow, styles.justifyContentBetween]} accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} accessibilityLabel={props.translate('task.task')} diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index ae77a18b980f..39807ab037d5 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -72,7 +72,7 @@ function TaskView(props) { e.currentTarget.blur(); } - Navigation.navigate(ROUTES.getTaskReportTitleRoute(props.report.reportID)); + Navigation.navigate(ROUTES.TASK_TITLE.getRoute(props.report.reportID)); })} style={({pressed}) => [ styles.ph5, @@ -132,7 +132,7 @@ function TaskView(props) { shouldParseTitle description={props.translate('task.description')} title={props.report.description || ''} - onPress={() => Navigation.navigate(ROUTES.getTaskReportDescriptionRoute(props.report.reportID))} + onPress={() => Navigation.navigate(ROUTES.TASK_DESCRIPTION.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]} @@ -150,7 +150,7 @@ function TaskView(props) { iconType={CONST.ICON_TYPE_AVATAR} avatarSize={CONST.AVATAR_SIZE.SMALLER} titleStyle={styles.assigneeTextStyle} - onPress={() => Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))} + onPress={() => Navigation.navigate(ROUTES.TASK_ASSIGNEE.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} wrapperStyle={[styles.pv2]} @@ -162,7 +162,7 @@ function TaskView(props) { ) : ( Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))} + onPress={() => Navigation.navigate(ROUTES.TASK_ASSIGNEE.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} wrapperStyle={[styles.pv2]} diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js index 80c26b5d6b3f..071e53de1776 100644 --- a/src/components/ReportWelcomeText.js +++ b/src/components/ReportWelcomeText.js @@ -102,7 +102,7 @@ function ReportWelcomeText(props) { {roomWelcomeMessage.showReportName && ( Navigation.navigate(ROUTES.getReportDetailsRoute(props.report.reportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(props.report.reportID))} suppressHighlighting > {ReportUtils.getReportName(props.report)} @@ -122,7 +122,7 @@ function ReportWelcomeText(props) { ) : ( Navigation.navigate(ROUTES.getProfileRoute(accountID))} + onPress={() => Navigation.navigate(ROUTES.PROFILE.getRoute(accountID))} suppressHighlighting > {displayName} diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index 1264ec777b28..dc4f35a59cba 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -165,7 +165,7 @@ function dismissModal(targetReportID) { case SCREENS.REPORT_ATTACHMENTS: // if we are not in the target report, we need to navigate to it after dismissing the modal if (targetReportID && targetReportID !== getTopmostReportId(rootState)) { - const state = getStateFromPath(ROUTES.getReportRoute(targetReportID)); + const state = getStateFromPath(ROUTES.REPORT_WITH_ID.getRoute(targetReportID)); const action = getActionFromState(state, linkingConfig.config); action.type = 'REPLACE'; diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js index f4420330fbd9..1a3253bf424b 100644 --- a/src/libs/Navigation/linkingConfig.js +++ b/src/libs/Navigation/linkingConfig.js @@ -16,7 +16,7 @@ export default { AppleSignInDesktop: ROUTES.APPLE_SIGN_IN, GoogleSignInDesktop: ROUTES.GOOGLE_SIGN_IN, [SCREENS.DESKTOP_SIGN_IN_REDIRECT]: ROUTES.DESKTOP_SIGN_IN_REDIRECT, - [SCREENS.REPORT_ATTACHMENTS]: ROUTES.REPORT_ATTACHMENTS, + [SCREENS.REPORT_ATTACHMENTS]: ROUTES.REPORT_ATTACHMENTS.route, // Demo routes [CONST.DEMO_PAGES.SAASTR]: ROUTES.SAASTR, @@ -29,7 +29,7 @@ export default { [NAVIGATORS.CENTRAL_PANE_NAVIGATOR]: { screens: { - [SCREENS.REPORT]: ROUTES.REPORT_WITH_ID, + [SCREENS.REPORT]: ROUTES.REPORT_WITH_ID.route, }, }, [SCREENS.NOT_FOUND]: '*', @@ -126,7 +126,7 @@ export default { exact: true, }, Settings_ContactMethodDetails: { - path: ROUTES.SETTINGS_CONTACT_METHOD_DETAILS, + path: ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.route, }, Settings_Lounge_Access: { path: ROUTES.SETTINGS_LOUNGE_ACCESS, @@ -168,79 +168,79 @@ export default { exact: true, }, Workspace_Initial: { - path: ROUTES.WORKSPACE_INITIAL, + path: ROUTES.WORKSPACE_INITIAL.route, }, Workspace_Settings: { - path: ROUTES.WORKSPACE_SETTINGS, + path: ROUTES.WORKSPACE_SETTINGS.route, }, Workspace_Card: { - path: ROUTES.WORKSPACE_CARD, + path: ROUTES.WORKSPACE_CARD.route, }, Workspace_Reimburse: { - path: ROUTES.WORKSPACE_REIMBURSE, + path: ROUTES.WORKSPACE_REIMBURSE.route, }, Workspace_RateAndUnit: { - path: ROUTES.WORKSPACE_RATE_AND_UNIT, + path: ROUTES.WORKSPACE_REIMBURSE.route, }, Workspace_Bills: { - path: ROUTES.WORKSPACE_BILLS, + path: ROUTES.WORKSPACE_BILLS.route, }, Workspace_Invoices: { - path: ROUTES.WORKSPACE_INVOICES, + path: ROUTES.WORKSPACE_INVOICES.route, }, Workspace_Travel: { - path: ROUTES.WORKSPACE_TRAVEL, + path: ROUTES.WORKSPACE_TRAVEL.route, }, Workspace_Members: { - path: ROUTES.WORKSPACE_MEMBERS, + path: ROUTES.WORKSPACE_MEMBERS.route, }, Workspace_Invite: { - path: ROUTES.WORKSPACE_INVITE, + path: ROUTES.WORKSPACE_INITIAL.route, }, Workspace_Invite_Message: { - path: ROUTES.WORKSPACE_INVITE_MESSAGE, + path: ROUTES.WORKSPACE_INVITE_MESSAGE.route, }, ReimbursementAccount: { - path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN, + path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route, exact: true, }, GetAssistance: { - path: ROUTES.GET_ASSISTANCE, + path: ROUTES.GET_ASSISTANCE.route, }, }, }, Private_Notes: { screens: { - PrivateNotes_View: ROUTES.PRIVATE_NOTES_VIEW, - PrivateNotes_List: ROUTES.PRIVATE_NOTES_LIST, - PrivateNotes_Edit: ROUTES.PRIVATE_NOTES_EDIT, + PrivateNotes_View: ROUTES.PRIVATE_NOTES_VIEW.route, + PrivateNotes_List: ROUTES.PRIVATE_NOTES_LIST.route, + PrivateNotes_Edit: ROUTES.PRIVATE_NOTES_EDIT.route, }, }, Report_Details: { screens: { - Report_Details_Root: ROUTES.REPORT_WITH_ID_DETAILS, - Report_Details_Share_Code: ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE, + Report_Details_Root: ROUTES.REPORT_WITH_ID_DETAILS.route, + Report_Details_Share_Code: ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route, }, }, Report_Settings: { screens: { Report_Settings_Root: { - path: ROUTES.REPORT_SETTINGS, + path: ROUTES.REPORT_SETTINGS.route, }, Report_Settings_Room_Name: { - path: ROUTES.REPORT_SETTINGS_ROOM_NAME, + path: ROUTES.REPORT_SETTINGS_ROOM_NAME.route, }, Report_Settings_Notification_Preferences: { - path: ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES, + path: ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES.route, }, Report_Settings_Write_Capability: { - path: ROUTES.REPORT_SETTINGS_WRITE_CAPABILITY, + path: ROUTES.REPORT_SETTINGS_WRITE_CAPABILITY.route, }, }, }, Report_WelcomeMessage: { screens: { - Report_WelcomeMessage_Root: ROUTES.REPORT_WELCOME_MESSAGE, + Report_WelcomeMessage_Root: ROUTES.REPORT_WELCOME_MESSAGE.route, }, }, NewChat: { @@ -286,23 +286,23 @@ export default { }, Details: { screens: { - Details_Root: ROUTES.DETAILS, + Details_Root: ROUTES.DETAILS.route, }, }, Profile: { screens: { - Profile_Root: ROUTES.PROFILE, + Profile_Root: ROUTES.PROFILE.route, }, }, Participants: { screens: { - ReportParticipants_Root: ROUTES.REPORT_PARTICIPANTS, + ReportParticipants_Root: ROUTES.REPORT_PARTICIPANTS.route, }, }, MoneyRequest: { screens: { Money_Request: { - path: ROUTES.MONEY_REQUEST, + path: ROUTES.MONEY_REQUEST.route, exact: true, screens: { manual: { @@ -314,22 +314,22 @@ export default { exact: true, }, distance: { - path: ROUTES.MONEY_REQUEST_DISTANCE_TAB, + path: ROUTES.WORKSPACE_MEMBERS.route, exact: true, }, }, }, - Money_Request_Amount: ROUTES.MONEY_REQUEST_AMOUNT, - Money_Request_Participants: ROUTES.MONEY_REQUEST_PARTICIPANTS, - Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION, - Money_Request_Date: ROUTES.MONEY_REQUEST_DATE, - Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY, - Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION, - Money_Request_Category: ROUTES.MONEY_REQUEST_CATEGORY, - Money_Request_Tag: ROUTES.MONEY_REQUEST_TAG, - Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT, - Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT, - Money_Request_Address: ROUTES.MONEY_REQUEST_ADDRESS, + Money_Request_Amount: ROUTES.MONEY_REQUEST_AMOUNT.route, + Money_Request_Participants: ROUTES.MONEY_REQUEST_PARTICIPANTS.route, + Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION.route, + Money_Request_Date: ROUTES.MONEY_REQUEST_DATE.route, + Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY.route, + Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION.route, + Money_Request_Category: ROUTES.MONEY_REQUEST_CATEGORY.route, + Money_Request_Tag: ROUTES.MONEY_REQUEST_TAG.route, + Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT.route, + Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT.route, + Money_Request_Address: ROUTES.MONEY_REQUEST_ADDRESS.route, IOU_Send_Enable_Payments: ROUTES.IOU_SEND_ENABLE_PAYMENTS, IOU_Send_Add_Bank_Account: ROUTES.IOU_SEND_ADD_BANK_ACCOUNT, IOU_Send_Add_Debit_Card: ROUTES.IOU_SEND_ADD_DEBIT_CARD, @@ -337,14 +337,14 @@ export default { }, SplitDetails: { screens: { - SplitDetails_Root: ROUTES.SPLIT_BILL_DETAILS, + SplitDetails_Root: ROUTES.SPLIT_BILL_DETAILS.route, }, }, Task_Details: { screens: { - Task_Title: ROUTES.TASK_TITLE, - Task_Description: ROUTES.TASK_DESCRIPTION, - Task_Assignee: ROUTES.TASK_ASSIGNEE, + Task_Title: ROUTES.TASK_TITLE.route, + Task_Description: ROUTES.TASK_DESCRIPTION.route, + Task_Assignee: ROUTES.TASK_ASSIGNEE.route, }, }, AddPersonalBankAccount: { @@ -359,18 +359,18 @@ export default { }, Wallet_Statement: { screens: { - WalletStatement_Root: ROUTES.WALLET_STATEMENT_WITH_DATE, + WalletStatement_Root: ROUTES.WALLET_STATEMENT_WITH_DATE.route, }, }, Flag_Comment: { screens: { - FlagComment_Root: ROUTES.FLAG_COMMENT, + FlagComment_Root: ROUTES.FLAG_COMMENT.route, }, }, EditRequest: { screens: { - EditRequest_Root: ROUTES.EDIT_REQUEST, - EditRequest_Currency: ROUTES.EDIT_CURRENCY_REQUEST, + EditRequest_Root: ROUTES.EDIT_REQUEST.route, + EditRequest_Currency: ROUTES.EDIT_CURRENCY_REQUEST.route, }, }, SignIn: { diff --git a/src/libs/Notification/PushNotification/subscribeToReportCommentPushNotifications.js b/src/libs/Notification/PushNotification/subscribeToReportCommentPushNotifications.js index 8e16bb72f656..aadc7d6c3983 100644 --- a/src/libs/Notification/PushNotification/subscribeToReportCommentPushNotifications.js +++ b/src/libs/Notification/PushNotification/subscribeToReportCommentPushNotifications.js @@ -31,7 +31,7 @@ export default function subscribeToReportCommentPushNotifications() { } Log.info('[PushNotification] onSelected() - Navigation is ready. Navigating...', false, {reportID, reportActionID}); - Navigation.navigate(ROUTES.getReportRoute(reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); } catch (error) { Log.alert('[PushNotification] onSelected() - failed', {reportID, reportActionID, error: error.message}); } diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index eee9d6549f6c..b32b9cbb666d 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -422,7 +422,7 @@ function isPublicAnnounceRoom(report) { * @returns {String} */ function getBankAccountRoute(report) { - return isPolicyExpenseChat(report) ? ROUTES.getBankAccountRoute('', report.policyID) : ROUTES.SETTINGS_ADD_BANK_ACCOUNT; + return isPolicyExpenseChat(report) ? ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', report.policyID) : ROUTES.SETTINGS_ADD_BANK_ACCOUNT; } /** @@ -1815,14 +1815,14 @@ function navigateToDetailsPage(report) { const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []); if (isChatRoom(report) || isPolicyExpenseChat(report) || isChatThread(report) || isTaskReport(report)) { - Navigation.navigate(ROUTES.getReportDetailsRoute(report.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID)); return; } if (participantAccountIDs.length === 1) { - Navigation.navigate(ROUTES.getProfileRoute(participantAccountIDs[0])); + Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountIDs[0])); return; } - Navigation.navigate(ROUTES.getReportParticipantsRoute(report.reportID)); + Navigation.navigate(ROUTES.REPORT_PARTICIPANTS.getRoute(report.reportID)); } /** diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 570b25040855..b8be35aa1919 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -325,10 +325,10 @@ function createWorkspaceAndNavigateToIt(policyOwnerEmail = '', makeMeAdmin = fal } if (shouldNavigateToAdminChat) { - Navigation.navigate(ROUTES.getReportRoute(adminsChatReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(adminsChatReportID)); } - Navigation.navigate(ROUTES.getWorkspaceInitialRoute(policyID)); + Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID)); }) .then(endSignOnTransition); } diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 86cd791f7fce..7feca4524855 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1473,14 +1473,14 @@ function deleteMoneyRequest(transactionID, reportAction, isSingleTransactionView if (isSingleTransactionView && shouldDeleteTransactionThread && !shouldDeleteIOUReport) { // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. Navigation.goBack(ROUTES.HOME); - Navigation.navigate(ROUTES.getReportRoute(iouReport.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(iouReport.reportID)); return; } if (shouldDeleteIOUReport) { // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. Navigation.goBack(ROUTES.HOME); - Navigation.navigate(ROUTES.getReportRoute(iouReport.chatReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(iouReport.chatReportID)); } } @@ -1982,7 +1982,7 @@ function replaceReceipt(transactionID, receipt, filePath) { */ function startMoneyRequest(iouType, reportID = '') { resetMoneyRequestInfo(`${iouType}${reportID}`); - Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); + Navigation.navigate(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID)); } /** @@ -2112,10 +2112,10 @@ function navigateToNextPage(iou, iouType, reportID, report) { .value(); setMoneyRequestParticipants(participants); } - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); return; } - Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); + Navigation.navigate(ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType)); } export { diff --git a/src/libs/actions/ReimbursementAccount/navigation.js b/src/libs/actions/ReimbursementAccount/navigation.js index ae655c1ab8cf..1b75e6f16a58 100644 --- a/src/libs/actions/ReimbursementAccount/navigation.js +++ b/src/libs/actions/ReimbursementAccount/navigation.js @@ -20,7 +20,7 @@ function goToWithdrawalAccountSetupStep(stepID, newAchData) { * @param {string} [backTo=''] - An optional return path. If provided, it will be URL-encoded and appended to the resulting URL. */ function navigateToBankAccountRoute(policyId, backTo) { - Navigation.navigate(ROUTES.getBankAccountRoute('', policyId, backTo)); + Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', policyId, backTo)); } export {goToWithdrawalAccountSetupStep, navigateToBankAccountRoute}; diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 9fa1e5fe0567..d154373812e0 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -622,7 +622,7 @@ function navigateToAndOpenReport(userLogins, shouldDismissModal = true) { if (shouldDismissModal) { Navigation.dismissModal(reportID); } else { - Navigation.navigate(ROUTES.getReportRoute(reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); } } @@ -655,7 +655,7 @@ function navigateToAndOpenReportWithAccountIDs(participantAccountIDs) { function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0') { if (childReportID !== '0') { openReport(childReportID); - Navigation.navigate(ROUTES.getReportRoute(childReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID)); } else { const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); const parentReport = allReports[parentReportID]; @@ -676,7 +676,7 @@ function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = const participantLogins = PersonalDetailsUtils.getLoginsByAccountIDs(newChat.participantAccountIDs); openReport(newChat.reportID, participantLogins, newChat, parentReportAction.reportActionID); - Navigation.navigate(ROUTES.getReportRoute(newChat.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(newChat.reportID)); } } @@ -946,7 +946,7 @@ function handleReportChanged(report) { // Only re-route them if they are still looking at the optimistically created report if (Navigation.getActiveRoute().includes(`/r/${report.reportID}`)) { // Pass 'FORCED_UP' type to replace new report on second login with proper one in the Navigation - Navigation.navigate(ROUTES.getReportRoute(report.preexistingReportID), CONST.NAVIGATION.TYPE.FORCED_UP); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.preexistingReportID), CONST.NAVIGATION.TYPE.FORCED_UP); } return; } @@ -1273,7 +1273,7 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi */ function updateNotificationPreferenceAndNavigate(reportID, previousValue, newValue) { if (previousValue === newValue) { - Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); return; } const optimisticData = [ @@ -1291,7 +1291,7 @@ function updateNotificationPreferenceAndNavigate(reportID, previousValue, newVal }, ]; API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); - Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); } /** @@ -1331,7 +1331,7 @@ function updateWelcomeMessage(reportID, previousValue, newValue) { */ function updateWriteCapabilityAndNavigate(report, newValue) { if (report.writeCapability === newValue) { - Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(report.reportID)); return; } @@ -1351,7 +1351,7 @@ function updateWriteCapabilityAndNavigate(report, newValue) { ]; API.write('UpdateReportWriteCapability', {reportID: report.reportID, writeCapability: newValue}, {optimisticData, failureData}); // Return to the report settings page since this field utilizes push-to-page - Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(report.reportID)); } /** @@ -1366,7 +1366,7 @@ function navigateToConciergeChat() { navigateToAndOpenReport([CONST.EMAIL.CONCIERGE], false); }); } else { - Navigation.navigate(ROUTES.getReportRoute(conciergeChatReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(conciergeChatReportID)); } } @@ -1516,7 +1516,7 @@ function updatePolicyRoomNameAndNavigate(policyRoomReport, policyRoomName) { // No change needed, navigate back if (previousName === policyRoomName) { - Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); return; } const optimisticData = [ @@ -1555,7 +1555,7 @@ function updatePolicyRoomNameAndNavigate(policyRoomReport, policyRoomName) { }, ]; API.write('UpdatePolicyRoomName', {reportID, policyRoomName}, {optimisticData, successData, failureData}); - Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); + Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); } /** @@ -1651,7 +1651,7 @@ function showReportActionNotification(reportID, action) { reportAction: action, onClick: () => { // Navigate to this report onClick - Navigation.navigate(ROUTES.getReportRoute(reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); }, }); notifyNewAction(reportID, action.actorAccountID, action.reportActionID); @@ -1890,7 +1890,7 @@ function leaveRoom(reportID) { Navigation.goBack(ROUTES.HOME); } if (report.parentReportID) { - Navigation.navigate(ROUTES.getReportRoute(report.parentReportID), CONST.NAVIGATION.TYPE.FORCED_UP); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID), CONST.NAVIGATION.TYPE.FORCED_UP); return; } navigateToConciergeChat(); @@ -1911,7 +1911,7 @@ function setLastOpenedPublicRoom(reportID) { function openLastOpenedPublicRoom(lastOpenedPublicRoomID) { Navigation.isNavigationReady().then(() => { setLastOpenedPublicRoom(''); - Navigation.navigate(ROUTES.getReportRoute(lastOpenedPublicRoomID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(lastOpenedPublicRoomID)); }); } diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 6e6fe2512dff..8e1832edb9a7 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -134,7 +134,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { } if (shouldNavigateToWorkspaceChat && workspaceChatReport) { - Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReport.reportID)); // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser // so the Welcome logic doesn't run again diff --git a/src/pages/EditRequestAmountPage.js b/src/pages/EditRequestAmountPage.js index b24275cbdfc0..9f72c9afbc23 100644 --- a/src/pages/EditRequestAmountPage.js +++ b/src/pages/EditRequestAmountPage.js @@ -43,7 +43,7 @@ function EditRequestAmountPage({defaultAmount, defaultCurrency, onSubmit, report const navigateToCurrencySelectionPage = () => { // Remove query from the route and encode it. const activeRoute = encodeURIComponent(Navigation.getActiveRoute().replace(/\?.*/, '')); - Navigation.navigate(ROUTES.getEditRequestCurrencyRoute(reportID, defaultCurrency, activeRoute)); + Navigation.navigate(ROUTES.EDIT_CURRENCY_REQUEST.getRoute(reportID, defaultCurrency, activeRoute)); }; useFocusEffect( diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.js b/src/pages/PrivateNotes/PrivateNotesListPage.js index fdfaa4c60e33..da6d0d611bc5 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.js +++ b/src/pages/PrivateNotes/PrivateNotesListPage.js @@ -110,7 +110,7 @@ function PrivateNotesListPage({report, personalDetailsList, network, session}) { title: Number(lodashGet(session, 'accountID', null)) === Number(accountID) ? translate('privateNotes.myNote') : lodashGet(personalDetailsList, [accountID, 'login'], ''), icon: UserUtils.getAvatar(lodashGet(personalDetailsList, [accountID, 'avatar'], UserUtils.getDefaultAvatar(accountID)), accountID), iconType: CONST.ICON_TYPE_AVATAR, - action: () => Navigation.navigate(ROUTES.getPrivateNotesViewRoute(report.reportID, accountID)), + action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_VIEW.getRoute(report.reportID, accountID)), brickRoadIndicator: privateNoteBrickRoadIndicator(accountID), })) .value(); diff --git a/src/pages/PrivateNotes/PrivateNotesViewPage.js b/src/pages/PrivateNotes/PrivateNotesViewPage.js index 4c6d960d5d9a..d09f1bbdee47 100644 --- a/src/pages/PrivateNotes/PrivateNotesViewPage.js +++ b/src/pages/PrivateNotes/PrivateNotesViewPage.js @@ -75,7 +75,7 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) { isCurrentUserNote && Navigation.navigate(ROUTES.getPrivateNotesEditRoute(report.reportID, route.params.accountID))} + onPress={() => isCurrentUserNote && Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, route.params.accountID))} shouldShowRightIcon={isCurrentUserNote} numberOfLinesTitle={0} shouldRenderAsHTML diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index ddec4e5a86ae..60037e4755c0 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -243,7 +243,7 @@ function ProfilePage(props) { title={`${props.translate('privateNotes.title')}`} titleStyle={styles.flex1} icon={Expensicons.Pencil} - onPress={() => Navigation.navigate(ROUTES.getPrivateNotesListRoute(chatReportWithCurrentUser.reportID))} + onPress={() => Navigation.navigate(ROUTES.PRIVATE_NOTES_LIST.getRoute(chatReportWithCurrentUser.reportID))} wrapperStyle={styles.breakAll} shouldShowRightIcon brickRoadIndicator={Report.hasErrorInPrivateNotes(chatReportWithCurrentUser) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} diff --git a/src/pages/ReimbursementAccount/Enable2FAPrompt.js b/src/pages/ReimbursementAccount/Enable2FAPrompt.js index 829ac9b63848..33424669903f 100644 --- a/src/pages/ReimbursementAccount/Enable2FAPrompt.js +++ b/src/pages/ReimbursementAccount/Enable2FAPrompt.js @@ -13,7 +13,9 @@ const propTypes = { ...withLocalizePropTypes, }; function Enable2FAPrompt(props) { - const secureYourAccountUrl = encodeURI(`settings?param={"section":"account","action":"enableTwoFactorAuth","exitTo":"${ROUTES.getBankAccountRoute()}","isFromNewDot":"true"}`); + const secureYourAccountUrl = encodeURI( + `settings?param={"section":"account","action":"enableTwoFactorAuth","exitTo":"${ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute()}","isFromNewDot":"true"}`, + ); return (
Navigation.navigate(ROUTES.getReportShareCodeRoute(props.report.reportID)), + action: () => Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.getRoute(props.report.reportID)), }, ]; @@ -95,7 +95,7 @@ function ReportDetailsPage(props) { subtitle: participants.length, isAnonymousAction: false, action: () => { - Navigation.navigate(ROUTES.getReportParticipantsRoute(props.report.reportID)); + Navigation.navigate(ROUTES.REPORT_PARTICIPANTS.getRoute(props.report.reportID)); }, }); } @@ -107,7 +107,7 @@ function ReportDetailsPage(props) { icon: Expensicons.Gear, isAnonymousAction: false, action: () => { - Navigation.navigate(ROUTES.getReportSettingsRoute(props.report.reportID)); + Navigation.navigate(ROUTES.REPORT_SETTINGS.getRoute(props.report.reportID)); }, }); } @@ -119,7 +119,7 @@ function ReportDetailsPage(props) { translationKey: 'privateNotes.title', icon: Expensicons.Pencil, isAnonymousAction: false, - action: () => Navigation.navigate(ROUTES.getPrivateNotesListRoute(props.report.reportID)), + action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_LIST.getRoute(props.report.reportID)), brickRoadIndicator: Report.hasErrorInPrivateNotes(props.report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '', }); } @@ -177,7 +177,7 @@ function ReportDetailsPage(props) { accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} accessibilityLabel={chatRoomSubtitle} onPress={() => { - Navigation.navigate(ROUTES.getWorkspaceInitialRoute(props.report.policyID)); + Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(props.report.policyID)); }} > {chatRoomSubtitleText} diff --git a/src/pages/ReportParticipantsPage.js b/src/pages/ReportParticipantsPage.js index c10401fb90db..7f453d16817b 100755 --- a/src/pages/ReportParticipantsPage.js +++ b/src/pages/ReportParticipantsPage.js @@ -130,7 +130,7 @@ function ReportParticipantsPage(props) { }, ]} onSelectRow={(option) => { - Navigation.navigate(ROUTES.getProfileRoute(option.accountID)); + Navigation.navigate(ROUTES.PROFILE.getRoute(option.accountID)); }} hideSectionHeaders showTitleTooltip diff --git a/src/pages/ShareCodePage.js b/src/pages/ShareCodePage.js index f19c79db5459..75bf5fd24f1d 100644 --- a/src/pages/ShareCodePage.js +++ b/src/pages/ShareCodePage.js @@ -47,8 +47,8 @@ class ShareCodePage extends React.Component { const subtitle = isReport ? ReportUtils.getParentNavigationSubtitle(this.props.report).workspaceName || ReportUtils.getChatRoomSubtitle(this.props.report) : formattedEmail; const urlWithTrailingSlash = Url.addTrailingForwardSlash(this.props.environmentURL); const url = isReport - ? `${urlWithTrailingSlash}${ROUTES.getReportRoute(this.props.report.reportID)}` - : `${urlWithTrailingSlash}${ROUTES.getProfileRoute(this.props.session.accountID)}`; + ? `${urlWithTrailingSlash}${ROUTES.REPORT_WITH_ID.getRoute(this.props.report.reportID)}` + : `${urlWithTrailingSlash}${ROUTES.PROFILE.getRoute(this.props.session.accountID)}`; const platform = getPlatform(); const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID; @@ -57,7 +57,7 @@ class ShareCodePage extends React.Component { Navigation.goBack(isReport ? ROUTES.getReportDetailsRoute(this.props.report.reportID) : ROUTES.SETTINGS)} + onBackButtonPress={() => Navigation.goBack(isReport ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(this.props.report.reportID) : ROUTES.SETTINGS)} /> diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 922b74d3b6a3..15bf25695fd3 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -250,7 +250,7 @@ function ReportScreen({ }, []); const chatWithAccountManager = useCallback(() => { - Navigation.navigate(ROUTES.getReportRoute(accountManagerReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(accountManagerReportID)); }, [accountManagerReportID]); /** diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 173bda0e5221..2a65bc2e67ab 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -298,11 +298,11 @@ export default [ const thread = ReportUtils.buildTransactionThread(reportAction, reportID); const userLogins = PersonalDetailsUtils.getLoginsByAccountIDs(thread.participantAccountIDs); Report.openReport(thread.reportID, userLogins, thread, reportAction.reportActionID); - Navigation.navigate(ROUTES.getReportRoute(thread.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(thread.reportID)); return; } Report.openReport(childReportID); - Navigation.navigate(ROUTES.getReportRoute(childReportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID)); return; } const editAction = () => Report.saveReportActionDraft(reportID, reportAction.reportActionID, _.isEmpty(draftMessage) ? getActionText(reportAction) : ''); @@ -382,10 +382,10 @@ export default [ reportAction.actorAccountID !== CONST.ACCOUNT_ID.CONCIERGE, onPress: (closePopover, {reportID, reportAction}) => { if (closePopover) { - hideContextMenu(false, () => Navigation.navigate(ROUTES.getFlagCommentRoute(reportID, reportAction.reportActionID))); + hideContextMenu(false, () => Navigation.navigate(ROUTES.FLAG_COMMENT.getRoute(reportID, reportAction.reportActionID))); } - Navigation.navigate(ROUTES.getFlagCommentRoute(reportID, reportAction.reportActionID)); + Navigation.navigate(ROUTES.FLAG_COMMENT.getRoute(reportID, reportAction.reportActionID)); }, getDescription: () => {}, }, diff --git a/src/pages/home/report/ReactionList/BaseReactionList.js b/src/pages/home/report/ReactionList/BaseReactionList.js index 0b77fca7c645..b082ca510edd 100755 --- a/src/pages/home/report/ReactionList/BaseReactionList.js +++ b/src/pages/home/report/ReactionList/BaseReactionList.js @@ -79,7 +79,7 @@ function BaseReactionList(props) { hoverStyle={styles.hoveredComponentBG} onSelectRow={() => { props.onClose(); - Navigation.navigate(ROUTES.getProfileRoute(item.accountID)); + Navigation.navigate(ROUTES.PROFILE.getRoute(item.accountID)); }} option={{ text: Str.removeSMSDomain(item.displayName), diff --git a/src/pages/home/report/ReportActionItemSingle.js b/src/pages/home/report/ReportActionItemSingle.js index bfbce8aed336..97dd5e37482e 100644 --- a/src/pages/home/report/ReportActionItemSingle.js +++ b/src/pages/home/report/ReportActionItemSingle.js @@ -80,11 +80,11 @@ const defaultProps = { }; const showUserDetails = (accountID) => { - Navigation.navigate(ROUTES.getProfileRoute(accountID)); + Navigation.navigate(ROUTES.PROFILE.getRoute(accountID)); }; const showWorkspaceDetails = (reportID) => { - Navigation.navigate(ROUTES.getReportDetailsRoute(reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID)); }; function ReportActionItemSingle(props) { @@ -149,7 +149,7 @@ function ReportActionItemSingle(props) { } else { // Show participants page IOU report preview if (displayAllActors) { - Navigation.navigate(ROUTES.getReportParticipantsRoute(iouReportID)); + Navigation.navigate(ROUTES.REPORT_PARTICIPANTS.getRoute(iouReportID)); return; } showUserDetails(props.action.delegateAccountID ? props.action.delegateAccountID : actorAccountID); diff --git a/src/pages/home/report/ReportAttachments.js b/src/pages/home/report/ReportAttachments.js index c8b5dd1ae685..4146be0d3971 100644 --- a/src/pages/home/report/ReportAttachments.js +++ b/src/pages/home/report/ReportAttachments.js @@ -32,7 +32,7 @@ function ReportAttachments(props) { source={source} onModalHide={() => Navigation.dismissModal(reportID)} onCarouselAttachmentChange={(attachment) => { - const route = ROUTES.getReportAttachmentRoute(reportID, attachment.source); + const route = ROUTES.REPORT_ATTACHMENTS.getRoute(reportID, attachment.source); Navigation.navigate(route); }} /> diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js index c38ac9e01ccb..9ff9cc261af4 100644 --- a/src/pages/home/sidebar/SidebarLinks.js +++ b/src/pages/home/sidebar/SidebarLinks.js @@ -141,7 +141,7 @@ class SidebarLinks extends React.PureComponent { ) { return; } - Navigation.navigate(ROUTES.getReportRoute(option.reportID)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(option.reportID)); this.props.onLinkClick(); } diff --git a/src/pages/iou/IOUCurrencySelection.js b/src/pages/iou/IOUCurrencySelection.js index 966cd2f87af6..e8c5cd6b3a92 100644 --- a/src/pages/iou/IOUCurrencySelection.js +++ b/src/pages/iou/IOUCurrencySelection.js @@ -138,7 +138,7 @@ function IOUCurrencySelection(props) { <> Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID))} /> { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); }; const updateCategory = (category) => { @@ -56,7 +56,7 @@ function MoneyRequestCategoryPage({route, report, iou}) { IOU.setMoneyRequestCategory(category.searchText); } - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); }; return ( diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js index 2d2f9c519c50..032b1642006a 100644 --- a/src/pages/iou/MoneyRequestDatePage.js +++ b/src/pages/iou/MoneyRequestDatePage.js @@ -62,12 +62,12 @@ function MoneyRequestDatePage({iou, route, selectedTab}) { } if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); } /** diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 61f688f5d4bd..eb67aa95be5b 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -84,12 +84,12 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { } if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); } /** diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js index dddf63a49673..cb3e97f2bc90 100644 --- a/src/pages/iou/MoneyRequestMerchantPage.js +++ b/src/pages/iou/MoneyRequestMerchantPage.js @@ -59,12 +59,12 @@ function MoneyRequestMerchantPage({iou, route}) { } if (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID]); function navigateBack() { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); } const validate = useCallback((value) => { diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index fcd2b412fbe8..32c21d949f2c 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -64,7 +64,7 @@ function MoneyRequestTagPage({route, report, policyTags, iou}) { const tagListName = lodashGet(tagList, 'name', translate('common.tag')); const navigateBack = () => { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, report.reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); }; const updateTag = (selectedTag) => { diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js index 11459cca3aa8..1e0622bc85ba 100644 --- a/src/pages/iou/WaypointEditor.js +++ b/src/pages/iou/WaypointEditor.js @@ -147,13 +147,13 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI } // Other flows will be handled by selecting a waypoint with selectWaypoint as this is mainly for the offline flow - Navigation.goBack(ROUTES.getMoneyRequestDistanceTabRoute(iouType)); + Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); }; const deleteStopAndHideModal = () => { Transaction.removeWaypoint(transactionID, waypointIndex); setIsDeleteStopModalOpen(false); - Navigation.goBack(ROUTES.getMoneyRequestDistanceTabRoute(iouType)); + Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); }; const selectWaypoint = (values) => { @@ -163,7 +163,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI address: values.address, }; saveWaypoint(waypoint); - Navigation.goBack(ROUTES.getMoneyRequestDistanceTabRoute(iouType)); + Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); }; const focusAddressInput = () => { @@ -187,7 +187,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI title={translate(wayPointDescriptionKey)} shouldShowBackButton onBackButtonPress={() => { - Navigation.goBack(ROUTES.getMoneyRequestDistanceTabRoute(iouType)); + Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); }} shouldShowThreeDotsButton={shouldShowThreeDotsButton} threeDotsAnchorPosition={styles.threeDotsPopoverOffset(windowWidth)} diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 82b3c4a4909d..9d4468c8aff4 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -91,7 +91,7 @@ function MoneyRequestConfirmPage(props) { if (!isDistanceRequest && prevMoneyRequestId.current !== props.iou.id) { // The ID is cleared on completing a request. In that case, we will do nothing. if (props.iou.id) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current), true); } return; } @@ -104,7 +104,7 @@ function MoneyRequestConfirmPage(props) { } if (_.isEmpty(props.iou.participants) || (props.iou.amount === 0 && !props.iou.receiptPath && !isDistanceRequest) || shouldReset) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current), true); } return () => { @@ -115,9 +115,9 @@ function MoneyRequestConfirmPage(props) { const navigateBack = () => { let fallback; if (reportID.current) { - fallback = ROUTES.getMoneyRequestRoute(iouType.current, reportID.current); + fallback = ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current); } else { - fallback = ROUTES.getMoneyRequestParticipantsRoute(iouType.current); + fallback = ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType.current); } Navigation.goBack(fallback); }; diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index b737e40b8e4b..8d745903eb40 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -67,21 +67,21 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { if (option.reportID) { isNewReportIDSelectedLocally.current = true; IOU.setMoneyRequestId(`${moneyRequestType}${option.reportID}`); - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, option.reportID)); + Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, option.reportID)); return; } IOU.setMoneyRequestId(moneyRequestType); - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, reportID.current)); + Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID.current)); }; const navigateToSplitStep = (moneyRequestType) => { IOU.setMoneyRequestId(moneyRequestType); - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(moneyRequestType, reportID.current)); + Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID.current)); }; const navigateBack = (forceFallback = false) => { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), forceFallback); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current), forceFallback); }; useEffect(() => { diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 9746fd602eb6..92bc40a2af51 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -106,7 +106,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { if (!iou.id) { return; } - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); return; } const moneyRequestID = `${iouType}${reportID}`; @@ -116,7 +116,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { } if (!isDistanceRequestTab && (_.isEmpty(iou.participantAccountIDs) || iou.amount === 0 || shouldReset)) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } } @@ -126,7 +126,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { }, [iou.participantAccountIDs, iou.amount, iou.id, isEditing, iouType, reportID, isDistanceRequestTab]); const navigateBack = () => { - Navigation.goBack(isEditing ? ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID) : ROUTES.HOME); + Navigation.goBack(isEditing ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME); }; const navigateToCurrencySelectionPage = () => { @@ -138,7 +138,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { // Remove query from the route and encode it. const activeRoute = encodeURIComponent(Navigation.getActiveRoute().replace(/\?.*/, '')); - Navigation.navigate(ROUTES.getMoneyRequestCurrencyRoute(iouType, reportID, currency, activeRoute)); + Navigation.navigate(ROUTES.MONEY_REQUEST_CURRENCY.getRoute(iouType, reportID, currency, activeRoute)); }; const navigateToNextPage = (currentAmount) => { @@ -147,7 +147,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { IOU.setMoneyRequestCurrency(currency); if (isEditing) { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); return; } diff --git a/src/pages/settings/Profile/Contacts/ContactMethodsPage.js b/src/pages/settings/Profile/Contacts/ContactMethodsPage.js index b5e05cf017df..de1979e425b5 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodsPage.js +++ b/src/pages/settings/Profile/Contacts/ContactMethodsPage.js @@ -100,7 +100,7 @@ function ContactMethodsPage(props) { Navigation.navigate(ROUTES.getEditContactMethodRoute(partnerUserID))} + onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(partnerUserID))} brickRoadIndicator={indicator} shouldShowBasicTitle shouldShowRightIcon diff --git a/src/pages/settings/Report/NotificationPreferencePage.js b/src/pages/settings/Report/NotificationPreferencePage.js index 57619bc3659f..b6dbf5f42c83 100644 --- a/src/pages/settings/Report/NotificationPreferencePage.js +++ b/src/pages/settings/Report/NotificationPreferencePage.js @@ -50,7 +50,7 @@ function NotificationPreferencePage(props) { Navigation.goBack(ROUTES.getReportSettingsRoute(props.report.reportID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(props.report.reportID))} /> Navigation.goBack(ROUTES.getReportDetailsRoute(report.reportID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID))} /> {report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN && ( @@ -87,7 +87,7 @@ function ReportSettingsPage(props) { shouldShowRightIcon title={notificationPreference} description={translate('notificationPreferencesPage.label')} - onPress={() => Navigation.navigate(ROUTES.getReportSettingsNotificationPreferencesRoute(report.reportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES.getRoute(report.reportID))} /> )} {shouldShowRoomName && ( @@ -117,7 +117,7 @@ function ReportSettingsPage(props) { shouldShowRightIcon title={report.reportName} description={translate('newRoomPage.roomName')} - onPress={() => Navigation.navigate(ROUTES.getReportSettingsRoomNameRoute(report.reportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_SETTINGS_ROOM_NAME.getRoute(report.reportID))} /> )} @@ -127,7 +127,7 @@ function ReportSettingsPage(props) { shouldShowRightIcon title={writeCapabilityText} description={translate('writeCapabilityPage.label')} - onPress={() => Navigation.navigate(ROUTES.getReportSettingsWriteCapabilityRoute(report.reportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_SETTINGS_WRITE_CAPABILITY.getRoute(report.reportID))} /> ) : ( @@ -184,7 +184,7 @@ function ReportSettingsPage(props) { Navigation.navigate(ROUTES.getReportWelcomeMessageRoute(report.reportID))} + onPress={() => Navigation.navigate(ROUTES.REPORT_WELCOME_MESSAGE.getRoute(report.reportID))} shouldShowRightIcon /> )} diff --git a/src/pages/settings/Report/RoomNamePage.js b/src/pages/settings/Report/RoomNamePage.js index b8844a39c38b..42d7156660f9 100644 --- a/src/pages/settings/Report/RoomNamePage.js +++ b/src/pages/settings/Report/RoomNamePage.js @@ -86,7 +86,7 @@ function RoomNamePage(props) { Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(report.reportID))} />
Navigation.goBack(ROUTES.getReportSettingsRoute(props.report.reportID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(props.report.reportID))} /> Navigation.navigate(ROUTES.getWorkspaceSettingsRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_SETTINGS.getRoute(policy.id)), brickRoadIndicator: hasGeneralSettingsError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '', }, { translationKey: 'workspace.common.card', icon: Expensicons.ExpensifyCard, - action: () => Navigation.navigate(ROUTES.getWorkspaceCardRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_CARD.getRoute(policy.id)), }, { translationKey: 'workspace.common.reimburse', icon: Expensicons.Receipt, - action: () => Navigation.navigate(ROUTES.getWorkspaceReimburseRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_REIMBURSE.getRoute(policy.id)), error: hasCustomUnitsError, }, { translationKey: 'workspace.common.bills', icon: Expensicons.Bill, - action: () => Navigation.navigate(ROUTES.getWorkspaceBillsRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_BILLS.getRoute(policy.id)), }, { translationKey: 'workspace.common.invoices', icon: Expensicons.Invoice, - action: () => Navigation.navigate(ROUTES.getWorkspaceInvoicesRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_INVOICES.getRoute(policy.id)), }, { translationKey: 'workspace.common.travel', icon: Expensicons.Luggage, - action: () => Navigation.navigate(ROUTES.getWorkspaceTravelRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_TRAVEL.getRoute(policy.id)), }, { translationKey: 'workspace.common.members', icon: Expensicons.Users, - action: () => Navigation.navigate(ROUTES.getWorkspaceMembersRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_MEMBERS.getRoute(policy.id)), brickRoadIndicator: hasMembersError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '', }, { diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.js b/src/pages/workspace/WorkspaceInviteMessagePage.js index fbab5dd93739..ce9cc730ddbe 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.js +++ b/src/pages/workspace/WorkspaceInviteMessagePage.js @@ -82,7 +82,7 @@ class WorkspaceInviteMessagePage extends React.Component { componentDidMount() { if (_.isEmpty(this.props.invitedEmailsToAccountIDsDraft)) { - Navigation.goBack(ROUTES.getWorkspaceInviteRoute(this.props.route.params.policyID), true); + Navigation.goBack(ROUTES.WORKSPACE_INITIAL.getRoute(this.props.route.params.policyID), true); return; } this.focusWelcomeMessageInput(); @@ -123,7 +123,7 @@ class WorkspaceInviteMessagePage extends React.Component { Policy.setWorkspaceInviteMembersDraft(this.props.route.params.policyID, {}); // Pop the invite message page before navigating to the members page. Navigation.goBack(ROUTES.HOME); - Navigation.navigate(ROUTES.getWorkspaceMembersRoute(this.props.route.params.policyID)); + Navigation.navigate(ROUTES.WORKSPACE_MEMBERS.getRoute(this.props.route.params.policyID)); } /** diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index a61b26be8ab3..5e57968ab77a 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -177,7 +177,7 @@ function WorkspaceInvitePage(props) { invitedEmailsToAccountIDs[login] = Number(accountID); }); Policy.setWorkspaceInviteMembersDraft(props.route.params.policyID, invitedEmailsToAccountIDs); - Navigation.navigate(ROUTES.getWorkspaceInviteMessageRoute(props.route.params.policyID)); + Navigation.navigate(ROUTES.WORKSPACE_INVITE_MESSAGE.getRoute(props.route.params.policyID)); }; const [policyName, shouldShowAlertPrompt] = useMemo( @@ -217,7 +217,7 @@ function WorkspaceInvitePage(props) { guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_MEMBERS} onBackButtonPress={() => { Policy.clearErrors(props.route.params.policyID); - Navigation.goBack(ROUTES.getWorkspaceMembersRoute(props.route.params.policyID)); + Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(props.route.params.policyID)); }} /> { setSearchValue(''); - Navigation.navigate(ROUTES.getWorkspaceInviteRoute(props.route.params.policyID)); + Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(props.route.params.policyID)); }; /** @@ -356,7 +356,7 @@ function WorkspaceMembersPage(props) { subtitle={policyName} onBackButtonPress={() => { setSearchValue(''); - Navigation.goBack(ROUTES.getWorkspaceInitialRoute(policyID)); + Navigation.goBack(ROUTES.WORKSPACE_INITIAL.getRoute(policyID)); }} shouldShowGetAssistanceButton guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_MEMBERS} diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index ff2b27800fed..80c2db793ce7 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -114,7 +114,7 @@ function WorkspacePageWithSections({backButtonRoute, children, footer, guidesCal subtitle={policyName} shouldShowGetAssistanceButton guidesCallTaskID={guidesCallTaskID} - onBackButtonPress={() => Navigation.goBack(backButtonRoute || ROUTES.getWorkspaceInitialRoute(policyID))} + onBackButtonPress={() => Navigation.goBack(backButtonRoute || ROUTES.WORKSPACE_INITIAL.getRoute(policyID))} /> {shouldUseScrollView ? ( Navigation.navigate(ROUTES.getWorkspaceInitialRoute(policy.id)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policy.id)), iconFill: themeColors.textLight, fallbackIcon: Expensicons.FallbackWorkspaceAvatar, brickRoadIndicator: reimbursementAccountBrickRoadIndicator || PolicyUtils.getPolicyBrickRoadIndicatorStatus(policy, allPolicyMembers), diff --git a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js index eb96033ed3ef..66b104d89fb1 100644 --- a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js +++ b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js @@ -87,7 +87,7 @@ class WorkspaceRateAndUnitPage extends React.Component { submit(values) { this.saveUnitAndRate(values.unit, values.rate); Keyboard.dismiss(); - Navigation.goBack(ROUTES.getWorkspaceReimburseRoute(this.props.policy.id)); + Navigation.goBack(ROUTES.WORKSPACE_REIMBURSE.getRoute(this.props.policy.id)); } validate(values) { @@ -111,7 +111,7 @@ class WorkspaceRateAndUnitPage extends React.Component { route={this.props.route} guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_REIMBURSE} shouldSkipVBBACall - backButtonRoute={ROUTES.getWorkspaceReimburseRoute(this.props.policy.id)} + backButtonRoute={ROUTES.WORKSPACE_REIMBURSE.getRoute(this.props.policy.id)} > {() => ( Navigation.navigate(ROUTES.getWorkspaceRateAndUnitRoute(props.policy.id))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REIMBURSE.getRoute(props.policy.id))} wrapperStyle={[styles.mhn5, styles.wAuto]} brickRoadIndicator={(lodashGet(distanceCustomUnit, 'errors') || lodashGet(distanceCustomRate, 'errors')) && CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR} /> diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 7372bb76b9e5..3df3b137bab3 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -2148,14 +2148,14 @@ describe('actions/IOU', () => { // Then we expect to navigate to the iou report - expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.getReportRoute(IOU_REPORT_ID)); + expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(IOU_REPORT_ID)); }); it('navigate the user correctly to the chat Report when appropriate', () => { // When we delete the money request and we should delete the IOU report IOU.deleteMoneyRequest(transaction.transactionID, createIOUAction, false); // Then we expect to navigate to the chat report - expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.getReportRoute(chatReport.reportID)); + expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(chatReport.reportID)); }); }); }); diff --git a/tests/e2e/ADDING_TESTS.md b/tests/e2e/ADDING_TESTS.md index 39cdb97ebed0..9704e4ea706d 100644 --- a/tests/e2e/ADDING_TESTS.md +++ b/tests/e2e/ADDING_TESTS.md @@ -37,7 +37,7 @@ that you might need to pass to the test running inside the app: ### Create the actual test -We created a new test file in `src/libs/E2E/tests/`. Typically, the +We created a new test file in `src/libs/E2E/tests/`. Typically, the tests ends on `.e2e.js`, so we can distinguish it from the other tests. Inside this test, we write logic that gets executed in the app. You can basically do @@ -61,9 +61,9 @@ import E2EClient from "./client.js"; const test = () => { const firstReportIDInList = // ... some logic to get a report - + performance.markStart("navigateToReport"); - Navigation.navigate(ROUTES.getReportRoute(firstReportIDInList)); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(firstReportIDInList)); // markEnd will be called in the Screen's implementation performance.subscribeToMeasurements("navigateToReport", (measurement) => { @@ -73,7 +73,7 @@ const test = () => { duration: measurement.duration, }).then(E2EClient.submitTestDone) }); - + }; export default test; From 63b89f78c9591d02029ceb4470759b6473a68315 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Sat, 23 Sep 2023 09:51:37 +0800 Subject: [PATCH 188/211] Remove unnecessary utility method --- src/ROUTES.ts | 25 +++---------------------- src/libs/ReportUtils.js | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 09d237a6e2e9..b1156271dbc0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1,5 +1,4 @@ import {ValueOf} from 'type-fest'; -import * as Url from './libs/Url'; import CONST from './CONST'; /** @@ -35,6 +34,7 @@ export default { // when linking users from e.com in order to share a session in this app. ENABLE_PAYMENTS: 'enable-payments', WALLET_STATEMENT_WITH_DATE: 'statements/:yearMonth', + SIGN_IN_MODAL: 'sign-in-modal', BANK_ACCOUNT: 'bank-account', BANK_ACCOUNT_NEW: 'bank-account/new', @@ -154,25 +154,6 @@ export default { WORKSPACE_MEMBERS: { route: 'workspace/:policyID/members', getRoute: (policyID: string) => `workspace/${policyID}/members`}, // These are some on-off routes that will be removed once they're no longer needed (see GH issues for details) - SAASTR: 'saastr', - SBE: 'sbe', - - parseReportRouteParams: (route: string): ParseReportRouteParams => { - let parsingRoute = route; - if (parsingRoute.at(0) === '/') { - // remove the first slash - parsingRoute = parsingRoute.slice(1); - } - - if (!parsingRoute.startsWith(Url.addTrailingForwardSlash(REPORT))) { - return {reportID: '', isSubReportPageRoute: false}; - } - - const pathSegments = parsingRoute.split('/'); - return { - reportID: pathSegments[1], - isSubReportPageRoute: pathSegments.length > 2, - }; - }, - SIGN_IN_MODAL: 'sign-in-modal', + SAASTR: 'saastr', + SBE: 'sbe', } as const; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index b32b9cbb666d..b477624142ba 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -15,6 +15,7 @@ import ROUTES from '../ROUTES'; import * as NumberUtils from './NumberUtils'; import * as ReportActionsUtils from './ReportActionsUtils'; import * as TransactionUtils from './TransactionUtils'; +import * as Url from './Url'; import Permissions from './Permissions'; import DateUtils from './DateUtils'; import linkingConfig from './Navigation/linkingConfig'; @@ -3146,13 +3147,35 @@ function getRouteFromLink(url) { return route; } +/** + * @param {String} route + * @returns {Object} + */ +function parseReportRouteParams(route) { + let parsingRoute = route; + if (parsingRoute.at(0) === '/') { + // remove the first slash + parsingRoute = parsingRoute.slice(1); + } + + if (!parsingRoute.startsWith(Url.addTrailingForwardSlash('r'))) { + return {reportID: '', isSubReportPageRoute: false}; + } + + const pathSegments = parsingRoute.split('/'); + return { + reportID: pathSegments[1], + isSubReportPageRoute: pathSegments.length > 2, + }; +} + /** * @param {String|null} url * @returns {String} */ function getReportIDFromLink(url) { const route = getRouteFromLink(url); - const {reportID, isSubReportPageRoute} = ROUTES.parseReportRouteParams(route); + const {reportID, isSubReportPageRoute} = parseReportRouteParams(route); if (isSubReportPageRoute) { // We allow the Sub-Report deep link routes (settings, details, etc.) to be handled by their respective component pages return ''; From 40358f6adf8ccb54b7ed079eae4265d48550a3f3 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Sat, 23 Sep 2023 09:52:41 +0800 Subject: [PATCH 189/211] Remove unused type --- src/ROUTES.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index b1156271dbc0..f602650706c8 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -5,11 +5,6 @@ import CONST from './CONST'; * This is a file containing constants for all of the routes we want to be able to go to */ -type ParseReportRouteParams = { - reportID: string; - isSubReportPageRoute: boolean; -}; - // prettier-ignore export default { HOME: '', @@ -39,7 +34,7 @@ export default { BANK_ACCOUNT: 'bank-account', BANK_ACCOUNT_NEW: 'bank-account/new', BANK_ACCOUNT_PERSONAL: 'bank-account/personal', - BANK_ACCOUNT_WITH_STEP_TO_OPEN: { route: 'bank-account/:stepToOpen?', getRoute: (stepToOpen = '', policyID = '', backTo = ''): string => { + BANK_ACCOUNT_WITH_STEP_TO_OPEN: { route: 'bank-account/:stepToOpen?', getRoute: (stepToOpen = '', policyID = '', backTo = ''): string => { const backToParam = backTo ? `&backTo=${encodeURIComponent(backTo)}` : ''; return `bank-account/${stepToOpen}?policyID=${policyID}${backToParam}`; }}, From 152524eed87ffbdaddec62cfbd8258868fd57768 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Sat, 23 Sep 2023 10:11:53 +0800 Subject: [PATCH 190/211] Fix a few mistakes --- src/libs/Navigation/linkingConfig.js | 8 ++++---- src/pages/iou/WaypointEditor.js | 8 ++++---- src/pages/workspace/reimburse/WorkspaceReimburseView.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js index 1a3253bf424b..c1823f91a952 100644 --- a/src/libs/Navigation/linkingConfig.js +++ b/src/libs/Navigation/linkingConfig.js @@ -180,7 +180,7 @@ export default { path: ROUTES.WORKSPACE_REIMBURSE.route, }, Workspace_RateAndUnit: { - path: ROUTES.WORKSPACE_REIMBURSE.route, + path: ROUTES.WORKSPACE_RATE_AND_UNIT.route, }, Workspace_Bills: { path: ROUTES.WORKSPACE_BILLS.route, @@ -195,7 +195,7 @@ export default { path: ROUTES.WORKSPACE_MEMBERS.route, }, Workspace_Invite: { - path: ROUTES.WORKSPACE_INITIAL.route, + path: ROUTES.WORKSPACE_INVITE.route, }, Workspace_Invite_Message: { path: ROUTES.WORKSPACE_INVITE_MESSAGE.route, @@ -314,7 +314,7 @@ export default { exact: true, }, distance: { - path: ROUTES.WORKSPACE_MEMBERS.route, + path: ROUTES.MONEY_REQUEST_DISTANCE_TAB.route, exact: true, }, }, @@ -359,7 +359,7 @@ export default { }, Wallet_Statement: { screens: { - WalletStatement_Root: ROUTES.WALLET_STATEMENT_WITH_DATE.route, + WalletStatement_Root: ROUTES.WALLET_STATEMENT_WITH_DATE, }, }, Flag_Comment: { diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js index 1e0622bc85ba..3397fa8701b6 100644 --- a/src/pages/iou/WaypointEditor.js +++ b/src/pages/iou/WaypointEditor.js @@ -147,13 +147,13 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI } // Other flows will be handled by selecting a waypoint with selectWaypoint as this is mainly for the offline flow - Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); + Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); }; const deleteStopAndHideModal = () => { Transaction.removeWaypoint(transactionID, waypointIndex); setIsDeleteStopModalOpen(false); - Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); + Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); }; const selectWaypoint = (values) => { @@ -163,7 +163,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI address: values.address, }; saveWaypoint(waypoint); - Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); + Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); }; const focusAddressInput = () => { @@ -187,7 +187,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI title={translate(wayPointDescriptionKey)} shouldShowBackButton onBackButtonPress={() => { - Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(iouType)); + Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); }} shouldShowThreeDotsButton={shouldShowThreeDotsButton} threeDotsAnchorPosition={styles.threeDotsPopoverOffset(windowWidth)} diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index d5a641cc43cb..5e7cf6d9baaa 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -168,7 +168,7 @@ function WorkspaceReimburseView(props) { title={currentRatePerUnit} description={translate('workspace.reimburse.trackDistanceRate')} shouldShowRightIcon - onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REIMBURSE.getRoute(props.policy.id))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(props.policy.id))} wrapperStyle={[styles.mhn5, styles.wAuto]} brickRoadIndicator={(lodashGet(distanceCustomUnit, 'errors') || lodashGet(distanceCustomRate, 'errors')) && CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR} /> From 9c823823afc38b8e6505a5502ff051e3244b33ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kapa=C5=82a?= Date: Sat, 23 Sep 2023 10:57:56 +0200 Subject: [PATCH 191/211] apply suggestions --- src/libs/SidebarUtils.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/libs/SidebarUtils.js b/src/libs/SidebarUtils.js index 0366a6820970..c87ea042e580 100644 --- a/src/libs/SidebarUtils.js +++ b/src/libs/SidebarUtils.js @@ -71,6 +71,16 @@ function isSidebarLoadedReady() { return sidebarIsReadyPromise; } +function compareStringDates(stringA, stringB) { + if (stringA < stringB) { + return -1; + } + if (stringA > stringB) { + return 1; + } + return 0; +} + function setIsSidebarLoadedReady() { resolveSidebarIsReadyPromise(); } @@ -184,21 +194,13 @@ function getOrderedReportIDs(currentReportId, allReportsDict, betas, policies, p pinnedReports.sort((a, b) => a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase())); outstandingIOUReports.sort((a, b) => b.iouReportAmount - a.iouReportAmount || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase())); draftReports.sort((a, b) => a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase())); - const compareStringDates = (stringA, stringB) => { - if (stringA < stringB) { - return 1; - } - if (stringA > stringB) { - return -1; - } - return 0; - }; + if (isInDefaultMode) { nonArchivedReports.sort( - (a, b) => compareStringDates(a.lastVisibleActionCreated, b.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), + (a, b) => compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), ); // For archived reports ensure that most recent reports are at the top by reversing the order - archivedReports.sort((a, b) => compareStringDates(a.lastVisibleActionCreated, b.lastVisibleActionCreated)); + archivedReports.sort((a, b) => compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated)); } else { nonArchivedReports.sort((a, b) => a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase())); archivedReports.sort((a, b) => a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase())); From d4dbcfa4c278c43da95c27d35fd60a7036ec7a06 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sat, 23 Sep 2023 19:14:20 +0530 Subject: [PATCH 192/211] show getting started at top --- docs/_data/_routes.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/_data/_routes.yml b/docs/_data/_routes.yml index 11218a907ec6..5666514b419e 100644 --- a/docs/_data/_routes.yml +++ b/docs/_data/_routes.yml @@ -14,6 +14,11 @@ platforms: # Hubs are comprised of sections and articles. Sections contain multiple related articles, but there can be standalone articles as well hubs: + - href: getting-started + title: Getting Started + icon: /assets/images/accounting.svg + description: From setting up your account to ensuring you get the most out of Expensify’s suite of features, click here to get started on streamlining your expense management journey. + - href: account-settings title: Account Settings icon: /assets/images/gears.svg @@ -49,11 +54,6 @@ platforms: icon: /assets/images/money-into-wallet.svg description: Whether you submit an expense report or an invoice, find out here how to ensure a smooth and timely payback process every time. - - href: getting-started - title: Getting Started - icon: /assets/images/accounting.svg - description: From setting up your account to ensuring you get the most out of Expensify’s suite of features, click here to get started on streamlining your expense management journey. - - href: integrations title: Integrations icon: /assets/images/workflow.svg @@ -83,6 +83,11 @@ platforms: image: /assets/images/settings-new-dot.svg hubs: + - href: getting-started + title: Getting Started + icon: /assets/images/accounting.svg + description: From setting up your account to ensuring you get the most out of Expensify’s suite of features, click here to get started on streamlining your expense management journey. + - href: account-settings title: Account Settings icon: /assets/images/gears.svg @@ -118,11 +123,6 @@ platforms: icon: /assets/images/money-into-wallet.svg description: Whether you submit an expense report or an invoice, find out here how to ensure a smooth and timely payback process every time. - - href: getting-started - title: Getting Started - icon: /assets/images/accounting.svg - description: From setting up your account to ensuring you get the most out of Expensify’s suite of features, click here to get started on streamlining your expense management journey. - - href: integrations title: Integrations icon: /assets/images/workflow.svg From 4a2fa58cb53eaea646492fae3544b9ece1b6d200 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 24 Sep 2023 12:42:46 +0530 Subject: [PATCH 193/211] refactor: remove style duplication --- docs/_sass/_main.scss | 162 +++++++----------------------------------- 1 file changed, 27 insertions(+), 135 deletions(-) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index b4cb8a1f3ac5..aa463c4e844c 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -465,7 +465,9 @@ button { } } -.card { +.card, +.platform-card, +.hub-card { display: flex; flex-wrap: nowrap; border-radius: 16px; @@ -484,16 +486,6 @@ button { flex-basis:100%; } - .left-icon { - display: flex; - align-items: center; - padding-right: 28px; - - img { - width: 64px; - } - } - .right-icon { display: flex; align-items: center; @@ -527,16 +519,28 @@ button { h4.title { padding: 0; margin: 0; + } - &.with-margin { - margin: 0 0 4px 0; + p.description, + p.url { + margin: 0; + font-weight: normal; + } +} + +.card, .hub-card { + .left-icon { + display: flex; + align-items: center; + padding-right: 28px; + + img { + width: 64px; } } p.description { padding: 0; - margin: 0; - font-weight: normal; &.with-min-height { min-height: 68px; @@ -548,24 +552,18 @@ button { } } -.platform-card { - display: flex; - flex-wrap: nowrap; - border-radius: 16px; - padding: 28px; - font-weight: 700; - cursor: pointer; - color: $color-text; - background-color: $color-highlightBG; - - &:hover { - background-color: darken($color-highlightBG, 1%); +.card, .platform-card { + h3.title, + h4.title { + &.with-margin { + margin: 0 0 4px 0; + } } +} +.platform-card { .row { - display: flex; flex-direction: column; - flex-basis:100%; } .platform-screenshot { @@ -578,30 +576,7 @@ button { } } - .right-icon { - display: flex; - align-items: center; - padding-left: 16px; - } - - .submit-button { - display: flex; - align-items: center; - margin-top: 16px; - padding-left: 0; - - @include breakpoint($breakpoint-desktop) { - margin-top: 0; - padding-left: 16px; - } - } - .body { - display: flex; - flex-wrap: nowrap; - flex-direction: column; - flex-grow: 2; - .header { display: flex; align-items: center; @@ -618,27 +593,10 @@ button { } h3.title { - font-family: "ExpensifyNewKansas", "Helvetica Neue", "Helvetica", Arial, sans-serif; font-size: 1.4em; font-weight: normal; } - h3.title, - h4.title { - padding: 0; - margin: 0; - - &.with-margin { - margin: 0 0 4px 0; - } - } - - p.description, - p.url { - margin: 0; - font-weight: normal; - } - p.description { padding: 20px 0 20px 0; } @@ -651,89 +609,23 @@ button { } .hub-card { - display: flex; - flex-wrap: nowrap; - border-radius: 16px; padding: 24px; - font-weight: 700; - cursor: pointer; - color: $color-text; - background-color: $color-highlightBG; - - &:hover { - background-color: darken($color-highlightBG, 1%); - } .row { - display: flex; - flex-direction: column; - flex-basis:100%; - } - - .left-icon { - display: flex; - align-items: center; - padding-right: 28px; - - img { - width: 68px; - } - } - - .right-icon { - display: flex; - align-items: center; - padding-left: 16px; - } - - .submit-button { - display: flex; - align-items: center; - margin-top: 16px; - padding-left: 0; - - @include breakpoint($breakpoint-desktop) { - margin-top: 0; - padding-left: 16px; - } - } - - .body { - display: flex; - flex-wrap: nowrap; flex-direction: column; - flex-grow: 2; } h3.title { - font-family: "ExpensifyNewKansas", "Helvetica Neue", "Helvetica", Arial, sans-serif; font-size: 1.2em; font-weight: normal; } h3.title, h4.title { - padding: 0; - margin: 0; - &.with-margin { margin: 20px 0 8px 0; } } - - p.description { - padding: 0; - margin: 0; - font-weight: normal; - - &.with-min-height { - min-height: 68px; - - @include breakpoint($breakpoint-tablet) { - min-height: 48px; - } - } - } } .base-icon { From 82567c6733a36848c6540c3f60da79f7a74469ec Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 24 Sep 2023 13:10:24 +0530 Subject: [PATCH 194/211] refactor: remove style duplication --- docs/_sass/_main.scss | 92 ++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 53 deletions(-) diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss index aa463c4e844c..cc021b94c695 100644 --- a/docs/_sass/_main.scss +++ b/docs/_sass/_main.scss @@ -465,9 +465,7 @@ button { } } -.card, -.platform-card, -.hub-card { +.card { display: flex; flex-wrap: nowrap; border-radius: 16px; @@ -486,24 +484,6 @@ button { flex-basis:100%; } - .right-icon { - display: flex; - align-items: center; - padding-left: 16px; - } - - .submit-button { - display: flex; - align-items: center; - margin-top: 16px; - padding-left: 0; - - @include breakpoint($breakpoint-desktop) { - margin-top: 0; - padding-left: 16px; - } - } - .body { display: flex; flex-wrap: nowrap; @@ -528,40 +508,18 @@ button { } } -.card, .hub-card { - .left-icon { +.article-card { + @extend .card; + + .right-icon { display: flex; align-items: center; - padding-right: 28px; - - img { - width: 64px; - } - } - - p.description { - padding: 0; - - &.with-min-height { - min-height: 68px; - - @include breakpoint($breakpoint-tablet) { - min-height: 48px; - } - } - } -} - -.card, .platform-card { - h3.title, - h4.title { - &.with-margin { - margin: 0 0 4px 0; - } + padding-left: 16px; } } .platform-card { + @extend .card; .row { flex-direction: column; } @@ -576,6 +534,18 @@ button { } } + .submit-button { + display: flex; + align-items: center; + margin-top: 16px; + padding-left: 0; + + @include breakpoint($breakpoint-desktop) { + margin-top: 0; + padding-left: 16px; + } + } + .body { .header { display: flex; @@ -592,6 +562,13 @@ button { } } + h3.title, + h4.title { + &.with-margin { + margin: 0 0 4px 0; + } + } + h3.title { font-size: 1.4em; font-weight: normal; @@ -609,6 +586,7 @@ button { } .hub-card { + @extend .card; padding: 24px; .row { @@ -618,14 +596,22 @@ button { h3.title { font-size: 1.2em; font-weight: normal; - } - - h3.title, - h4.title { &.with-margin { margin: 20px 0 8px 0; } } + + p.description { + padding: 0; + + &.with-min-height { + min-height: 68px; + + @include breakpoint($breakpoint-tablet) { + min-height: 48px; + } + } + } } .base-icon { From 3b5c73c888312495eeaaaa77f35572bfcfc9a05a Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 24 Sep 2023 13:10:56 +0530 Subject: [PATCH 195/211] cleanup --- docs/_includes/article-card.html | 2 +- docs/_includes/hub-card.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_includes/article-card.html b/docs/_includes/article-card.html index cddc93ac65fb..b66affebb4ae 100644 --- a/docs/_includes/article-card.html +++ b/docs/_includes/article-card.html @@ -1,4 +1,4 @@ - +

{{ include.title }}

diff --git a/docs/_includes/hub-card.html b/docs/_includes/hub-card.html index 2ad288d941a4..859ee0004394 100644 --- a/docs/_includes/hub-card.html +++ b/docs/_includes/hub-card.html @@ -2,7 +2,7 @@ {% assign platform = include.platform %}
-
+
{{ hub.href }}
From c7b0fe89024f65422325ea4955dc20286e791152 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 24 Sep 2023 14:34:06 +0530 Subject: [PATCH 196/211] cleanup --- docs/_data/_routes.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/_data/_routes.yml b/docs/_data/_routes.yml index 5666514b419e..e38e0470c3c9 100644 --- a/docs/_data/_routes.yml +++ b/docs/_data/_routes.yml @@ -8,8 +8,7 @@ platforms: title: Expensify Classic hub-title: Expensify Classic - Help & Resources url: www.expensify.com - description: >- - Your account settings will look something like this: + description: "Your account settings will look something like this:" image: /assets/images/settings-old-dot.svg # Hubs are comprised of sections and articles. Sections contain multiple related articles, but there can be standalone articles as well @@ -78,8 +77,7 @@ platforms: title: New Expensify hub-title: New Expensify - Help & Resources url: new.expensify.com - description: >- - Your account settings will look something like this: + description: "Your account settings will look something like this:" image: /assets/images/settings-new-dot.svg hubs: From 5d3fffcb27641ecf78c01cabb749714dbe08f879 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Sun, 24 Sep 2023 17:42:35 +0800 Subject: [PATCH 197/211] indent more routes --- src/ROUTES.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index f602650706c8..0def079ce2af 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -9,7 +9,7 @@ import CONST from './CONST'; export default { HOME: '', /** This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated */ - CONCIERGE: 'concierge', + CONCIERGE: 'concierge', FLAG_COMMENT: { route: 'flag/:reportID/:reportActionID', getRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`}, SEARCH: 'search', DETAILS: { route: 'details', getRoute: (login: string) => `details?login=${encodeURIComponent(login)}`}, @@ -77,7 +77,7 @@ export default { NEW_CHAT: 'new/chat', NEW_ROOM: 'new/room', - REPORT: 'r', + REPORT: 'r', REPORT_WITH_ID: { route: 'r/:reportID?/:reportActionID?', getRoute: (reportID: string) => `r/${reportID}`}, EDIT_REQUEST: { route: 'r/:threadReportID/edit/:field', getRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`}, EDIT_CURRENCY_REQUEST: { route: 'r/:threadReportID/edit/currency', getRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`}, From f22ac9f17b399bcc2e3934e4f70dd155e5eaf6d3 Mon Sep 17 00:00:00 2001 From: situchan Date: Sun, 24 Sep 2023 22:01:53 +0600 Subject: [PATCH 198/211] fix crash on category picker --- src/components/CategoryPicker/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CategoryPicker/index.js b/src/components/CategoryPicker/index.js index ee591a851c13..ef8b1d71ad1d 100644 --- a/src/components/CategoryPicker/index.js +++ b/src/components/CategoryPicker/index.js @@ -54,13 +54,13 @@ function CategoryPicker({selectedCategory, policyCategories, policyRecentlyUsedC let categoryInitialFocusedIndex = 0; if (!_.isEmpty(searchValue) || isCategoriesCountBelowThreshold) { - const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === iou.category); + const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === selectedCategory); categoryInitialFocusedIndex = index === -1 ? 0 : index; } return categoryInitialFocusedIndex; - }, [iou.category, searchValue, isCategoriesCountBelowThreshold, sections]); + }, [selectedCategory, searchValue, isCategoriesCountBelowThreshold, sections]); const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, searchValue); const shouldShowTextInput = !isCategoriesCountBelowThreshold; From 0263c98e3328fb820b2861b530ce9c9e15f710e8 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 25 Sep 2023 03:34:20 +0530 Subject: [PATCH 199/211] Update description for platforms --- docs/_data/_routes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_data/_routes.yml b/docs/_data/_routes.yml index e38e0470c3c9..89a93e989672 100644 --- a/docs/_data/_routes.yml +++ b/docs/_data/_routes.yml @@ -8,7 +8,7 @@ platforms: title: Expensify Classic hub-title: Expensify Classic - Help & Resources url: www.expensify.com - description: "Your account settings will look something like this:" + description: "Your account settings look like this:" image: /assets/images/settings-old-dot.svg # Hubs are comprised of sections and articles. Sections contain multiple related articles, but there can be standalone articles as well @@ -77,7 +77,7 @@ platforms: title: New Expensify hub-title: New Expensify - Help & Resources url: new.expensify.com - description: "Your account settings will look something like this:" + description: "Your account settings look like this:" image: /assets/images/settings-new-dot.svg hubs: From 812c2e901ec822c3ae5f45bd6b47ec757c593b9d Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 24 Sep 2023 20:54:49 +0530 Subject: [PATCH 200/211] crash display name --- src/pages/PrivateNotes/PrivateNotesListPage.js | 1 + src/pages/iou/MoneyRequestDatePage.js | 1 + src/pages/iou/MoneyRequestDescriptionPage.js | 1 + src/pages/iou/MoneyRequestMerchantPage.js | 1 + src/pages/settings/Profile/Contacts/NewContactMethodPage.js | 1 + src/pages/settings/Profile/PersonalDetails/AddressPage.js | 1 + src/pages/settings/Profile/PersonalDetails/LegalNamePage.js | 1 + src/pages/settings/Profile/TimezoneSelectPage.js | 1 + src/pages/settings/Security/CloseAccountPage.js | 1 + .../settings/Security/TwoFactorAuth/StepWrapper/StepWrapper.js | 1 + src/pages/settings/Wallet/AddDebitCardPage.js | 1 + src/pages/settings/Wallet/WalletPage/BaseWalletPage.js | 2 +- src/pages/tasks/TaskDescriptionPage.js | 1 + src/pages/tasks/TaskTitlePage.js | 1 + src/pages/workspace/WorkspacePageWithSections.js | 1 + 15 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.js b/src/pages/PrivateNotes/PrivateNotesListPage.js index fdfaa4c60e33..e35caf1ea165 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.js +++ b/src/pages/PrivateNotes/PrivateNotesListPage.js @@ -139,6 +139,7 @@ function PrivateNotesListPage({report, personalDetailsList, network, session}) { PrivateNotesListPage.propTypes = propTypes; PrivateNotesListPage.defaultProps = defaultProps; +PrivateNotesListPage.displayName = 'PrivateNotesListPage'; export default compose( withLocalize, diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js index 2d2f9c519c50..ae451c0dd9ca 100644 --- a/src/pages/iou/MoneyRequestDatePage.js +++ b/src/pages/iou/MoneyRequestDatePage.js @@ -111,6 +111,7 @@ function MoneyRequestDatePage({iou, route, selectedTab}) { MoneyRequestDatePage.propTypes = propTypes; MoneyRequestDatePage.defaultProps = defaultProps; +MoneyRequestDatePage.displayName = 'MoneyRequestDatePage'; export default withOnyx({ iou: { diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 61f688f5d4bd..30353bfe2617 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -150,6 +150,7 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { MoneyRequestDescriptionPage.propTypes = propTypes; MoneyRequestDescriptionPage.defaultProps = defaultProps; +MoneyRequestDescriptionPage.displayName = 'MoneyRequestDescriptionPage'; export default withOnyx({ iou: { diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js index dddf63a49673..a0cfaee9591a 100644 --- a/src/pages/iou/MoneyRequestMerchantPage.js +++ b/src/pages/iou/MoneyRequestMerchantPage.js @@ -126,6 +126,7 @@ function MoneyRequestMerchantPage({iou, route}) { MoneyRequestMerchantPage.propTypes = propTypes; MoneyRequestMerchantPage.defaultProps = defaultProps; +MoneyRequestMerchantPage.displayName = 'MoneyRequestMerchantPage'; export default withOnyx({ iou: { diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.js b/src/pages/settings/Profile/Contacts/NewContactMethodPage.js index 1880ef694b40..cce43117d4f2 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.js +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.js @@ -133,6 +133,7 @@ function NewContactMethodPage(props) { NewContactMethodPage.propTypes = propTypes; NewContactMethodPage.defaultProps = defaultProps; +NewContactMethodPage.displayName = 'NewContactMethodPage'; export default compose( withLocalize, diff --git a/src/pages/settings/Profile/PersonalDetails/AddressPage.js b/src/pages/settings/Profile/PersonalDetails/AddressPage.js index a50d9e7e23c3..782756024d8f 100644 --- a/src/pages/settings/Profile/PersonalDetails/AddressPage.js +++ b/src/pages/settings/Profile/PersonalDetails/AddressPage.js @@ -234,6 +234,7 @@ function AddressPage({privatePersonalDetails}) { AddressPage.propTypes = propTypes; AddressPage.defaultProps = defaultProps; +AddressPage.displayName = 'AddressPage'; export default withOnyx({ privatePersonalDetails: { diff --git a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js index fc55893169dc..725c3f4ffbb9 100644 --- a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js +++ b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js @@ -120,6 +120,7 @@ function LegalNamePage(props) { LegalNamePage.propTypes = propTypes; LegalNamePage.defaultProps = defaultProps; +LegalNamePage.displayName = 'LegalNamePage'; export default compose( withLocalize, diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js index ee34f24788bb..2c47acd58daa 100644 --- a/src/pages/settings/Profile/TimezoneSelectPage.js +++ b/src/pages/settings/Profile/TimezoneSelectPage.js @@ -102,5 +102,6 @@ function TimezoneSelectPage(props) { TimezoneSelectPage.propTypes = propTypes; TimezoneSelectPage.defaultProps = defaultProps; +TimezoneSelectPage.displayName = 'TimezoneSelectPage'; export default withCurrentUserPersonalDetails(TimezoneSelectPage); diff --git a/src/pages/settings/Security/CloseAccountPage.js b/src/pages/settings/Security/CloseAccountPage.js index ae015e3cda8a..fb2ae3cfa3d0 100644 --- a/src/pages/settings/Security/CloseAccountPage.js +++ b/src/pages/settings/Security/CloseAccountPage.js @@ -136,6 +136,7 @@ function CloseAccountPage(props) { CloseAccountPage.propTypes = propTypes; CloseAccountPage.defaultProps = defaultProps; +CloseAccountPage.displayName = 'CloseAccountPage'; export default compose( withLocalize, diff --git a/src/pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper.js b/src/pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper.js index 07714fb3c49b..64aa64d07ee5 100644 --- a/src/pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper.js +++ b/src/pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper.js @@ -44,5 +44,6 @@ function StepWrapper({ } StepWrapper.propTypes = StepWrapperPropTypes; +StepWrapper.displayName = 'StepWrapper'; export default StepWrapper; diff --git a/src/pages/settings/Wallet/AddDebitCardPage.js b/src/pages/settings/Wallet/AddDebitCardPage.js index f74fc050738f..e75c3b2c517e 100644 --- a/src/pages/settings/Wallet/AddDebitCardPage.js +++ b/src/pages/settings/Wallet/AddDebitCardPage.js @@ -202,6 +202,7 @@ function DebitCardPage(props) { DebitCardPage.propTypes = propTypes; DebitCardPage.defaultProps = defaultProps; +DebitCardPage.displayName = 'DebitCardPage'; export default withOnyx({ formData: { diff --git a/src/pages/settings/Wallet/WalletPage/BaseWalletPage.js b/src/pages/settings/Wallet/WalletPage/BaseWalletPage.js index 4ffd4cf9a744..74f0137fa26d 100644 --- a/src/pages/settings/Wallet/WalletPage/BaseWalletPage.js +++ b/src/pages/settings/Wallet/WalletPage/BaseWalletPage.js @@ -450,7 +450,7 @@ function BaseWalletPage(props) { BaseWalletPage.propTypes = propTypes; BaseWalletPage.defaultProps = defaultProps; -BaseWalletPage.displayName = BaseWalletPage; +BaseWalletPage.displayName = 'BaseWalletPage'; export default compose( withNetwork(), diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 61d33f781892..be2cdad03fe6 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -125,6 +125,7 @@ function TaskDescriptionPage(props) { TaskDescriptionPage.propTypes = propTypes; TaskDescriptionPage.defaultProps = defaultProps; +TaskDescriptionPage.displayName = 'TaskDescriptionPage'; export default compose( withLocalize, diff --git a/src/pages/tasks/TaskTitlePage.js b/src/pages/tasks/TaskTitlePage.js index 5bfc94467e3e..fca90a5fa904 100644 --- a/src/pages/tasks/TaskTitlePage.js +++ b/src/pages/tasks/TaskTitlePage.js @@ -120,6 +120,7 @@ function TaskTitlePage(props) { TaskTitlePage.propTypes = propTypes; TaskTitlePage.defaultProps = defaultProps; +TaskTitlePage.displayName = 'TaskTitlePage'; export default compose( withLocalize, diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index ff2b27800fed..bd3c70127adf 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -134,6 +134,7 @@ function WorkspacePageWithSections({backButtonRoute, children, footer, guidesCal WorkspacePageWithSections.propTypes = propTypes; WorkspacePageWithSections.defaultProps = defaultProps; +WorkspacePageWithSections.displayName = 'WorkspacePageWithSections'; export default compose( withOnyx({ From d3b08423e01a477b81125a194e90ff6796717471 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 25 Sep 2023 08:57:09 +0800 Subject: [PATCH 201/211] Fix a couple of stragglers --- src/components/MoneyRequestConfirmationList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 06e21f70c9d5..cdc5a787068d 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -463,7 +463,7 @@ function MoneyRequestConfirmationList(props) { shouldShowRightIcon={!props.isReadOnly && !props.isDistanceRequest} title={formattedAmount} description={translate('iou.amount')} - onPress={() => !props.isDistanceRequest && Navigation.navigate(ROUTES.getMoneyRequestAmountRoute(props.iouType, props.reportID))} + onPress={() => !props.isDistanceRequest && Navigation.navigate(ROUTES.MONEY_REQUEST_AMOUNT.getRoute(props.iouType, props.reportID))} style={[styles.moneyRequestMenuItem, styles.mt2]} titleStyle={styles.moneyRequestConfirmationAmount} disabled={didConfirm || props.isReadOnly} @@ -513,7 +513,7 @@ function MoneyRequestConfirmationList(props) { description={translate('common.distance')} style={[styles.moneyRequestMenuItem, styles.mb2]} titleStyle={styles.flex1} - onPress={() => Navigation.navigate(ROUTES.getMoneyRequestAddressRoute(props.iouType, props.reportID))} + onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_ADDRESS.getRoute(props.iouType, props.reportID))} disabled={didConfirm || props.isReadOnly || !isTypeRequest} /> ) : ( From 32221aeb4522a1590f6c7c503773fa8dc988c1b5 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 25 Sep 2023 10:16:26 +0800 Subject: [PATCH 202/211] fix route conflicts --- src/components/MoneyRequestHeader.js | 2 +- src/libs/actions/IOU.js | 4 ++-- src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index 61c1cacffefb..9db9c87c4eb1 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -92,7 +92,7 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction, { icon: Expensicons.Receipt, text: translate('receipt.addReceipt'), - onSelected: () => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)), + onSelected: () => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)), }, ]), { diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3e564bb9b940..04b02977169d 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2100,8 +2100,8 @@ function navigateToNextPage(iou, iouType, reportID, report, path = '') { } // If we're adding a receipt, that means the user came from the confirmation page and we need to navigate back to it. - if (path.slice(1) === ROUTES.getMoneyRequestReceiptRoute(iouType, reportID)) { - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + if (path.slice(1) === ROUTES.MONEY_REQUEST_RECEIPT.getRoute(iouType, reportID)) { + Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); return; } diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 52827a5914e6..015707db71f2 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -297,7 +297,7 @@ function MoneyRequestConfirmPage(props) { { icon: Expensicons.Receipt, text: props.translate('receipt.addReceipt'), - onSelected: () => Navigation.navigate(ROUTES.getMoneyRequestReceiptRoute(iouType.current, reportID.current)), + onSelected: () => Navigation.navigate(ROUTES.MONEY_REQUEST_RECEIPT.getRoute(iouType.current, reportID.current)), }, ]} /> From 94ba36ec8fa39b4bc90b20cb9b484f02350ab7ba Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 25 Sep 2023 03:49:36 +0000 Subject: [PATCH 203/211] Update version to 1.3.73-1 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 629f10f56267..7201618a2c1c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -90,8 +90,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001037300 - versionName "1.3.73-0" + versionCode 1001037301 + versionName "1.3.73-1" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 0014eb50f5e8..49e9d8cc5a7c 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.3.73.0 + 1.3.73.1 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 256676c4de81..20ba9c9d52aa 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.73.0 + 1.3.73.1 diff --git a/package-lock.json b/package-lock.json index d15542839618..03a97f23ae45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.73-0", + "version": "1.3.73-1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.73-0", + "version": "1.3.73-1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 73876077bb8d..e07431bfbd4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.73-0", + "version": "1.3.73-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.", From 4d0d1c004c515f0d0417db5a34df0c02ac689760 Mon Sep 17 00:00:00 2001 From: situchan Date: Mon, 25 Sep 2023 12:11:04 +0600 Subject: [PATCH 204/211] exclude double quote from url --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03a97f23ae45..165c7eff70bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#35bff866a8d345b460ea6256f0a0f0a8a7f81086", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#1609f1848cc0c2528064519c3ea48b4953a708ee", "fbjs": "^3.0.2", "htmlparser2": "^7.2.0", "idb-keyval": "^6.2.1", @@ -28106,8 +28106,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#35bff866a8d345b460ea6256f0a0f0a8a7f81086", - "integrity": "sha512-O0KbaMljSFyoZXcxtx5B2qBL+n0md3wYOrArMVT8N0W+4wKncn+p8/vrmVlUMHe/vDloUbVmUZNdHwOZNWdx3w==", + "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#1609f1848cc0c2528064519c3ea48b4953a708ee", + "integrity": "sha512-sUd/ky6xCB/mShVaD2nVkedGL2xy+h6Jf5MfX9GOiYX8wB2D8uZSpqswz515uwcp8RDWrA5wxM2cR6pBXNfgxw==", "license": "MIT", "dependencies": { "classnames": "2.3.1", @@ -68254,9 +68254,9 @@ } }, "expensify-common": { - "version": "git+ssh://git@github.com/Expensify/expensify-common.git#35bff866a8d345b460ea6256f0a0f0a8a7f81086", - "integrity": "sha512-O0KbaMljSFyoZXcxtx5B2qBL+n0md3wYOrArMVT8N0W+4wKncn+p8/vrmVlUMHe/vDloUbVmUZNdHwOZNWdx3w==", - "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#35bff866a8d345b460ea6256f0a0f0a8a7f81086", + "version": "git+ssh://git@github.com/Expensify/expensify-common.git#1609f1848cc0c2528064519c3ea48b4953a708ee", + "integrity": "sha512-sUd/ky6xCB/mShVaD2nVkedGL2xy+h6Jf5MfX9GOiYX8wB2D8uZSpqswz515uwcp8RDWrA5wxM2cR6pBXNfgxw==", + "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#1609f1848cc0c2528064519c3ea48b4953a708ee", "requires": { "classnames": "2.3.1", "clipboard": "2.0.4", diff --git a/package.json b/package.json index e07431bfbd4d..99ff06606898 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#35bff866a8d345b460ea6256f0a0f0a8a7f81086", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#1609f1848cc0c2528064519c3ea48b4953a708ee", "fbjs": "^3.0.2", "htmlparser2": "^7.2.0", "idb-keyval": "^6.2.1", From ace44eec08d15f60c221f1f9b08406ab07c15d05 Mon Sep 17 00:00:00 2001 From: Matt Allen Date: Mon, 25 Sep 2023 15:46:21 +0800 Subject: [PATCH 205/211] Update CONTRIBUTING.md --- contributingGuides/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributingGuides/CONTRIBUTING.md b/contributingGuides/CONTRIBUTING.md index b97d04b95e10..621673e5a487 100644 --- a/contributingGuides/CONTRIBUTING.md +++ b/contributingGuides/CONTRIBUTING.md @@ -47,7 +47,7 @@ Note: if you are hired for an Upwork job and have any job-specific questions, pl If you've found a vulnerability, please email security@expensify.com with the subject `Vulnerability Report` instead of creating an issue. ## Payment for Contributions -We hire and pay external contributors via Upwork.com. If you'd like to be paid for contributing or reporting a bug, please create an Upwork account, apply for an available job in [GitHub](https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22), and finally apply for the job in Upwork once your proposal gets selected in GitHub. PLease make sure your Upwork profile is **fully verified** before applying, otherwise you run the risk of not being paid. If you think your compensation should be increased for a specific job, you can request a reevaluation by commenting in the Github issue where the Upwork job was posted. +We hire and pay external contributors via Upwork.com. If you'd like to be paid for contributing or reporting a bug, please create an Upwork account, apply for an available job in [GitHub](https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22), and finally apply for the job in Upwork once your proposal gets selected in GitHub. Please make sure your Upwork profile is **fully verified** before applying, otherwise you run the risk of not being paid. If you think your compensation should be increased for a specific job, you can request a reevaluation by commenting in the Github issue where the Upwork job was posted. Payment for your contributions and bug reports will be made no less than 7 days after the pull request is deployed to production to allow for [regression](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#regressions) testing. If you have not received payment after 8 days of the PR being deployed to production, and there are no [regressions](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#regressions), please add a comment to the issue mentioning the BugZero team member (Look for the melvin-bot "Triggered auto assignment to... (`Bug`)" to see who this is). From ff64f371cbcb625e7fd85ca6a6d5e5310c3a37da Mon Sep 17 00:00:00 2001 From: Wojciech Stanisz Date: Mon, 25 Sep 2023 10:38:01 +0200 Subject: [PATCH 206/211] Remove ^ from reanimated version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d4b5521cc21..48f7628a73e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.5.4", + "react-native-reanimated": "3.5.4", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", diff --git a/package.json b/package.json index a74cd86af7cf..8bc06745f115 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "react-native-plaid-link-sdk": "^10.0.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.5.4", + "react-native-reanimated": "3.5.4", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", From 61bc84a988b3f7c6fa6211332ea56fc3d343b28e Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Mon, 25 Sep 2023 09:52:23 +0100 Subject: [PATCH 207/211] fix: small review fixes --- src/components/ReportActionItem/MoneyRequestView.js | 4 ++-- src/libs/PolicyUtils.js | 6 +++--- src/libs/ReportUtils.js | 8 +------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index b077b0da4f0a..0220bbdf520a 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -214,14 +214,14 @@ function MoneyRequestView({report, betas, parentReport, policyCategories, should )} {shouldShowTag && ( - + Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.TAG))} + onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.TAG))} /> )} diff --git a/src/libs/PolicyUtils.js b/src/libs/PolicyUtils.js index 21a88b9227b9..347a825f59cc 100644 --- a/src/libs/PolicyUtils.js +++ b/src/libs/PolicyUtils.js @@ -208,11 +208,11 @@ function getIneligibleInvitees(policyMembers, personalDetails) { * * @param {Object} policyTags * @param {String} [tagKey] - * @returns {String} + * @returns {Object} */ function getTag(policyTags, tagKey) { if (_.isEmpty(policyTags)) { - return ''; + return {}; } const policyTagKey = tagKey || _.first(_.keys(policyTags)); @@ -252,7 +252,7 @@ function getTagList(policyTags, tagKey) { return lodashGet(policyTags, [policyTagKey, 'tags'], {}); } - + /** * @param {Object} policy * @returns {Boolean} diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 27401f52a5da..fbc6f6a73033 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1596,12 +1596,7 @@ function getModifiedExpenseMessage(reportAction) { const hasModifiedTag = _.has(reportActionOriginalMessage, 'oldTag') && _.has(reportActionOriginalMessage, 'tag'); if (hasModifiedTag) { - return getProperSchemaForModifiedExpenseMessage( - reportActionOriginalMessage.tag, - reportActionOriginalMessage.oldTag, - reportActionOriginalMessage.tagListName || Localize.translateLocal('common.tag'), - true, - ); + return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.tag, reportActionOriginalMessage.oldTag, Localize.translateLocal('common.tag'), true); } } @@ -1651,7 +1646,6 @@ function getModifiedExpenseOriginalMessage(oldTransaction, transactionChanges, i if (_.has(transactionChanges, 'tag')) { originalMessage.oldTag = TransactionUtils.getTag(oldTransaction); originalMessage.tag = transactionChanges.tag; - originalMessage.tagListName = transactionChanges.tagListName; } return originalMessage; From cb4e665533f6dce86ef1d14aa1cadaef5b7c74df Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 25 Sep 2023 09:16:52 +0000 Subject: [PATCH 208/211] Update version to 1.3.74-0 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 4 ++-- ios/NewExpensifyTests/Info.plist | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7201618a2c1c..c67f715f6334 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -90,8 +90,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001037301 - versionName "1.3.73-1" + versionCode 1001037400 + versionName "1.3.74-0" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 49e9d8cc5a7c..8d90a7367526 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.73 + 1.3.74 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.3.73.1 + 1.3.74.0 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 20ba9c9d52aa..fbd5f49a2a79 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.3.73 + 1.3.74 CFBundleSignature ???? CFBundleVersion - 1.3.73.1 + 1.3.74.0 diff --git a/package-lock.json b/package-lock.json index 03a97f23ae45..1c3faec2b5ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.73-1", + "version": "1.3.74-0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.73-1", + "version": "1.3.74-0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e07431bfbd4d..4f7e495c7d87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.73-1", + "version": "1.3.74-0", "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.", From a4603d6d3d492d422082cac073fc6cfa5116a127 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Mon, 25 Sep 2023 09:18:17 +0000 Subject: [PATCH 209/211] Update version to 1.3.74-1 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index c67f715f6334..0f6ee4dff858 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -90,8 +90,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001037400 - versionName "1.3.74-0" + versionCode 1001037401 + versionName "1.3.74-1" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 8d90a7367526..bc37a65393fb 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.3.74.0 + 1.3.74.1 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index fbd5f49a2a79..83c733238921 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.74.0 + 1.3.74.1 diff --git a/package-lock.json b/package-lock.json index 1c3faec2b5ac..6fe517cf1ea2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.74-0", + "version": "1.3.74-1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.74-0", + "version": "1.3.74-1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 4f7e495c7d87..9bbd665a586a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.74-0", + "version": "1.3.74-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.", From 472eabc734055efcd4ee636c3a5fcdee08adfbf9 Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Mon, 25 Sep 2023 10:41:52 +0100 Subject: [PATCH 210/211] fix: navigation back when reloading on the edit page --- src/pages/EditRequestPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index 24ed08a82047..7a19df7af8dc 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -117,7 +117,7 @@ function EditRequestPage({report, route, parentReport, policy, session, policyTa // Update the transaction object and close the modal function editMoneyRequest(transactionChanges) { IOU.editMoneyRequest(transaction.transactionID, report.reportID, transactionChanges); - Navigation.dismissModal(); + Navigation.dismissModal(report.reportID); } if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.DESCRIPTION) { @@ -215,6 +215,7 @@ function EditRequestPage({report, route, parentReport, policy, session, policyTa tagName={tagListName} policyID={lodashGet(report, 'policyID', '')} onSubmit={(transactionChanges) => { + console.log("[MINE] Update tag", transactionChanges.tag, transactionTag); let updatedTag = transactionChanges.tag; // In case the same tag has been selected, reset the tag. From 02c218fb79b60dd21da3a1c14637d8e9c4f2afd2 Mon Sep 17 00:00:00 2001 From: Ana Margarida Silva Date: Mon, 25 Sep 2023 10:43:08 +0100 Subject: [PATCH 211/211] revert: log --- src/pages/EditRequestPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index 7a19df7af8dc..5e6e0dd3f17b 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -215,7 +215,6 @@ function EditRequestPage({report, route, parentReport, policy, session, policyTa tagName={tagListName} policyID={lodashGet(report, 'policyID', '')} onSubmit={(transactionChanges) => { - console.log("[MINE] Update tag", transactionChanges.tag, transactionTag); let updatedTag = transactionChanges.tag; // In case the same tag has been selected, reset the tag.