From 4bea6847e83c3fa908efc0d8d1845aed3edf69d7 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Fri, 15 Apr 2016 17:11:30 -0700 Subject: [PATCH] Set isPending --- ios/CodePush/CodePush.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/CodePush/CodePush.m b/ios/CodePush/CodePush.m index 0f73662..1fc223d 100644 --- a/ios/CodePush/CodePush.m +++ b/ios/CodePush/CodePush.m @@ -544,7 +544,7 @@ RCT_EXPORT_METHOD(getUpdateMetadata:(CodePushUpdateState)updateState { NSError *error; NSMutableDictionary *package = [[CodePushPackage getCurrentPackage:&error] mutableCopy]; - + if (error) { return reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error); } else if (package == nil) { @@ -570,13 +570,17 @@ RCT_EXPORT_METHOD(getUpdateMetadata:(CodePushUpdateState)updateState // 1) Caller wanted a pending, and there is a pending update // 2) Caller wanted the running update, and there isn't a pending // 3) Calers wants the latest update, regardless if it's pending or not + 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"]; } - + + // To support differentiating pending vs. non-pending updates + // when request an update state of LATEST, provide an isPending flag + [package setObject:@(currentUpdateIsPending) forKey:PackageIsPendingKey]; resolve(package); } }