-
Notifications
You must be signed in to change notification settings - Fork 1
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
Chore
: Introduce ArtemisContext and ArtemisContextBasedService
#405
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice changes this makes already makes it a lot cleaner. I tried to go through all of the screens of the app and noticed that the pull to refresh is not working anymore in the Exercise Screen, it does not happen on develop
. Could you take a look?
Couldn't find issues in your code.
Nice catch, this should be fixed now :) |
Problem Description
Currently we have a lot of code duplication in the service implementations. Most prominently, the serverUrl and authToken is passed down to (almost) every single API call. This clutters the code, especially in the ViewModels.
This PR is the first of several planned PRs for introducing the new concept of an
ArtemisContext
and anArtemisContextBasedService
that does not need a serverUrl or authToken as function parameters. To keep the PR size in a manageable scale, there will be follow-up PRs dealing with the introduction of thisArtemisContext
to other services as well. For this first PR, I only applied the necassary changes to the Services defined in thecore:data
module.Changes
ArtemisContext
: Simple data class to keep track of serverUrl and authTokenArtemisContextProvider
: Provides a flow for tracking the latest contextArtemisContextBasedService
: Interface used by service definitions to indicate that the serverUrl and authToken are handled internally and not needed as function parametersArtemisContextBasedServiceImpl
: Implementation of the interface above. Provides convenient methods for API requests (taking care of the serverUrl and authToken in the background)Steps for testing
See the affected services in the commit messages and confirm that related functionality in the app still works