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

Add Koin for dependency injection #560

Merged
merged 14 commits into from
Sep 15, 2020
Merged

Conversation

thornbill
Copy link
Member

Changes
Adds Koin for dependency injection and migrates some global app state to using it instead of referencing TvApp.

Issues
N/A

@thornbill thornbill marked this pull request as ready for review September 14, 2020 18:35
@nielsvanvelzen
Copy link
Member

I've started reviewing but it will take some time since there's a lot of changes.

@nielsvanvelzen nielsvanvelzen self-requested a review September 15, 2020 07:32
Copy link
Member

@nielsvanvelzen nielsvanvelzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I noticed a few places where get() was called multiple times instead of using a property for it but it was all in ugly Java classes so I don't care too much about those.

@thornbill
Copy link
Member Author

My general approach was to use inject if there were more than 1-2 usages of a dependency in a file except for when it was being used in a static public method. That seemed like a reasonable approach to me, but I’m new to Koin lol. 🤷‍♂️

@nielsvanvelzen
Copy link
Member

I don't see a problem with that, although I prefer using inject via properties everywhere (but I think you did that already in the Kotlin code)

Co-authored-by: Niels van Velzen <[email protected]>
Copy link
Contributor

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 1
- Added 1
           

Clones removed
==============
+ app/src/main/java/org/jellyfin/androidtv/ui/playback/CustomPlaybackOverlayFragment.java  -1
+ app/src/main/java/org/jellyfin/androidtv/ui/livetv/LiveTvGuideActivity.java  -1
         

See the complete overview on Codacy

@@ -56,11 +59,11 @@ class NextUpActivity : FragmentActivity() {
}

private suspend fun loadItemData(id: String) = withContext(Dispatchers.IO) {
val item = TvApp.getApplication().apiClient.getItem(id) ?: return@withContext null
val item = apiClient.getItem(id) ?: return@withContext null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nielsvanvelzen nielsvanvelzen merged commit d308991 into jellyfin:master Sep 15, 2020
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

Successfully merging this pull request may close these issues.

3 participants