ImageToImageActionHandler

internal class ImageToImageActionHandler(val dispatchersProvider: DispatchersProvider, val getRandomImageUseCase: GetRandomImageUseCase, val imageToImageUseCase: ImageToImageUseCase, 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: ImageToImageRouter, val platformActions: ImageToImagePlatformActions, val currentState: () -> ImageToImageState, val emitState: (ImageToImageState) -> Unit, val updateState: ((ImageToImageState) -> ImageToImageState) -> Unit, val launch: ViewModelLauncher, val onError: (Throwable) -> Unit)(source)

Coordinates ImageToImageActionHandler behavior in the SDAI presentation layer.

Author

Dmitriy Moroz

Throws

when the current state is invalid.

Constructors

Link copied to clipboard
constructor(dispatchersProvider: DispatchersProvider, getRandomImageUseCase: GetRandomImageUseCase, imageToImageUseCase: ImageToImageUseCase, saveGenerationResultUseCase: SaveGenerationResultUseCase, saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, interruptGenerationUseCase: InterruptGenerationUseCase, preferenceManager: PreferenceManager, backgroundTaskManager: BackgroundTaskManager, backgroundWorkObserver: BackgroundWorkObserver, platformServices: GenerationPlatformServices, buildInfoProvider: BuildInfoProvider, dimensionValidator: DimensionValidator, imageSaver: ImageSaver, imageSharer: ImageSharer, router: ImageToImageRouter, platformActions: ImageToImagePlatformActions, currentState: () -> ImageToImageState, emitState: (ImageToImageState) -> Unit, updateState: ((ImageToImageState) -> ImageToImageState) -> 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: () -> ImageToImageState

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: (ImageToImageState) -> 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

Exposes the getRandomImageUseCase 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 imageToImageUseCase 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 platformActions 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 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 pickImage step in the SDAI presentation layer.

Link copied to clipboard

Executes the pickRandomImage 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.