Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.dororong.rodi.core.data

import android.content.Context
import com.dororong.rodi.core.domain.EntryRepository
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

interface EntryRepository {
val isCompleted: Flow<Boolean?>
suspend fun setCompleted()
}

class EntryRepositoryImpl @Inject constructor(
@ApplicationContext context: Context,
) : EntryRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.dororong.rodi.core.data.di

import com.dororong.rodi.core.data.CourseRepositoryImpl
import com.dororong.rodi.core.data.EntryRepository
import com.dororong.rodi.core.data.EntryRepositoryImpl
import com.dororong.rodi.core.data.navi.NaviPreferenceRepository
import com.dororong.rodi.core.data.navi.NaviPreferenceRepositoryImpl
import com.dororong.rodi.core.domain.CourseRepository
import com.dororong.rodi.core.domain.EntryRepository
import com.dororong.rodi.core.domain.NaviPreferenceRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.dororong.rodi.core.data.navi

import android.content.Context

enum class NaviApp(val key: String, val label: String) {
KAKAOMAP("kakaomap", "카카오맵"),
KAKAONAVI("kakaonavi", "카카오내비"),
}
import com.dororong.rodi.core.domain.NaviApp

object NaviPreference {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.dororong.rodi.core.data.navi

import android.content.Context
import com.dororong.rodi.core.domain.NaviApp
import com.dororong.rodi.core.domain.NaviPreferenceRepository
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject

interface NaviPreferenceRepository {
fun getAlways(): NaviApp?
fun setAlways(app: NaviApp)
}

class NaviPreferenceRepositoryImpl @Inject constructor(
@param:ApplicationContext private val context: Context,
) : NaviPreferenceRepository {
Expand Down
1 change: 1 addition & 0 deletions core/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
dependencies {
implementation(project(":core:common"))
implementation(libs.javax.inject)
implementation(libs.kotlinx.coroutines.core)

testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.platform.launcher)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.dororong.rodi.core.domain

import kotlinx.coroutines.flow.Flow

interface EntryRepository {
val isCompleted: Flow<Boolean?>
suspend fun setCompleted()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.dororong.rodi.core.domain

enum class NaviApp(val key: String, val label: String) {
KAKAOMAP("kakaomap", "카카오맵"),
KAKAONAVI("kakaonavi", "카카오내비"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.dororong.rodi.core.domain

interface NaviPreferenceRepository {
fun getAlways(): NaviApp?
fun setAlways(app: NaviApp)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.dororong.rodi.core.domain.usecase

import com.dororong.rodi.core.domain.EntryRepository
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class GetEntryCompletedUseCase @Inject constructor(
private val entryRepository: EntryRepository,
) {
operator fun invoke(): Flow<Boolean?> = entryRepository.isCompleted
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.dororong.rodi.core.domain.usecase

import com.dororong.rodi.core.domain.NaviApp
import com.dororong.rodi.core.domain.NaviPreferenceRepository
import javax.inject.Inject

class GetNaviAlwaysUseCase @Inject constructor(
private val naviPreferenceRepository: NaviPreferenceRepository,
) {
operator fun invoke(): NaviApp? = naviPreferenceRepository.getAlways()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.dororong.rodi.core.domain.usecase

import com.dororong.rodi.core.domain.EntryRepository
import javax.inject.Inject

class SetEntryCompletedUseCase @Inject constructor(
private val entryRepository: EntryRepository,
) {
suspend operator fun invoke() = entryRepository.setCompleted()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.dororong.rodi.core.domain.usecase

import com.dororong.rodi.core.domain.NaviApp
import com.dororong.rodi.core.domain.NaviPreferenceRepository
import javax.inject.Inject

class SetNaviAlwaysUseCase @Inject constructor(
private val naviPreferenceRepository: NaviPreferenceRepository,
) {
operator fun invoke(app: NaviApp) = naviPreferenceRepository.setAlways(app)
}
Loading
Loading