Measurements Screen View Model

class MeasurementsScreenViewModel : EquinoxViewModel, ToastsLauncher

The MeasurementsScreenViewModel class is the support class used to manage the daily measurements requests

Author

N7ghtm4r3 - Tecknobit

See also

Retriever.RetrieverWrapper
EquinoxViewModel

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val currentDay: StateFlow<Long>
Link copied to clipboard
Link copied to clipboard
lateinit var glycemia: MutableState<String>

glycemia the value of the glycemia

Link copied to clipboard

glycemiaError whether the glycemia field is not valid

Link copied to clipboard

insulinNeeded whether the measurement requires the insulin units administration

Link copied to clipboard
lateinit var insulinUnits: QuantityPickerState

insulinUnits the state used to pick the insulin units quantity

Link copied to clipboard

mealContent list with the content of a meal

Link copied to clipboard

postPrandialGlycemia the value of the post-prandial glycemia

Link copied to clipboard

postPrandialGlycemiaError whether the postPrandialGlycemia field is not valid

Link copied to clipboard
open override var scope: CoroutineScope

toasterState the state used to launch the toasts messages

Link copied to clipboard
lateinit var sessionFlowState: SessionFlowState

sessionFlowState the state used to manage the session lifecycle in the screen

Link copied to clipboard
Link copied to clipboard
open lateinit override var toasterState: ToasterState

toasterState the state used to launch the toasts messages

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
open override fun canRetrieverStart(): Boolean
Link copied to clipboard
fun computeDayValue(page: Int)

Method used to compute the value in millis of the _currentDay based on the page

Link copied to clipboard
open override fun continueToRetrieve(currentContext: KClass<*>): Boolean
Link copied to clipboard
fun fillBasalInsulin(basalInsulin: BasalInsulin, onSave: () -> Unit)

Method used to request to fill a basal insulin record

Link copied to clipboard
fun fillDay()

Method used to request the filling of the selected _currentDay

Link copied to clipboard
fun fillMeal(meal: Meal, onSave: () -> Unit)

Method used to request to fill a meal

Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
open override fun restartRetriever()
Link copied to clipboard
open fun restartRetrieverIf(condition: Boolean)
Link copied to clipboard
open override fun retrieve(currentContext: KClass<*>, routine: suspend () -> Unit, repeatRoutine: Boolean, refreshDelay: Long)
Link copied to clipboard

Method used to request to retrieve the daily measurements related to the selected _currentDay

Link copied to clipboard
fun saveDailyNotes(content: String, onSave: () -> Unit)

Method used to request to save the daily notes content

Link copied to clipboard
open fun setActiveContext(currentContext: KClass<*>)
Link copied to clipboard
fun setCurrentDay(millis: Long)

Method used to set the value for the _currentDay

Link copied to clipboard
fun showSnackbarMessage(message: String, actionLabel: String?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
fun showSnackbarMessage(response: JsonObject, actionLabel: String?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
fun showSnackbarMessage(message: StringResource, actionLabel: StringResource?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
Link copied to clipboard
open override fun suspendRetriever()
Link copied to clipboard
open fun suspendRetrieverIf(condition: Boolean)
Link copied to clipboard
open fun toastError(error: StringResource, vararg formatArgs: Any)

Method used to toast an error message