Skip to content

Commit

Permalink
update according to all NAB suggestions.
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Gupta <[email protected]>
  • Loading branch information
Krishna2323 committed Mar 16, 2024
1 parent 6ba7f40 commit 6c6ed85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import * as Welcome from '@userActions/Welcome';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {HybridAppRoute, Route as Routes} from '@src/ROUTES';
import type {HybridAppRoute, Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import type Credentials from '@src/types/onyx/Credentials';
Expand Down Expand Up @@ -909,18 +909,18 @@ function waitForUserSignIn(): Promise<boolean> {
});
}

function handleExitToNavigation(exitTo: Routes | HybridAppRoute) {
function handleExitToNavigation(exitTo: Route | HybridAppRoute) {
InteractionManager.runAfterInteractions(() => {
waitForUserSignIn().then(() => {
Navigation.waitForProtectedRoutes().then(() => {
const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Routes);
const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Route);
Navigation.navigate(url);
});
});
});
}

function signInWithValidateCodeAndNavigate(accountID: number, validateCode: string, twoFactorAuthCode = '', exitTo?: Routes | HybridAppRoute) {
function signInWithValidateCodeAndNavigate(accountID: number, validateCode: string, twoFactorAuthCode = '', exitTo?: Route | HybridAppRoute) {
signInWithValidateCode(accountID, validateCode, twoFactorAuthCode);
if (exitTo) {
handleExitToNavigation(exitTo);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LogInWithShortLivedAuthTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {PublicScreensParamList} from '@libs/Navigation/types';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route as Routes} from '@src/ROUTES';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type {Account} from '@src/types/onyx';
Expand Down Expand Up @@ -64,7 +64,7 @@ function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedA

if (exitTo) {
Navigation.isNavigationReady().then(() => {
const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Routes);
const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : (exitTo as Route);
Navigation.navigate(url);
});
}
Expand Down
7 changes: 4 additions & 3 deletions src/pages/iou/request/step/IOURequestStepConfirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ function IOURequestStepConfirmation({
const transactionTaxCode = transaction.taxRate && transaction.taxRate.keyForList;
const transactionTaxAmount = transaction.taxAmount;
const requestType = TransactionUtils.getRequestType(transaction);
const headerTitle = () => {
const headerTitle = useMemo(() => {
if (iouType === CONST.IOU.TYPE.SPLIT) {
return translate('iou.split');
}
if (iouType === CONST.IOU.TYPE.SEND) {
return translate('common.send');
}
return translate(TransactionUtils.getHeaderTitleTranslationKey(transaction));
};
}, [iouType, transaction, translate]);

const participants = useMemo(
() =>
_.map(transaction.participants, (participant) => {
Expand Down Expand Up @@ -412,7 +413,7 @@ function IOURequestStepConfirmation({
{({safeAreaPaddingBottomStyle}) => (
<View style={[styles.flex1, safeAreaPaddingBottomStyle]}>
<HeaderWithBackButton
title={headerTitle()}
title={headerTitle}
onBackButtonPress={navigateBack}
shouldShowThreeDotsButton={requestType === CONST.IOU.REQUEST_TYPE.MANUAL && iouType === CONST.IOU.TYPE.REQUEST}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/iou/request/step/IOURequestStepParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ function IOURequestStepParticipants({
const goToNextStep = useCallback(
(selectedIouType) => {
const isSplit = selectedIouType === CONST.IOU.TYPE.SPLIT;
let nextStepIOUType;
let nextStepIOUType = CONST.IOU.TYPE.REQUEST;

if (isSplit && iouType !== CONST.IOU.TYPE.REQUEST) {
nextStepIOUType = CONST.IOU.TYPE.SPLIT;
} else {
nextStepIOUType = iouType === CONST.IOU.TYPE.SEND ? CONST.IOU.TYPE.SEND : CONST.IOU.TYPE.REQUEST;
} else if (iouType === CONST.IOU.TYPE.SEND) {
nextStepIOUType = CONST.IOU.TYPE.SEND;
}

IOU.setMoneyRequestTag(transactionID, '');
Expand Down

0 comments on commit 6c6ed85

Please sign in to comment.