Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked most of the Kotlin FxA wrapper
Renamed the class from `PersistedFirefoxAccount` to `FxaClient` because class is now adding more functionality than just persistance. The main reason I chose `FxaClient` was that it doesn't conflict with any of the other class names. Added a state machine, similar to the android-components one but more lightweight. Applications send FxaActions the client sends them back FxaEvents. Everything happens in a single async task that reads actions from a channel and processing things serially. Well, that was the goal at least, there's a few places where we need break this model to make things work with the existing firefox-android code. See StateTypes.kt for details. Most getter functions are now async, using `withContext` plus a application-supplied `CoroutineContext`. Some getter functions are advertised as blocking because they don't make network requests. I don't think this is completely accurate (#5819), but I made this sync functions since that's what the application expects. Implemented a simple form of network retry / automatic auth checking. I'm not sure if this is the correct logic, but it should be simple to modify. Added functions to manually test this, the plan is to hook them up to the secret debug menu an Android. Updated sync_local_device_info to accept a None value for display name. This updates the device type/commands, then returns a LocalDevice record with the display name filled in from the server response. This is what we firefox-android needs for its startup. Switched to using FxaConfig and FxaServer directly. Don't persist the state on startup with a Config. This doesn't work on firefox-android since the state persistence callback is not setup on the layer above us. It also doesn't make much sense to save the state before any action has been taken -- you can always reproduce that state by starting with a new config.
- Loading branch information