Package-level declarations

Types

Link copied to clipboard
internal class AndroidImageSaver(val mediaStoreGateway: MediaStoreGateway, val dispatchersProvider: DispatchersProvider) : ImageSaver

Coordinates AndroidImageSaver behavior in the SDAI presentation layer.

Link copied to clipboard
internal class AndroidImageSharer(val context: Context, val fileProviderDescriptor: FileProviderDescriptor, val dispatchersProvider: DispatchersProvider, val base64ToBitmapConverter: Base64ToBitmapConverter) : ImageSharer, FileSavableExporter.BmpToFile

Coordinates AndroidImageSharer behavior in the SDAI presentation layer.

Link copied to clipboard
interface ImageSaver

Defines the ImageSaver contract for the SDAI presentation layer.

Link copied to clipboard
sealed interface ImageSaveResult

Defines the ImageSaveResult contract for the SDAI presentation layer.

Link copied to clipboard
interface ImageSharer

Defines the ImageSharer contract for the SDAI presentation layer.

Link copied to clipboard
sealed interface ImageShareResult

Defines the ImageShareResult contract for the SDAI presentation layer.

Link copied to clipboard
private class IosImageSaver : ImageSaver

Coordinates IosImageSaver behavior in the SDAI presentation layer.

Link copied to clipboard
private class IosImageSharer : ImageSharer

Coordinates IosImageSharer behavior in the SDAI presentation layer.

Link copied to clipboard
internal data class StableDiffusionSamplersKey(val serverUrl: String, val demoMode: Boolean)

Carries StableDiffusionSamplersKey data through the SDAI presentation layer.

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

Coordinates TextToImageActionHandler behavior in the SDAI presentation layer.

Link copied to clipboard
sealed interface TextToImageIntent : MviIntent

Defines the TextToImageIntent contract for the SDAI presentation layer.

Link copied to clipboard
internal class TextToImageIntentProcessor(val router: TextToImageRouter, val updateState: ((TextToImageState) -> TextToImageState) -> Unit, val generate: () -> Unit, val cancelGeneration: () -> Unit, val saveImage: (String) -> Unit, val shareImage: (String) -> Unit, val saveGenerationResults: (List<AiGenerationResult>) -> Unit, val viewGenerationResult: (AiGenerationResult) -> Unit, val reportGenerationResult: (AiGenerationResult) -> Unit, val applyGenerationResult: (AiGenerationResult) -> Unit)

Coordinates TextToImageIntentProcessor behavior in the SDAI presentation layer.

Link copied to clipboard
private sealed interface TextToImagePanel

Defines the TextToImagePanel contract for the SDAI presentation layer.

Link copied to clipboard
data class TextToImageState(val loadingConfiguration: Boolean = true, val generating: Boolean = false, val savingImage: Boolean = false, val sharingImage: Boolean = false, val promptValidationError: UiText? = null, val error: UiText? = null, val message: UiText? = null, val screenModal: GenerationModal = GenerationModal.None, val results: List<AiGenerationResult> = emptyList(), val editTag: PromptTagEditRequest? = null, val onBoardingDemo: Boolean = false, val mode: ServerSource = ServerSource.AUTOMATIC1111, val advancedToggleButtonVisible: Boolean = true, val advancedOptionsVisible: Boolean = false, val formPromptTaggedInput: Boolean = false, val prompt: String = "", val negativePrompt: String = "", val width: String = DEFAULT_SIZE.toString(), val height: String = DEFAULT_SIZE.toString(), val samplingSteps: Int = 20, val cfgScale: Float = 7.0f, val restoreFaces: Boolean = false, val seed: String = "", val subSeed: String = "", val subSeedStrength: Float = 0.0f, val selectedSampler: String = "", val availableSamplers: List<String> = emptyList(), val selectedStylePreset: StabilityAiStylePreset = StabilityAiStylePreset.NONE, val selectedClipGuidancePreset: StabilityAiClipGuidance = StabilityAiClipGuidance.NONE, val openAiModel: OpenAiModel = OpenAiModel.default, val openAiSize: OpenAiSize = OpenAiSize.W1024_H1024, val openAiQuality: OpenAiQuality = OpenAiQuality.AUTO, val widthValidationError: UiText? = null, val heightValidationError: UiText? = null, val nsfw: Boolean = false, val batchCount: Int = 1) : MviState, GenerationInputFormState

Carries TextToImageState data through the SDAI presentation layer.

Link copied to clipboard
data class TextToImageStrings(val title: String = Localization.string("title_text_to_image"), val prompt: String = Localization.string("hint_prompt"), val negativePrompt: String = Localization.string("hint_prompt_negative"), val width: String = Localization.string("width"), val height: String = Localization.string("height"), val steps: String = Localization.string("gallery_info_field_sampling_steps"), val cfgScale: String = Localization.string("gallery_info_field_cfg"), val batch: String = Localization.string("hint_batch_tag"), val generate: String = Localization.string("action_generate"), val generating: String = Localization.string("notification_running_title"), val save: String = Localization.string("action_save"), val savingImage: String = Localization.string("message_image_saving"), val share: String = Localization.string("action_share_prompt"), val sharingImage: String = Localization.string("message_image_sharing"), val configureProvider: String = Localization.string("settings_item_config"), val sourceUnavailable: String = Localization.string("error_source_android_only"), val results: String = Localization.string("title_generation_results"), val imageUnavailable: String = Localization.string("message_image_data_received"), val resultMeta: (AiGenerationResult) -> String = { result -> Localization.string( "generation_result_meta", result.width, result.height, result.samplingSteps, ) })

Carries TextToImageStrings data through the SDAI presentation layer.

Link copied to clipboard
class TextToImageViewModel(val dispatchersProvider: DispatchersProvider, val getConfigurationUseCase: GetConfigurationUseCase, val getStableDiffusionSamplersUseCase: GetStableDiffusionSamplersUseCase, val textToImageUseCase: TextToImageUseCase, val saveGenerationResultUseCase: SaveGenerationResultUseCase, val saveLastResultToCacheUseCase: SaveLastResultToCacheUseCase, val interruptGenerationUseCase: InterruptGenerationUseCase, val observeHordeProcessStatusUseCase: ObserveHordeProcessStatusUseCase, val observeLocalDiffusionProcessStatusUseCase: ObserveLocalDiffusionProcessStatusUseCase, val preferenceManager: PreferenceManager, val backgroundTaskManager: BackgroundTaskManager, val backgroundWorkObserver: BackgroundWorkObserver, val platformServices: GenerationPlatformServices, val buildInfoProvider: BuildInfoProvider, val generationFormUpdateEvent: GenerationFormUpdateEvent, val dimensionValidator: DimensionValidator, val imageSaver: ImageSaver, val imageSharer: ImageSharer, val router: TextToImageRouter, val onError: (Throwable) -> Unit = {}) : BaseMviViewModel<TextToImageState, TextToImageIntent, EmptyEffect>

Coordinates TextToImageViewModel behavior in the SDAI presentation layer.

Link copied to clipboard

Provides the UnsupportedAndroidImageSaver singleton used by the SDAI presentation layer.

Link copied to clipboard

Provides the UnsupportedAndroidImageSharer singleton used by the SDAI presentation layer.

Properties

Link copied to clipboard

Exposes the AiGenerationResult value used by the SDAI presentation layer.

Link copied to clipboard
internal const val DEFAULT_SIZE: Int = 512

Exposes the DEFAULT_SIZE value used by the SDAI presentation layer.

Link copied to clipboard

Exposes the ServerSource value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MAX_BATCH_COUNT: Int = 20

Exposes the MAX_BATCH_COUNT value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MAX_CFG_SCALE: Float = 30.0f

Exposes the MAX_CFG_SCALE value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MAX_STEPS: Int = 150

Exposes the MAX_STEPS value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MAX_SUB_SEED_STRENGTH: Float = 1.0f

Exposes the MAX_SUB_SEED_STRENGTH value used by the SDAI presentation layer.

Link copied to clipboard
private const val MIME_TYPE_JPG: String

Exposes the MIME_TYPE_JPG value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MIN_BATCH_COUNT: Int = 1

Exposes the MIN_BATCH_COUNT value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MIN_CFG_SCALE: Float = 1.0f

Exposes the MIN_CFG_SCALE value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MIN_STEPS: Int = 1

Exposes the MIN_STEPS value used by the SDAI presentation layer.

Link copied to clipboard
internal const val MIN_SUB_SEED_STRENGTH: Float = 0.0f

Exposes the MIN_SUB_SEED_STRENGTH value used by the SDAI presentation layer.

Functions

Link copied to clipboard
private fun String.appendPromptTag(tag: String): String

Executes the appendPromptTag step in the SDAI presentation layer.

Link copied to clipboard
internal fun BatchControl(state: TextToImageState, strings: TextToImageStrings, processIntent: (TextToImageIntent) -> Unit)

Renders the BatchControl UI for the SDAI presentation layer.

Link copied to clipboard

Executes the canGenerate step in the SDAI presentation layer.

Link copied to clipboard

Creates the SDAI value produced by createImageFileName.

Link copied to clipboard

Creates the SDAI value produced by createPlatformImageSaver.

Creates the SDAI value produced by createPlatformImageSaver.

Creates the SDAI value produced by createPlatformImageSaver.

Link copied to clipboard

Creates the SDAI value produced by createPlatformImageSharer.

Creates the SDAI value produced by createPlatformImageSharer.

Creates the SDAI value produced by createPlatformImageSharer.

Link copied to clipboard

Converts SDAI data with decodeBase64ImageBitmap.

Converts SDAI data with decodeBase64ImageBitmap.

Converts SDAI data with decodeBase64ImageBitmap.

Link copied to clipboard
private fun String.decodeGeneratedImageData(): NSData

Executes the decodeGeneratedImageData step in the SDAI presentation layer.

Link copied to clipboard
internal fun String.decodeGeneratedUiImage(): UIImage

Executes the decodeGeneratedUiImage step in the SDAI presentation layer.

Link copied to clipboard

Executes the function step in the SDAI presentation layer.

Link copied to clipboard
private fun flushPendingTaggedText(state: TextToImageState, promptChipTextFieldState: MutableState<TextFieldValue>, negativePromptChipTextFieldState: MutableState<TextFieldValue>, processIntent: (TextToImageIntent) -> Unit)

Executes the flushPendingTaggedText step in the SDAI presentation layer.

Link copied to clipboard
internal fun GeneratedImageItem(result: AiGenerationResult, strings: TextToImageStrings, savingImage: Boolean, sharingImage: Boolean, processIntent: (TextToImageIntent) -> Unit)

Renders the GeneratedImageItem UI for the SDAI presentation layer.

Link copied to clipboard
private fun GenerationHistoryDialog(onClose: () -> Unit, onGenerationSelected: (AiGenerationResult) -> Unit)

Renders the GenerationHistoryDialog UI for the SDAI presentation layer.

Link copied to clipboard

Executes the localizedMessageText step in the SDAI presentation layer.

Link copied to clipboard

Converts SDAI data with mapToPayload.

Link copied to clipboard
internal fun NumberField(value: String, label: String, error: UiText?, onValueChange: (String) -> Unit, modifier: Modifier = Modifier)

Renders the NumberField UI for the SDAI presentation layer.

Link copied to clipboard
internal fun TextToImageState.progressModal(canCancelLocalGeneration: Boolean): GenerationModal

Executes the progressModal step in the SDAI presentation layer.

Link copied to clipboard
private fun UIApplication.rootViewController(): UIViewController?

Executes the rootViewController step in the SDAI presentation layer.

Link copied to clipboard
internal fun Float.roundToString(): String

Executes the roundToString step in the SDAI presentation layer.

Link copied to clipboard
private inline suspend fun runSavingAction(crossinline action: suspend () -> Unit): ImageSaveResult

Executes the runSavingAction step in the SDAI presentation layer.

Link copied to clipboard
private inline suspend fun runSharingAction(crossinline action: suspend () -> Unit): ImageShareResult

Executes the runSharingAction step in the SDAI presentation layer.

Link copied to clipboard
internal fun SliderRow(label: String, value: String, content: @Composable () -> Unit)

Renders the SliderRow UI for the SDAI presentation layer.

Link copied to clipboard
internal fun TextToImageBody(state: TextToImageState, strings: TextToImageStrings, promptChipTextFieldState: MutableState<TextFieldValue>, negativePromptChipTextFieldState: MutableState<TextFieldValue>, processIntent: (TextToImageIntent) -> Unit)

Renders the TextToImageBody UI for the SDAI presentation layer.

Link copied to clipboard
fun TextToImageContent(state: TextToImageState, processIntent: (TextToImageIntent) -> Unit, modifier: Modifier = Modifier, strings: TextToImageStrings = TextToImageStrings(), useDrawerNavigation: Boolean = false)

Renders the TextToImageContent UI for the SDAI presentation layer.

Link copied to clipboard
internal fun TextToImageForm(state: TextToImageState, strings: TextToImageStrings, promptChipTextFieldState: MutableState<TextFieldValue>, negativePromptChipTextFieldState: MutableState<TextFieldValue>, processIntent: (TextToImageIntent) -> Unit)

Renders the TextToImageForm UI for the SDAI presentation layer.

Link copied to clipboard

Converts SDAI data with toImageBytes.

Link copied to clipboard
private fun UIViewController.topMostPresentedViewController(): UIViewController

Converts SDAI data with topMostPresentedViewController.

Link copied to clipboard

Converts SDAI data with toTextToImageIntent.

Link copied to clipboard
internal fun List<AiGenerationResult>.toTextToImageResultModal(autoSaveEnabled: Boolean, reportEnabled: Boolean): GenerationModal

Converts SDAI data with toTextToImageResultModal.

Link copied to clipboard

Executes the validated step in the SDAI presentation layer.

Link copied to clipboard
internal fun TextToImageState.withSettings(settings: Settings, stableDiffusionSamplers: List<String>?): TextToImageState

Executes the withSettings step in the SDAI presentation layer.

Link copied to clipboard
internal fun TextToImageState.withSource(source: ServerSource, stableDiffusionSamplers: List<String>?): TextToImageState

Executes the withSource step in the SDAI presentation layer.