refactor: remove getString() from RadioConfigViewModel

This commit is contained in:
andrekir 2024-12-17 12:42:09 -03:00 committed by Andre K
parent b05768df98
commit 74497488a7
5 changed files with 90 additions and 42 deletions

View file

@ -81,6 +81,7 @@ import com.geeksville.mesh.ui.components.NodeMapScreen
import com.geeksville.mesh.ui.components.PositionLogScreen
import com.geeksville.mesh.ui.components.SignalMetricsScreen
import com.geeksville.mesh.ui.components.TracerouteLogScreen
import com.geeksville.mesh.util.UiText
import com.geeksville.mesh.ui.components.config.AmbientLightingConfigScreen
import com.geeksville.mesh.ui.components.config.AudioConfigScreen
import com.geeksville.mesh.ui.components.config.BluetoothConfigScreen
@ -260,7 +261,7 @@ sealed class ResponseState<out T> {
data object Empty : ResponseState<Nothing>()
data class Loading(var total: Int = 1, var completed: Int = 0) : ResponseState<Nothing>()
data class Success<T>(val result: T) : ResponseState<T>()
data class Error(val error: String) : ResponseState<Nothing>()
data class Error(val error: UiText) : ResponseState<Nothing>()
fun isWaiting() = this !is Empty
}

View file

@ -74,7 +74,7 @@ fun <T> PacketResponseStateDialog(
}
if (state is ResponseState.Error) {
Text(text = stringResource(id = R.string.error), minLines = 2)
Text(text = state.error)
Text(text = state.error.asString())
}
}
},