This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
LIVE-590 Remove device connection hold after timeout #4848
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🦒 Context (issues, jira)
https://ledgerhq.atlassian.net/browse/LIVE-590
💻 Description / Demo (image or video)
After literally two months of iterations and releases this is the first time the PR for testing this feature is actually pointing at released versions of the dependencies. The code for live-common
v21.35.0
LedgerHQ/ledger-live-common#1735 made it to the last version and the changes at the transport level made it tov6.26.0
LedgerHQ/ledgerjs#797 (possible earlier, but they're definitely there)Without this PR the functionality of the USB hold should remain unchanged. This PR introduces a locking/unlocking mechanism that is triggered when we start/end a
withDevice
code block. From my testing this allows us to not be able to connect while a long running task is happening such as an add account flow but as soon as the flow finishes +5s the hold is released and we no longer prevent users from connecting.This was mostly targeting metamask users on mac in the first place.
🖤 Expectations to reach
PR must pass CI, rebase develop if conflicts. Thanks!
How to test this (copied from #4764)
Same as the original PR, the context of this is still making sure that we don't keep control of the HID connection after we are done with the device. Just be sure that the failing tests (long add accounts on Cosmos, or a complex send) also work. The device should be connectable after 5 seconds when we are no longer interacting with it from https://repl.ledger.tools/ on chrome.
In particular, check what happens with flows if we leave the device idle for more than 5 seconds after the action is completed. I noticed the add accounts flow will throw an error when we disconnect even though we are no longer interacting with the device. Perhaps other flows have this same behavior and we'd need to adapt the UX to it (ie, if the action is done, ignore the error basically)