Replace StateViewModel with explicit backing fields (#3763)

Assisted-by: Claude:claude-opus-5
This commit is contained in:
AntsyLich
2026-08-15 01:53:06 +06:00
committed by GitHub
parent d00efa4bfc
commit b1efee47f5
21 changed files with 184 additions and 127 deletions
-14
View File
@@ -1,14 +0,0 @@
plugins {
alias(mihonx.plugins.android.library)
alias(mihonx.plugins.spotless)
alias(libs.plugins.kotlin.serialization)
}
android {
namespace = "mihon.core.viewmodel"
}
dependencies {
implementation(libs.androidx.lifecycle.viewmodel)
}
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
@@ -1,11 +0,0 @@
package mihon.core.viewmodel
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
abstract class StateViewModel<S>(initialState: S) : ViewModel() {
protected val mutableState: MutableStateFlow<S> = MutableStateFlow(initialState)
val state: StateFlow<S> = mutableState.asStateFlow()
}