diff --git a/CodePush.js b/CodePush.js index 7834f08..70efd24 100644 --- a/CodePush.js +++ b/CodePush.js @@ -70,7 +70,9 @@ async function checkForUpdate(deploymentKey = null) { * because we want to avoid having to install diff updates against the binary's * version, which we can't do yet on Android. */ - if (!update || update.updateAppVersion || localPackage && (update.packageHash === localPackage.packageHash) || !localPackage && config.packageHash === update.packageHash) { + if (!update || update.updateAppVersion || + localPackage && (update.packageHash === localPackage.packageHash) || + (!localPackage || localPackage._isDebugOnly) && config.packageHash === update.packageHash) { if (update && update.updateAppVersion) { log("An update is available but it is targeting a newer binary version than you are currently running."); } diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java index da51b84..446e2bc 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java @@ -423,6 +423,10 @@ public class CodePush { return null; } + if (isRunningBinaryVersion) { + currentPackage.putBoolean("_isDebugOnly", true); + } + Boolean isPendingUpdate = false; if (currentPackage.hasKey(codePushPackage.PACKAGE_HASH_KEY)) { diff --git a/ios/CodePush/CodePush.m b/ios/CodePush/CodePush.m index 0ccbc64..b0647b4 100644 --- a/ios/CodePush/CodePush.m +++ b/ios/CodePush/CodePush.m @@ -480,6 +480,13 @@ RCT_EXPORT_METHOD(getCurrentPackage:(RCTPromiseResolveBlock)resolve return; } + if (isRunningBinaryVersion) { + // This only matters in Debug builds. Since we do not clear "outdated" updates, + // we need to indicate to the JS side that somehow we have a current update on + // disk that is not actually running. + [package setObject:@(YES) forKey:@"_isDebugOnly"]; + } + // Add the "isPending" virtual property to the package at this point, so that // the script-side doesn't need to immediately call back into native to populate it. BOOL isPendingUpdate = [self isPendingUpdate:[package objectForKey:PackageHashKey]];