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

Commit bc7ee8b

Browse files
committed
Typings for the status report
1 parent 26634c0 commit bc7ee8b

File tree

2 files changed

+58
-17
lines changed

2 files changed

+58
-17
lines changed

CodePush.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ if (NativeCodePush) {
429429
PENDING: NativeCodePush.codePushUpdateStatePending,
430430
LATEST: NativeCodePush.codePushUpdateStateLatest
431431
},
432+
DeploymentStatus: {
433+
FAILED: "DeploymentFailed",
434+
SUCCEEDED: "DeploymentSucceeded",
435+
},
432436
DEFAULT_UPDATE_DIALOG: {
433437
appendReleaseDescription: false,
434438
descriptionPrefix: " Description: ",

typings/react-native-code-push.d.ts

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,30 @@ export interface UpdateDialog {
191191
*/
192192
title?: string;
193193
}
194-
195-
declare namespace CodePush {
194+
195+
export interface StatusReport {
196+
/**
197+
* Whether the deployment succeeded or failed.
198+
*/
199+
status: CodePush.DeploymentStatus;
200+
201+
/**
202+
* Details of the package that was deployed (or attempted to).
203+
*/
204+
package: Package;
205+
206+
/**
207+
* Deployment key used when deploying the previous package.
208+
*/
209+
previousDeploymentKey?: string;
210+
211+
/**
212+
* The label (v#) of the package that was upgraded from.
213+
*/
214+
previousLabelOrAppVersion?: string;
215+
}
216+
217+
declare namespace CodePush {
196218
/**
197219
* Represents the default settings that will be used by the sync method if
198220
* an update dialog is configured to be displayed.
@@ -216,7 +238,7 @@ declare namespace CodePush {
216238
/**
217239
* Notifies the CodePush runtime that an installed update is considered successful.
218240
*/
219-
function notifyAppReady(): Promise<void>;
241+
function notifyAppReady(): Promise<StatusReport>;
220242

221243
/**
222244
* Allow CodePush to restart the app.
@@ -273,74 +295,89 @@ declare namespace CodePush {
273295
* The CodePush server is being queried for an update.
274296
*/
275297
CHECKING_FOR_UPDATE,
276-
298+
277299
/**
278300
* An update is available, and a confirmation dialog was shown
279301
* to the end user. (This is only applicable when the updateDialog is used)
280302
*/
281303
AWAITING_USER_ACTION,
282-
304+
283305
/**
284306
* An available update is being downloaded from the CodePush server.
285307
*/
286308
DOWNLOADING_PACKAGE,
287-
309+
288310
/**
289311
* An available update was downloaded and is about to be installed.
290312
*/
291313
INSTALLING_UPDATE,
292-
293-
/**
314+
315+
/**
294316
* The app is up-to-date with the CodePush server.
295317
*/
296318
UP_TO_DATE,
297-
319+
298320
/**
299321
* The app had an optional update which the end user chose to ignore.
300322
* (This is only applicable when the updateDialog is used)
301323
*/
302324
UPDATE_IGNORED,
303-
325+
304326
/**
305327
* An available update has been installed and will be run either immediately after the
306328
* syncStatusChangedCallback function returns or the next time the app resumes/restarts,
307329
* depending on the InstallMode specified in SyncOptions
308330
*/
309331
UPDATE_INSTALLED,
310-
332+
311333
/**
312334
* There is an ongoing sync operation running which prevents the current call from being executed.
313335
*/
314336
SYNC_IN_PROGRESS,
315-
337+
316338
/**
317339
* The sync operation encountered an unknown error.
318340
*/
319341
UNKNOWN_ERROR
320342
}
321-
343+
322344
/**
323345
* Indicates the state that an update is currently in.
324346
*/
325347
enum UpdateState {
326348
/**
327349
* Indicates that an update represents the
328-
* version of the app that is currently running.
350+
* version of the app that is currently running.
329351
*/
330352
RUNNING,
331-
353+
332354
/**
333355
* Indicates than an update has been installed, but the
334356
* app hasn't been restarted yet in order to apply it.
335357
*/
336358
PENDING,
337-
359+
338360
/**
339361
* Indicates than an update represents the latest available
340362
* release, and can be either currently running or pending.
341363
*/
342364
LATEST
343365
}
366+
367+
/**
368+
* Indicates the status of a deployment (after installing and restarting).
369+
*/
370+
enum DeploymentStatus {
371+
/**
372+
* The deployment failed.
373+
*/
374+
FAILED,
375+
376+
/**
377+
* The deployment succeeded.
378+
*/
379+
SUCCEEDED
380+
}
344381
}
345382

346-
export default CodePush;
383+
export default CodePush;

0 commit comments

Comments
 (0)