-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE] #25 : NoticeViewModel EventFlow 추가 및 handleEvent 추가
- Loading branch information
Showing
2 changed files
with
25 additions
and
4 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
14 changes: 14 additions & 0 deletions
14
feature/notice/src/main/java/com/wap/wapp/feature/notice/NoticeViewModel.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,9 +1,23 @@ | ||
package com.wap.wapp.feature.notice | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class NoticeViewModel @Inject constructor() : ViewModel() { | ||
private val _eventFlow = MutableSharedFlow<NoticeEvent>() | ||
val eventFlow = _eventFlow.asSharedFlow() | ||
|
||
private fun event(event: NoticeEvent) = viewModelScope.launch { | ||
_eventFlow.emit(event) | ||
} | ||
|
||
sealed class NoticeEvent { | ||
|
||
} | ||
} |