-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt koin annotation for list module
- Loading branch information
1 parent
a43df53
commit 9a6c1a3
Showing
9 changed files
with
36 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 12 additions & 53 deletions
65
.../main/java/com/codandotv/streamplayerapp/feature_list_streams/list/di/ListStreamModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,20 @@ | ||
package com.codandotv.streamplayerapp.feature_list_streams.list.di | ||
|
||
import com.codandotv.streamplayerapp.core_shared.qualifier.QualifierDispatcherIO | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.data.ListStreamRepository | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.data.ListStreamRepositoryImpl | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.data.ListStreamService | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.GetTopRatedStream | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.GetTopRatedStreamImpl | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.GetGenresUseCase | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.GetGenresUseCaseImpl | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.ListStreamAnalytics | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.ListStreamAnalyticsImpl | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.ListStreamUseCase | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.domain.ListStreamUseCaseImpl | ||
import com.codandotv.streamplayerapp.feature_list_streams.list.presentation.screens.ListStreamViewModel | ||
import org.koin.androidx.viewmodel.dsl.viewModel | ||
import org.koin.dsl.module | ||
import org.koin.core.annotation.ComponentScan | ||
import org.koin.core.annotation.Factory | ||
import org.koin.core.annotation.Module | ||
import org.koin.core.context.GlobalContext | ||
import retrofit2.Retrofit | ||
|
||
object ListStreamModule { | ||
val module = module { | ||
viewModel { | ||
ListStreamViewModel( | ||
listStreams = get(), | ||
listGenres = get(), | ||
latestStream = get() | ||
) | ||
} | ||
@Module | ||
@ComponentScan("com.codandotv.streamplayerapp.feature_list_streams.list") | ||
class ListStreamModule { | ||
|
||
factory<ListStreamUseCase> { | ||
ListStreamUseCaseImpl( | ||
repository = get() | ||
) | ||
} | ||
|
||
factory<GetGenresUseCase> { | ||
GetGenresUseCaseImpl( | ||
repository = get() | ||
) | ||
} | ||
|
||
factory<GetTopRatedStream> { | ||
GetTopRatedStreamImpl( | ||
repository = get() | ||
) | ||
} | ||
|
||
factory<ListStreamAnalytics> { | ||
ListStreamAnalyticsImpl() | ||
} | ||
|
||
factory<ListStreamRepository> { | ||
ListStreamRepositoryImpl( | ||
service = get(), | ||
dispatcher = get(QualifierDispatcherIO) | ||
) | ||
} | ||
|
||
factory { get<Retrofit>().create(ListStreamService::class.java) } | ||
@Factory | ||
fun service(): ListStreamService { | ||
val koin = GlobalContext.get() | ||
val retrofit = koin.get<Retrofit>() | ||
return retrofit.create(ListStreamService::class.java) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ava/com/codandotv/streamplayerapp/feature_list_streams/list/domain/ListStreamAnalytics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
package com.codandotv.streamplayerapp.feature_list_streams.list.domain | ||
|
||
import org.koin.core.annotation.Factory | ||
|
||
interface ListStreamAnalytics{} | ||
|
||
@Factory | ||
class ListStreamAnalyticsImpl : ListStreamAnalytics { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters