Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept a ZiplineHttpClient creating a TreehouseAppFactory #2436

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 2 additions & 0 deletions redwood-treehouse-host/api/android/redwood-treehouse-host.api
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public abstract class app/cash/redwood/treehouse/TreehouseApp$Spec {
}

public final class app/cash/redwood/treehouse/TreehouseAppFactoryAndroidKt {
public static final fun TreehouseAppFactory (Landroid/content/Context;Lapp/cash/zipline/loader/ZiplineHttpClient;Lapp/cash/zipline/loader/ManifestVerifier;Lokio/FileSystem;Lokio/Path;Ljava/lang/String;JLapp/cash/zipline/loader/LoaderEventListener;ILapp/cash/redwood/treehouse/StateStore;Lapp/cash/redwood/leaks/LeakDetector;)Lapp/cash/redwood/treehouse/TreehouseApp$Factory;
public static final fun TreehouseAppFactory (Landroid/content/Context;Lokhttp3/OkHttpClient;Lapp/cash/zipline/loader/ManifestVerifier;Lokio/FileSystem;Lokio/Path;Ljava/lang/String;JLapp/cash/zipline/loader/LoaderEventListener;ILapp/cash/redwood/treehouse/StateStore;Lapp/cash/redwood/leaks/LeakDetector;)Lapp/cash/redwood/treehouse/TreehouseApp$Factory;
public static synthetic fun TreehouseAppFactory$default (Landroid/content/Context;Lapp/cash/zipline/loader/ZiplineHttpClient;Lapp/cash/zipline/loader/ManifestVerifier;Lokio/FileSystem;Lokio/Path;Ljava/lang/String;JLapp/cash/zipline/loader/LoaderEventListener;ILapp/cash/redwood/treehouse/StateStore;Lapp/cash/redwood/leaks/LeakDetector;ILjava/lang/Object;)Lapp/cash/redwood/treehouse/TreehouseApp$Factory;
public static synthetic fun TreehouseAppFactory$default (Landroid/content/Context;Lokhttp3/OkHttpClient;Lapp/cash/zipline/loader/ManifestVerifier;Lokio/FileSystem;Lokio/Path;Ljava/lang/String;JLapp/cash/zipline/loader/LoaderEventListener;ILapp/cash/redwood/treehouse/StateStore;Lapp/cash/redwood/leaks/LeakDetector;ILjava/lang/Object;)Lapp/cash/redwood/treehouse/TreehouseApp$Factory;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down