forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathCodePushConstants.java
More file actions
76 lines (73 loc) · 4.97 KB
/
Copy pathCodePushConstants.java
File metadata and controls
76 lines (73 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.microsoft.codepush.react;
public class CodePushConstants {
public static final String ASSET_DIFF_DOWNLOAD_URL_KEY = "assetDiffDownloadUrl";
public static final String ASSETS_BUNDLE_PREFIX = "assets://";
// The binary patch values below are the client half of the contract the CLI writes
// into a patch archive. The CLI is TypeScript, so its constants cannot be imported
// here: any change to the manifest it produces has to be repeated in this file.
public static final String BINARY_PATCH_ALGORITHM = "hdiffpatch-m-zstd";
public static final String BINARY_PATCH_ALGORITHM_KEY = "algorithm";
public static final String BINARY_PATCH_BASE_BUNDLE_HASH_KEY = "baseBundleHash";
public static final String BINARY_PATCH_BUNDLE_PATH_KEY = "bundlePath";
public static final String BINARY_PATCH_DOWNLOAD_URL_KEY = "binaryPatchDownloadUrl";
public static final String BINARY_PATCH_FILE_KEY = "patchFile";
public static final String BINARY_PATCH_FOLDER_NAME = "binary-patch";
public static final int BINARY_PATCH_FORMAT_VERSION = 1;
public static final String BINARY_PATCH_FORMAT_VERSION_KEY = "formatVersion";
public static final String BINARY_PATCH_MANIFEST_FILE_NAME = "codepush-binary-patch.json";
// A manifest asking for a bundle larger than this is treated as malformed rather than
// as a reason to reserve that much memory and disk. A large Hermes bundle stays under
// 50 MB, and a release that somehow exceeds the bound still installs from its full
// archive, so the headroom below is generous enough for the limit to only ever catch
// a manifest that is wrong. The other platform's applier holds the same value.
public static final long BINARY_PATCH_MAX_TARGET_BUNDLE_SIZE = 128L * 1024 * 1024;
// Not part of the CLI's contract: the field a download that tried a patch reports its
// outcome under, on the package it resolves with and on no package it stores.
public static final String UPDATE_ARCHIVE_RESULT_KEY = "updateArchiveResult";
public static final String BINARY_PATCH_TARGET_BUNDLE_HASH_KEY = "targetBundleHash";
public static final String BINARY_PATCH_TARGET_BUNDLE_SIZE_KEY = "targetBundleSize";
public static final String BINARY_PATCH_TARGET_FILE_NAME = "target.bundle";
public static final String CODE_PUSH_FOLDER_PREFIX = "CodePush";
public static final String CODE_PUSH_HASH_FILE_NAME = "CodePushHash";
public static final String CODE_PUSH_OLD_HASH_FILE_NAME = "CodePushHash.json";
public static final String CODE_PUSH_PREFERENCES = "CodePush";
public static final String CURRENT_PACKAGE_KEY = "currentPackage";
public static final String DEFAULT_JS_BUNDLE_NAME = "index.android.bundle";
public static final String DIFF_MANIFEST_FILE_NAME = "hotcodepush.json";
public static final int DOWNLOAD_BUFFER_SIZE = 1024 * 256;
/**
* How long a download waits for the server to answer at all.
*
* Kept well above any real handshake, because the only thing this has to catch is a
* host that will never answer - a captive portal, a dead route, a network that went
* away between the update check and the download.
*/
public static final int DOWNLOAD_CONNECT_TIMEOUT_IN_MS = 10 * 1000;
/**
* How long a download waits for the next bytes of a response already flowing.
*
* This bounds silence, not the download: a slow connection that keeps delivering is
* never cut off, however long the whole archive takes. A connection that delivers
* nothing for this long is one the operating system has stopped reporting as dead.
*/
public static final int DOWNLOAD_READ_TIMEOUT_IN_MS = 30 * 1000;
public static final String DOWNLOAD_FILE_NAME = "download.zip";
public static final String DOWNLOAD_PROGRESS_EVENT_NAME = "CodePushDownloadProgress";
public static final String DOWNLOAD_URL_KEY = "downloadUrl";
public static final String FAILED_UPDATES_KEY = "CODE_PUSH_FAILED_UPDATES";
public static final String PACKAGE_FILE_NAME = "app.json";
public static final String PACKAGE_HASH_KEY = "packageHash";
public static final String PENDING_UPDATE_HASH_KEY = "hash";
public static final String PENDING_UPDATE_IS_LOADING_KEY = "isLoading";
public static final String PENDING_UPDATE_KEY = "CODE_PUSH_PENDING_UPDATE";
public static final String PREVIOUS_PACKAGE_KEY = "previousPackage";
public static final String REACT_NATIVE_LOG_TAG = "ReactNative";
public static final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath";
public static final String STATUS_FILE = "codepush.json";
public static final String UNZIPPED_FOLDER_NAME = "unzipped";
public static final String LATEST_ROLLBACK_INFO_KEY = "LATEST_ROLLBACK_INFO";
public static final String LATEST_ROLLBACK_PACKAGE_HASH_KEY = "packageHash";
public static final String LATEST_ROLLBACK_TIME_KEY = "time";
public static final String LATEST_ROLLBACK_COUNT_KEY = "count";
public static final String CLIENT_UNIQUE_ID_KEY = "clientUniqueId";
}