[lib] Refactor useLogIn to be more generic
Summary:
useLogIn is a helper function internal to login-hooks.js. This diff refactors the helper function in preparation for a new use case that will be introduced in the next diff.
Right now useLogIn is coupled with the specific forms of login that it supports; this diff makes it more generic.
Depends on D12112
Test Plan: I tested the flow using staging, with my phone as a primary device and a local simulator as a secondary device
Reviewers: bartek, tomek
Reviewed By: bartek
Differential Revision: https://phab.comm.dev/D12113