mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-16 19:51:57 +08:00
rely on buildconfig
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user