From 786c1ecc2a6856967d676da68eb02f89eb38fb79 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 3 May 2018 08:38:15 -0700 Subject: [PATCH] Markers: add info about type of delta client Summary: Adds information which type of delta client is used (if at all) to the `BundleInfo` object. Reviewed By: fromcelticpark Differential Revision: D7845139 fbshipit-source-id: e4bf6cda62c71a78aaff97aa69daec263e6d3cdf --- .../facebook/react/devsupport/BundleDownloader.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java index 69f50a832..e64d02edb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java @@ -47,6 +47,7 @@ public class BundleDownloader { private @Nullable Call mDownloadBundleFromURLCall; public static class BundleInfo { + private @Nullable String mDeltaClientName; private @Nullable String mUrl; private int mFilesChangedCount; @@ -59,6 +60,7 @@ public class BundleDownloader { try { JSONObject obj = new JSONObject(jsonStr); + info.mDeltaClientName = obj.getString("deltaClient"); info.mUrl = obj.getString("url"); info.mFilesChangedCount = obj.getInt("filesChangedCount"); } catch (JSONException e) { @@ -73,6 +75,7 @@ public class BundleDownloader { JSONObject obj = new JSONObject(); try { + obj.put("deltaClient", mDeltaClientName); obj.put("url", mUrl); obj.put("filesChangedCount", mFilesChangedCount); } catch (JSONException e) { @@ -83,6 +86,10 @@ public class BundleDownloader { return obj.toString(); } + public @Nullable String getDeltaClient() { + return mDeltaClientName; + } + public String getUrl() { return mUrl != null ? mUrl : "unknown"; } @@ -281,7 +288,7 @@ public class BundleDownloader { } if (bundleInfo != null) { - populateBundleInfo(url, headers, bundleInfo); + populateBundleInfo(url, headers, clientType, bundleInfo); } File tmpFile = new File(outputFile.getPath() + ".tmp"); @@ -333,7 +340,8 @@ public class BundleDownloader { return true; } - private static void populateBundleInfo(String url, Headers headers, BundleInfo bundleInfo) { + private static void populateBundleInfo(String url, Headers headers, BundleDeltaClient.ClientType clientType, BundleInfo bundleInfo) { + bundleInfo.mDeltaClientName = clientType == BundleDeltaClient.ClientType.NONE ? null : clientType.name(); bundleInfo.mUrl = url; String filesChangedCountStr = headers.get("X-Metro-Files-Changed-Count");