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
@@ -10,6 +10,7 @@ import com.m57.hermescontrol.data.model.SessionSearchResult
|
||||
import com.m57.hermescontrol.data.remote.ApiClient
|
||||
import com.m57.hermescontrol.data.remote.NetworkResult
|
||||
import com.m57.hermescontrol.data.remote.safeApiCall
|
||||
import com.m57.hermescontrol.ui.common.ToastHost
|
||||
import com.m57.hermescontrol.ui.common.safeLaunchLoad
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
@@ -52,7 +53,7 @@ data class SessionsUiState(
|
||||
val isSearchMode: Boolean get() = searchQuery.isNotBlank()
|
||||
}
|
||||
|
||||
class SessionsViewModel : ViewModel() {
|
||||
class SessionsViewModel : ViewModel(), ToastHost {
|
||||
private val _uiState = MutableStateFlow(SessionsUiState())
|
||||
val uiState: StateFlow<SessionsUiState> = _uiState.asStateFlow()
|
||||
|
||||
@@ -471,7 +472,7 @@ class SessionsViewModel : ViewModel() {
|
||||
|
||||
// ── Toast ────────────────────────────────────────────────────────────
|
||||
|
||||
fun clearToast() {
|
||||
override fun clearToast() {
|
||||
_uiState.update { it.copy(toastMessage = null) }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user