TextToImageActionHandler

internal class TextToImageActionHandler(val dispatchersProvider: DispatchersProvider, val textToImageUseCase: TextToImageUseCase, val saveGenerationResultUseCase: SaveGenerationResultUseCase, val saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, val interruptGenerationUseCase: InterruptGenerationUseCase, val preferenceManager: PreferenceManager, val backgroundTaskManager: BackgroundTaskManager, val backgroundWorkObserver: BackgroundWorkObserver, val platformServices: GenerationPlatformServices, val buildInfoProvider: BuildInfoProvider, val dimensionValidator: DimensionValidator, val imageSaver: ImageSaver, val imageSharer: ImageSharer, val router: TextToImageRouter, val currentState: () -> TextToImageState, val emitState: (TextToImageState) -> Unit, val updateState: ((TextToImageState) -> TextToImageState) -> Unit, val launch: ViewModelLauncher, val onError: (Throwable) -> Unit)(source)

Coordinates TextToImageActionHandler behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(dispatchersProvider: DispatchersProvider, textToImageUseCase: TextToImageUseCase, saveGenerationResultUseCase: SaveGenerationResultUseCase, saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, interruptGenerationUseCase: InterruptGenerationUseCase, preferenceManager: PreferenceManager, backgroundTaskManager: BackgroundTaskManager, backgroundWorkObserver: BackgroundWorkObserver, platformServices: GenerationPlatformServices, buildInfoProvider: BuildInfoProvider, dimensionValidator: DimensionValidator, imageSaver: ImageSaver, imageSharer: ImageSharer, router: TextToImageRouter, currentState: () -> TextToImageState, emitState: (TextToImageState) -> Unit, updateState: ((TextToImageState) -> TextToImageState) -> Unit, launch: ViewModelLauncher, onError: (Throwable) -> Unit)

Properties

Link copied to clipboard

Exposes the backgroundGenerationEnabled value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the backgroundTaskManager value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the backgroundWorkObserver value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the buildInfoProvider value used by the SDAI presentation layer.

Link copied to clipboard
private val currentState: () -> TextToImageState

Exposes the currentState value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the dimensionValidator 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
private val emitState: (TextToImageState) -> Unit

Exposes the emitState value used by the SDAI presentation layer.

Link copied to clipboard
private var generationJob: Job?

Exposes the generationJob value used by the SDAI presentation layer.

Link copied to clipboard
private val imageSaver: ImageSaver

Exposes the imageSaver value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the imageSharer value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the interruptGenerationUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the launch 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 platformServices 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

Exposes the router value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the saveGenerationResultUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the saveLastResultToCacheUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the textToImageUseCase value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the updateState value used by the SDAI presentation layer.

Functions

Link copied to clipboard

Executes the cacheResultIfNeeded step in the SDAI presentation layer.

Link copied to clipboard

Executes the cancelGeneration step in the SDAI presentation layer.

Link copied to clipboard
fun generate()

Executes the generate step in the SDAI presentation layer.

Link copied to clipboard

Executes the persistResultIfNeeded step in the SDAI presentation layer.

Link copied to clipboard

Executes the persistResultsIfNeeded step in the SDAI presentation layer.

Link copied to clipboard

Executes the reportGenerationResult step in the SDAI presentation layer.

Link copied to clipboard

Performs the SDAI side effect handled by saveGenerationResults.

Link copied to clipboard
fun saveImage(base64: String)

Performs the SDAI side effect handled by saveImage.

Link copied to clipboard
fun shareImage(base64: String)

Performs the SDAI side effect handled by shareImage.

Link copied to clipboard

Executes the viewGenerationResult step in the SDAI presentation layer.