mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-18 12:12:15 +08:00
Unpack files required by optimized bundle format
Reviewed By: tadeuzagallo Differential Revision: D3522855 fbshipit-source-id: 2d14db33ce9b98ea1aeea5a12e292e5926e43796
This commit is contained in:
committed by
Facebook Github Bot 2
parent
e632025917
commit
a665914d18
@@ -14,6 +14,8 @@ import android.content.Context;
|
||||
import com.facebook.react.devsupport.DebugServerException;
|
||||
import com.facebook.react.devsupport.DevServerHelper;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* A class that stores JS bundle information and allows {@link CatalystInstance} to load a correct
|
||||
* bundle through {@link ReactBridge}.
|
||||
@@ -99,6 +101,19 @@ public abstract class JSBundleLoader {
|
||||
};
|
||||
}
|
||||
|
||||
public static JSBundleLoader createUnpackingBundleLoader(
|
||||
final Context context,
|
||||
final String sourceURL,
|
||||
final String bundleName) {
|
||||
return UnpackingJSBundleLoader.newBuilder()
|
||||
.setContext(context)
|
||||
.setSourceURL(sourceURL)
|
||||
.setDestinationPath(new File(context.getFilesDir(), "optimized-bundle"))
|
||||
.checkAndUnpackFile(bundleName + ".meta", "bundle.meta")
|
||||
.unpackFile(bundleName, "bundle.js")
|
||||
.build();
|
||||
}
|
||||
|
||||
public abstract void loadScript(CatalystInstanceImpl instance);
|
||||
public abstract String getSourceUrl();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user