diff --git a/packages/suite-web/e2e/tests/suite/passphrase-cancel.test.ts b/packages/suite-web/e2e/tests/suite/passphrase-cancel.test.ts index a13a6db01abb..6c932acb0723 100644 --- a/packages/suite-web/e2e/tests/suite/passphrase-cancel.test.ts +++ b/packages/suite-web/e2e/tests/suite/passphrase-cancel.test.ts @@ -18,7 +18,9 @@ describe('Passphrase cancel', () => { mnemonic: 'mnemonic_all', passphrase_protection: true, }); - cy.task('startBridge'); + + // using specific bridge version - older versions don't support 'cancel' button + cy.task('startBridge', '2.0.33'); cy.prefixedVisit('/'); cy.passThroughInitialRun(); cy.discoveryShouldFinish(); diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmActionModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmActionModal.tsx index 1a83d6c6f212..1700ab756a86 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmActionModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmActionModal.tsx @@ -1,8 +1,5 @@ -import { useIntl } from 'react-intl'; - import styled from 'styled-components'; -import TrezorConnect from '@trezor/connect'; import { H2, NewModal } from '@trezor/components'; import { ConfirmOnDevice } from '@trezor/product-components'; import { spacings } from '@trezor/theme'; @@ -10,7 +7,6 @@ import { spacings } from '@trezor/theme'; import { Translation } from 'src/components/suite/Translation'; import { DeviceConfirmImage } from 'src/components/suite'; import { TrezorDevice } from 'src/types/suite'; -import messages from 'src/support/messages'; const ImageWrapper = styled.div` display: flex; @@ -19,12 +15,10 @@ const ImageWrapper = styled.div` interface ConfirmActionProps { device: TrezorDevice; + onCancel?: () => void; } -export const ConfirmActionModal = ({ device }: ConfirmActionProps) => { - const intl = useIntl(); - const onCancel = () => TrezorConnect.cancel(intl.formatMessage(messages.TR_CANCELLED)); - +export const ConfirmActionModal = ({ device, onCancel }: ConfirmActionProps) => { return ( ) => { const device = useSelector(selectSelectedDevice); + const transport = useSelector(state => state.suite.transport); const intl = useIntl(); if (!device) return null; + const isBridge27 = transport?.type === 'BridgeTransport' && transport.version === '2.0.27'; const abort = () => TrezorConnect.cancel(intl.formatMessage(messages.TR_CANCELLED)); switch (windowType) { @@ -63,7 +65,7 @@ export const DeviceContextModal = ({ return ; } case 'ButtonRequest_Other': { - return ; + return ; } case 'ButtonRequest_FirmwareCheck': return ; @@ -74,14 +76,16 @@ export const DeviceContextModal = ({ case 'ButtonRequest_RecoveryHomepage': case 'ButtonRequest_MnemonicWordCount': case 'ButtonRequest_MnemonicInput': - case 'ButtonRequest_ProtectCall': case 'ButtonRequest_ResetDevice': // dispatched on BackupDevice call for T2T1, weird but true case 'ButtonRequest_ConfirmWord': // dispatched on BackupDevice call for T1B1 case 'ButtonRequest_WipeDevice': case 'ButtonRequest_UnknownDerivationPath': case 'ButtonRequest_FirmwareUpdate': case 'ButtonRequest_PinEntry': - return ; + return ; + // it appears that cancelling ButtonRequest_ProtectCall doesn't work using bridge 2.0.27. + case 'ButtonRequest_ProtectCall': + return ; case 'ButtonRequest_Address': return data ? (