BC-CS481-Capstone / ReturnPalsApp

0 stars 0 forks source link

login repo and view model #196

Closed andrew-pogue closed 5 months ago

andrew-pogue commented 5 months ago

the per-table repos still need work but the login one works

andrew-pogue commented 5 months ago

@emptyloot Thank you for your feedback. Session repo is not being used for anything yet. Session repository was my first approach to creating a repo that you can login and logout with. It was supposed to encapsulate AWS Cognito and Auth User Pools. Its implemented via call-backs which you said you preferred. I tried using the session repository in the login view-model but I was getting fatal java runtime errors (something about writing to memory i shouldn't be). So, I removed all calls to session repository and replaced it with login repository, which is implemented via kotlin coroutines and things just worked. I kept session repository around because I was thinking about converting it to a user repository. You talked earlier about removing the user table from the database and using cognito user pools instead, the code in session repo gets user data from cognito.

andrew-pogue commented 5 months ago

I was thinking the view model would only need to store state that needs to be shared with multiple screens. UI state that is specific to one screen and no other screen can be stored within the composable itself. I'll put the email/password back in.

For the login repo, I spent a lot of time (20+ hours or something) trying to get the coroutines to work so I dont want to just dump all that work and convert it to use call-back method instead of coroutines, its encapsulated so the caller doesn't have to think about coroutines as long as they use the view model.

You mentioned interfaces last time we talked so I changed the login view model in attempt to turn it into an interface but I did end up making things a little more jumbled