@appzung/react-native-code-push 11.0.0-rc2 → 11.0.0-rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android/app/src/main/java/com/appzung/codepush/react/CodePushNativeModule.java +14 -0
- package/docs/api-js/README.md +55 -0
- package/docs/api-js/enumerations/CheckFrequency.md +33 -0
- package/docs/api-js/enumerations/DeploymentStatus.md +25 -0
- package/docs/api-js/enumerations/InstallMode.md +50 -0
- package/docs/api-js/enumerations/SyncStatus.md +85 -0
- package/docs/api-js/enumerations/UpdateState.md +37 -0
- package/docs/api-js/functions/allowRestart.md +17 -0
- package/docs/api-js/functions/checkForUpdate.md +29 -0
- package/docs/api-js/functions/clearUpdates.md +19 -0
- package/docs/api-js/functions/disallowRestart.md +17 -0
- package/docs/api-js/functions/getClientUniqueId.md +15 -0
- package/docs/api-js/functions/getUpdateMetadata.md +23 -0
- package/docs/api-js/functions/notifyAppReady.md +17 -0
- package/docs/api-js/functions/resetClientUniqueId.md +15 -0
- package/docs/api-js/functions/restartApp.md +25 -0
- package/docs/api-js/functions/sync.md +43 -0
- package/docs/api-js/functions/withCodePush.md +65 -0
- package/docs/api-js/interfaces/CodePushOptions.md +118 -0
- package/docs/api-js/interfaces/DownloadProgress.md +23 -0
- package/docs/api-js/interfaces/LocalPackage.md +171 -0
- package/docs/api-js/interfaces/Package.md +98 -0
- package/docs/api-js/interfaces/RemotePackage.md +169 -0
- package/docs/api-js/interfaces/RollbackRetryOptions.md +28 -0
- package/docs/api-js/interfaces/StatusReport.md +47 -0
- package/docs/api-js/interfaces/SyncOptions.md +80 -0
- package/docs/api-js/interfaces/UpdateDialog.md +89 -0
- package/docs/api-js/type-aliases/DownloadProgressCallback.md +21 -0
- package/docs/api-js/type-aliases/HandleBinaryVersionMismatchCallback.md +21 -0
- package/docs/api-js/type-aliases/SyncStatusChangedCallback.md +23 -0
- package/docs/api-js/variables/DEFAULT_UPDATE_DIALOG.md +12 -0
- package/docs/setup-android.md +1 -1
- package/docs/setup-ios.md +1 -1
- package/ios/CodePush/CodePush.h +1 -0
- package/ios/CodePush/CodePush.m +7 -0
- package/lib/commonjs/CodePush.js +6 -2
- package/lib/commonjs/CodePush.js.map +1 -1
- package/lib/commonjs/allowRestart.js +2 -0
- package/lib/commonjs/allowRestart.js.map +1 -1
- package/lib/commonjs/clearUpdates.js +2 -1
- package/lib/commonjs/clearUpdates.js.map +1 -1
- package/lib/commonjs/disallowRestart.js +2 -0
- package/lib/commonjs/disallowRestart.js.map +1 -1
- package/lib/commonjs/enums/CheckFrequency.enum.js +2 -2
- package/lib/commonjs/enums/InstallMode.enum.js +7 -3
- package/lib/commonjs/enums/InstallMode.enum.js.map +1 -1
- package/lib/commonjs/enums/SyncStatus.enum.js +7 -7
- package/lib/commonjs/enums/UpdateState.enum.js +7 -6
- package/lib/commonjs/enums/UpdateState.enum.js.map +1 -1
- package/lib/commonjs/getClientUniqueId.js +16 -0
- package/lib/commonjs/getClientUniqueId.js.map +1 -0
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internals/getConfiguration.js +4 -0
- package/lib/commonjs/internals/getConfiguration.js.map +1 -1
- package/lib/commonjs/internals/version.js +1 -1
- package/lib/commonjs/notifyAppReady.js +2 -0
- package/lib/commonjs/notifyAppReady.js.map +1 -1
- package/lib/commonjs/resetClientUniqueId.js +18 -0
- package/lib/commonjs/resetClientUniqueId.js.map +1 -0
- package/lib/commonjs/restartApp.js +2 -0
- package/lib/commonjs/restartApp.js.map +1 -1
- package/lib/commonjs/sync.js +5 -3
- package/lib/commonjs/sync.js.map +1 -1
- package/lib/module/CodePush.js +6 -2
- package/lib/module/CodePush.js.map +1 -1
- package/lib/module/allowRestart.js +2 -0
- package/lib/module/allowRestart.js.map +1 -1
- package/lib/module/clearUpdates.js +2 -1
- package/lib/module/clearUpdates.js.map +1 -1
- package/lib/module/disallowRestart.js +2 -0
- package/lib/module/disallowRestart.js.map +1 -1
- package/lib/module/enums/CheckFrequency.enum.js +2 -2
- package/lib/module/enums/InstallMode.enum.js +7 -3
- package/lib/module/enums/InstallMode.enum.js.map +1 -1
- package/lib/module/enums/SyncStatus.enum.js +7 -7
- package/lib/module/enums/UpdateState.enum.js +7 -6
- package/lib/module/enums/UpdateState.enum.js.map +1 -1
- package/lib/module/getClientUniqueId.js +12 -0
- package/lib/module/getClientUniqueId.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internals/getConfiguration.js +3 -0
- package/lib/module/internals/getConfiguration.js.map +1 -1
- package/lib/module/internals/version.js +1 -1
- package/lib/module/notifyAppReady.js +2 -0
- package/lib/module/notifyAppReady.js.map +1 -1
- package/lib/module/resetClientUniqueId.js +14 -0
- package/lib/module/resetClientUniqueId.js.map +1 -0
- package/lib/module/restartApp.js +2 -0
- package/lib/module/restartApp.js.map +1 -1
- package/lib/module/sync.js +5 -3
- package/lib/module/sync.js.map +1 -1
- package/lib/typescript/commonjs/src/CodePush.d.ts +10 -5
- package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/allowRestart.d.ts +2 -0
- package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/clearUpdates.d.ts +2 -1
- package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/disallowRestart.d.ts +2 -0
- package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +2 -2
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +7 -3
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +7 -7
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +7 -6
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/getClientUniqueId.d.ts +5 -0
- package/lib/typescript/commonjs/src/getClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +1 -0
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +1 -0
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/version.d.ts +1 -1
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts +2 -0
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts +5 -0
- package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts +2 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sync.d.ts +3 -1
- package/lib/typescript/commonjs/src/sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types.d.ts +68 -26
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/CodePush.d.ts +10 -5
- package/lib/typescript/module/src/CodePush.d.ts.map +1 -1
- package/lib/typescript/module/src/allowRestart.d.ts +2 -0
- package/lib/typescript/module/src/allowRestart.d.ts.map +1 -1
- package/lib/typescript/module/src/clearUpdates.d.ts +2 -1
- package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -1
- package/lib/typescript/module/src/disallowRestart.d.ts +2 -0
- package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -1
- package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +2 -2
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +7 -3
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -1
- package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +7 -7
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +7 -6
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -1
- package/lib/typescript/module/src/getClientUniqueId.d.ts +5 -0
- package/lib/typescript/module/src/getClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +1 -0
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/getConfiguration.d.ts +1 -0
- package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/version.d.ts +1 -1
- package/lib/typescript/module/src/notifyAppReady.d.ts +2 -0
- package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -1
- package/lib/typescript/module/src/resetClientUniqueId.d.ts +5 -0
- package/lib/typescript/module/src/resetClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/module/src/restartApp.d.ts +2 -0
- package/lib/typescript/module/src/restartApp.d.ts.map +1 -1
- package/lib/typescript/module/src/sync.d.ts +3 -1
- package/lib/typescript/module/src/sync.d.ts.map +1 -1
- package/lib/typescript/module/src/types.d.ts +68 -26
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/CodePush.tsx +12 -5
- package/src/allowRestart.ts +2 -0
- package/src/clearUpdates.ts +2 -1
- package/src/disallowRestart.ts +2 -0
- package/src/enums/CheckFrequency.enum.ts +2 -2
- package/src/enums/InstallMode.enum.ts +7 -3
- package/src/enums/SyncStatus.enum.ts +7 -7
- package/src/enums/UpdateState.enum.ts +7 -6
- package/src/getClientUniqueId.ts +9 -0
- package/src/index.ts +2 -0
- package/src/internals/RNAppZungCodePushModuleSpec.ts +1 -0
- package/src/internals/getConfiguration.ts +4 -0
- package/src/internals/version.ts +1 -1
- package/src/notifyAppReady.ts +2 -0
- package/src/resetClientUniqueId.ts +11 -0
- package/src/restartApp.ts +2 -0
- package/src/sync.ts +5 -3
- package/src/types.ts +70 -26
- package/typedoc.json +9 -0
- package/docs/api-js.md +0 -557
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export enum SyncStatus {
|
|
5
5
|
/**
|
|
6
|
-
* The app is up-to-date with the
|
|
6
|
+
* The app is fully up-to-date with the configured release channel.
|
|
7
7
|
*/
|
|
8
8
|
UP_TO_DATE,
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An available update has been installed and will be run either immediately after the
|
|
12
|
-
* syncStatusChangedCallback function returns or the next time the app resumes/restarts,
|
|
13
|
-
* depending on the InstallMode specified in SyncOptions
|
|
12
|
+
* `syncStatusChangedCallback` function returns or the next time the app resumes/restarts,
|
|
13
|
+
* depending on the `InstallMode` specified in `SyncOptions`
|
|
14
14
|
*/
|
|
15
15
|
UPDATE_INSTALLED,
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* The app had an optional update which the end user chose to ignore.
|
|
19
|
-
* (This is only applicable when the updateDialog is used)
|
|
19
|
+
* (This is only applicable when the `updateDialog` is used)
|
|
20
20
|
*/
|
|
21
21
|
UPDATE_IGNORED,
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* The sync operation encountered an unknown error.
|
|
24
|
+
* The `sync` operation encountered an unknown error.
|
|
25
25
|
*/
|
|
26
26
|
UNKNOWN_ERROR,
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* There is an ongoing sync operation running which prevents the current call from being executed.
|
|
29
|
+
* There is an ongoing `sync` operation running which prevents the current call from being executed.
|
|
30
30
|
*/
|
|
31
31
|
SYNC_IN_PROGRESS,
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export enum SyncStatus {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* An update is available, and a confirmation dialog was shown
|
|
40
|
-
* to the end user. (This is only applicable when the updateDialog is used)
|
|
40
|
+
* to the end user. (This is only applicable when the `updateDialog` is used)
|
|
41
41
|
*/
|
|
42
42
|
AWAITING_USER_ACTION,
|
|
43
43
|
|
|
@@ -5,20 +5,21 @@ import { NativeRNAppZungCodePushModule } from '../internals/NativeRNAppZungCodeP
|
|
|
5
5
|
*/
|
|
6
6
|
export enum UpdateState {
|
|
7
7
|
/**
|
|
8
|
-
* Indicates that an update represents the
|
|
9
|
-
*
|
|
8
|
+
* Indicates that an update represents the version of the app that is currently running.
|
|
9
|
+
*
|
|
10
|
+
* This can be useful for identifying attributes about the app, for scenarios such as displaying the release description in a "what's new?" dialog or reporting the latest version to an analytics and/or crash reporting service.
|
|
10
11
|
*/
|
|
11
12
|
RUNNING = NativeRNAppZungCodePushModule.getConstants().codePushUpdateStateRunning,
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* Indicates than an update has been installed, but the
|
|
15
|
-
*
|
|
15
|
+
* Indicates than an update has been installed, but the app hasn't been restarted yet in order to apply it.
|
|
16
|
+
*
|
|
17
|
+
* This can be useful for determining whether there is a pending update, which you may want to force a programmatic restart (via `restartApp`) in order to apply.
|
|
16
18
|
*/
|
|
17
19
|
PENDING = NativeRNAppZungCodePushModule.getConstants().codePushUpdateStatePending,
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
|
-
* Indicates than an update represents the latest available
|
|
21
|
-
* release, and can be either currently running or pending.
|
|
22
|
+
* Indicates than an update represents the latest available release, and can be either currently running or pending.
|
|
22
23
|
*/
|
|
23
24
|
LATEST = NativeRNAppZungCodePushModule.getConstants().codePushUpdateStateLatest,
|
|
24
25
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getConfiguration } from './internals/getConfiguration';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gets the client's unique ID set by the module. You may also see `resetClientUniqueId`.
|
|
5
|
+
*/
|
|
6
|
+
export const getClientUniqueId = async () => {
|
|
7
|
+
const nativeConfig = await getConfiguration();
|
|
8
|
+
return nativeConfig.clientUniqueId;
|
|
9
|
+
};
|
package/src/index.ts
CHANGED
package/src/internals/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '11.0.0-
|
|
2
|
+
export const version = '11.0.0-rc3';
|
package/src/notifyAppReady.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { StatusReport } from './types';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Notifies the CodePush runtime that an installed update is considered successful.
|
|
11
|
+
*
|
|
12
|
+
* If you are manually checking for and installing updates (i.e. not using the `sync` method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
|
|
11
13
|
*/
|
|
12
14
|
export const notifyAppReady = (() => {
|
|
13
15
|
// This ensures that notifyApplicationReadyInternal is only called once
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
|
|
2
|
+
import { reloadCachedConfiguration } from './internals/getConfiguration';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resets the client's unique ID. You may use this in some GDPR compliance scenarios. Note that this will create a new MAU if a new request is sent later.
|
|
6
|
+
*/
|
|
7
|
+
export const resetClientUniqueId = async () => {
|
|
8
|
+
const newId = await NativeRNAppZungCodePushModule.resetClientUniqueId();
|
|
9
|
+
await reloadCachedConfiguration();
|
|
10
|
+
return newId;
|
|
11
|
+
};
|
package/src/restartApp.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
3
3
|
/**
|
|
4
4
|
* Immediately restarts the app.
|
|
5
5
|
*
|
|
6
|
+
* If there is an update pending, it will be immediately displayed to the end user. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process.
|
|
7
|
+
*
|
|
6
8
|
* @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update.
|
|
7
9
|
*/
|
|
8
10
|
export async function restartApp(onlyIfUpdateIsPending = false) {
|
package/src/sync.ts
CHANGED
|
@@ -206,6 +206,8 @@ async function syncInternal(
|
|
|
206
206
|
/**
|
|
207
207
|
* Allows checking for an update, downloading it and installing it, all with a single call.
|
|
208
208
|
*
|
|
209
|
+
* Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps, if they are not using the `withCodePush` HOC.
|
|
210
|
+
*
|
|
209
211
|
* @param options Options used to configure the end-user update experience (e.g. show a prompt?, install the update immediately?).
|
|
210
212
|
* @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise.
|
|
211
213
|
* @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded.
|
|
@@ -222,17 +224,17 @@ export const sync = (() => {
|
|
|
222
224
|
|
|
223
225
|
return (
|
|
224
226
|
options?: SyncOptions,
|
|
225
|
-
|
|
227
|
+
syncStatusChangedCallback?: SyncStatusChangedCallback,
|
|
226
228
|
downloadProgressCallback?: DownloadProgressCallback,
|
|
227
229
|
handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback,
|
|
228
230
|
): Promise<SyncStatus> => {
|
|
229
231
|
let syncStatusCallbackWithTryCatch: SyncStatusChangedCallback | undefined;
|
|
230
232
|
let downloadProgressCallbackWithTryCatch: DownloadProgressCallback | undefined;
|
|
231
233
|
|
|
232
|
-
if (typeof
|
|
234
|
+
if (typeof syncStatusChangedCallback === 'function') {
|
|
233
235
|
syncStatusCallbackWithTryCatch = (...args) => {
|
|
234
236
|
try {
|
|
235
|
-
|
|
237
|
+
syncStatusChangedCallback(...args);
|
|
236
238
|
} catch (error) {
|
|
237
239
|
log(`An error has occurred : ${error instanceof Error ? error.stack : 'unknown'}`);
|
|
238
240
|
}
|
package/src/types.ts
CHANGED
|
@@ -6,50 +6,78 @@ import type { SyncStatus } from './enums/SyncStatus.enum';
|
|
|
6
6
|
export interface UpdateDialog {
|
|
7
7
|
/**
|
|
8
8
|
* Indicates whether you would like to append the description of an available release to the
|
|
9
|
-
* notification message which is displayed to the end user.
|
|
9
|
+
* notification message which is displayed to the end user.
|
|
10
|
+
*
|
|
11
|
+
* Defaults to false.
|
|
10
12
|
*/
|
|
11
13
|
appendReleaseDescription?: boolean;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Indicates the string you would like to prefix the release description with, if any, when
|
|
15
|
-
* displaying the update notification to the end user.
|
|
17
|
+
* displaying the update notification to the end user.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to " Description: "
|
|
16
20
|
*/
|
|
17
21
|
descriptionPrefix?: string;
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
|
-
* The text to use for the button the end user must press in order to install a mandatory update.
|
|
24
|
+
* The text to use for the button the end user must press in order to install a mandatory update.
|
|
25
|
+
*
|
|
26
|
+
* Defaults to "Continue".
|
|
21
27
|
*/
|
|
22
28
|
mandatoryContinueButtonLabel?: string;
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
31
|
* The text used as the body of an update notification, when the update is specified as mandatory.
|
|
32
|
+
*
|
|
26
33
|
* Defaults to "An update is available that must be installed.".
|
|
27
34
|
*/
|
|
28
35
|
mandatoryUpdateMessage?: string;
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
|
-
* The text to use for the button the end user can press in order to ignore an optional update that is available.
|
|
38
|
+
* The text to use for the button the end user can press in order to ignore an optional update that is available.
|
|
39
|
+
*
|
|
40
|
+
* Defaults to "Ignore".
|
|
32
41
|
*/
|
|
33
42
|
optionalIgnoreButtonLabel?: string;
|
|
34
43
|
|
|
35
44
|
/**
|
|
36
|
-
* The text to use for the button the end user can press in order to install an optional update.
|
|
45
|
+
* The text to use for the button the end user can press in order to install an optional update.
|
|
46
|
+
*
|
|
47
|
+
* Defaults to "Install".
|
|
37
48
|
*/
|
|
38
49
|
optionalInstallButtonLabel?: string;
|
|
39
50
|
|
|
40
51
|
/**
|
|
41
|
-
* The text used as the body of an update notification, when the update is optional.
|
|
52
|
+
* The text used as the body of an update notification, when the update is optional.
|
|
53
|
+
*
|
|
54
|
+
* Defaults to "An update is available. Would you like to install it?".
|
|
42
55
|
*/
|
|
43
56
|
optionalUpdateMessage?: string;
|
|
44
57
|
|
|
45
58
|
/**
|
|
46
|
-
* The text used as the header of an update notification that is displayed to the end user.
|
|
59
|
+
* The text used as the header of an update notification that is displayed to the end user.
|
|
60
|
+
*
|
|
61
|
+
* Defaults to "Update available".
|
|
47
62
|
*/
|
|
48
63
|
title?: string;
|
|
49
64
|
}
|
|
50
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Called periodically when an available update is being downloaded from the CodePush server.
|
|
68
|
+
*/
|
|
51
69
|
export type DownloadProgressCallback = (progress: DownloadProgress) => void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Called when the sync process moves from one stage to another in the overall update process.
|
|
73
|
+
*
|
|
74
|
+
* The method is called with a status code which represents the current state, and can be any of the `SyncStatus` values.
|
|
75
|
+
*/
|
|
52
76
|
export type SyncStatusChangedCallback = (status: SyncStatus) => void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Called when there are any binary update available.
|
|
80
|
+
*/
|
|
53
81
|
export type HandleBinaryVersionMismatchCallback = (update: NativeUpdateNotification) => void;
|
|
54
82
|
|
|
55
83
|
export interface DownloadProgress {
|
|
@@ -64,6 +92,9 @@ export interface DownloadProgress {
|
|
|
64
92
|
receivedBytes: number;
|
|
65
93
|
}
|
|
66
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Represents a downloaded update that is either already running, or has been installed and is pending an app restart.
|
|
97
|
+
*/
|
|
67
98
|
export interface LocalPackage extends Package {
|
|
68
99
|
/**
|
|
69
100
|
* Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app.
|
|
@@ -82,7 +113,7 @@ export interface LocalPackage extends Package {
|
|
|
82
113
|
export interface Package {
|
|
83
114
|
/**
|
|
84
115
|
* The app binary version that this update is dependent on. This is the value that was
|
|
85
|
-
* specified via the
|
|
116
|
+
* specified via the --target-binary-version parameter when calling the CLI's release command.
|
|
86
117
|
*/
|
|
87
118
|
appVersion: string;
|
|
88
119
|
|
|
@@ -98,11 +129,15 @@ export interface Package {
|
|
|
98
129
|
|
|
99
130
|
/**
|
|
100
131
|
* Indicates whether this update has been previously installed but was rolled back.
|
|
132
|
+
*
|
|
133
|
+
* The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`.
|
|
101
134
|
*/
|
|
102
135
|
failedInstall: boolean;
|
|
103
136
|
|
|
104
137
|
/**
|
|
105
138
|
* Indicates whether this is the first time the update has been run after being installed.
|
|
139
|
+
*
|
|
140
|
+
* This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update.
|
|
106
141
|
*/
|
|
107
142
|
isFirstRun: boolean;
|
|
108
143
|
|
|
@@ -133,6 +168,9 @@ export interface Package {
|
|
|
133
168
|
packageSize: number;
|
|
134
169
|
}
|
|
135
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Represents an available update on the CodePush server that hasn't been downloaded yet.
|
|
173
|
+
*/
|
|
136
174
|
export interface RemotePackage extends Package {
|
|
137
175
|
/**
|
|
138
176
|
* Downloads the available update from the CodePush service.
|
|
@@ -143,27 +181,31 @@ export interface RemotePackage extends Package {
|
|
|
143
181
|
|
|
144
182
|
/**
|
|
145
183
|
* The URL at which the package is available for download.
|
|
184
|
+
*
|
|
185
|
+
* This property is only needed for advanced usage, since the `download` method will automatically handle the acquisition of updates for you.
|
|
146
186
|
*/
|
|
147
187
|
downloadUrl: string;
|
|
148
188
|
}
|
|
149
189
|
|
|
150
190
|
export interface SyncOptions {
|
|
151
191
|
/**
|
|
152
|
-
* Specifies the release channel you want to query for an update against.
|
|
153
|
-
*
|
|
154
|
-
* dynamically use a different release channel for a specific call to sync.
|
|
192
|
+
* Specifies the release channel you want to query for an update against.
|
|
193
|
+
*
|
|
194
|
+
* By default, this value is derived from the Info.plist file (iOS) and strings resources (Android), but this option allows you to override it from the JS-side if you need to dynamically use a different release channel for a specific call to sync.
|
|
155
195
|
*/
|
|
156
196
|
releaseChannelPublicId?: string;
|
|
157
197
|
|
|
158
198
|
/**
|
|
159
|
-
* Specifies when you would like to install
|
|
160
|
-
*
|
|
199
|
+
* Specifies when you would like to install regular updates (i.e. those that aren't marked as mandatory).
|
|
200
|
+
*
|
|
201
|
+
* Defaults to InstallMode.ON_NEXT_RESTART.
|
|
161
202
|
*/
|
|
162
203
|
installMode?: InstallMode;
|
|
163
204
|
|
|
164
205
|
/**
|
|
165
206
|
* Specifies when you would like to install updates which are marked as mandatory.
|
|
166
|
-
*
|
|
207
|
+
*
|
|
208
|
+
* Defaults to InstallMode.IMMEDIATE.
|
|
167
209
|
*/
|
|
168
210
|
mandatoryInstallMode?: InstallMode;
|
|
169
211
|
|
|
@@ -176,19 +218,18 @@ export interface SyncOptions {
|
|
|
176
218
|
minimumBackgroundDuration?: number;
|
|
177
219
|
|
|
178
220
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* overriding one or more of the default strings.
|
|
221
|
+
* Used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use.
|
|
222
|
+
*
|
|
223
|
+
* Defaults to null, which has the effect of disabling the dialog completely.
|
|
224
|
+
* Setting this to true will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings.
|
|
183
225
|
*/
|
|
184
226
|
updateDialog?: UpdateDialog | true;
|
|
185
227
|
|
|
186
228
|
/**
|
|
187
|
-
* The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding
|
|
191
|
-
* one or more of the default values.
|
|
229
|
+
* The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions specified in the options).
|
|
230
|
+
*
|
|
231
|
+
* This defaults to null, which has the effect of disabling the retry mechanism.
|
|
232
|
+
* Setting this to true will enable the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding one or more of the default values.
|
|
192
233
|
*/
|
|
193
234
|
rollbackRetryOptions?: RollbackRetryOptions | true;
|
|
194
235
|
|
|
@@ -197,14 +238,17 @@ export interface SyncOptions {
|
|
|
197
238
|
|
|
198
239
|
export interface RollbackRetryOptions {
|
|
199
240
|
/**
|
|
200
|
-
* Specifies the minimum time in hours that the app will wait after the latest rollback
|
|
201
|
-
*
|
|
241
|
+
* Specifies the minimum time in hours that the app will wait after the latest rollback before attempting to reinstall same rolled-back package.
|
|
242
|
+
*
|
|
243
|
+
* Defaults to `24`.
|
|
202
244
|
*/
|
|
203
245
|
delayInHours?: number;
|
|
204
246
|
|
|
205
247
|
/**
|
|
206
248
|
* Specifies the maximum number of retry attempts that the app can make before it stops trying.
|
|
207
|
-
* Cannot be less than `1`.
|
|
249
|
+
* Cannot be less than `1`.
|
|
250
|
+
*
|
|
251
|
+
* Defaults to `1`.
|
|
208
252
|
*/
|
|
209
253
|
maxRetryAttempts?: number;
|
|
210
254
|
}
|