@appzung/react-native-code-push 10.0.1 → 10.1.1
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/CodePush.java +3 -0
- 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/ios/CodePush/CodePushConfig.m +4 -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/checkForUpdates.js +23 -25
- package/lib/commonjs/checkForUpdates.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 +34 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internals/CodePushApiSdk.errors.js +26 -0
- package/lib/commonjs/internals/CodePushApiSdk.errors.js.map +1 -0
- package/lib/commonjs/internals/CodePushApiSdk.js +100 -0
- package/lib/commonjs/internals/CodePushApiSdk.js.map +1 -0
- package/lib/commonjs/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +3 -2
- package/lib/commonjs/internals/CodePushApiSdk.types.js.map +1 -0
- package/lib/commonjs/internals/RemotePackageImplementation.js +6 -5
- package/lib/commonjs/internals/RemotePackageImplementation.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/utils/fetchRetry.js +59 -0
- package/lib/commonjs/internals/utils/fetchRetry.js.map +1 -0
- package/lib/commonjs/internals/utils/queryStringify.js +25 -0
- package/lib/commonjs/internals/utils/queryStringify.js.map +1 -0
- package/lib/commonjs/internals/utils/requestFetchAdapter.js +33 -0
- package/lib/commonjs/internals/utils/requestFetchAdapter.js.map +1 -0
- package/lib/commonjs/internals/version.js +1 -1
- package/lib/commonjs/notifyAppReady.js +11 -9
- 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/checkForUpdates.js +23 -25
- package/lib/module/checkForUpdates.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 +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internals/CodePushApiSdk.errors.js +20 -0
- package/lib/module/internals/CodePushApiSdk.errors.js.map +1 -0
- package/lib/module/internals/CodePushApiSdk.js +96 -0
- package/lib/module/internals/CodePushApiSdk.js.map +1 -0
- package/lib/module/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +2 -1
- package/lib/module/internals/CodePushApiSdk.types.js.map +1 -0
- package/lib/module/internals/RemotePackageImplementation.js +6 -5
- package/lib/module/internals/RemotePackageImplementation.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/utils/fetchRetry.js +55 -0
- package/lib/module/internals/utils/fetchRetry.js.map +1 -0
- package/lib/module/internals/utils/queryStringify.js +21 -0
- package/lib/module/internals/utils/queryStringify.js.map +1 -0
- package/lib/module/internals/utils/requestFetchAdapter.js +29 -0
- package/lib/module/internals/utils/requestFetchAdapter.js.map +1 -0
- package/lib/module/internals/version.js +1 -1
- package/lib/module/notifyAppReady.js +11 -9
- 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/checkForUpdates.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 +3 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts +13 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts +9 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts +101 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
- 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/RemotePackageImplementation.d.ts +2 -2
- package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.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/types.d.ts +2 -2
- package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts +9 -0
- package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts +4 -0
- package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
- 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 +72 -29
- 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/checkForUpdates.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 +3 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts +13 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts +9 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts +101 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
- 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/RemotePackageImplementation.d.ts +2 -2
- package/lib/typescript/module/src/internals/RemotePackageImplementation.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/types.d.ts +2 -2
- package/lib/typescript/module/src/internals/types.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts +9 -0
- package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/queryStringify.d.ts +4 -0
- package/lib/typescript/module/src/internals/utils/queryStringify.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts +3 -0
- package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
- 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 +72 -29
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/CodePush.tsx +12 -5
- package/src/allowRestart.ts +2 -0
- package/src/checkForUpdates.ts +24 -23
- 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 +3 -1
- package/src/internals/CodePushApiSdk.errors.ts +22 -0
- package/src/internals/CodePushApiSdk.ts +133 -0
- package/src/internals/CodePushApiSdk.types.ts +115 -0
- package/src/internals/RNAppZungCodePushModuleSpec.ts +1 -0
- package/src/internals/RemotePackageImplementation.ts +8 -7
- package/src/internals/getConfiguration.ts +4 -0
- package/src/internals/types.ts +2 -2
- package/src/internals/utils/fetchRetry.ts +72 -0
- package/src/internals/utils/queryStringify.ts +22 -0
- package/src/internals/utils/requestFetchAdapter.ts +28 -0
- package/src/internals/version.ts +1 -1
- package/src/notifyAppReady.ts +12 -13
- package/src/resetClientUniqueId.ts +11 -0
- package/src/restartApp.ts +2 -0
- package/src/sync.ts +5 -3
- package/src/types.ts +72 -29
- 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
- package/lib/commonjs/enums/DeploymentStatus.enum.js.map +0 -1
- package/lib/commonjs/internals/AcquisitionSdk.js +0 -9
- package/lib/commonjs/internals/AcquisitionSdk.js.map +0 -1
- package/lib/commonjs/internals/getPromisifiedSdk.js +0 -49
- package/lib/commonjs/internals/getPromisifiedSdk.js.map +0 -1
- package/lib/commonjs/internals/utils/request-fetch-adapter.js +0 -50
- package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +0 -1
- package/lib/module/enums/DeploymentStatus.enum.js.map +0 -1
- package/lib/module/internals/AcquisitionSdk.js +0 -5
- package/lib/module/internals/AcquisitionSdk.js.map +0 -1
- package/lib/module/internals/getPromisifiedSdk.js +0 -45
- package/lib/module/internals/getPromisifiedSdk.js.map +0 -1
- package/lib/module/internals/utils/request-fetch-adapter.js +0 -46
- package/lib/module/internals/utils/request-fetch-adapter.js.map +0 -1
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +0 -14
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +0 -3
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +0 -13
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +0 -3
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +0 -14
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +0 -3
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +0 -13
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +0 -3
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
- package/src/enums/DeploymentStatus.enum.ts +0 -14
- package/src/internals/AcquisitionSdk.ts +0 -3
- package/src/internals/getPromisifiedSdk.ts +0 -72
- package/src/internals/utils/request-fetch-adapter.ts +0 -58
|
@@ -1,47 +1,74 @@
|
|
|
1
|
-
import type { NativeUpdateNotification } from 'code-push/script/acquisition-sdk';
|
|
2
|
-
import type { DeploymentStatus } from './enums/DeploymentStatus.enum';
|
|
3
1
|
import type { InstallMode } from './enums/InstallMode.enum';
|
|
4
2
|
import type { SyncStatus } from './enums/SyncStatus.enum';
|
|
3
|
+
import { DeploymentStatus } from './internals/CodePushApiSdk.types';
|
|
5
4
|
export interface UpdateDialog {
|
|
6
5
|
/**
|
|
7
6
|
* Indicates whether you would like to append the description of an available release to the
|
|
8
|
-
* notification message which is displayed to the end user.
|
|
7
|
+
* notification message which is displayed to the end user.
|
|
8
|
+
*
|
|
9
|
+
* Defaults to false.
|
|
9
10
|
*/
|
|
10
11
|
appendReleaseDescription?: boolean;
|
|
11
12
|
/**
|
|
12
13
|
* Indicates the string you would like to prefix the release description with, if any, when
|
|
13
|
-
* displaying the update notification to the end user.
|
|
14
|
+
* displaying the update notification to the end user.
|
|
15
|
+
*
|
|
16
|
+
* Defaults to " Description: "
|
|
14
17
|
*/
|
|
15
18
|
descriptionPrefix?: string;
|
|
16
19
|
/**
|
|
17
|
-
* The text to use for the button the end user must press in order to install a mandatory update.
|
|
20
|
+
* The text to use for the button the end user must press in order to install a mandatory update.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to "Continue".
|
|
18
23
|
*/
|
|
19
24
|
mandatoryContinueButtonLabel?: string;
|
|
20
25
|
/**
|
|
21
26
|
* The text used as the body of an update notification, when the update is specified as mandatory.
|
|
27
|
+
*
|
|
22
28
|
* Defaults to "An update is available that must be installed.".
|
|
23
29
|
*/
|
|
24
30
|
mandatoryUpdateMessage?: string;
|
|
25
31
|
/**
|
|
26
|
-
* The text to use for the button the end user can press in order to ignore an optional update that is available.
|
|
32
|
+
* The text to use for the button the end user can press in order to ignore an optional update that is available.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to "Ignore".
|
|
27
35
|
*/
|
|
28
36
|
optionalIgnoreButtonLabel?: string;
|
|
29
37
|
/**
|
|
30
|
-
* The text to use for the button the end user can press in order to install an optional update.
|
|
38
|
+
* The text to use for the button the end user can press in order to install an optional update.
|
|
39
|
+
*
|
|
40
|
+
* Defaults to "Install".
|
|
31
41
|
*/
|
|
32
42
|
optionalInstallButtonLabel?: string;
|
|
33
43
|
/**
|
|
34
|
-
* The text used as the body of an update notification, when the update is optional.
|
|
44
|
+
* The text used as the body of an update notification, when the update is optional.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to "An update is available. Would you like to install it?".
|
|
35
47
|
*/
|
|
36
48
|
optionalUpdateMessage?: string;
|
|
37
49
|
/**
|
|
38
|
-
* The text used as the header of an update notification that is displayed to the end user.
|
|
50
|
+
* The text used as the header of an update notification that is displayed to the end user.
|
|
51
|
+
*
|
|
52
|
+
* Defaults to "Update available".
|
|
39
53
|
*/
|
|
40
54
|
title?: string;
|
|
41
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Called periodically when an available update is being downloaded from the CodePush server.
|
|
58
|
+
*/
|
|
42
59
|
export type DownloadProgressCallback = (progress: DownloadProgress) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Called when the sync process moves from one stage to another in the overall update process.
|
|
62
|
+
*
|
|
63
|
+
* The method is called with a status code which represents the current state, and can be any of the `SyncStatus` values.
|
|
64
|
+
*/
|
|
43
65
|
export type SyncStatusChangedCallback = (status: SyncStatus) => void;
|
|
44
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Called when there are any binary update available.
|
|
68
|
+
*/
|
|
69
|
+
export type HandleBinaryVersionMismatchCallback = (update: {
|
|
70
|
+
appVersion: string;
|
|
71
|
+
}) => void;
|
|
45
72
|
export interface DownloadProgress {
|
|
46
73
|
/**
|
|
47
74
|
* The total number of bytes expected to be received for this update.
|
|
@@ -52,6 +79,9 @@ export interface DownloadProgress {
|
|
|
52
79
|
*/
|
|
53
80
|
receivedBytes: number;
|
|
54
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Represents a downloaded update that is either already running, or has been installed and is pending an app restart.
|
|
84
|
+
*/
|
|
55
85
|
export interface LocalPackage extends Package {
|
|
56
86
|
/**
|
|
57
87
|
* Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app.
|
|
@@ -65,7 +95,7 @@ export interface LocalPackage extends Package {
|
|
|
65
95
|
export interface Package {
|
|
66
96
|
/**
|
|
67
97
|
* The app binary version that this update is dependent on. This is the value that was
|
|
68
|
-
* specified via the
|
|
98
|
+
* specified via the --target-binary-version parameter when calling the CLI's release command.
|
|
69
99
|
*/
|
|
70
100
|
appVersion: string;
|
|
71
101
|
/**
|
|
@@ -78,10 +108,14 @@ export interface Package {
|
|
|
78
108
|
description: string;
|
|
79
109
|
/**
|
|
80
110
|
* Indicates whether this update has been previously installed but was rolled back.
|
|
111
|
+
*
|
|
112
|
+
* The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`.
|
|
81
113
|
*/
|
|
82
114
|
failedInstall: boolean;
|
|
83
115
|
/**
|
|
84
116
|
* Indicates whether this is the first time the update has been run after being installed.
|
|
117
|
+
*
|
|
118
|
+
* This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update.
|
|
85
119
|
*/
|
|
86
120
|
isFirstRun: boolean;
|
|
87
121
|
/**
|
|
@@ -106,6 +140,9 @@ export interface Package {
|
|
|
106
140
|
*/
|
|
107
141
|
packageSize: number;
|
|
108
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Represents an available update on the CodePush server that hasn't been downloaded yet.
|
|
145
|
+
*/
|
|
109
146
|
export interface RemotePackage extends Package {
|
|
110
147
|
/**
|
|
111
148
|
* Downloads the available update from the CodePush service.
|
|
@@ -115,24 +152,28 @@ export interface RemotePackage extends Package {
|
|
|
115
152
|
download(downloadProgressCallback?: DownloadProgressCallback): Promise<LocalPackage>;
|
|
116
153
|
/**
|
|
117
154
|
* The URL at which the package is available for download.
|
|
155
|
+
*
|
|
156
|
+
* This property is only needed for advanced usage, since the `download` method will automatically handle the acquisition of updates for you.
|
|
118
157
|
*/
|
|
119
158
|
downloadUrl: string;
|
|
120
159
|
}
|
|
121
160
|
export interface SyncOptions {
|
|
122
161
|
/**
|
|
123
|
-
* Specifies the release channel you want to query for an update against.
|
|
124
|
-
*
|
|
125
|
-
* dynamically use a different release channel for a specific call to sync.
|
|
162
|
+
* Specifies the release channel you want to query for an update against.
|
|
163
|
+
*
|
|
164
|
+
* 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.
|
|
126
165
|
*/
|
|
127
166
|
releaseChannelPublicId?: string;
|
|
128
167
|
/**
|
|
129
|
-
* Specifies when you would like to install
|
|
130
|
-
*
|
|
168
|
+
* Specifies when you would like to install regular updates (i.e. those that aren't marked as mandatory).
|
|
169
|
+
*
|
|
170
|
+
* Defaults to InstallMode.ON_NEXT_RESTART.
|
|
131
171
|
*/
|
|
132
172
|
installMode?: InstallMode;
|
|
133
173
|
/**
|
|
134
174
|
* Specifies when you would like to install updates which are marked as mandatory.
|
|
135
|
-
*
|
|
175
|
+
*
|
|
176
|
+
* Defaults to InstallMode.IMMEDIATE.
|
|
136
177
|
*/
|
|
137
178
|
mandatoryInstallMode?: InstallMode;
|
|
138
179
|
/**
|
|
@@ -143,31 +184,33 @@ export interface SyncOptions {
|
|
|
143
184
|
*/
|
|
144
185
|
minimumBackgroundDuration?: number;
|
|
145
186
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* overriding one or more of the default strings.
|
|
187
|
+
* 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.
|
|
188
|
+
*
|
|
189
|
+
* Defaults to null, which has the effect of disabling the dialog completely.
|
|
190
|
+
* 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.
|
|
150
191
|
*/
|
|
151
192
|
updateDialog?: UpdateDialog | true;
|
|
152
193
|
/**
|
|
153
|
-
* The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding
|
|
157
|
-
* one or more of the default values.
|
|
194
|
+
* 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).
|
|
195
|
+
*
|
|
196
|
+
* This defaults to null, which has the effect of disabling the retry mechanism.
|
|
197
|
+
* 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.
|
|
158
198
|
*/
|
|
159
199
|
rollbackRetryOptions?: RollbackRetryOptions | true;
|
|
160
200
|
ignoreFailedUpdates?: boolean;
|
|
161
201
|
}
|
|
162
202
|
export interface RollbackRetryOptions {
|
|
163
203
|
/**
|
|
164
|
-
* Specifies the minimum time in hours that the app will wait after the latest rollback
|
|
165
|
-
*
|
|
204
|
+
* Specifies the minimum time in hours that the app will wait after the latest rollback before attempting to reinstall same rolled-back package.
|
|
205
|
+
*
|
|
206
|
+
* Defaults to `24`.
|
|
166
207
|
*/
|
|
167
208
|
delayInHours?: number;
|
|
168
209
|
/**
|
|
169
210
|
* Specifies the maximum number of retry attempts that the app can make before it stops trying.
|
|
170
|
-
* Cannot be less than `1`.
|
|
211
|
+
* Cannot be less than `1`.
|
|
212
|
+
*
|
|
213
|
+
* Defaults to `1`.
|
|
171
214
|
*/
|
|
172
215
|
maxRetryAttempts?: number;
|
|
173
216
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appzung/react-native-code-push",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "React Native plugin for the CodePush service",
|
|
5
5
|
"author": "Louis Lagrange <lagrange.louis@gmail.com> (https://github.com/Minishlink)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,14 +44,13 @@
|
|
|
44
44
|
"test:types": "tsc --noEmit",
|
|
45
45
|
"test:format": "prettier --check \"{src,docs}/**/*.{ts,js,md}\" README.md react-native.config.js",
|
|
46
46
|
"tslint": "tslint -c tslint.json test/**/*.ts",
|
|
47
|
-
"prepare": "genversion src/internals/version.ts --esm -s && bob build"
|
|
47
|
+
"prepare": "genversion src/internals/version.ts --esm -s && typedoc && bob build"
|
|
48
48
|
},
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
51
51
|
"url": "https://github.com/appzung/react-native-code-push"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"code-push": "^4.2.3",
|
|
55
54
|
"hoist-non-react-statics": "^3.3.2"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
@@ -77,6 +76,8 @@
|
|
|
77
76
|
"shx": "^0.3.4",
|
|
78
77
|
"slash": "^3.0.0",
|
|
79
78
|
"tslint": "^6.1.3",
|
|
79
|
+
"typedoc": "^0.27.7",
|
|
80
|
+
"typedoc-plugin-markdown": "^4.4.2",
|
|
80
81
|
"typescript": "^5.7.3"
|
|
81
82
|
},
|
|
82
83
|
"react-native-builder-bob": {
|
|
@@ -116,5 +117,6 @@
|
|
|
116
117
|
"expo-updates",
|
|
117
118
|
"expo-ota",
|
|
118
119
|
"appcenter"
|
|
119
|
-
]
|
|
120
|
+
],
|
|
121
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
120
122
|
}
|
package/src/CodePush.tsx
CHANGED
|
@@ -14,25 +14,32 @@ import type {
|
|
|
14
14
|
export interface CodePushOptions extends SyncOptions {
|
|
15
15
|
/**
|
|
16
16
|
* Specifies when you would like to synchronize updates with the CodePush server.
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
|
+
* Defaults to CheckFrequency.ON_APP_START.
|
|
18
19
|
*/
|
|
19
20
|
checkFrequency?: CheckFrequency;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Wraps a React component inside a "higher order" React component that knows how to synchronize your app's JavaScript bundle and image assets when it is mounted.
|
|
25
|
+
*
|
|
26
|
+
* Internally, the higher-order component calls `sync` inside its `componentDidMount` lifecycle handle, which in turns performs an update check, downloads the update if it exists and installs the update for you.
|
|
24
27
|
*
|
|
25
28
|
* @param component the React Component that will be decorated
|
|
26
29
|
*/
|
|
27
30
|
// @ts-ignore
|
|
28
|
-
export function withCodePush(component:
|
|
31
|
+
export function withCodePush<P extends object>(component: React.ComponentType<P>): React.ComponentType;
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
34
|
+
* Wraps a React component inside a "higher order" React component that knows how to synchronize your app's JavaScript bundle and image assets when it is mounted.
|
|
35
|
+
*
|
|
36
|
+
* Internally, the higher-order component calls `sync` inside its `componentDidMount` lifecycle handle, which in turns performs an update check, downloads the update if it exists and installs the update for you.
|
|
32
37
|
*
|
|
33
38
|
* @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show a prompt?, install the update immediately?).
|
|
34
39
|
*/
|
|
35
|
-
export function withCodePush
|
|
40
|
+
export function withCodePush<P extends object>(
|
|
41
|
+
options: CodePushOptions,
|
|
42
|
+
): (component: React.ComponentType<P>) => React.ComponentType;
|
|
36
43
|
|
|
37
44
|
export function withCodePush<P extends object>(optionsOrComponent: CodePushOptions | React.ComponentType<P>) {
|
|
38
45
|
const options: CodePushOptions = typeof optionsOrComponent === 'function' ? {} : optionsOrComponent;
|
package/src/allowRestart.ts
CHANGED
|
@@ -2,5 +2,7 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Allow CodePush to restart the app.
|
|
5
|
+
*
|
|
6
|
+
* This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
|
|
5
7
|
*/
|
|
6
8
|
export const allowRestart: () => void = NativeRNAppZungCodePushModule.allow;
|
package/src/checkForUpdates.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import { CodePushApiSdk } from './internals/CodePushApiSdk';
|
|
3
|
+
import type { ApiSdkQueryUpdatePackageInfo } from './internals/CodePushApiSdk.types';
|
|
2
4
|
import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
|
|
3
5
|
import { RemotePackageImpl } from './internals/RemotePackageImplementation';
|
|
4
6
|
import { getConfiguration } from './internals/getConfiguration';
|
|
5
7
|
import { getCurrentPackage } from './internals/getCurrentPackage';
|
|
6
|
-
import { type PromisifiedSdkQueryPackage, getPromisifiedSdk } from './internals/getPromisifiedSdk';
|
|
7
8
|
import type { Configuration } from './internals/types';
|
|
8
9
|
import { log } from './internals/utils/log';
|
|
9
|
-
import { requestFetchAdapter } from './internals/utils/
|
|
10
|
+
import { requestFetchAdapter } from './internals/utils/requestFetchAdapter';
|
|
10
11
|
import type { HandleBinaryVersionMismatchCallback, RemotePackage } from './types';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -36,10 +37,8 @@ export async function checkForUpdate(
|
|
|
36
37
|
* dynamically "redirecting" end-users at different
|
|
37
38
|
* release channels (e.g. an early access release channel for insiders).
|
|
38
39
|
*/
|
|
39
|
-
const config: Configuration = releaseChannelPublicId
|
|
40
|
-
|
|
41
|
-
: nativeConfig;
|
|
42
|
-
const sdk = getPromisifiedSdk(requestFetchAdapter, config);
|
|
40
|
+
const config: Configuration = releaseChannelPublicId ? { ...nativeConfig, releaseChannelPublicId } : nativeConfig;
|
|
41
|
+
const sdk = new CodePushApiSdk(requestFetchAdapter, config);
|
|
43
42
|
|
|
44
43
|
const localPackage = await getCurrentPackage();
|
|
45
44
|
|
|
@@ -51,15 +50,10 @@ export async function checkForUpdate(
|
|
|
51
50
|
* to send the app version to the server, since we are interested
|
|
52
51
|
* in any updates for current binary version, regardless of hash.
|
|
53
52
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
queryPackage = { appVersion: config.appVersion };
|
|
59
|
-
if (Platform.OS === 'ios' && config.packageHash) {
|
|
60
|
-
queryPackage.packageHash = config.packageHash;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
53
|
+
const queryPackage: ApiSdkQueryUpdatePackageInfo = localPackage ?? {
|
|
54
|
+
appVersion: config.appVersion,
|
|
55
|
+
...(Platform.OS === 'ios' && config.packageHash ? { packageHash: config.packageHash } : {}),
|
|
56
|
+
};
|
|
63
57
|
|
|
64
58
|
const update = await sdk.queryUpdateWithCurrentPackage(queryPackage);
|
|
65
59
|
|
|
@@ -85,7 +79,11 @@ export async function checkForUpdate(
|
|
|
85
79
|
return null;
|
|
86
80
|
}
|
|
87
81
|
|
|
88
|
-
if ('updateAppVersion' in update
|
|
82
|
+
if ('updateAppVersion' in update) {
|
|
83
|
+
if (!update.updateAppVersion) {
|
|
84
|
+
throw new Error('updateAppVersion should never be false');
|
|
85
|
+
}
|
|
86
|
+
|
|
89
87
|
log('An update is available but it is not targeting the binary version of your app.');
|
|
90
88
|
handleBinaryVersionMismatchCallback?.(update);
|
|
91
89
|
|
|
@@ -93,17 +91,20 @@ export async function checkForUpdate(
|
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
if (
|
|
96
|
-
(localPackage &&
|
|
94
|
+
(localPackage && update.packageHash === localPackage.packageHash) ||
|
|
97
95
|
((!localPackage || ('_isDebugOnly' in localPackage && localPackage._isDebugOnly)) &&
|
|
98
|
-
'packageHash' in update &&
|
|
99
96
|
config.packageHash === update.packageHash)
|
|
100
97
|
) {
|
|
101
98
|
return null;
|
|
102
99
|
}
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
const remotePackageData: Omit<RemotePackage, 'download'> = {
|
|
102
|
+
...update,
|
|
103
|
+
releaseChannelPublicId: releaseChannelPublicId || nativeConfig.releaseChannelPublicId,
|
|
104
|
+
failedInstall: await NativeRNAppZungCodePushModule.isFailedUpdate(update.packageHash),
|
|
105
|
+
isFirstRun: false,
|
|
106
|
+
isPending: false,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return new RemotePackageImpl(remotePackageData, (packageInfo) => sdk.reportStatusDownload(packageInfo));
|
|
109
110
|
}
|
package/src/clearUpdates.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Clears all downloaded CodePush updates.
|
|
5
|
+
*
|
|
5
6
|
* This is useful when switching to a different release channel which may have an older release than the current package.
|
|
6
|
-
* Note: we don’t recommend
|
|
7
|
+
* Note: we don’t recommend using this method in scenarios other than that (CodePush will call
|
|
7
8
|
* this method automatically when needed in other cases) as it could lead to unpredictable behavior.
|
|
8
9
|
*/
|
|
9
10
|
export const clearUpdates: () => void = NativeRNAppZungCodePushModule.clearUpdates;
|
package/src/disallowRestart.ts
CHANGED
|
@@ -2,5 +2,7 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Forbid CodePush to restart the app.
|
|
5
|
+
*
|
|
6
|
+
* This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
|
|
5
7
|
*/
|
|
6
8
|
export const disallowRestart: () => void = NativeRNAppZungCodePushModule.disallow;
|
|
@@ -8,12 +8,12 @@ export enum CheckFrequency {
|
|
|
8
8
|
ON_APP_START,
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* When the app re-enters the foreground.
|
|
11
|
+
* When the app re-enters the foreground after being "backgrounded" (user pressed the home button, app launches a separate payment process, etc.)
|
|
12
12
|
*/
|
|
13
13
|
ON_APP_RESUME,
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Don't automatically check for updates, but only do it when
|
|
16
|
+
* Don't automatically check for updates, but only do it when `sync()` is manually called in app code.
|
|
17
17
|
*/
|
|
18
18
|
MANUAL,
|
|
19
19
|
}
|
|
@@ -6,18 +6,22 @@ import { NativeRNAppZungCodePushModule } from '../internals/NativeRNAppZungCodeP
|
|
|
6
6
|
export enum InstallMode {
|
|
7
7
|
/**
|
|
8
8
|
* Indicates that you want to install the update and restart the app immediately.
|
|
9
|
+
*
|
|
10
|
+
* This value is appropriate for debugging scenarios as well as when displaying an update prompt to the user, since they would expect to see the changes immediately after accepting the installation. Additionally, this mode can be used to enforce mandatory updates, since it removes the potentially undesired latency between the update installation and the next time the end user restarts or resumes the app.
|
|
9
11
|
*/
|
|
10
12
|
IMMEDIATE = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeImmediate,
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Indicates that you want to install the update, but not forcibly restart the app.
|
|
16
|
+
*
|
|
17
|
+
* When the app is "naturally" restarted (due the OS or end user killing it), the update will be seamlessly picked up. This value is appropriate when performing silent updates, since it would likely be disruptive to the end user if the app suddenly restarted out of nowhere, since they wouldn't have realized an update was even downloaded. This is the default mode used for both the `sync` and `LocalPackage.install` methods.
|
|
14
18
|
*/
|
|
15
19
|
ON_NEXT_RESTART = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextRestart,
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
* Indicates that you want to install the update, but don't want to restart the app until the next time
|
|
19
|
-
*
|
|
20
|
-
* but you can get the update in front of them sooner than having to wait for the next natural restart.
|
|
22
|
+
* Indicates that you want to install the update, but don't want to restart the app until the next time the end user resumes it from the background.
|
|
23
|
+
*
|
|
24
|
+
* This way, you don't disrupt their current session,but you can get the update in front of them sooner than having to wait for the next natural restart.
|
|
21
25
|
* This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
|
|
22
26
|
*/
|
|
23
27
|
ON_NEXT_RESUME = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextResume,
|
|
@@ -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
|
@@ -8,11 +8,13 @@ export * from './getUpdateMetadata';
|
|
|
8
8
|
export * from './notifyAppReady';
|
|
9
9
|
export * from './restartApp';
|
|
10
10
|
export * from './sync';
|
|
11
|
+
export * from './getClientUniqueId';
|
|
12
|
+
export * from './resetClientUniqueId';
|
|
11
13
|
|
|
12
14
|
export * from './types';
|
|
13
15
|
|
|
14
16
|
export * from './enums/SyncStatus.enum';
|
|
15
17
|
export * from './enums/InstallMode.enum';
|
|
16
18
|
export * from './enums/UpdateState.enum';
|
|
17
|
-
export
|
|
19
|
+
export { DeploymentStatus } from './internals/CodePushApiSdk.types';
|
|
18
20
|
export * from './enums/CheckFrequency.enum';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class CodePushError extends Error {
|
|
2
|
+
constructor(message: string) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'CodePushError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class CodePushHttpError extends CodePushError {
|
|
9
|
+
constructor(
|
|
10
|
+
readonly url: string,
|
|
11
|
+
readonly statusCode: number,
|
|
12
|
+
message: string,
|
|
13
|
+
) {
|
|
14
|
+
super(message);
|
|
15
|
+
|
|
16
|
+
if (statusCode === 0) {
|
|
17
|
+
this.message = `Couldn't send request to ${url}, xhr.statusCode = 0 was returned. One of the possible reasons for that might be connection problems. Please, check your internet connection.`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this.name = 'CodePushHttpError';
|
|
21
|
+
}
|
|
22
|
+
}
|