GalleryDetailViewModel

class GalleryDetailViewModel(val itemId: Long, val dispatchersProvider: DispatchersProvider, val buildInfoProvider: BuildInfoProvider, val getGenerationResultUseCase: GetGenerationResultUseCase, val getLastResultFromCacheUseCase: GetLastResultFromCacheUseCase, val deleteGalleryItemUseCase: DeleteGalleryItemUseCase, val toggleImageVisibilityUseCase: ToggleImageVisibilityUseCase, val generationFormUpdateEvent: GenerationFormUpdateEvent, val router: GalleryDetailRouter, val platformActions: GalleryDetailPlatformActions, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<GalleryDetailState, GalleryDetailIntent, EmptyEffect> (source)

Coordinates GalleryDetailViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(itemId: Long, dispatchersProvider: DispatchersProvider, buildInfoProvider: BuildInfoProvider, getGenerationResultUseCase: GetGenerationResultUseCase, getLastResultFromCacheUseCase: GetLastResultFromCacheUseCase, deleteGalleryItemUseCase: DeleteGalleryItemUseCase, toggleImageVisibilityUseCase: ToggleImageVisibilityUseCase, generationFormUpdateEvent: GenerationFormUpdateEvent, router: GalleryDetailRouter, platformActions: GalleryDetailPlatformActions, onError: (Throwable) -> Unit = {})

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
Link copied to clipboard

Exposes the deleteGalleryItemUseCase value used by the SDAI presentation layer.

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 generationFormUpdateEvent value used by the SDAI presentation layer.

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

Exposes the platformActions value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the router value used by the SDAI presentation layer.

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

Exposes the toggleImageVisibilityUseCase value used by the SDAI presentation layer.

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
private fun copyToClipboard(text: String)
Link copied to clipboard
private fun delete()
Link copied to clipboard
protected fun emitEffect(effect: EmptyEffect)
Link copied to clipboard
protected fun emitState(state: GalleryDetailState)
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
private fun handleFailure(t: Throwable)
Link copied to clipboard
Link copied to clipboard
protected fun launch(dispatcher: CoroutineDispatcher, start: CoroutineStart, block: suspend CoroutineScope.() -> Unit): Job
Link copied to clipboard
private fun load()
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
open override fun processIntent(intent: GalleryDetailIntent)
Link copied to clipboard
private fun saveImage()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private fun shareImage()
Link copied to clipboard
private fun shareParams()
Link copied to clipboard
private fun toggleVisibility()
Link copied to clipboard
protected fun updateState(mutation: (GalleryDetailState) -> GalleryDetailState)