Add screens to sign-in to Mozilla Accounts via OAuth
Sign-in screen
Add a screen to sign into Mozilla Accounts. If the user doesn't have an account yet, they can click a link to create one. This could look similar to the "Sync and save your data" screen from Firefox for Android.
As a first step we only want to support the option to sign in via email. Later we also want to support the QR code option.
Choosing "sign in" or "create a new account" will open a web flow that handles the use cases. Once done, the browser will redirect to the app and in most cases the user will be signed in. Many of the error cases (e.g. wrong password) are handled by the web flow. However, in some cases the web flow redirects to the app with an error code/message. In this case we need to display the error to the user. I'd like to avoid using a separate screen for this because then we'd also have to worry about navigation. Instead, I'd like for us to display the error message in this "sign in" screen. This way the user can easily try again or create a new account.
We want to use a custom browser tab if the default browser supports that. Otherwise we'll open the user's default browser.
Notes for QA:
- Make sure this works if using a Google or Apple account when signing in.
- Make sure this works if the default browser is Firefox and the user is already signed in to Mozilla Accounts.
Post sign-in screens
After signing in the user should be able to select which data to sync. As a first step the Android app will only be able to sync email accounts and optionally their passwords.
There's a couple of different cases to consider:
- User signs in when first setting up the app, but the sync storage is empty. We should inform the user why this action had no immediate benefit (but that accounts created in the future will be synced automatically) and then send them to the regular account setup flow.
- User signs in when first setting up the app and there's remote email accounts that could be synced to the device.
- If the user selects at least one account to be synced to the device we can redirect them to the permissions screen as the last step of account setup.
- If the user doesn't select any account to sync, we send them to the regular account setup flow (similar to case 1).
- User signs in after the app has been set up, i.e. there's at least one local account. What's special about this case is that there could be local accounts that should not be synced (to the server), and there could be remote accounts that should not be synced from the server to this device. We probably want to visually distinguish these accounts.
When there's at least one account (cases 2 and 3), the screen could look something like this:
Email accounts to sync:
- [x] [email protected]
- [x] Passwords
- [ ] [email protected] (local)
- [ ] [email protected] (remote)
Continue button