Skip to content

Commit

Permalink
Merge branch 'main' into tgolen-refactor-reportactionitemremovesidelo…
Browse files Browse the repository at this point in the history
…ading
  • Loading branch information
tgolen committed Jan 8, 2024
2 parents e3758e0 + 5aaeca1 commit 1470c83
Show file tree
Hide file tree
Showing 54 changed files with 515 additions and 474 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001042200
versionName "1.4.22-0"
versionCode 1001042203
versionName "1.4.22-3"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.22.0</string>
<string>1.4.22.3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.22.0</string>
<string>1.4.22.3</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.22-0",
"version": "1.4.22-3",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
3 changes: 3 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ const CONST = {
DIGITS_AND_PLUS: /^\+?[0-9]*$/,
ALPHABETIC_AND_LATIN_CHARS: /^[\p{Script=Latin} ]*$/u,
NON_ALPHABETIC_AND_NON_LATIN_CHARS: /[^\p{Script=Latin}]/gu,
ACCENT_LATIN_CHARS: /[\u00C0-\u017F]/g,
POSITIVE_INTEGER: /^\d+$/,
PO_BOX: /\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b/,
ANY_VALUE: /^.+$/,
Expand Down Expand Up @@ -1422,6 +1423,7 @@ const CONST = {
ROUTES: {
VALIDATE_LOGIN: /\/v($|(\/\/*))/,
UNLINK_LOGIN: /\/u($|(\/\/*))/,
REDUNDANT_SLASHES: /(\/{2,})|(\/$)/g,
},

TIME_STARTS_01: /^01:\d{2} [AP]M$/,
Expand Down Expand Up @@ -2954,6 +2956,7 @@ const CONST = {
MAPBOX: {
PADDING: 50,
DEFAULT_ZOOM: 10,
SINGLE_MARKER_ZOOM: 15,
DEFAULT_COORDINATE: [-122.4021, 37.7911],
STYLE_URL: 'mapbox://styles/expensify/cllcoiqds00cs01r80kp34tmq',
},
Expand Down
44 changes: 22 additions & 22 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ const ROUTES = {
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) => `create/${iouType}/start/${transactionID}/${reportID}` as const,
},
MONEY_REQUEST_STEP_CONFIRMATION: {
route: 'create/:iouType/confirmation/:transactionID/:reportID/',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) => `create/${iouType}/confirmation/${transactionID}/${reportID}/` as const,
route: 'create/:iouType/confirmation/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) => `create/${iouType}/confirmation/${transactionID}/${reportID}` as const,
},
MONEY_REQUEST_STEP_AMOUNT: {
route: 'create/:iouType/amount/:transactionID/:reportID/',
route: 'create/:iouType/amount/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/amount/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/amount/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_TAX_RATE: {
route: 'create/:iouType/taxRate/:transactionID/:reportID?',
Expand All @@ -333,52 +333,52 @@ const ROUTES = {
getUrlWithBackToParam(`create/${iouType}/taxAmount/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_CATEGORY: {
route: 'create/:iouType/category/:transactionID/:reportID/',
route: 'create/:iouType/category/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/category/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/category/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_CURRENCY: {
route: 'create/:iouType/currency/:transactionID/:reportID/:pageIndex?/',
route: 'create/:iouType/currency/:transactionID/:reportID/:pageIndex?',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, pageIndex = '', backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/currency/${transactionID}/${reportID}/${pageIndex}`, backTo),
},
MONEY_REQUEST_STEP_DATE: {
route: 'create/:iouType/date/:transactionID/:reportID/',
route: 'create/:iouType/date/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/date/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/date/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_DESCRIPTION: {
route: 'create/:iouType/description/:transactionID/:reportID/',
route: 'create/:iouType/description/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/description/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/description/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_DISTANCE: {
route: 'create/:iouType/distance/:transactionID/:reportID/',
route: 'create/:iouType/distance/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/distance/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/distance/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_MERCHANT: {
route: 'create/:iouType/merchant/:transactionID/:reportID/',
route: 'create/:iouType/merchant/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/merchant/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/merchant/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_PARTICIPANTS: {
route: 'create/:iouType/participants/:transactionID/:reportID/',
route: 'create/:iouType/participants/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/participants/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/participants/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_SCAN: {
route: 'create/:iouType/scan/:transactionID/:reportID/',
route: 'create/:iouType/scan/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/scan/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/scan/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_TAG: {
route: 'create/:iouType/tag/:transactionID/:reportID/',
route: 'create/:iouType/tag/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/tag/${transactionID}/${reportID}/`, backTo),
getUrlWithBackToParam(`create/${iouType}/tag/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_WAYPOINT: {
route: 'create/:iouType/waypoint/:transactionID/:reportID/:pageIndex/',
route: 'create/:iouType/waypoint/:transactionID/:reportID/:pageIndex',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, pageIndex = '', backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/waypoint/${transactionID}/${reportID}/${pageIndex}`, backTo),
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function AttachmentModal(props) {
const [isAuthTokenRequired, setIsAuthTokenRequired] = useState(props.isAuthTokenRequired);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState('');
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState(null);
const [source, setSource] = useState(props.source);
const [source, setSource] = useState(() => props.source);
const [modalType, setModalType] = useState(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE);
const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false);
const [confirmButtonFadeAnimation] = useState(() => new Animated.Value(1));
Expand Down Expand Up @@ -362,7 +362,7 @@ function AttachmentModal(props) {
}, []);

useEffect(() => {
setSource(props.source);
setSource(() => props.source);
}, [props.source]);

useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/BaseMiniContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DomUtils from '@libs/DomUtils';
import getButtonState from '@libs/getButtonState';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import Tooltip from './Tooltip/PopoverAnchorTooltip';

Expand Down Expand Up @@ -66,6 +67,7 @@ function BaseMiniContextMenuItem({tooltipText, onPress, children, isDelayButtonS
event.preventDefault();
}}
accessibilityLabel={tooltipText}
role={CONST.ROLE.BUTTON}
style={({hovered, pressed}) => [
styles.reportActionContextMenuMiniButton,
StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed, isDelayButtonStateComplete)),
Expand Down
6 changes: 3 additions & 3 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,16 @@ function Button(

const keyboardShortcutCallback = useCallback(
(event?: GestureResponderEvent | KeyboardEvent) => {
if (!validateSubmitShortcut(isFocused, isDisabled, isLoading, event)) {
if (!validateSubmitShortcut(isDisabled, isLoading, event)) {
return;
}
onPress();
},
[isDisabled, isFocused, isLoading, onPress],
[isDisabled, isLoading, onPress],
);

useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, keyboardShortcutCallback, {
isActive: pressOnEnter && !shouldDisableEnterShortcut,
isActive: pressOnEnter && !shouldDisableEnterShortcut && isFocused,
shouldBubble: allowBubble,
priority: enterKeyEventListenerPriority,
shouldPreventDefault: false,
Expand Down
5 changes: 2 additions & 3 deletions src/components/Button/validateSubmitShortcut/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import type ValidateSubmitShortcut from './types';
/**
* Validate if the submit shortcut should be triggered depending on the button state
*
* @param isFocused Whether Button is on active screen
* @param isDisabled Indicates whether the button should be disabled
* @param isLoading Indicates whether the button should be disabled and in the loading state
* @return Returns `true` if the shortcut should be triggered
*/

const validateSubmitShortcut: ValidateSubmitShortcut = (isFocused, isDisabled, isLoading) => {
if (!isFocused || isDisabled || isLoading) {
const validateSubmitShortcut: ValidateSubmitShortcut = (isDisabled, isLoading) => {
if (isDisabled || isLoading) {
return false;
}

Expand Down
5 changes: 2 additions & 3 deletions src/components/Button/validateSubmitShortcut/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import type ValidateSubmitShortcut from './types';
/**
* Validate if the submit shortcut should be triggered depending on the button state
*
* @param isFocused Whether Button is on active screen
* @param isDisabled Indicates whether the button should be disabled
* @param isLoading Indicates whether the button should be disabled and in the loading state
* @param event Focused input event
* @returns Returns `true` if the shortcut should be triggered
*/

const validateSubmitShortcut: ValidateSubmitShortcut = (isFocused, isDisabled, isLoading, event) => {
const validateSubmitShortcut: ValidateSubmitShortcut = (isDisabled, isLoading, event) => {
const eventTarget = event?.target as HTMLElement;
if (!isFocused || isDisabled || isLoading || eventTarget.nodeName === 'TEXTAREA') {
if (isDisabled || isLoading || eventTarget.nodeName === 'TEXTAREA') {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/validateSubmitShortcut/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {GestureResponderEvent} from 'react-native';

type ValidateSubmitShortcut = (isFocused: boolean, isDisabled: boolean, isLoading: boolean, event?: GestureResponderEvent | KeyboardEvent) => boolean;
type ValidateSubmitShortcut = (isDisabled: boolean, isLoading: boolean, event?: GestureResponderEvent | KeyboardEvent) => boolean;

export default ValidateSubmitShortcut;
2 changes: 1 addition & 1 deletion src/components/CheckboxWithLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type CheckboxWithLabelProps = RequiredLabelProps & {
/** Error text to display */
errorText?: string;

/** Value for checkbox. This prop is intended to be set by Form.js only */
/** Value for checkbox. This prop is intended to be set by FormProvider only */
value?: boolean;

/** The default value for the checkbox */
Expand Down
34 changes: 32 additions & 2 deletions src/components/DatePicker/CalendarPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,44 @@ class CalendarPicker extends React.PureComponent {
* Handles the user pressing the previous month arrow of the calendar picker.
*/
moveToPrevMonth() {
this.setState((prev) => ({currentDateView: subMonths(new Date(prev.currentDateView), 1)}));
this.setState((prev) => {
const prevMonth = subMonths(new Date(prev.currentDateView), 1);
// if year is subtracted, we need to update the years list
let newYears = prev.years;
if (prevMonth.getFullYear() < prev.currentDateView.getFullYear()) {
newYears = _.map(prev.years, (item) => ({
...item,
isSelected: item.value === prevMonth.getFullYear(),
}));
}

return {
currentDateView: prevMonth,
years: newYears,
};
});
}

/**
* Handles the user pressing the next month arrow of the calendar picker.
*/
moveToNextMonth() {
this.setState((prev) => ({currentDateView: addMonths(new Date(prev.currentDateView), 1)}));
this.setState((prev) => {
const nextMonth = addMonths(new Date(prev.currentDateView), 1);
// if year is added, we need to update the years list
let newYears = prev.years;
if (nextMonth.getFullYear() > prev.currentDateView.getFullYear()) {
newYears = _.map(prev.years, (item) => ({
...item,
isSelected: item.value === nextMonth.getFullYear(),
}));
}

return {
currentDateView: nextMonth,
years: newYears,
};
});
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(

if (waypoints.length === 1) {
cameraRef.current?.setCamera({
zoomLevel: 15,
zoomLevel: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
animationDuration: 1500,
centerCoordinate: waypoints[0].coordinate,
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
if (waypoints.length === 1) {
mapRef.flyTo({
center: waypoints[0].coordinate,
zoom: CONST.MAPBOX.DEFAULT_ZOOM,
zoom: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
});
return;
}
Expand Down
Loading

0 comments on commit 1470c83

Please sign in to comment.