This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
android/app/src/main/java/com/microsoft/codepush/react Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,9 @@ async function checkForUpdate(deploymentKey = null) {
7070 * because we want to avoid having to install diff updates against the binary's
7171 * version, which we can't do yet on Android.
7272 */
73- if ( ! update || update . updateAppVersion || localPackage && ( update . packageHash === localPackage . packageHash ) || ! localPackage && config . packageHash === update . packageHash ) {
73+ if ( ! update || update . updateAppVersion ||
74+ localPackage && ( update . packageHash === localPackage . packageHash ) ||
75+ ( ! localPackage || localPackage . _isDebugOnly ) && config . packageHash === update . packageHash ) {
7476 if ( update && update . updateAppVersion ) {
7577 log ( "An update is available but it is targeting a newer binary version than you are currently running." ) ;
7678 }
Original file line number Diff line number Diff line change @@ -423,6 +423,10 @@ protected Void doInBackground(Object... params) {
423423 return null ;
424424 }
425425
426+ if (isRunningBinaryVersion ) {
427+ currentPackage .putBoolean ("_isDebugOnly" , true );
428+ }
429+
426430 Boolean isPendingUpdate = false ;
427431
428432 if (currentPackage .hasKey (codePushPackage .PACKAGE_HASH_KEY )) {
Original file line number Diff line number Diff line change @@ -480,6 +480,13 @@ - (void)savePendingUpdate:(NSString *)packageHash
480480 return ;
481481 }
482482
483+ if (isRunningBinaryVersion) {
484+ // This only matters in Debug builds. Since we do not clear "outdated" updates,
485+ // we need to indicate to the JS side that somehow we have a current update on
486+ // disk that is not actually running.
487+ [package setObject: @(YES ) forKey: @" _isDebugOnly" ];
488+ }
489+
483490 // Add the "isPending" virtual property to the package at this point, so that
484491 // the script-side doesn't need to immediately call back into native to populate it.
485492 BOOL isPendingUpdate = [self isPendingUpdate: [package objectForKey: PackageHashKey]];
You can’t perform that action at this time.
0 commit comments