-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(suite): update passphrase flow #16937
base: develop
Are you sure you want to change the base?
Conversation
4376924
to
afe72d5
Compare
I know the PR is not published. I have was analyzing test fails and notices these. You have added a new button to the wallet switcher but duplicated a testId. The playwright tests are now failing becuase they detect two elements with same testId instead of one. |
2a6ab88
to
952e6e7
Compare
9dd4594
to
3c677d7
Compare
🚀 Expo preview is ready!
|
const selectedDevice = useSelector(selectSelectedDevice); | ||
const dispatch = useDispatch(); | ||
const { setPassphraseState, setIsExisting } = usePassphraseModalContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This context keeps the passphrase state and identification if we went through isExisting branch in the state machine. Theoretically this info can be extracted also from passphraseState.
E.g.: not-exist-enter-passphrase
state should have isExisting = false
Should I do it? WDYT?
} | ||
}; | ||
|
||
export const PassphraseFlow = () => <ModalSwitcher />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy about this component, but honestly, I don't know how to do it better. It's not proper refactoring, just moving related components to one specific place. It should be refactored in the future.
|
||
<ModalSwitcher /> | ||
<PassphraseFlow /> | ||
<AppShortcuts /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be inside of PassphraseModalProvider
context
firmware: FirmwareUpdate, | ||
'firmware-type': FirmwareType, | ||
'firmware-custom': FirmwareCustom, | ||
version: Version, | ||
bridge: BridgeUnavailable, | ||
'bridge-requested': BridgeRequested, | ||
udev: UdevRules, | ||
'switch-device': SwitchDevice, | ||
'switch-device': null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled in PassphraseFlow
// Passphrase on host | ||
case UI.REQUEST_PASSPHRASE: | ||
return <PassphraseModal device={device} />; | ||
|
||
case 'WordRequestType_Plain': | ||
return <WordModal renderer={renderer} />; | ||
case 'WordRequestType_Matrix6': | ||
return <WordAdvancedModal count={6} renderer={renderer} />; | ||
case 'WordRequestType_Matrix9': | ||
return <WordAdvancedModal count={9} renderer={renderer} />; | ||
// T2T1 firmware | ||
case UI.REQUEST_PASSPHRASE_ON_DEVICE: | ||
case 'ButtonRequest_PassphraseEntry': | ||
return <PassphraseOnDeviceModal device={device} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to PassphraseFlow
} | ||
|
||
// first step of adding passphrase wallet from switch device modal | ||
return <PassphraseDefaultForm />; | ||
throw new Error('Unexpected passphrase state'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should never happen
}} | ||
data-testid="@passphrase-confirmation/step2-button" | ||
> | ||
<Button isFullWidth onClick={onNext} data-testid="@passphrase-confirmation/step2-button"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming of some buttons is not valid anymore. We should rename it
@@ -27,7 +27,6 @@ import { | |||
ImportTransactionModal, | |||
MetadataProviderModal, | |||
MoreRoundsNeededModal, | |||
PassphraseDuplicateModal, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to PassphraseFlow
4e2c45d
to
b35f285
Compare
deebe4c
to
4cb3e67
Compare
4cb3e67
to
e763869
Compare
The problem
There are two entry points for showing modal:
PassphraseModal
(called by Trezor hardware device)SwitchDevice
(shown by us in Suite)Unfortunately part of the flow is handled in
PassphraseModal
and part of it inSwitchDevice
.Diagram
What happened in this PR
PassphraseModalContext
for keeping the current state. It allows custom order without specific contextRelated Issue
Resolve #15794