Skip to content

Commit

Permalink
remove input interface [#61]
Browse files Browse the repository at this point in the history
- 삭제 사유
   - domain module에서 input interface를 두어 의존성 역전을 해서 사용중
   - 하지만 Hilt를 사용해서 UseCase를 의존성 주입해서 사용중인데 input interface로 다시 의존성 역전하고 이를 Bind하는 것이 burden이라 판단
  • Loading branch information
DokySp committed Oct 7, 2024
1 parent f2c5390 commit 95bd2bb
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 74 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.foke.together.domain.interactor

import com.foke.together.domain.input.GetCameraSourceTypeInterface
import com.foke.together.domain.interactor.entity.CameraSourceType
import com.foke.together.domain.output.AppPreferenceInterface
import kotlinx.coroutines.flow.Flow
Expand All @@ -9,7 +8,7 @@ import javax.inject.Inject

class GetCameraSourceTypeUseCase @Inject constructor(
private val appPreference: AppPreferenceInterface
): GetCameraSourceTypeInterface {
override operator fun invoke(): Flow<CameraSourceType> =
) {
operator fun invoke(): Flow<CameraSourceType> =
appPreference.getCameraSourceType().map { it }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.foke.together.domain.interactor


import com.foke.together.domain.input.GetExternalCameraIPInterface
import com.foke.together.domain.interactor.entity.ExternalCameraIP
import com.foke.together.domain.output.AppPreferenceInterface
import kotlinx.coroutines.flow.Flow
Expand All @@ -10,8 +8,8 @@ import javax.inject.Inject

class GetExternalCameraIPUseCase @Inject constructor(
private val appPreference: AppPreferenceInterface
): GetExternalCameraIPInterface {
override operator fun invoke(): Flow<ExternalCameraIP> =
) {
operator fun invoke(): Flow<ExternalCameraIP> =
appPreference.getExternalCameraIP().map { it }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.foke.together.domain.interactor

import com.foke.together.domain.input.SetCameraSourceTypeInterface
import com.foke.together.domain.interactor.entity.CameraSourceType
import com.foke.together.domain.output.AppPreferenceInterface
import javax.inject.Inject

class SetCameraSourceTypeUseCase @Inject constructor(
private val appPreference: AppPreferenceInterface
): SetCameraSourceTypeInterface {
override suspend operator fun invoke(cameraSourceType: CameraSourceType) =
) {
suspend operator fun invoke(cameraSourceType: CameraSourceType) =
appPreference.setCameraSourceType(cameraSourceType)
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.foke.together.domain.interactor


import com.foke.together.domain.input.SetExternalCameraIPInterface
import com.foke.together.domain.interactor.entity.ExternalCameraIP
import com.foke.together.domain.output.AppPreferenceInterface
import javax.inject.Inject

class SetExternalCameraIPUseCase @Inject constructor(
private val appPreference: AppPreferenceInterface
): SetExternalCameraIPInterface {
override suspend operator fun invoke(externalCameraIP: ExternalCameraIP)=
) {
suspend operator fun invoke(externalCameraIP: ExternalCameraIP)=
appPreference.setExternalCameraIP(externalCameraIP)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.foke.together.presenter.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.foke.together.domain.input.GetCameraSourceTypeInterface
import com.foke.together.domain.input.SetCameraSourceTypeInterface
import com.foke.together.domain.interactor.GetCameraSourceTypeUseCase
import com.foke.together.domain.interactor.SetCameraSourceTypeUseCase
import com.foke.together.domain.interactor.entity.CameraSourceType
import com.foke.together.util.AppLog
import dagger.hilt.android.lifecycle.HiltViewModel
Expand All @@ -16,10 +16,10 @@ import javax.inject.Inject

@HiltViewModel
class SettingViewModel @Inject constructor(
private val getCameraSourceTypeInterface: GetCameraSourceTypeInterface,
private val setCameraSourceTypeInterface: SetCameraSourceTypeInterface
getCameraSourceTypeUseCase: GetCameraSourceTypeUseCase,
private val setCameraSourceTypeUseCase: SetCameraSourceTypeUseCase
): ViewModel() {
val cameraSourceType = getCameraSourceTypeInterface().shareIn(
val cameraSourceType = getCameraSourceTypeUseCase().shareIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5000),
replay = 1
Expand All @@ -36,7 +36,7 @@ class SettingViewModel @Inject constructor(
fun setCameraSourceType(type: CameraSourceType){
viewModelScope.launch {
AppLog.e(TAG, "setCameraSourceType", "type: $type")
setCameraSourceTypeInterface(type)
setCameraSourceTypeUseCase(type)
}
}

Expand Down

0 comments on commit 95bd2bb

Please sign in to comment.