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:
Yan Soares Couto
2018-07-06 04:16:19 -07:00
committed by Facebook Github Bot
parent 0f4926598a
commit ac09261a4c
2 changed files with 27 additions and 6 deletions

View File

@@ -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,

View File

@@ -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;