Well done! Now that you have understood Authentication and the First set of APIS we are ready to make a wrap up of the initial flow for Registration/Login.
1) Splash to Login
- You must first request Geolocation permission, this permission should be forced to be available always (not only when the app is in use), it does not need to be extremely accurate and can be obtained via Wifi or Cellular.
- If Location is not obtained within a reasonable period then you must alert user and re-request until it is obtained. The App cannot work without location permission and initial coordinates.
- Once the location is approved you should get DeviceID and Authorisation for FCM Push Notifications, this is an optional feature and the app can continue the flow regardless of availability.
- The initial login screen is displayed.
2) Auto-Login Attempt
This flow should be run prior to displaying the Login Form. It helps improve the user experience by attempting auto-login based on the availability of either the token or the user credentials.
3) Login to Registration
When user clicks on Create New Account from the Login View, the Register Form appears. Once completed, form is validated and submitted to newUser action, based on the result you will either display a toast with the error message and go back to the Form or if succesful, store local credentials and redirect back to Login, now with account created.
On the first cycle, there will NOT be a countryState (mktHandle) available so you won't be able to do Auto-Login since this variable is defined at Login. To make a better experience try to have the credentials simply Pre-populate the login fields so that user doesn't have to capture them again.
Also, once user submits Login form successfully, make sure you store tokenID and mktHandle locally so that you can automate login as defined in the previous story.
4) Login to Password Recovery
Password recovery is an off-line process that triggers an email with the password sent to the users registered account. Then the Login View is simply reloaded so that user can input the value that was received.
5) Login to Home
This is the core flow of the Login Process. It takes user credentials and market selection to generate a token, store locally and redirect to Home. We will see at a later step what does home mean based on the Info parsed from getProfile action that happens after a successful login.