Use koin in domain module

pull/2064/head
lihenggui 1 year ago
parent fd58187a88
commit a37fa9c2de

@ -15,9 +15,8 @@
*/
plugins {
alias(libs.plugins.nowinandroid.kmp.library)
alias(libs.plugins.nowinandroid.kotlin.inject)
alias(libs.plugins.nowinandroid.di.koin)
alias(libs.plugins.nowinandroid.android.library.jacoco)
id("com.google.devtools.ksp")
}
android {

@ -23,10 +23,12 @@ import com.google.samples.apps.nowinandroid.core.domain.TopicSortField.NONE
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import org.koin.core.annotation.Factory
/**
* A use case which obtains a list of topics with their followed state.
*/
@Factory
class GetFollowableTopicsUseCase(
private val topicsRepository: TopicsRepository,
private val userDataRepository: UserDataRepository,

@ -19,12 +19,12 @@ package com.google.samples.apps.nowinandroid.core.domain
import com.google.samples.apps.nowinandroid.core.data.model.RecentSearchQuery
import com.google.samples.apps.nowinandroid.core.data.repository.RecentSearchRepository
import kotlinx.coroutines.flow.Flow
import me.tatarka.inject.annotations.Inject
import org.koin.core.annotation.Factory
/**
* A use case which returns the recent search queries.
*/
@Inject
@Factory
class GetRecentSearchQueriesUseCase(
private val recentSearchRepository: RecentSearchRepository,
) {

@ -25,12 +25,12 @@ import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
import com.google.samples.apps.nowinandroid.core.model.data.UserSearchResult
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import me.tatarka.inject.annotations.Inject
import org.koin.core.annotation.Factory
/**
* A use case which returns the searched contents matched with the search query.
*/
@Inject
@Factory
class GetSearchContentsUseCase(
private val searchContentsRepository: SearchContentsRepository,
private val userDataRepository: UserDataRepository,

@ -0,0 +1,28 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.samples.apps.nowinandroid.core.domain.di
import org.koin.core.annotation.ComponentScan
import org.koin.core.annotation.Module
import org.koin.ksp.generated.module
val domainModule = listOf(
DomainModule().module
)
@Module
@ComponentScan
class DomainModule
Loading…
Cancel
Save