diff --git a/packages/suite/src/actions/recovery/recoveryActions.ts b/packages/suite/src/actions/recovery/recoveryActions.ts index 951e838c9bbb..cc6cd18e18ab 100644 --- a/packages/suite/src/actions/recovery/recoveryActions.ts +++ b/packages/suite/src/actions/recovery/recoveryActions.ts @@ -8,6 +8,7 @@ import * as routerActions from 'src/actions/suite/routerActions'; import { Dispatch, GetState } from 'src/types/suite'; import { WordCount } from 'src/types/recovery'; import { DEFAULT_PASSPHRASE_PROTECTION } from 'src/constants/suite/device'; +import { isRecoveryInProgress } from '../../utils/device/isRecoveryInProgress'; export type SeedInputStatus = | 'initial' @@ -167,7 +168,7 @@ const rerun = () => async (dispatch: Dispatch, getState: GetState) => { const features = response.payload; - if (!features.recovery_mode) { + if (!isRecoveryInProgress(features.recovery_status)) { return; } diff --git a/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts b/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts index 16ff0d5fc773..a17a3807fa1d 100644 --- a/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts +++ b/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts @@ -7,6 +7,7 @@ import { SUITE } from 'src/actions/suite/constants'; import * as recoveryActions from 'src/actions/recovery/recoveryActions'; import * as onboardingActions from 'src/actions/onboarding/onboardingActions'; import { AppState, Action, Dispatch } from 'src/types/suite'; +import { isRecoveryInProgress } from '../../utils/device/isRecoveryInProgress'; const recovery = (api: MiddlewareAPI) => @@ -31,7 +32,7 @@ const recovery = if ( deviceActions.updateSelectedDevice.match(action) && - action.payload?.features?.recovery_mode && + isRecoveryInProgress(action.payload?.features?.recovery_status) && recovery.status !== 'in-progress' ) { api.dispatch( @@ -41,7 +42,7 @@ const recovery = }), ); if (!analytics.confirmed) { - // If you connect T2T1 in recovery mode to fresh Suite, you should see analytics optout option first. + // If you connect T2T1 in recovery mode to fresh Suite, you should see analytics opt-out option first. api.dispatch(recoveryActions.setStatus('in-progress')); } else { api.dispatch(recoveryActions.rerun()); diff --git a/packages/suite/src/utils/device/isRecoveryInProgress.ts b/packages/suite/src/utils/device/isRecoveryInProgress.ts new file mode 100644 index 000000000000..c20348f44173 --- /dev/null +++ b/packages/suite/src/utils/device/isRecoveryInProgress.ts @@ -0,0 +1,4 @@ +import { PROTO } from '@trezor/connect'; + +export const isRecoveryInProgress = (recoveryStatus: PROTO.RecoveryStatus | undefined) => + recoveryStatus !== undefined && recoveryStatus !== PROTO.RecoveryStatus.NoRecovery; diff --git a/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx b/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx index e65e9af6ad6c..7e7dfbc9ee68 100644 --- a/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx @@ -17,10 +17,12 @@ const doesSupportMultiShare = (device: TrezorDevice | undefined): boolean => { return false; } - if (!device.features.capabilities?.includes('Capability_ShamirGroups')) { + if (!device.features.capabilities?.includes('Capability_Shamir')) { return false; } + // TODO: Add IF to cover `is_extendable` flag/case + return ( device.features.backup_type !== null && ['Slip39_Basic', 'Slip39_Advanced'].includes(device.features.backup_type) diff --git a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx index 86c0e80d98a8..38433d63f296 100644 --- a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx @@ -29,12 +29,14 @@ import { WipeDevice } from './WipeDevice'; import { ChangeLanguage } from './ChangeLanguage'; import { EnableViewOnly } from './EnableViewOnly'; import { selectSuiteFlags } from 'src/reducers/suite/suiteReducer'; +import { isRecoveryInProgress } from '../../../utils/device/isRecoveryInProgress'; const deviceSettingsUnavailable = (device?: TrezorDevice, transport?: Partial) => { const noTransportAvailable = transport && !transport.type; const wrongDeviceType = device?.type && ['unacquired', 'unreadable'].includes(device.type); const wrongDeviceMode = - (device?.mode && ['seedless'].includes(device.mode)) || device?.features?.recovery_mode; + (device?.mode && ['seedless'].includes(device.mode)) || + isRecoveryInProgress(device?.features?.recovery_status); const firmwareUpdateRequired = device?.firmware === 'required'; return noTransportAvailable || wrongDeviceType || wrongDeviceMode || firmwareUpdateRequired;