All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.seiko.imageloader.component.SetupComponents.kt Maven / Gradle / Ivy

There is a newer version: 1.9.0
Show newest version
package com.seiko.imageloader.component

import com.seiko.imageloader.component.fetcher.Base64Fetcher
import com.seiko.imageloader.component.fetcher.BitmapFetcher
import com.seiko.imageloader.component.fetcher.KtorUrlFetcher
import com.seiko.imageloader.component.keyer.KtorUrlKeyer
import com.seiko.imageloader.component.mapper.Base64Mapper
import com.seiko.imageloader.component.mapper.KtorUrlMapper
import com.seiko.imageloader.component.mapper.StringUriMapper
import com.seiko.imageloader.util.httpEngine
import io.ktor.client.HttpClient

fun ComponentRegistryBuilder.setupKtorComponents(
    httpClient: () -> HttpClient = { HttpClient(httpEngine) },
) {
    // Mappers
    add(KtorUrlMapper())
    // Keyers
    add(KtorUrlKeyer())
    // Fetchers
    add(KtorUrlFetcher.Factory(httpClient))
}

fun ComponentRegistryBuilder.setupBase64Components() {
    // Mappers
    add(Base64Mapper())
    // Fetchers
    add(Base64Fetcher.Factory())
}

fun ComponentRegistryBuilder.setupCommonComponents() {
    // Mappers
    add(StringUriMapper())
    // Fetchers
    add(BitmapFetcher.Factory())
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy