diff --git a/feature/detail/src/main/java/team/ppac/detail/DetailViewModel.kt b/feature/detail/src/main/java/team/ppac/detail/DetailViewModel.kt index f23a9215..92495319 100644 --- a/feature/detail/src/main/java/team/ppac/detail/DetailViewModel.kt +++ b/feature/detail/src/main/java/team/ppac/detail/DetailViewModel.kt @@ -16,6 +16,7 @@ import team.ppac.domain.usecase.EmitRefreshEventUseCase import team.ppac.domain.usecase.GetMemeUseCase import team.ppac.domain.usecase.ReactMemeUseCase import team.ppac.domain.usecase.SaveMemeUseCase +import team.ppac.domain.usecase.ShareMemeUseCase import team.ppac.errorhandling.FarmemeNetworkException import javax.inject.Inject @@ -27,6 +28,7 @@ class DetailViewModel @Inject constructor( private val deleteSavedMemeUseCase: DeleteSavedMemeUseCase, private val reactMemeUseCase: ReactMemeUseCase, private val emitRefreshEventUseCase: EmitRefreshEventUseCase, + private val shareMemeUseCase: ShareMemeUseCase, ) : BaseViewModel(savedStateHandle) { init { @@ -64,6 +66,7 @@ class DetailViewModel @Inject constructor( } is DetailIntent.ClickBottomButton.Share -> { + incrementShareCount() postSideEffect(DetailSideEffect.ShareLink(intent.memeId)) } @@ -168,6 +171,10 @@ class DetailViewModel @Inject constructor( } } + private suspend fun incrementShareCount() { + shareMemeUseCase(currentState.memeId) + } + companion object { const val TAG = "DetailViewModel" }