[identity] Create function to determine primary device
Summary:
Resolves ENG-5287. Implements a function that determines which device should be primary basing on user's current devices.
Depends on D10399
Test Plan: Unit tests covering all cases from the ENG-5844 testing task.
Reviewers: michal, varun
Reviewed By: varun
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D10400