@@ -107,6 +107,9 @@ function notifyApplicationReady() {
107
107
*/
108
108
function sync ( options = { } ) {
109
109
var syncOptions = {
110
+ descriptionPrefix : " Description: " ,
111
+ appendReleaseDescription : false ,
112
+
110
113
ignoreFailedUpdates : true ,
111
114
112
115
mandatoryContinueButtonLabel : "Continue" ,
@@ -119,7 +122,6 @@ function sync(options = {}) {
119
122
rollbackTimeout : 0 ,
120
123
121
124
updateTitle : "Update available" ,
122
- useReleaseDescription : false ,
123
125
124
126
...options
125
127
} ;
@@ -128,7 +130,7 @@ function sync(options = {}) {
128
130
checkForUpdate ( )
129
131
. then ( ( remotePackage ) => {
130
132
if ( ! remotePackage || ( remotePackage . failedApply && syncOptions . ignoreFailedUpdates ) ) {
131
- resolve ( CodePush . SyncStatus . NO_UPDATE_AVAILABLE ) ;
133
+ resolve ( CodePush . SyncStatus . UP_TO_DATE ) ;
132
134
}
133
135
else {
134
136
var message = null ;
@@ -138,9 +140,11 @@ function sync(options = {}) {
138
140
onPress : ( ) => {
139
141
remotePackage . download ( )
140
142
. then ( ( localPackage ) => {
141
- resolve ( CodePush . SyncStatus . UPDATE_DOWNLOADED ) ;
142
- localPackage . apply ( syncOptions . rollbackTimeout ) ;
143
- } , reject ) ;
143
+ resolve ( CodePush . SyncStatus . UPDATE_APPLIED )
144
+ return localPackage . apply ( syncOptions . rollbackTimeout ) ;
145
+ } )
146
+ . catch ( reject )
147
+ . done ( ) ;
144
148
}
145
149
}
146
150
] ;
@@ -162,13 +166,15 @@ function sync(options = {}) {
162
166
163
167
// If the update has a description, and the developer
164
168
// explicitly chose to display it, then set that as the message
165
- if ( syncOptions . useReleaseDescription && remotePackage . description ) {
166
- message = remotePackage . description ;
169
+ if ( syncOptions . appendReleaseDescription && remotePackage . description ) {
170
+ message += ` ${ syncOptions . descriptionPrefix } ${ remotePackage . description } ` ;
167
171
}
168
172
169
173
AlertIOS . alert ( syncOptions . updateTitle , message , dialogButtons ) ;
170
174
}
171
- } , reject ) ;
175
+ } )
176
+ . catch ( reject )
177
+ . done ( ) ;
172
178
} ) ;
173
179
} ;
174
180
@@ -180,9 +186,9 @@ var CodePush = {
180
186
setUpTestDependencies : setUpTestDependencies ,
181
187
sync : sync ,
182
188
SyncStatus : {
183
- NO_UPDATE_AVAILABLE : 0 , // The running app is up-to-date
189
+ UP_TO_DATE : 0 , // The running app is up-to-date
184
190
UPDATE_IGNORED : 1 , // The app had an optional update and the end-user chose to ignore it
185
- UPDATE_DOWNLOADED : 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
191
+ UPDATE_APPLIED : 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
186
192
}
187
193
} ;
188
194
0 commit comments