Add new FileSourceProvider

Reviewed By: michalgr

Differential Revision: D3207541

fbshipit-source-id: d53599c3cf36ae7c89e85a29f637987bc7139159
This commit is contained in:
Tadeu Zagallo
2016-07-07 08:37:27 -07:00
committed by Facebook Github Bot 7
parent f11a783e64
commit af24e8001a
11 changed files with 291 additions and 50 deletions

View File

@@ -28,11 +28,18 @@ public abstract class JSBundleLoader {
public static JSBundleLoader createFileLoader(
final Context context,
final String fileName) {
return createFileLoader(context, fileName, false);
}
public static JSBundleLoader createFileLoader(
final Context context,
final String fileName,
final boolean useLazyBundle) {
return new JSBundleLoader() {
@Override
public void loadScript(CatalystInstanceImpl instance) {
if (fileName.startsWith("assets://")) {
instance.loadScriptFromAssets(context.getAssets(), fileName);
instance.loadScriptFromAssets(context.getAssets(), fileName, useLazyBundle);
} else {
instance.loadScriptFromFile(fileName, fileName);
}