ReportViewModel

class ReportViewModel(val itemId: Long, val dispatchersProvider: DispatchersProvider, val sendReportUseCase: SendReportUseCase, val getGenerationResultUseCase: GetGenerationResultUseCase, val getLastResultFromCacheUseCase: GetLastResultFromCacheUseCase, val router: ReportRouter, val buildInfoProvider: BuildInfoProvider, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<ReportState, ReportIntent, EmptyEffect> (source)

Coordinates ReportViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(itemId: Long, dispatchersProvider: DispatchersProvider, sendReportUseCase: SendReportUseCase, getGenerationResultUseCase: GetGenerationResultUseCase, getLastResultFromCacheUseCase: GetLastResultFromCacheUseCase, router: ReportRouter, buildInfoProvider: BuildInfoProvider, onError: (Throwable) -> Unit = {})

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
private val _effect: Channel<E>
Link copied to clipboard
private val _state: MutableStateFlow<S>
Link copied to clipboard

Exposes the buildInfoProvider value used by the SDAI presentation layer.

Link copied to clipboard
protected val currentState: ReportState
Link copied to clipboard

Exposes the dispatchersProvider value used by the SDAI presentation layer.

Link copied to clipboard
open override val effect: Flow<EmptyEffect>
Link copied to clipboard
private val effectDispatcher: CoroutineDispatcher
Link copied to clipboard

Exposes the getGenerationResultUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getLastResultFromCacheUseCase value used by the SDAI presentation layer.

Link copied to clipboard
private val itemId: Long

Exposes the itemId value used by the SDAI presentation layer.

Link copied to clipboard
private val onError: (Throwable) -> Unit

Exposes the onError value used by the SDAI presentation layer.

Link copied to clipboard
private val router: ReportRouter

Exposes the router value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the sendReportUseCase value used by the SDAI presentation layer.

Link copied to clipboard
open override val state: StateFlow<ReportState>

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
internal expect fun clear()
Link copied to clipboard
protected fun emitEffect(effect: EmptyEffect)
Link copied to clipboard
protected fun emitState(state: ReportState)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
private suspend fun getGenerationResult(id: Long): AiGenerationResult
Link copied to clipboard
protected fun launch(dispatcher: CoroutineDispatcher, start: CoroutineStart, block: suspend CoroutineScope.() -> Unit): Job
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
open override fun processIntent(intent: ReportIntent)
Link copied to clipboard
private fun submitReport()
Link copied to clipboard
protected fun updateState(mutation: (ReportState) -> ReportState)