@srcpush/react-native-code-push 1.0.3-develop.2 → 1.0.3-develop.4
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/CONTRIBUTING.md +20 -9
- package/package.json +1 -1
- package/windows/CodePush/CodePush.def +0 -3
- package/windows/CodePush/CodePush.vcxproj +0 -198
- package/windows/CodePush/CodePush.vcxproj.filters +0 -91
- package/windows/CodePush/CodePushConfig.cpp +0 -104
- package/windows/CodePush/CodePushConfig.h +0 -66
- package/windows/CodePush/CodePushConfig.idl +0 -12
- package/windows/CodePush/CodePushDownloadHandler.cpp +0 -73
- package/windows/CodePush/CodePushDownloadHandler.h +0 -32
- package/windows/CodePush/CodePushNativeModule.cpp +0 -937
- package/windows/CodePush/CodePushNativeModule.h +0 -247
- package/windows/CodePush/CodePushPackage.cpp +0 -456
- package/windows/CodePush/CodePushPackage.h +0 -49
- package/windows/CodePush/CodePushTelemetryManager.cpp +0 -213
- package/windows/CodePush/CodePushTelemetryManager.h +0 -29
- package/windows/CodePush/CodePushUpdateUtils.cpp +0 -86
- package/windows/CodePush/CodePushUpdateUtils.h +0 -38
- package/windows/CodePush/CodePushUtils.cpp +0 -29
- package/windows/CodePush/CodePushUtils.h +0 -18
- package/windows/CodePush/FileUtils.cpp +0 -131
- package/windows/CodePush/FileUtils.h +0 -28
- package/windows/CodePush/PropertySheet.props +0 -16
- package/windows/CodePush/ReactPackageProvider.cpp +0 -15
- package/windows/CodePush/ReactPackageProvider.h +0 -22
- package/windows/CodePush/ReactPackageProvider.idl +0 -9
- package/windows/CodePush/miniz/LICENSE +0 -22
- package/windows/CodePush/miniz/miniz.c +0 -7657
- package/windows/CodePush/miniz/miniz.h +0 -1338
- package/windows/CodePush/miniz/readme.md +0 -37
- package/windows/CodePush/packages.config +0 -4
- package/windows/CodePush/pch.cpp +0 -1
- package/windows/CodePush/pch.h +0 -4
- package/windows-legacy/CodePush/CodePush.csproj +0 -128
- package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
- package/windows-legacy/CodePush/FileUtils.cs +0 -40
- package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
- package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
- package/windows-legacy/CodePush/UpdateManager.cs +0 -305
- package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
- package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
- package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
- package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
- package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
- package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
- package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
- package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
- package/windows-legacy/CodePush.Net46/packages.config +0 -5
- package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
- package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
- package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
- package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
- package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
- package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
- package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
- package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
- package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
- package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
- package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
- package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
- package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
- package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
- package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
- package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
using Newtonsoft.Json;
|
|
2
|
-
using Newtonsoft.Json.Linq;
|
|
3
|
-
using System;
|
|
4
|
-
using System.Runtime.CompilerServices;
|
|
5
|
-
|
|
6
|
-
[assembly: InternalsVisibleTo("CodePush.Net46.Test")]
|
|
7
|
-
|
|
8
|
-
namespace CodePush.ReactNative
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
/// Implementation is ported from
|
|
12
|
-
/// android\app\src\main\java\com\microsoft\codepush\react\CodePushTelemetry.java
|
|
13
|
-
/// I've tried to leave all logic, comments and structure without significant modification.
|
|
14
|
-
/// </summary>
|
|
15
|
-
|
|
16
|
-
internal class TelemetryManager
|
|
17
|
-
{
|
|
18
|
-
#region Constants
|
|
19
|
-
private static readonly string APP_VERSION_KEY = "appVersion";
|
|
20
|
-
private static readonly string DEPLOYMENT_FAILED_STATUS = "DeploymentFailed";
|
|
21
|
-
private static readonly string DEPLOYMENT_KEY_KEY = "deploymentKey";
|
|
22
|
-
private static readonly string DEPLOYMENT_SUCCEEDED_STATUS = "DeploymentSucceeded";
|
|
23
|
-
private static readonly string LABEL_KEY = "label";
|
|
24
|
-
private static readonly string LAST_DEPLOYMENT_REPORT_KEY = "CODE_PUSH_LAST_DEPLOYMENT_REPORT";
|
|
25
|
-
private static readonly string PACKAGE_KEY = "package";
|
|
26
|
-
private static readonly string PREVIOUS_DEPLOYMENT_KEY_KEY = "previousDeploymentKey";
|
|
27
|
-
private static readonly string PREVIOUS_LABEL_OR_APP_VERSION_KEY = "previousLabelOrAppVersion";
|
|
28
|
-
private static readonly string RETRY_DEPLOYMENT_REPORT_KEY = "CODE_PUSH_RETRY_DEPLOYMENT_REPORT";
|
|
29
|
-
private static readonly string STATUS_KEY = "status";
|
|
30
|
-
#endregion
|
|
31
|
-
|
|
32
|
-
#region Internal methods
|
|
33
|
-
|
|
34
|
-
internal static JObject GetBinaryUpdateReport(string appVersion)
|
|
35
|
-
{
|
|
36
|
-
var previousStatusReportIdentifier = GetPreviousStatusReportIdentifier();
|
|
37
|
-
|
|
38
|
-
if (previousStatusReportIdentifier == null)
|
|
39
|
-
{
|
|
40
|
-
ClearRetryStatusReport();
|
|
41
|
-
|
|
42
|
-
var report = new JObject();
|
|
43
|
-
report.Add(APP_VERSION_KEY, appVersion);
|
|
44
|
-
return report;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!previousStatusReportIdentifier.Equals(appVersion))
|
|
48
|
-
{
|
|
49
|
-
ClearRetryStatusReport();
|
|
50
|
-
|
|
51
|
-
var report = new JObject();
|
|
52
|
-
report.Add(APP_VERSION_KEY, appVersion);
|
|
53
|
-
if (IsStatusReportIdentifierCodePushLabel(previousStatusReportIdentifier))
|
|
54
|
-
{
|
|
55
|
-
var previousDeploymentKey = GetDeploymentKeyFromStatusReportIdentifier(previousStatusReportIdentifier);
|
|
56
|
-
var previousLabel = GetVersionLabelFromStatusReportIdentifier(previousStatusReportIdentifier);
|
|
57
|
-
|
|
58
|
-
report.Add(PREVIOUS_DEPLOYMENT_KEY_KEY, previousDeploymentKey);
|
|
59
|
-
report.Add(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousLabel);
|
|
60
|
-
}
|
|
61
|
-
else
|
|
62
|
-
{
|
|
63
|
-
// Previous status report was with a binary app version.
|
|
64
|
-
report.Add(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousStatusReportIdentifier);
|
|
65
|
-
}
|
|
66
|
-
return report;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
internal static JObject GetRetryStatusReport()
|
|
73
|
-
{
|
|
74
|
-
var retryStatusReportString = SettingsManager.GetString(RETRY_DEPLOYMENT_REPORT_KEY);
|
|
75
|
-
|
|
76
|
-
if (retryStatusReportString != null)
|
|
77
|
-
{
|
|
78
|
-
ClearRetryStatusReport();
|
|
79
|
-
try
|
|
80
|
-
{
|
|
81
|
-
var report = JObject.Parse(retryStatusReportString);
|
|
82
|
-
return report;
|
|
83
|
-
}
|
|
84
|
-
catch (Exception)
|
|
85
|
-
{
|
|
86
|
-
//TODO: should be reported error
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
internal static JObject GetRollbackReport(JObject lastFailedPackage)
|
|
94
|
-
{
|
|
95
|
-
var report = new JObject();
|
|
96
|
-
report.Add(STATUS_KEY, DEPLOYMENT_FAILED_STATUS);
|
|
97
|
-
report.Add(PACKAGE_KEY, lastFailedPackage);
|
|
98
|
-
|
|
99
|
-
return report;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
internal static JObject GetUpdateReport(JObject currentPackage)
|
|
103
|
-
{
|
|
104
|
-
var currentPackageIdentifier = GetPackageStatusReportIdentifier(currentPackage);
|
|
105
|
-
if (currentPackageIdentifier == null)
|
|
106
|
-
{
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
var previousStatusReportIdentifier = GetPreviousStatusReportIdentifier();
|
|
111
|
-
if (previousStatusReportIdentifier == null)
|
|
112
|
-
{
|
|
113
|
-
ClearRetryStatusReport();
|
|
114
|
-
var report = new JObject();
|
|
115
|
-
report.Add(PACKAGE_KEY, currentPackage);
|
|
116
|
-
report.Add(STATUS_KEY, DEPLOYMENT_SUCCEEDED_STATUS);
|
|
117
|
-
return report;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (!previousStatusReportIdentifier.Equals(currentPackageIdentifier))
|
|
121
|
-
{
|
|
122
|
-
ClearRetryStatusReport();
|
|
123
|
-
var report = new JObject();
|
|
124
|
-
report.Add(PACKAGE_KEY, currentPackage);
|
|
125
|
-
report.Add(STATUS_KEY, DEPLOYMENT_SUCCEEDED_STATUS);
|
|
126
|
-
|
|
127
|
-
if (IsStatusReportIdentifierCodePushLabel(previousStatusReportIdentifier))
|
|
128
|
-
{
|
|
129
|
-
var previousDeploymentKey = GetDeploymentKeyFromStatusReportIdentifier(previousStatusReportIdentifier);
|
|
130
|
-
var previousLabel = GetVersionLabelFromStatusReportIdentifier(previousStatusReportIdentifier);
|
|
131
|
-
|
|
132
|
-
report.Add(PREVIOUS_DEPLOYMENT_KEY_KEY, previousDeploymentKey);
|
|
133
|
-
report.Add(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousLabel);
|
|
134
|
-
}
|
|
135
|
-
else
|
|
136
|
-
{
|
|
137
|
-
// Previous status report was with a binary app version.
|
|
138
|
-
report.Add(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousStatusReportIdentifier);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return report;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
internal static void RecordStatusReported(JObject statusReport)
|
|
148
|
-
{
|
|
149
|
-
// We don't need to record rollback reports, so exit early if that's what was specified.
|
|
150
|
-
var status = (string)statusReport.GetValue(STATUS_KEY);
|
|
151
|
-
if ((!string.IsNullOrEmpty(status)) && DEPLOYMENT_FAILED_STATUS.Equals(status))
|
|
152
|
-
{
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
var appVersion = (string)statusReport.GetValue(APP_VERSION_KEY);
|
|
157
|
-
if (!string.IsNullOrEmpty(appVersion))
|
|
158
|
-
{
|
|
159
|
-
SaveStatusReportedForIdentifier(appVersion);
|
|
160
|
-
}
|
|
161
|
-
else
|
|
162
|
-
{
|
|
163
|
-
var package = (JObject)statusReport.GetValue(PACKAGE_KEY);
|
|
164
|
-
if (package == null)
|
|
165
|
-
{
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
var packageIdentifier = GetPackageStatusReportIdentifier(package);
|
|
170
|
-
SaveStatusReportedForIdentifier(packageIdentifier);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
internal static void SaveStatusReportForRetry(JObject statusReport)
|
|
175
|
-
{
|
|
176
|
-
SettingsManager.SetString(RETRY_DEPLOYMENT_REPORT_KEY, statusReport.ToString(Formatting.None));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
#endregion
|
|
180
|
-
|
|
181
|
-
#region Private methods
|
|
182
|
-
static string GetPackageStatusReportIdentifier(JObject updatePackage)
|
|
183
|
-
{
|
|
184
|
-
// Because deploymentKeys can be dynamically switched, we use a
|
|
185
|
-
// combination of the deploymentKey and label as the packageIdentifier.
|
|
186
|
-
try
|
|
187
|
-
{
|
|
188
|
-
var deploymentKey = (string)updatePackage[DEPLOYMENT_KEY_KEY];
|
|
189
|
-
var label = (string)updatePackage[LABEL_KEY];
|
|
190
|
-
if (string.IsNullOrEmpty(deploymentKey) || string.IsNullOrEmpty(label))
|
|
191
|
-
{
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return $"{deploymentKey}:{label}";
|
|
196
|
-
}
|
|
197
|
-
catch
|
|
198
|
-
{
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
static string GetPreviousStatusReportIdentifier()
|
|
204
|
-
{
|
|
205
|
-
return SettingsManager.GetString(LAST_DEPLOYMENT_REPORT_KEY);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
static private void ClearRetryStatusReport()
|
|
209
|
-
{
|
|
210
|
-
SettingsManager.RemoveString(RETRY_DEPLOYMENT_REPORT_KEY);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
static bool IsStatusReportIdentifierCodePushLabel(string statusReportIdentifier)
|
|
214
|
-
{
|
|
215
|
-
return (!string.IsNullOrEmpty(statusReportIdentifier)) && statusReportIdentifier.Contains(":");
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
static string GetDeploymentKeyFromStatusReportIdentifier(string statusReportIdentifier)
|
|
219
|
-
{
|
|
220
|
-
string[] parsedIdentifier = statusReportIdentifier.Split(':');
|
|
221
|
-
if (parsedIdentifier.Length > 0)
|
|
222
|
-
{
|
|
223
|
-
return parsedIdentifier[0];
|
|
224
|
-
}
|
|
225
|
-
else
|
|
226
|
-
{
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
static string GetVersionLabelFromStatusReportIdentifier(string statusReportIdentifier)
|
|
232
|
-
{
|
|
233
|
-
string[] parsedIdentifier = statusReportIdentifier.Split(':');
|
|
234
|
-
if (parsedIdentifier.Length > 1)
|
|
235
|
-
{
|
|
236
|
-
return parsedIdentifier[1];
|
|
237
|
-
}
|
|
238
|
-
else
|
|
239
|
-
{
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
static void SaveStatusReportedForIdentifier(string appVersionOrPackageIdentifier)
|
|
245
|
-
{
|
|
246
|
-
SettingsManager.SetString(LAST_DEPLOYMENT_REPORT_KEY, appVersionOrPackageIdentifier);
|
|
247
|
-
}
|
|
248
|
-
#endregion
|
|
249
|
-
}
|
|
250
|
-
}
|