From 9b68b54c0a5cf357f4b8750f7b1dc0ec3fceca19 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Wed, 28 Oct 2015 18:09:09 -0700 Subject: [PATCH] Adding some doc comments --- CodePush.ios.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/CodePush.ios.js b/CodePush.ios.js index 63f38d4..63ddc67 100644 --- a/CodePush.ios.js +++ b/CodePush.ios.js @@ -96,6 +96,15 @@ function notifyApplicationReady() { return NativeCodePush.notifyApplicationReady(); } +/** + * The sync method provides a simple, one-line experience for + * incorporating the check, download and application of an update. + * + * It simply composes the existing API methods together and adds additional + * support for respecting mandatory updates, ignoring previously failed + * releases, and displaying a standard confirmation UI to the end-user + * when an update is available. + */ function sync(options = {}) { var syncOptions = { ignoreFailedUpdates: true, @@ -139,8 +148,10 @@ function sync(options = {}) { dialogButtons[0].text = syncOptions.mandatoryContinueButtonLabel; } else { message = syncOptions.optionalUpdateMessage; - - dialogButtons[0].text = syncOptions.optionalInstallButtonLabel; + dialogButtons[0].text = syncOptions.optionalInstallButtonLabel; + + // Since this is an optional update, add another button + // to allow the end-user to ignore it dialogButtons.push({ text: syncOptions.optionalIgnoreButtonLabel, onPress: () => resolve(CodePush.SyncStatus.UPDATE_IGNORED) @@ -161,9 +172,9 @@ var CodePush = { setUpTestDependencies: setUpTestDependencies, sync: sync, SyncStatus: { - NO_UPDATE_AVAILABLE: 0, - UPDATE_IGNORED: 1, - APPLY_SUCCESS: 2 + NO_UPDATE_AVAILABLE: 0, // The running app is up-to-date + UPDATE_IGNORED: 1, // The app had an optional update and the end-user chose to ignore it + APPLY_SUCCESS: 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied } };