Part of ENG-10094 and ENG-10103.
This is a more convenient way of using the same logic as in useCheckIfPrimaryDevice - it reduces the asynchronous nature of effects and allows for simplifying code. This is also more detailed because it returns an unknown value which is different from !isPrimary which could be interpreted as being a secondary device.
Using this hook should be safe and synced with the actual state because the primary can change in two scenarios:
- Device list updated - it is reactive to userDevicesInfos
- deviceID change - this can't be done without logging out, and this hook is reactive to loggedIn.
In the future, it should also be reactive to primary keys rotation, but this protocol is not yet implemented.
Depends on D14217