rely on buildconfig

This commit is contained in:
Geoffrey Goh
2015-12-23 16:34:58 -08:00
parent aa92913496
commit f2b109c78b
2 changed files with 14 additions and 4 deletions

View File

@@ -67,14 +67,20 @@ public class CodePush {
private Activity mainActivity;
private Context applicationContext;
private final boolean isDebugMode;
public CodePush(String deploymentKey, Activity mainActivity) {
this(deploymentKey, mainActivity, false);
}
public CodePush(String deploymentKey, Activity mainActivity, boolean isDebugMode) {
SoLoader.init(mainActivity, false);
this.deploymentKey = deploymentKey;
this.codePushPackage = new CodePushPackage(mainActivity.getFilesDir().getAbsolutePath());
this.mainActivity = mainActivity;
this.applicationContext = mainActivity.getApplicationContext();
this.deploymentKey = deploymentKey;
this.isDebugMode = isDebugMode;
PackageInfo pInfo = null;
try {
@@ -145,7 +151,10 @@ public class CodePush {
} else {
// The binary version is newer.
didUpdate = false;
this.clearUpdates();
if (!this.isDebugMode) {
this.clearUpdates();
}
CodePushUtils.logBundleUrl(binaryJsBundleUrl);
return binaryJsBundleUrl;
}
@@ -194,7 +203,9 @@ public class CodePush {
rollbackPackage();
} else {
// Clear the React dev bundle cache so that new updates can be loaded.
clearReactDevBundleCache();
if (!this.isDebugMode) {
clearReactDevBundleCache();
}
// Mark that we tried to initialize the new update, so that if it crashes,
// we will know that we need to rollback when the app next starts.
savePendingUpdate(pendingUpdate.getString(PENDING_UPDATE_HASH_KEY),