Add ToastHost interface + override keyword to the 3 ViewModels that declared clearToast() without implementing the interface. This aligns them with the other 17 ViewModels and enables polymorphic substitution where ToastHost is expected. Fixes #614 Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
3030e431f2
commit
dc1d5f2c7c
3 files changed
+9
-6
No files matched your search
@@ -6,6 +6,7 @@ import com.m57.hermescontrol.data.model.ProcessInfo
|
||||
import com.m57.hermescontrol.data.session.ActiveSessionHolder
|
||||
import com.m57.hermescontrol.data.ws.HermesWsClient
|
||||
import com.m57.hermescontrol.data.ws.WsMethods
|
||||
import com.m57.hermescontrol.ui.common.ToastHost
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@@ -23,7 +24,7 @@ data class ProcessesUiState(
|
||||
val sessionId: String? = null,
|
||||
)
|
||||
|
||||
class ProcessesViewModel : ViewModel() {
|
||||
class ProcessesViewModel : ViewModel(), ToastHost {
|
||||
private val _uiState = MutableStateFlow(ProcessesUiState())
|
||||
val uiState: StateFlow<ProcessesUiState> = _uiState.asStateFlow()
|
||||
|
||||
@@ -123,7 +124,7 @@ class ProcessesViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun clearToast() {
|
||||
override fun clearToast() {
|
||||
_uiState.update { it.copy(toastMessage = null) }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user