googleinterns / play-movies-2020-intern

Apache License 2.0
1 stars 1 forks source link

Invoke server add account endpoint from app #45

Closed jackstenglein closed 4 years ago

jackstenglein commented 4 years ago

The main changes are in the Account and AccountRepository classes. The Account class now uses AutoValue and also has an added isPending field to indicate whether the account has been synced with the server. The AccountRepository addAccount function now sends a request to the server. If the request is successful, the account is added locally with isPending set to false. If the request fails, the account is added locally with isPending true.

The last big change is in the server's AccountController class. I changed the addAccounts return type to directly place the list in the body if the request is successful and directly place the error in the body if the request fails. This aligns more with how Retrofit's response parsing works. Because of this change, the AddAccountResponse class was no longer necessary and was deleted.

All other changes support the above changes.