@@ -96,6 +96,15 @@ function notifyApplicationReady() {
96
96
return NativeCodePush . notifyApplicationReady ( ) ;
97
97
}
98
98
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
+ */
99
108
function sync ( options = { } ) {
100
109
var syncOptions = {
101
110
ignoreFailedUpdates : true ,
@@ -139,8 +148,10 @@ function sync(options = {}) {
139
148
dialogButtons [ 0 ] . text = syncOptions . mandatoryContinueButtonLabel ;
140
149
} else {
141
150
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
144
155
dialogButtons . push ( {
145
156
text : syncOptions . optionalIgnoreButtonLabel ,
146
157
onPress : ( ) => resolve ( CodePush . SyncStatus . UPDATE_IGNORED )
@@ -161,9 +172,9 @@ var CodePush = {
161
172
setUpTestDependencies : setUpTestDependencies ,
162
173
sync : sync ,
163
174
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
167
178
}
168
179
} ;
169
180
0 commit comments