diff --git a/CHANGELOG.md b/CHANGELOG.md index d645afaa8c..f91d7ef85d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ New: - Redwood publishes what's happening in bound content through the new `Content.State` type. +- Accept a `ZiplineHttpClient` in `TreehouseAppFactory` on Android. Changed: - Drop support for non-incremental layouts in `Row` and `Column`. diff --git a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/treehouseAppFactoryAndroid.kt b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/treehouseAppFactoryAndroid.kt index cb275fb5ae..e1c19970bd 100644 --- a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/treehouseAppFactoryAndroid.kt +++ b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/treehouseAppFactoryAndroid.kt @@ -19,6 +19,7 @@ import android.content.Context import app.cash.redwood.leaks.LeakDetector import app.cash.zipline.loader.LoaderEventListener import app.cash.zipline.loader.ManifestVerifier +import app.cash.zipline.loader.ZiplineHttpClient import app.cash.zipline.loader.asZiplineHttpClient import kotlinx.coroutines.Dispatchers import okhttp3.OkHttpClient @@ -38,9 +39,36 @@ public fun TreehouseAppFactory( concurrentDownloads: Int = 8, stateStore: StateStore = MemoryStateStore(), leakDetector: LeakDetector = LeakDetector.none(), +): TreehouseApp.Factory = TreehouseAppFactory( + context = context, + httpClient = httpClient.asZiplineHttpClient(), + manifestVerifier = manifestVerifier, + embeddedFileSystem = embeddedFileSystem, + embeddedDir = embeddedDir, + cacheName = cacheName, + cacheMaxSizeInBytes = cacheMaxSizeInBytes, + loaderEventListener = loaderEventListener, + concurrentDownloads = concurrentDownloads, + stateStore = stateStore, + leakDetector = leakDetector, +) + +@Suppress("FunctionName") +public fun TreehouseAppFactory( + context: Context, + httpClient: ZiplineHttpClient, + manifestVerifier: ManifestVerifier, + embeddedFileSystem: FileSystem? = null, + embeddedDir: Path? = null, + cacheName: String = "zipline", + cacheMaxSizeInBytes: Long = 50L * 1024L * 1024L, + loaderEventListener: LoaderEventListener = LoaderEventListener.None, + concurrentDownloads: Int = 8, + stateStore: StateStore = MemoryStateStore(), + leakDetector: LeakDetector = LeakDetector.none(), ): TreehouseApp.Factory = RealTreehouseApp.Factory( platform = AndroidTreehousePlatform(context), - httpClient = httpClient.asZiplineHttpClient(), + httpClient = httpClient, frameClockFactory = AndroidChoreographerFrameClock.Factory(), manifestVerifier = manifestVerifier, embeddedFileSystem = embeddedFileSystem,