@bravemobile/react-native-code-push 13.1.0-beta.4 → 13.1.0-beta.6
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/CodePush.podspec +5 -0
- package/README.md +15 -145
- package/android/app/src/main/java/com/microsoft/codepush/react/ArchiveAttemptLog.java +181 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/{BinaryPatchResult.java → ArchiveRestoreResult.java} +17 -7
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBinaryPatch.java +20 -20
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +20 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushErrorCode.java +86 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushHttpException.java +29 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushIncompleteDownloadException.java +17 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +12 -7
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +143 -43
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushBinaryPatchTest.java +31 -31
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushErrorCodeTest.java +90 -0
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushUpdateManagerBinaryPatchTest.java +159 -19
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushUpdateManagerDownloadTest.java +304 -15
- package/cli/commands/buildPatchToolsCommand/buildPatchTools.test.ts +118 -0
- package/cli/commands/buildPatchToolsCommand/buildPatchTools.ts +46 -0
- package/cli/commands/buildPatchToolsCommand/index.ts +44 -0
- package/cli/commands/createHistoryCommand/createReleaseHistory.test.ts +133 -0
- package/cli/commands/createHistoryCommand/createReleaseHistory.ts +3 -11
- package/cli/commands/releaseCommand/addToReleaseHistory.ts +3 -11
- package/cli/commands/releaseCommand/release.test.ts +3 -3
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +3 -11
- package/cli/dist/commands/buildPatchToolsCommand/buildPatchTools.js +34 -0
- package/cli/dist/commands/buildPatchToolsCommand/buildPatchTools.test.js +88 -0
- package/cli/dist/commands/buildPatchToolsCommand/index.js +32 -0
- package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +2 -8
- package/cli/dist/commands/createHistoryCommand/createReleaseHistory.test.js +95 -0
- package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +2 -8
- package/cli/dist/commands/releaseCommand/release.test.js +3 -3
- package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +2 -8
- package/cli/dist/functions/stageReleaseHistoryFile.js +28 -0
- package/cli/dist/index.js +4 -0
- package/cli/dist/utils/binaryPatch.js +8 -5
- package/cli/dist/utils/binaryPatch.test.js +1 -1
- package/cli/functions/stageReleaseHistoryFile.ts +38 -0
- package/cli/index.ts +5 -0
- package/cli/utils/binaryPatch.test.ts +1 -1
- package/cli/utils/binaryPatch.ts +8 -5
- package/ios/CodePush/CodePush.h +6 -3
- package/ios/CodePush/CodePush.mm +10 -10
- package/ios/CodePush/CodePushBinaryPatch.h +18 -8
- package/ios/CodePush/CodePushBinaryPatch.m +23 -22
- package/ios/CodePush/CodePushDownloadHandler.m +2 -1
- package/ios/CodePush/CodePushErrorUtils.m +55 -0
- package/ios/CodePush/CodePushPackage.m +242 -71
- package/package.json +2 -1
- package/src/CodePush.js +28 -18
- package/src/CodePush.test.js +110 -55
- package/src/package-mixins.js +19 -10
- package/typings/react-native-code-push.d.ts +110 -29
- package/android/app/src/main/java/com/microsoft/codepush/react/BinaryPatchAttempt.java +0 -92
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
package com.microsoft.codepush.react;
|
|
2
|
-
|
|
3
|
-
import org.json.JSONObject;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The record of one attempt at installing an update from its binary patch archive: whether
|
|
7
|
-
* the update was installed from the patch, why the full archive had to be downloaded when it
|
|
8
|
-
* was not, and how long the work took.
|
|
9
|
-
*
|
|
10
|
-
* The record exists for an app that wants to judge a patch rollout with its own telemetry, so
|
|
11
|
-
* it travels to whoever asked for the download and nowhere else. It is not part of the
|
|
12
|
-
* update's metadata, it is never written to disk, and nothing here sends it anywhere.
|
|
13
|
-
*/
|
|
14
|
-
class BinaryPatchAttempt {
|
|
15
|
-
|
|
16
|
-
private static final String APPLY_DURATION_MS_KEY = "applyDurationMs";
|
|
17
|
-
private static final String FALLBACK_REASON_KEY = "fallbackReason";
|
|
18
|
-
private static final String STATUS_KEY = "status";
|
|
19
|
-
|
|
20
|
-
private static final String STATUS_APPLIED = "applied";
|
|
21
|
-
private static final String STATUS_FALLBACK = "fallback";
|
|
22
|
-
|
|
23
|
-
private final long mStartTimeMs = System.currentTimeMillis();
|
|
24
|
-
|
|
25
|
-
/** How long the applier took, once it has restored the bundle. */
|
|
26
|
-
private long mApplyDurationMs = -1;
|
|
27
|
-
|
|
28
|
-
private boolean mFellBack;
|
|
29
|
-
private String mFallbackReason;
|
|
30
|
-
private long mAttemptDurationMs;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The applier restored the bundle. Whether the update installs is decided by the checks
|
|
34
|
-
* that follow, so this is not yet the attempt succeeding.
|
|
35
|
-
*/
|
|
36
|
-
void recordBundleRestored(long applyDurationMs) {
|
|
37
|
-
mApplyDurationMs = applyDurationMs;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The attempt ended in one of the reasons the appliers report.
|
|
42
|
-
*
|
|
43
|
-
* The attempt is timed here rather than when it is read, because what happens next is the
|
|
44
|
-
* full archive being downloaded and that is not time the patch spent.
|
|
45
|
-
*/
|
|
46
|
-
void recordFallback(String failureReason) {
|
|
47
|
-
mFellBack = true;
|
|
48
|
-
mFallbackReason = failureReason;
|
|
49
|
-
mAttemptDurationMs = System.currentTimeMillis() - mStartTimeMs;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The attempt ended in an error rather than in a verdict of its own.
|
|
54
|
-
*
|
|
55
|
-
* An error raised after the bundle was restored is the restored update failing the checks
|
|
56
|
-
* that every update passes before it is installed. Before that point the appliers have no
|
|
57
|
-
* word for what happened - the patch archive not being downloadable, say - and inventing
|
|
58
|
-
* one here would put a value on the wire that no platform reports, so the fallback is
|
|
59
|
-
* reported without a reason.
|
|
60
|
-
*/
|
|
61
|
-
void recordFallbackAfterError() {
|
|
62
|
-
recordFallback(bundleWasRestored() ? BinaryPatchResult.REASON_PACKAGE_VERIFICATION_FAILED : null);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private boolean bundleWasRestored() {
|
|
66
|
-
return mApplyDurationMs >= 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* What the attempt ended in, as the app reads it.
|
|
71
|
-
*
|
|
72
|
-
* An attempt that never fell back is one the update was installed from, and it reports the
|
|
73
|
-
* time the applier took. A fallback reports how long the attempt ran before it was given
|
|
74
|
-
* up on, because there is no completed apply to time.
|
|
75
|
-
*/
|
|
76
|
-
JSONObject result() {
|
|
77
|
-
JSONObject result = new JSONObject();
|
|
78
|
-
if (!mFellBack) {
|
|
79
|
-
CodePushUtils.setJSONValueForKey(result, STATUS_KEY, STATUS_APPLIED);
|
|
80
|
-
CodePushUtils.setJSONValueForKey(result, APPLY_DURATION_MS_KEY, Math.max(mApplyDurationMs, 0));
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
CodePushUtils.setJSONValueForKey(result, STATUS_KEY, STATUS_FALLBACK);
|
|
85
|
-
if (mFallbackReason != null) {
|
|
86
|
-
CodePushUtils.setJSONValueForKey(result, FALLBACK_REASON_KEY, mFallbackReason);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
CodePushUtils.setJSONValueForKey(result, APPLY_DURATION_MS_KEY, mAttemptDurationMs);
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
}
|