From 2a194b84f3104190433a514bd410db1ca9e4f1c7 Mon Sep 17 00:00:00 2001 From: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com> Date: Fri, 16 Feb 2024 09:49:12 -0300 Subject: [PATCH] chore: add logs to identify root cause of issue reported in #1507 (#8414) --- app/components/Views/LockScreen/index.js | 9 ++++++++- app/components/Views/Login/index.js | 13 +++++++++++++ app/components/Views/ManualBackupStep1/index.js | 2 ++ .../Views/RestoreWallet/WalletRestored.tsx | 6 ++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/components/Views/LockScreen/index.js b/app/components/Views/LockScreen/index.js index f8f0284a741..96a1542ab28 100644 --- a/app/components/Views/LockScreen/index.js +++ b/app/components/Views/LockScreen/index.js @@ -133,8 +133,15 @@ class LockScreen extends PureComponent { async unlockKeychain() { const { bioStateMachineId } = this.props; try { - // Retreive the credentials + // Retrieve the credentials Logger.log('Lockscreen::unlockKeychain - getting credentials'); + + // Log to provide insights into bug research. + // Check https://github.com/MetaMask/mobile-planning/issues/1507 + const { selectedAddress } = this.props; + if (typeof selectedAddress !== 'string') { + Logger.error('unlockKeychain error', 'selectedAddress is not a string'); + } await Authentication.appTriggeredAuth({ selectedAddress: this.props.selectedAddress, bioStateMachineId, diff --git a/app/components/Views/Login/index.js b/app/components/Views/Login/index.js index 9e109aa3bc8..d7825b3393d 100644 --- a/app/components/Views/Login/index.js +++ b/app/components/Views/Login/index.js @@ -366,6 +366,13 @@ class Login extends PureComponent { ); try { + // Log to provide insights into bug research. + // Check https://github.com/MetaMask/mobile-planning/issues/1507 + const { selectedAddress } = this.props; + if (typeof selectedAddress !== 'string') { + Logger.error('Login error', 'selectedAddress is not a string'); + } + await Authentication.userEntryAuth( password, authType, @@ -435,6 +442,12 @@ class Login extends PureComponent { const { current: field } = this.fieldRef; field?.blur(); try { + // Log to provide insights into bug research. + // Check https://github.com/MetaMask/mobile-planning/issues/1507 + const { selectedAddress } = this.props; + if (typeof selectedAddress !== 'string') { + Logger.error('unlockKeychain error', 'selectedAddress is not a string'); + } await Authentication.appTriggeredAuth({ selectedAddress: this.props.selectedAddress, }); diff --git a/app/components/Views/ManualBackupStep1/index.js b/app/components/Views/ManualBackupStep1/index.js index 952de38fb1d..2f08b053f69 100644 --- a/app/components/Views/ManualBackupStep1/index.js +++ b/app/components/Views/ManualBackupStep1/index.js @@ -15,6 +15,7 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view import FeatherIcons from 'react-native-vector-icons/Feather'; import { BlurView } from '@react-native-community/blur'; import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english'; +import Logger from '../../../util/Logger'; import { baseStyles } from '../../../styles/common'; import StyledButton from '../../UI/StyledButton'; import OnboardingProgress from '../../UI/OnboardingProgress'; @@ -81,6 +82,7 @@ const ManualBackupStep1 = ({ route, navigation, appTheme }) => { setView(CONFIRM_PASSWORD); } } catch (e) { + Logger.error('Error trying to recover SRP from keyring-controller'); setView(CONFIRM_PASSWORD); } } diff --git a/app/components/Views/RestoreWallet/WalletRestored.tsx b/app/components/Views/RestoreWallet/WalletRestored.tsx index 78c90d211de..bdab7d609f2 100644 --- a/app/components/Views/RestoreWallet/WalletRestored.tsx +++ b/app/components/Views/RestoreWallet/WalletRestored.tsx @@ -13,6 +13,7 @@ import Text, { TextVariant, } from '../../../component-library/components/Texts/Text'; import StyledButton from '../../UI/StyledButton'; +import Logger from '../../../util/Logger'; import { createNavigationDetails } from '../../../util/navigation/navUtils'; import Routes from '../../../constants/navigation/Routes'; import { SafeAreaView } from 'react-native-safe-area-context'; @@ -49,6 +50,11 @@ const WalletRestored = () => { const finishWalletRestore = useCallback(async (): Promise => { try { + // Log to provide insights into bug research. + // Check https://github.com/MetaMask/mobile-planning/issues/1507 + if (typeof selectedAddress !== 'string') { + Logger.error('Wallet restore error', 'selectedAddress is not a string'); + } await Authentication.appTriggeredAuth({ selectedAddress }); navigation.replace(Routes.ONBOARDING.HOME_NAV); } catch (e) {