Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonals committed Apr 18, 2024
2 parents aa3a0cd + a96cc01 commit 1da8fd1
Show file tree
Hide file tree
Showing 15 changed files with 428 additions and 445 deletions.
4 changes: 3 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4341,8 +4341,10 @@ const CONST = {
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;

type IOUType = ValueOf<typeof CONST.IOU.TYPE>;
type IOUAction = ValueOf<typeof CONST.IOU.ACTION>;

export type {Country, IOUType};
export type {Country, IOUAction, IOUType};

export default CONST;
100 changes: 46 additions & 54 deletions src/ROUTES.ts

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/components/AttachmentPicker/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ function AttachmentPicker({type = CONST.ATTACHMENT_PICKER_TYPE.FILE, children, s
const validateAndCompleteAttachmentSelection = useCallback(
(fileData: FileResponse) => {
// Check if the file dimensions indicate corruption
// The width/height for corrupt file is -1 on android native and 0 on ios native
if (!fileData.width || !fileData.height || (fileData.width <= 0 && fileData.height <= 0)) {
// The width/height for a corrupted file is -1 on android native and 0 on ios native
// We must check only numeric values because the width/height can be undefined for non-image files
if ((typeof fileData.width === 'number' && fileData.width <= 0) || (typeof fileData.height === 'number' && fileData.height <= 0)) {
showImageCorruptionAlert();
return Promise.resolve();
}
Expand Down
12 changes: 5 additions & 7 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
Expand All @@ -24,6 +23,7 @@ import * as ReceiptUtils from '@libs/ReceiptUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import * as IOU from '@userActions/IOU';
import type {IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
Expand All @@ -45,8 +45,6 @@ import ShowMoreButton from './ShowMoreButton';
import Switch from './Switch';
import Text from './Text';

type IouType = ValueOf<typeof CONST.IOU.TYPE>;

type MoneyRequestConfirmationListOnyxProps = {
/** Collection of categories attached to a policy */
policyCategories: OnyxEntry<OnyxTypes.PolicyCategories>;
Expand All @@ -71,7 +69,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
onConfirm?: (selectedParticipants: Array<Participant | ReportUtils.OptionData>) => void;

/** Callback to parent modal to send money */
onSendMoney?: (paymentMethod: IouType | PaymentMethodType | undefined) => void;
onSendMoney?: (paymentMethod: IOUType | PaymentMethodType | undefined) => void;

/** Callback to inform a participant is selected */
onSelectParticipant?: (option: Participant) => void;
Expand All @@ -89,7 +87,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
iouCurrencyCode?: string;

/** IOU type */
iouType?: IouType;
iouType?: IOUType;

/** IOU date */
iouCreated?: string;
Expand Down Expand Up @@ -337,7 +335,7 @@ function MoneyRequestConfirmationList({
setDidConfirm(false);
}

const splitOrRequestOptions: Array<DropdownOption<IouType>> = useMemo(() => {
const splitOrRequestOptions: Array<DropdownOption<IOUType>> = useMemo(() => {
let text;
if (isSplitBill && iouAmount === 0) {
text = translate('iou.split');
Expand Down Expand Up @@ -472,7 +470,7 @@ function MoneyRequestConfirmationList({
};

const confirm = useCallback(
(paymentMethod: IouType | PaymentMethodType | undefined) => {
(paymentMethod: IOUType | PaymentMethodType | undefined) => {
if (!selectedParticipants.length) {
return;
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,
if (isOnHold) {
IOU.unholdRequest(iouTransactionID, report?.reportID);
} else {
if (!policy?.type) {
return;
}

const activeRoute = encodeURIComponent(Navigation.getActiveRouteWithoutParams());
Navigation.navigate(ROUTES.MONEY_REQUEST_HOLD_REASON.getRoute(policy?.type ?? '', iouTransactionID, report?.reportID, activeRoute));
Navigation.navigate(ROUTES.MONEY_REQUEST_HOLD_REASON.getRoute(policy.type, iouTransactionID, report?.reportID, activeRoute));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import {useIsFocused} from '@react-navigation/native';
import {format} from 'date-fns';
import Str from 'expensify-common/lib/str';
import React, {useCallback, useEffect, useMemo, useReducer, useRef, useState} from 'react';
import {View} from 'react-native';
import type {StyleProp, ViewStyle} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import {withOnyx} from 'react-native-onyx';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import usePrevious from '@hooks/usePrevious';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
import type {DefaultMileageRate} from '@libs/DistanceRequestUtils';
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
import * as IOUUtils from '@libs/IOUUtils';
import Log from '@libs/Log';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
Expand All @@ -29,10 +28,11 @@ import playSound, {SOUNDS} from '@libs/Sound';
import * as TransactionUtils from '@libs/TransactionUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import * as IOU from '@userActions/IOU';
import type {IOUAction, IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
import type {Participant} from '@src/types/onyx/IOU';
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';
Expand Down Expand Up @@ -92,7 +92,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
iouCurrencyCode?: string;

/** IOU type */
iouType?: ValueOf<typeof CONST.IOU.TYPE>;
iouType?: IOUType;

/** IOU date */
iouCreated?: string;
Expand Down Expand Up @@ -162,7 +162,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &

reportActionID?: string;

action?: ValueOf<typeof CONST.IOU.ACTION>;
action?: IOUAction;
};

const getTaxAmount = (transaction: OnyxEntry<OnyxTypes.Transaction>, defaultTaxValue: string) => {
Expand Down
18 changes: 6 additions & 12 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {IOUAction, IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type {Report, Transaction} from '@src/types/onyx';
Expand All @@ -8,13 +8,7 @@ import * as CurrencyUtils from './CurrencyUtils';
import Navigation from './Navigation/Navigation';
import * as TransactionUtils from './TransactionUtils';

function navigateToStartMoneyRequestStep(
requestType: IOURequestType,
iouType: ValueOf<typeof CONST.IOU.TYPE>,
transactionID: string,
reportID: string,
iouAction?: ValueOf<typeof CONST.IOU.ACTION>,
): void {
function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: IOUType, transactionID: string, reportID: string, iouAction?: IOUAction): void {
if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.MOVE) {
Navigation.goBack();
return;
Expand Down Expand Up @@ -134,7 +128,7 @@ function insertTagIntoTransactionTagsString(transactionTags: string, tag: string
return tagArray.join(CONST.COLON).replace(/:*$/, '');
}

function isMovingTransactionFromTrackExpense(action?: ValueOf<typeof CONST.IOU.ACTION>) {
function isMovingTransactionFromTrackExpense(action?: IOUAction) {
if (action === CONST.IOU.ACTION.MOVE || action === CONST.IOU.ACTION.SHARE || action === CONST.IOU.ACTION.CATEGORIZE) {
return true;
}
Expand All @@ -144,10 +138,10 @@ function isMovingTransactionFromTrackExpense(action?: ValueOf<typeof CONST.IOU.A

export {
calculateAmount,
updateIOUOwnerAndTotal,
insertTagIntoTransactionTagsString,
isIOUReportPendingCurrencyConversion,
isMovingTransactionFromTrackExpense,
isValidMoneyRequestType,
navigateToStartMoneyRequestStep,
insertTagIntoTransactionTagsString,
isMovingTransactionFromTrackExpense,
updateIOUOwnerAndTotal,
};
6 changes: 3 additions & 3 deletions src/libs/MoneyRequestUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import type {SelectedTabRequest} from '@src/types/onyx';

Expand Down Expand Up @@ -80,7 +80,7 @@ function replaceAllDigits(text: string, convertFn: (char: string) => string): st
/**
* Check if distance expense or not
*/
function isDistanceRequest(iouType: ValueOf<typeof CONST.IOU.TYPE>, selectedTab: OnyxEntry<SelectedTabRequest>): boolean {
function isDistanceRequest(iouType: IOUType, selectedTab: OnyxEntry<SelectedTabRequest>): boolean {
return iouType === CONST.IOU.TYPE.REQUEST && selectedTab === CONST.TAB_REQUEST.DISTANCE;
}

Expand All @@ -91,4 +91,4 @@ function isScanRequest(selectedTab: SelectedTabRequest): boolean {
return selectedTab === CONST.TAB_REQUEST.SCAN;
}

export {stripCommaFromAmount, stripDecimalsFromAmount, stripSpacesFromAmount, addLeadingZero, validateAmount, replaceAllDigits, isDistanceRequest, isScanRequest};
export {addLeadingZero, isDistanceRequest, isScanRequest, replaceAllDigits, stripCommaFromAmount, stripDecimalsFromAmount, stripSpacesFromAmount, validateAmount};
Loading

0 comments on commit 1da8fd1

Please sign in to comment.