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

Commit 9b68b54

Browse files
committed
Adding some doc comments
1 parent 30b4abc commit 9b68b54

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

CodePush.ios.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ function notifyApplicationReady() {
9696
return NativeCodePush.notifyApplicationReady();
9797
}
9898

99+
/**
100+
* The sync method provides a simple, one-line experience for
101+
* incorporating the check, download and application of an update.
102+
*
103+
* It simply composes the existing API methods together and adds additional
104+
* support for respecting mandatory updates, ignoring previously failed
105+
* releases, and displaying a standard confirmation UI to the end-user
106+
* when an update is available.
107+
*/
99108
function sync(options = {}) {
100109
var syncOptions = {
101110
ignoreFailedUpdates: true,
@@ -139,8 +148,10 @@ function sync(options = {}) {
139148
dialogButtons[0].text = syncOptions.mandatoryContinueButtonLabel;
140149
} else {
141150
message = syncOptions.optionalUpdateMessage;
142-
143-
dialogButtons[0].text = syncOptions.optionalInstallButtonLabel;
151+
dialogButtons[0].text = syncOptions.optionalInstallButtonLabel;
152+
153+
// Since this is an optional update, add another button
154+
// to allow the end-user to ignore it
144155
dialogButtons.push({
145156
text: syncOptions.optionalIgnoreButtonLabel,
146157
onPress: () => resolve(CodePush.SyncStatus.UPDATE_IGNORED)
@@ -161,9 +172,9 @@ var CodePush = {
161172
setUpTestDependencies: setUpTestDependencies,
162173
sync: sync,
163174
SyncStatus: {
164-
NO_UPDATE_AVAILABLE: 0,
165-
UPDATE_IGNORED: 1,
166-
APPLY_SUCCESS: 2
175+
NO_UPDATE_AVAILABLE: 0, // The running app is up-to-date
176+
UPDATE_IGNORED: 1, // The app had an optional update and the end-user chose to ignore it
177+
APPLY_SUCCESS: 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
167178
}
168179
};
169180

0 commit comments

Comments
 (0)