@appzung/react-native-code-push 10.0.1 → 10.1.0
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/ios/CodePush/CodePush.h +1 -0
- package/ios/CodePush/CodePush.m +64 -13
- 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/advanced-usage.md +0 -56
- package/docs/api-android.md +0 -22
- package/docs/api-ios.md +0 -19
- package/docs/api-js.md +0 -557
- package/docs/code-signing.md +0 -62
- package/docs/migrating-to-v10.md +0 -31
- package/docs/setup-android.md +0 -81
- package/docs/setup-ios.md +0 -108
- package/docs/setup-windows.md +0 -55
|
@@ -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 = '10.0
|
|
2
|
+
export const version = '10.1.0';
|
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
|
}
|
package/typedoc.json
ADDED
package/docs/advanced-usage.md
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
## Advanced usage
|
|
2
|
-
|
|
3
|
-
### Multiple environments
|
|
4
|
-
|
|
5
|
-
#### Staging / Production
|
|
6
|
-
|
|
7
|
-
In a real-world scenario you would have `Staging` and `Production` apps that are different binaries, each using specific environment config (different package name, bundle identifier, API, feature flags etc). Create a release channel for each of these environments with `appzung release-channels create` and change the `CodePushReleaseChannelPublicId` on the native side with environment variables. You might want to use a module like [react-native-config](https://github.com/lugg/react-native-config) (or do it manually using build variants and configurations).
|
|
8
|
-
|
|
9
|
-
```groovy
|
|
10
|
-
// android/app/build.gradle
|
|
11
|
-
android {
|
|
12
|
-
// ...
|
|
13
|
-
defaultConfig {
|
|
14
|
-
// ...
|
|
15
|
-
resValue 'string', "CodePushReleaseChannelPublicId", project.env.get("CODEPUSH_RELEASE_CHANNEL_PUBLIC_ID_ANDROID")
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
// ios/myapp/Info.plist
|
|
22
|
-
|
|
23
|
-
<key>CodePushReleaseChannelPublicId</key>
|
|
24
|
-
<string>$(CODEPUSH_RELEASE_CHANNEL_PUBLIC_ID_IOS)</string>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
#### QA / Production
|
|
28
|
-
|
|
29
|
-
In the case where you have a `QA` environment that is completely iso-prod (meaning you can swap the JS bundle between those two apps), you may take advantage of the `promote` feature:
|
|
30
|
-
|
|
31
|
-
1. Release a CodePush update to your `QA` release channel using the `appzung releases deploy-react-native` command (or `appzung releases deploy` if you need more control)
|
|
32
|
-
2. Let QA test the build
|
|
33
|
-
3. Promote the tested release from `QA` to `Production` using the `appzung releases promote` command
|
|
34
|
-
|
|
35
|
-
_NOTE: If you want to take a more cautious approach, you can even choose to perform a "staged rollout" as part of #3, which allows you to mitigate additional potential risk with the update (like did your testing in #2 touch all possible devices/conditions?) by only making the production update available to a percentage of your users (for example `appzung releases promote -r 20`). Then, after waiting for a reasonable amount of time to see if any crash reports or customer feedback comes in, you can expand it to your entire audience by running `appzung releases edit -r 100`._
|
|
36
|
-
|
|
37
|
-
### Dynamic release channel assignment
|
|
38
|
-
|
|
39
|
-
The above section illustrated how you can leverage multiple CodePush release channels in order to effectively test your updates before broadly releasing them to your end users. However, since that workflow statically embeds the release channel assignment into the actual binary, a staging or production build will only ever sync updates from that release channel. In many cases, this is sufficient, since you only want your team, customers, stakeholders, etc. to sync with your pre-production releases, and therefore, only they need a build that knows how to sync with staging. However, if you want to be able to perform A/B tests, or provide early access of your app to certain users, it can prove very useful to be able to dynamically place specific users (or audiences) into specific release channels at runtime.
|
|
40
|
-
|
|
41
|
-
In order to achieve this kind of workflow, all you need to do is specify the release channel public ID you want the current user to synchronize with when calling the `codePush` method. When specified, this key will override the "default" one that was provided in your app's `Info.plist` (iOS) or strings resources (Android) files. This allows you to produce a build for staging or production, that is also capable of being dynamically "redirected" as needed.
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
// Imagine that "userProfile" is a prop that this component received
|
|
45
|
-
// which includes the release channel public ID that the current user should use.
|
|
46
|
-
codePush.sync({ releaseChannelPublicId: userProfile.RELEASE_CHANNEL_PUBLIC_ID });
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
With that change in place, now it's just a matter of choosing how your app determines the right release channel for the current user. In practice, there are typically two solutions for this:
|
|
50
|
-
|
|
51
|
-
1. Expose a user-visible mechanism for changing release channels at any time. For example, your settings page could have a toggle for enabling "beta" access. This model works well if you're not concerned with the privacy of your pre-production updates, and you have power users that may want to opt-in to earlier (and potentially buggy) updates at their own will (kind of like Chrome channels). However, this solution puts the decision in the hands of your users, which doesn't help you perform A/B tests transparently.
|
|
52
|
-
2. Annotate the server-side profile of your users with an additional piece of metadata that indicates the release channel they should sync with. By default, your app could just use the binary-embedded key, but after a user has authenticated, your server can choose to "redirect" them to a different release channel, which allows you to incrementally place certain users or groups in different release channels as needed. You could even choose to store the server-response in local storage so that it becomes the new default. How you store the key alongside your user's profiles is entirely up to your authentication solution (for example Auth0, Firebase, custom DB + REST API), but is generally pretty trivial to do.
|
|
53
|
-
|
|
54
|
-
_NOTE: If needed, you could also implement a hybrid solution that allowed your end-users to toggle between different release channels, while also allowing your server to override that decision. This way, you have a hierarchy of "release channel resolution" that ensures your app has the ability to update itself out-of-the-box, your end users can feel rewarded by getting early access to bits, but you also have the ability to run A/B tests on your users as needed._
|
|
55
|
-
|
|
56
|
-
Are you using dynamic release channel assignments? Contact us at hello@appzung.com so that we may provide better integration.
|
package/docs/api-android.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
## Java API reference (Android)
|
|
2
|
-
|
|
3
|
-
You can customize CodePush by placing these values in string resources.
|
|
4
|
-
|
|
5
|
-
- **Release channel Public ID** - The default release channel's **public ID** that will be used to check updates. For example:
|
|
6
|
-
|
|
7
|
-
```xml
|
|
8
|
-
<string moduleConfig="true" name="CodePushReleaseChannelPublicId">sU0Eikse9JFCDLZmAT-_lUSwDWACrSGgTKCXyWqcE0</string>
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
- **Public Key** - used for bundle verification in the Code Signing Feature. Please refer to [Code Signing](setup-android.md#code-signing-setup) section for more details about the Code Signing Feature.
|
|
12
|
-
To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushSigningPublicKey`. CodePush automatically gets this property and enables the Code Signing feature. For example:
|
|
13
|
-
|
|
14
|
-
```xml
|
|
15
|
-
<string moduleConfig="true" name="CodePushSigningPublicKey">your-public-key</string>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
- **Server Url** - used for specifying CodePush Server Url (as an Enterprise customer we may setup a custom infra for your needs).
|
|
19
|
-
The Default value: "https://codepush.appzung.com/" is overridden by adding your path to `strings.xml` with name `CodePushServerUrl`. CodePush automatically gets this property and will use this path to send requests. For example:
|
|
20
|
-
```xml
|
|
21
|
-
<string moduleConfig="true" name="CodePushServerUrl">https://codepush.yourdomain.com</string>
|
|
22
|
-
```
|
package/docs/api-ios.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## Objective-C API reference (iOS)
|
|
2
|
-
|
|
3
|
-
The Objective-C API is made available by importing the `CodePush.h` header into your `AppDelegate.m` file, and consists of a single public class named `CodePush`.
|
|
4
|
-
|
|
5
|
-
### CodePush
|
|
6
|
-
|
|
7
|
-
Contains static methods for retrieving the `NSURL` that represents the most recent JavaScript bundle file, and can be passed to the `RCTRootView`'s `initWithBundleURL` method when bootstrapping your app in the `AppDelegate.m` file.
|
|
8
|
-
|
|
9
|
-
#### Methods
|
|
10
|
-
|
|
11
|
-
- **(NSURL \*)bundleURL** - Returns the most recent JS bundle `NSURL` as described above. This method assumes that the name of the JS bundle contained within your app binary is `main.jsbundle`.
|
|
12
|
-
|
|
13
|
-
- **(NSURL \*)bundleURLForResource:(NSString \*)resourceName** - Equivalent to the `bundleURL` method, but also allows customizing the name of the JS bundle that is looked for within the app binary. This is useful if you aren't naming this file `main` (which is the default convention). This method assumes that the JS bundle's extension is `*.jsbundle`.
|
|
14
|
-
|
|
15
|
-
- **(NSURL \*)bundleURLForResource:(NSString \*)resourceName withExtension:(NSString \*)resourceExtension**: Equivalent to the `bundleURLForResource:` method, but also allows customizing the extension used by the JS bundle that is looked for within the app binary. This is useful if you aren't naming this file `*.jsbundle` (which is the default convention).
|
|
16
|
-
|
|
17
|
-
- **(void)overrideAppVersion:(NSString \*)appVersionOverride** - Sets the version of the application's binary interface, which would otherwise default to the App Store version specified as the `CFBundleShortVersionString` in the `Info.plist`. This should be called a single time, before the bundle URL is loaded.
|
|
18
|
-
|
|
19
|
-
- **(void)setReleaseChannelPublicId:(NSString \*)releaseChannelPublicId** - Sets the release channel public ID that the app should use when querying for updates. This is a dynamic alternative to setting the release channel in your `Info.plist` and/or specifying a release channel in JS when calling `checkForUpdate` or `sync`.
|