mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-06 22:38:37 +08:00
downloadBundleFromURL with an optional starting Request.Builder
Summary: This makes it possible to specify an optional Request.Builder when calling `downloadBundleFromURL` (the old method still works as usual). Reviewed By: davidaurelio Differential Revision: D8691303 fbshipit-source-id: 2fb2aecd3506355c6b3a72457a7bb9acfd03b18d
This commit is contained in:
committed by
Facebook Github Bot
parent
0f4926598a
commit
ac09261a4c
@@ -104,14 +104,25 @@ public class BundleDownloader {
|
||||
}
|
||||
|
||||
public void downloadBundleFromURL(
|
||||
final DevBundleDownloadListener callback,
|
||||
final File outputFile,
|
||||
final String bundleURL,
|
||||
final @Nullable BundleInfo bundleInfo,
|
||||
final BundleDeltaClient.ClientType clientType) {
|
||||
final DevBundleDownloadListener callback,
|
||||
final File outputFile,
|
||||
final String bundleURL,
|
||||
final @Nullable BundleInfo bundleInfo,
|
||||
final BundleDeltaClient.ClientType clientType) {
|
||||
downloadBundleFromURL(
|
||||
callback, outputFile, bundleURL, bundleInfo, clientType, new Request.Builder());
|
||||
}
|
||||
|
||||
public void downloadBundleFromURL(
|
||||
final DevBundleDownloadListener callback,
|
||||
final File outputFile,
|
||||
final String bundleURL,
|
||||
final @Nullable BundleInfo bundleInfo,
|
||||
final BundleDeltaClient.ClientType clientType,
|
||||
Request.Builder requestBuilder) {
|
||||
|
||||
final Request request =
|
||||
new Request.Builder()
|
||||
requestBuilder
|
||||
.url(formatBundleUrl(bundleURL, clientType))
|
||||
// FIXME: there is a bug that makes MultipartStreamReader to never find the end of the
|
||||
// multipart message. This temporarily disables the multipart mode to work around it,
|
||||
|
||||
@@ -382,6 +382,16 @@ public class DevServerHelper {
|
||||
mBundleDownloader.downloadBundleFromURL(callback, outputFile, bundleURL, bundleInfo, getDeltaClientType());
|
||||
}
|
||||
|
||||
public void downloadBundleFromURL(
|
||||
DevBundleDownloadListener callback,
|
||||
File outputFile,
|
||||
String bundleURL,
|
||||
BundleDownloader.BundleInfo bundleInfo,
|
||||
Request.Builder requestBuilder) {
|
||||
mBundleDownloader.downloadBundleFromURL(
|
||||
callback, outputFile, bundleURL, bundleInfo, getDeltaClientType(), requestBuilder);
|
||||
}
|
||||
|
||||
private BundleDeltaClient.ClientType getDeltaClientType() {
|
||||
if (mSettings.isBundleDeltasCppEnabled()) {
|
||||
return BundleDeltaClient.ClientType.NATIVE;
|
||||
|
||||
Reference in New Issue
Block a user