Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/libs/Navigation/useNavigateTo3DSAuthorizationChallenge.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {findFocusedRoute} from '@react-navigation/native';
import {useEffect, useMemo} from 'react';
import AuthorizeTransaction from '@components/MultifactorAuthentication/config/scenarios/AuthorizeTransaction';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import AuthorizeTransaction from '@components/MultifactorAuthentication/config/scenarios/AuthorizeTransaction';
import {allowedAuthenticationMethods} from '@components/MultifactorAuthentication/config/scenarios/AuthorizeTransaction';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually doesn't work here, since it's an object as a default export rather than a set of named exports. Some JS bundlers will allow it anyway because they don't differentiate between an object and a module, but ours doesn't seem to allow it.

import useNativeBiometrics from '@components/MultifactorAuthentication/Context/useNativeBiometrics';
import useOnyx from '@hooks/useOnyx';
import useRootNavigationState from '@hooks/useRootNavigationState';
Expand Down Expand Up @@ -99,12 +100,9 @@ function useNavigateTo3DSAuthorizationChallenge() {
return;
}

// Note: Importing AuthorizeTransaction in this file causes the browser to get stuck in an infinite reload loop
// Issue to fix this: https://github.com/Expensify/App/issues/83021
// TODO: when adding Passkey support, update this list and the switch below.
// TODO: when adding Passkey support, update the switch-case below.
// Passkey issue: https://github.com/expensify/app/issues/79470
const allowedAuthenticationMethods = [CONST.MULTIFACTOR_AUTHENTICATION.TYPE.BIOMETRICS];
const doesDeviceSupportAnAllowedAuthenticationMethod = allowedAuthenticationMethods.some((method) => {
const doesDeviceSupportAnAllowedAuthenticationMethod = AuthorizeTransaction.allowedAuthenticationMethods.some((method) => {
Comment thread
chuckdries marked this conversation as resolved.
switch (method) {
case CONST.MULTIFACTOR_AUTHENTICATION.TYPE.BIOMETRICS:
return doesDeviceSupportBiometrics();
Expand All @@ -128,7 +126,7 @@ function useNavigateTo3DSAuthorizationChallenge() {
// the old value and react will run a second effect with the new value. Typescript doesn't know that Onyx treats the object as
// immutable, so we must guard against transactionID becoming undefined again, even though we know it won't be.
if (!transactionPending3DSReview?.transactionID) {
Log.info('[useNavigateTo3DSAuthorizationChallenge] Ignoring navigation - typeguard bail-out (should be impossible to reach)');
Log.info('[useNavigateTo3DSAuthorizationChallenge] Ignoring navigation - type guard bail-out (should be impossible to reach)');
return;
}

Expand Down
Loading