Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository Pattern + Related Thoughts #114

Open
jguerinet opened this issue Mar 7, 2019 · 0 comments
Open

Repository Pattern + Related Thoughts #114

jguerinet opened this issue Mar 7, 2019 · 0 comments
Assignees

Comments

@jguerinet
Copy link
Owner

I'm in the middle of reworking the Courses section to follow MVVM and I'm trying to introduce the Repository pattern to handle network refreshes etc. You can see my work on this branch, specifically CoursesViewModel, CourseRepository, and CoursesActivity. A couple of things that I'm still working out:

  • I have yet to report back any errors from the CourseRepository back to the Activity. This has a significant impact because some errors should kick the user out, and some should display an error message. I was reading up and it looks like the consensus is to wrap your object within some sort of Result object, with the state attached to it, an an optional error. Thoughts?
  • I also need to report back when the loading has been finished, to know when to hide my progress bar within the toolbar. If we go with the solution above, this should cover this.
  • The adapter needs two pieces of information to display its cells: whether the user can unregister from terms, and the courses to show. This is problematic as these are 2 different pieces of observable data, meaning that you will either update the adapter twice, or you will hope that the first observable has been properly updated before observing the second observable and updating the adapter. I'm wondering what the right way of doing this.

You can find relevant sections for these three points as TODOs, 2 within CoursesActivity, and 1 within CourseRepository. Any thoughts on any of these three points would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants