Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 340bb7e

Browse files
committed
feedback
1 parent 02e556d commit 340bb7e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CodePush.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,28 @@ function setUpTestDependencies(testSdk, providedTestConfig, testNativeBridge) {
170170
if (testNativeBridge) NativeCodePush = testNativeBridge;
171171
}
172172

173-
// This function allows sync operations to be chained on to each other so that they do not
173+
// This function allows calls to syncInternal to be chained on to each other so that they do not
174174
// interleave in the event that sync() is called multiple times.
175175
const sync = (() => {
176176
let syncPromiseChain = Promise.resolve();
177177
return (options = {}, syncStatusChangeCallback, downloadProgressCallback) => {
178178
syncPromiseChain = syncPromiseChain
179179
.catch(() => {})
180-
.then(() => syncOperation(options, syncStatusChangeCallback, downloadProgressCallback));
180+
.then(() => syncInternal(options, syncStatusChangeCallback, downloadProgressCallback));
181181
return syncPromiseChain;
182182
};
183183
})();
184184

185185
/*
186-
* The syncOperation method provides a simple, one-line experience for
186+
* The syncInternal method provides a simple, one-line experience for
187187
* incorporating the check, download and application of an update.
188188
*
189189
* It simply composes the existing API methods together and adds additional
190190
* support for respecting mandatory updates, ignoring previously failed
191191
* releases, and displaying a standard confirmation UI to the end-user
192192
* when an update is available.
193193
*/
194-
async function syncOperation(options = {}, syncStatusChangeCallback, downloadProgressCallback) {
194+
async function syncInternal(options = {}, syncStatusChangeCallback, downloadProgressCallback) {
195195
const syncOptions = {
196196

197197
deploymentKey: null,

CodePush.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ - (void)savePendingUpdate:(NSString *)packageHash
506506
RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve
507507
rejecter:(RCTPromiseRejectBlock)reject)
508508
{
509+
// We only mark a pending update as succeeded only if it update has been booted up,
510+
// during which `_isFirstRunAfterUpdate` is true.
509511
if (_isFirstRunAfterUpdate) {
510512
[CodePush removePendingUpdate];
511513
}

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,12 @@ public void isFirstRun(String packageHash, Promise promise) {
539539

540540
@ReactMethod
541541
public void notifyApplicationReady(Promise promise) {
542+
// We only mark a pending update as succeeded only if it update has been booted up,
543+
// during which `didUpdate` is true.
542544
if (didUpdate) {
543545
removePendingUpdate();
544546
}
545-
547+
546548
promise.resolve("");
547549
}
548550

0 commit comments

Comments
 (0)