GalleryViewModel

class GalleryViewModel(val dispatchersProvider: DispatchersProvider, val getMediaStoreInfoUseCase: GetMediaStoreInfoUseCase, val backgroundWorkObserver: BackgroundWorkObserver, val preferenceManager: PreferenceManager, val deleteAllGalleryUseCase: DeleteAllGalleryUseCase, val deleteGalleryItemsUseCase: DeleteGalleryItemsUseCase, val getGenerationResultPagedUseCase: GetGenerationResultPagedUseCase, val galleryExportService: GalleryExportService, val galleryRouter: GalleryRouter, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<GalleryState, GalleryIntent, GalleryEffect> (source)

Coordinates GalleryViewModel behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(dispatchersProvider: DispatchersProvider, getMediaStoreInfoUseCase: GetMediaStoreInfoUseCase, backgroundWorkObserver: BackgroundWorkObserver, preferenceManager: PreferenceManager, deleteAllGalleryUseCase: DeleteAllGalleryUseCase, deleteGalleryItemsUseCase: DeleteGalleryItemsUseCase, getGenerationResultPagedUseCase: GetGenerationResultPagedUseCase, galleryExportService: GalleryExportService, galleryRouter: GalleryRouter, 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 backgroundWorkObserver value used by the SDAI presentation layer.

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

Exposes the deleteAllGalleryUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the deleteGalleryItemsUseCase 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<GalleryEffect>
Link copied to clipboard
private val effectDispatcher: CoroutineDispatcher
Link copied to clipboard

Exposes the galleryExportService value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the galleryRouter value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the getGenerationResultPagedUseCase value used by the SDAI presentation layer.

Link copied to clipboard

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

Link copied to clipboard
private val requestedLimit: MutableStateFlow<Int>
Link copied to clipboard
open override val state: StateFlow<GalleryState>

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: GalleryEffect)
Link copied to clipboard
protected fun emitState(state: GalleryState)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
protected fun launch(dispatcher: CoroutineDispatcher, start: CoroutineStart, block: suspend CoroutineScope.() -> Unit): Job
Link copied to clipboard
private fun launchDeletion(action: suspend () -> Unit)
Link copied to clipboard
private fun launchGalleryExport(exportAll: Boolean)
Link copied to clipboard
private fun loadMediaStoreInfo()
Link copied to clipboard
private fun loadNextPage()
Link copied to clipboard
private fun observeBackgroundWork()
Link copied to clipboard
private fun observeGallery()
Link copied to clipboard
private fun observePreferences()
Link copied to clipboard
protected expect open fun onCleared()
Link copied to clipboard
open override fun processIntent(intent: GalleryIntent)
Link copied to clipboard
private fun refreshGallery()
Link copied to clipboard
private fun setActiveDialog(dialog: GalleryDialog)
Link copied to clipboard
protected fun updateState(mutation: (GalleryState) -> GalleryState)