chore(suite-native): prepare one place for all global hooks #16444
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.
Description
We have multiple hooks that is supposed to be global and available everywhere, this is defining one place for those hooks.
We apparently have incorrectly placed hooks in the
AuthorizeDeviceStackNavigator
, namelyuseReportDeviceConnectToAnalytics
anduseDetectDeviceError
. TheAuthorizeDeviceStackNavigator
only mounts when connecting a Trezor that hasn't been remembered (view-only on). If the Trezor with view-only enabled was connected, it did not mount, and those hooks remained inactive.Notes for @trezor/qa
The only change that this PR is supposed to cause is that if you connect Trezor, that has view-only already enabled and have some error, it should show the alert. Previously it was ignored. So it can theoretically cause more Unacquired errors.
It makes sense to test connecting Trezor to the app in different scenarios (view-only enabled/disabled, welcome flow finished/fresh app, open app by connecting the Trezor...)
Followup to move and fix reporting of device connected to analytics #16446
Screenshots
Trezor connected at the first screen of Welcome flow, warning visible only after Welcome flow:
https://github.com/user-attachments/assets/f3a2f7f4-1494-484b-b44c-ed5f597f30c0