In the lectures we've seen how to work with Retrofit to consume REST APIs. You need to apply that knowledge to integrate Signup and Related Products APIs.
You can use the Insomnia workspace to see the request and response formats.
Also we couldn't find any chance to add the circular progress indicator to our app, in this assignment you also need to add that.
Finally, you need to handle session related stuff (skipping login flow until the user logs out).
Todo
Signup API
Send request to /auth/local/register when user tries to sign up and all client side validations pass.
Handle the response and..
if it's successful save the jwt and navigate to product list screen, popping all the backstack.
for errors with 4XX status code display the returned message in a Snackbar.
for other status codes display Unexpected error occurred in a Snackbar.
Handle other connectivity problems (eg. device is not connected to internet) and show this message in a Snackbar: Please check your connection and try again.
Related Products
Make api request to /related-products/:id where :id is the id of the product displayed.
Handle 401 status code and navigate to login screen in that case.
When the returned list is empty (there is no related products to the product queried) then hide the related products title TextView and the RecyclerView.
When the returned list is non-empty fill the RecyclerView with the given list.
Circular Progress Indicator
In Product List screen show a circular progress indicator until the list is loaded.
In Product Detail screen show a circular progress indicator until the product detail and the related products are both loaded.
Logout Action
Add a menu which is visible only in Product List screen and show a logout action in the overflow menu.
When user selects this menu item, delete the token and navigate to login popping all the back stack.
Skip login flow when user is logged in
When user successfully logs in or signs up, do not show Signup or Login screens to the user anymore until the user logs out.
Background
In the lectures we've seen how to work with Retrofit to consume REST APIs. You need to apply that knowledge to integrate Signup and Related Products APIs.
You can use the Insomnia workspace to see the request and response formats.
Also we couldn't find any chance to add the circular progress indicator to our app, in this assignment you also need to add that.
Finally, you need to handle session related stuff (skipping login flow until the user logs out).
Todo
Signup API
/auth/local/register
when user tries to sign up and all client side validations pass.Unexpected error occurred
in a Snackbar.Please check your connection and try again.
Related Products
/related-products/:id
where :id is the id of the product displayed.Circular Progress Indicator
Logout Action
Skip login flow when user is logged in