@turbopush/react-native-code-push 10.2.5 → 10.2.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.
Files changed (85) hide show
  1. package/LICENSE.md +3 -1
  2. package/README.md +118 -39
  3. package/android/app/src/debug/AndroidManifest.xml +9 -0
  4. package/package.json +15 -12
  5. package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
  6. package/.azurepipelines/test-rn-code-push.yml +0 -94
  7. package/.config/CredScanSuppressions.json +0 -14
  8. package/.gitconfig +0 -6
  9. package/CONTRIBUTING.md +0 -134
  10. package/SECURITY.md +0 -41
  11. package/docs/api-android.md +0 -52
  12. package/docs/api-ios.md +0 -31
  13. package/docs/api-js.md +0 -592
  14. package/docs/multi-deployment-testing-android.md +0 -55
  15. package/docs/multi-deployment-testing-ios.md +0 -59
  16. package/docs/setup-android.md +0 -92
  17. package/docs/setup-ios.md +0 -138
  18. package/docs/setup-windows.md +0 -121
  19. package/expo.js +0 -324
  20. package/tsconfig.json +0 -17
  21. package/tslint.json +0 -32
  22. package/windows/CodePush/CodePush.def +0 -3
  23. package/windows/CodePush/CodePush.vcxproj +0 -198
  24. package/windows/CodePush/CodePush.vcxproj.filters +0 -91
  25. package/windows/CodePush/CodePushConfig.cpp +0 -104
  26. package/windows/CodePush/CodePushConfig.h +0 -66
  27. package/windows/CodePush/CodePushConfig.idl +0 -12
  28. package/windows/CodePush/CodePushDownloadHandler.cpp +0 -73
  29. package/windows/CodePush/CodePushDownloadHandler.h +0 -32
  30. package/windows/CodePush/CodePushNativeModule.cpp +0 -934
  31. package/windows/CodePush/CodePushNativeModule.h +0 -247
  32. package/windows/CodePush/CodePushPackage.cpp +0 -456
  33. package/windows/CodePush/CodePushPackage.h +0 -49
  34. package/windows/CodePush/CodePushTelemetryManager.cpp +0 -213
  35. package/windows/CodePush/CodePushTelemetryManager.h +0 -29
  36. package/windows/CodePush/CodePushUpdateUtils.cpp +0 -86
  37. package/windows/CodePush/CodePushUpdateUtils.h +0 -38
  38. package/windows/CodePush/CodePushUtils.cpp +0 -29
  39. package/windows/CodePush/CodePushUtils.h +0 -18
  40. package/windows/CodePush/FileUtils.cpp +0 -131
  41. package/windows/CodePush/FileUtils.h +0 -28
  42. package/windows/CodePush/PropertySheet.props +0 -16
  43. package/windows/CodePush/ReactPackageProvider.cpp +0 -15
  44. package/windows/CodePush/ReactPackageProvider.h +0 -22
  45. package/windows/CodePush/ReactPackageProvider.idl +0 -9
  46. package/windows/CodePush/miniz/LICENSE +0 -22
  47. package/windows/CodePush/miniz/miniz.c +0 -7657
  48. package/windows/CodePush/miniz/miniz.h +0 -1338
  49. package/windows/CodePush/miniz/readme.md +0 -37
  50. package/windows/CodePush/packages.config +0 -4
  51. package/windows/CodePush/pch.cpp +0 -1
  52. package/windows/CodePush/pch.h +0 -4
  53. package/windows-legacy/CodePush/CodePush.csproj +0 -128
  54. package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
  55. package/windows-legacy/CodePush/FileUtils.cs +0 -40
  56. package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
  57. package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
  58. package/windows-legacy/CodePush/UpdateManager.cs +0 -305
  59. package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
  60. package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
  61. package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
  62. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
  63. package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
  64. package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
  65. package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
  66. package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
  67. package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
  68. package/windows-legacy/CodePush.Net46/packages.config +0 -5
  69. package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
  70. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
  71. package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
  72. package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
  73. package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
  74. package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
  75. package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
  76. package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
  77. package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
  78. package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
  79. package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
  80. package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
  81. package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
  82. package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
  83. package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
  84. package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
  85. package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
@@ -1,104 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- #include "pch.h"
5
- #include "CodePushConfig.h"
6
- #include "CodePushConfig.g.cpp"
7
- #include "CodePushNativeModule.h"
8
-
9
- #include "winrt/Windows.Foundation.Collections.h"
10
- #include "winrt/Windows.Storage.h"
11
-
12
- namespace winrt::Microsoft::CodePush::ReactNative::implementation
13
- {
14
- using namespace Windows::Storage;
15
- using namespace Windows::Data::Json;
16
- using namespace Windows::Foundation::Collections;
17
-
18
- CodePushConfig CodePushConfig::s_currentConfig{};
19
-
20
- /*static*/ CodePushConfig& CodePushConfig::Current() noexcept
21
- {
22
- return s_currentConfig;
23
- }
24
-
25
- JsonObject CodePushConfig::GetConfiguration()
26
- {
27
- JsonObject configObject;
28
- for (const auto& pair : m_configuration)
29
- {
30
- configObject.Insert(pair.Key(), JsonValue::CreateStringValue(pair.Value()));
31
- }
32
- return configObject;
33
- }
34
-
35
- /*static*/ void CodePushConfig::Init(IMap<hstring, hstring> const& configMap) noexcept
36
- {
37
- std::optional<hstring> appVersion;
38
- std::optional<hstring> buildVersion;
39
- std::optional<hstring> deploymentKey;
40
- std::optional<hstring> publicKey;
41
- std::optional<hstring> serverUrl;
42
-
43
- if (configMap != nullptr)
44
- {
45
- appVersion = configMap.TryLookup(AppVersionConfigKey);
46
- buildVersion = configMap.TryLookup(BuildVersionConfigKey);
47
- deploymentKey = configMap.TryLookup(DeploymentKeyConfigKey);
48
- publicKey = configMap.TryLookup(PublicKeyKey);
49
- serverUrl = configMap.TryLookup(ServerURLConfigKey);
50
- }
51
-
52
- s_currentConfig.m_configuration = winrt::single_threaded_map<hstring, hstring>();
53
- auto addToConfiguration = [=](std::wstring_view key, std::optional<hstring> optValue) {
54
- if (optValue.has_value())
55
- {
56
- s_currentConfig.m_configuration.Insert(key, optValue.value());
57
- }
58
- };
59
-
60
- auto localSettings{ ::Microsoft::CodePush::ReactNative::CodePushNativeModule::GetLocalSettings() };
61
- hstring clientUniqueId;
62
- auto clientUniqueIdData{ localSettings.Values().TryLookup(ClientUniqueIDConfigKey) };
63
- if (clientUniqueIdData == nullptr)
64
- {
65
- auto newGuid{ GuidHelper::CreateNewGuid() };
66
- clientUniqueId = to_hstring(newGuid);
67
- localSettings.Values().Insert(ClientUniqueIDConfigKey, box_value(clientUniqueId));
68
- }
69
- else
70
- {
71
- clientUniqueId = unbox_value<hstring>(clientUniqueIdData);
72
- }
73
-
74
- addToConfiguration(AppVersionConfigKey, appVersion);
75
- addToConfiguration(BuildVersionConfigKey, buildVersion);
76
- addToConfiguration(DeploymentKeyConfigKey, deploymentKey);
77
- addToConfiguration(PublicKeyKey, publicKey);
78
- addToConfiguration(ServerURLConfigKey, serverUrl);
79
-
80
- s_currentConfig.m_configuration.Insert(ClientUniqueIDConfigKey, clientUniqueId);
81
-
82
- if (!serverUrl.has_value())
83
- {
84
- s_currentConfig.m_configuration.Insert(ServerURLConfigKey, L"https://api.turbopush.org/");
85
- }
86
-
87
- ::Microsoft::CodePush::ReactNative::CodePushNativeModule::LoadBundle();
88
- }
89
-
90
- hstring CodePushConfig::QueryConfig(std::wstring_view key)
91
- {
92
- auto value{ m_configuration.TryLookup(key) };
93
- if (value.has_value())
94
- {
95
- return value.value();
96
- }
97
- return L"";
98
- }
99
-
100
- /*static*/ void CodePushConfig::SetHost(Microsoft::ReactNative::ReactNativeHost const& host) noexcept
101
- {
102
- ::Microsoft::CodePush::ReactNative::CodePushNativeModule::SetHost(host);
103
- }
104
- }
@@ -1,66 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- #pragma once
5
- #include "CodePushConfig.g.h"
6
-
7
- #include "NativeModules.h"
8
-
9
- #include <string_view>
10
- #include "winrt/Microsoft.ReactNative.h"
11
- #include "winrt/Windows.Data.Json.h"
12
- #include "winrt/Windows.Foundation.Collections.h"
13
-
14
- namespace winrt::Microsoft::CodePush::ReactNative::implementation
15
- {
16
- struct CodePushConfig : CodePushConfigT<CodePushConfig>
17
- {
18
- CodePushConfig() = default;
19
-
20
- static void Init(Windows::Foundation::Collections::IMap<hstring, hstring> const& configMap) noexcept;
21
- static void SetHost(Microsoft::ReactNative::ReactNativeHost const& host) noexcept;
22
-
23
- static CodePushConfig& Current() noexcept;
24
-
25
- hstring GetAppVersion() { return QueryConfig(AppVersionConfigKey); }
26
- void SetAppVersion(std::wstring_view appVersion) { m_configuration.Insert(AppVersionConfigKey, appVersion); }
27
-
28
- hstring GetBuildVersion() { return QueryConfig(BuildVersionConfigKey); }
29
-
30
- Windows::Data::Json::JsonObject GetConfiguration();
31
-
32
- hstring GetDeploymentKey() { return QueryConfig(DeploymentKeyConfigKey); }
33
- void SetDeploymentKey(std::wstring_view deploymentKey) { m_configuration.Insert(DeploymentKeyConfigKey, deploymentKey); }
34
-
35
- hstring GetServerUrl() { return QueryConfig(ServerURLConfigKey); }
36
- void SetServerUrl(std::wstring_view serverUrl) { m_configuration.Insert(ServerURLConfigKey, serverUrl); }
37
-
38
- hstring GetPublicKey() { return QueryConfig(PublicKeyKey); }
39
- void SetPublicKey(std::wstring_view publicKey) { m_configuration.Insert(PublicKeyKey, publicKey); }
40
-
41
- private:
42
- static constexpr std::wstring_view AppVersionConfigKey{ L"appVersion" };
43
- static constexpr std::wstring_view BuildVersionConfigKey{ L"buildVersion" };
44
- static constexpr std::wstring_view ClientUniqueIDConfigKey{ L"clientUniqueId" };
45
- static constexpr std::wstring_view DeploymentKeyConfigKey{ L"deploymentKey" };
46
- static constexpr std::wstring_view ServerURLConfigKey{ L"serverUrl" };
47
- static constexpr std::wstring_view PublicKeyKey{ L"publicKey" };
48
-
49
- Windows::Foundation::Collections::IMap<hstring, hstring> m_configuration;
50
- static CodePushConfig s_currentConfig;
51
-
52
- hstring QueryConfig(std::wstring_view key);
53
- };
54
- }
55
-
56
- namespace winrt::Microsoft::CodePush::ReactNative::factory_implementation
57
- {
58
- struct CodePushConfig : CodePushConfigT<CodePushConfig, implementation::CodePushConfig>
59
- {
60
- };
61
- }
62
-
63
- namespace Microsoft::CodePush::ReactNative
64
- {
65
- using winrt::Microsoft::CodePush::ReactNative::implementation::CodePushConfig;
66
- }
@@ -1,12 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- namespace Microsoft.CodePush.ReactNative
5
- {
6
- [webhosthidden]
7
- [default_interface]
8
- runtimeclass CodePushConfig {
9
- static void Init(IMap<String, String> configMap);
10
- static void SetHost(Microsoft.ReactNative.ReactNativeHost host);
11
- };
12
- } // namespace CppModule
@@ -1,73 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- #include "pch.h"
5
-
6
- #include "winrt/Windows.Data.Json.h"
7
- #include "winrt/Windows.Foundation.h"
8
- #include "winrt/Windows.Storage.h"
9
- #include "winrt/Windows.Storage.Streams.h"
10
- #include "winrt/Windows.Web.Http.h"
11
- #include "winrt/Windows.Web.Http.Headers.h"
12
-
13
- #include "CodePushDownloadHandler.h"
14
-
15
- namespace Microsoft::CodePush::ReactNative
16
- {
17
- using namespace winrt;
18
- using namespace Windows::Data::Json;
19
- using namespace Windows::Foundation;
20
- using namespace Windows::Storage;
21
- using namespace Windows::Storage::Streams;
22
- using namespace Windows::Web::Http;
23
-
24
- CodePushDownloadHandler::CodePushDownloadHandler(
25
- StorageFile downloadFile,
26
- std::function<void(int64_t, int64_t)> progressCallback) :
27
- receivedContentLength(0),
28
- expectedContentLength(0),
29
- progressCallback(progressCallback),
30
- downloadFile(downloadFile) {}
31
-
32
- IAsyncOperation<bool> CodePushDownloadHandler::Download(std::wstring_view url)
33
- {
34
- HttpClient client;
35
-
36
- auto headers{ client.DefaultRequestHeaders() };
37
- headers.Append(L"Accept-Encoding", L"identity");
38
-
39
- HttpRequestMessage reqm{ HttpMethod::Get(), Uri(url) };
40
- auto resm{ co_await client.SendRequestAsync(reqm, HttpCompletionOption::ResponseHeadersRead) };
41
- expectedContentLength = resm.Content().Headers().ContentLength().GetInt64();
42
- auto inputStream{ co_await resm.Content().ReadAsInputStreamAsync() };
43
- auto outputStream{ co_await downloadFile.OpenAsync(FileAccessMode::ReadWrite) };
44
-
45
- uint8_t header[4] = {};
46
-
47
- for (;;)
48
- {
49
- auto outputBuffer{ co_await inputStream.ReadAsync(Buffer{ BufferSize }, BufferSize, InputStreamOptions::None) };
50
-
51
- if (outputBuffer.Length() == 0)
52
- {
53
- break;
54
- }
55
- co_await outputStream.WriteAsync(outputBuffer);
56
-
57
- if (receivedContentLength < ARRAYSIZE(header))
58
- {
59
- for (uint32_t i{ static_cast<uint32_t>(receivedContentLength) }; i < min(ARRAYSIZE(header), outputBuffer.Length()); i++)
60
- {
61
- header[i] = outputBuffer.data()[i];
62
- }
63
- }
64
-
65
- receivedContentLength += outputBuffer.Length();
66
-
67
- progressCallback(/*expectedContentLength*/ expectedContentLength, /*receivedContentLength*/ receivedContentLength);
68
- }
69
-
70
- bool isZip{ header[0] == 'P' && header[1] == 'K' && header[2] == 3 && header[3] == 4 };
71
- co_return isZip;
72
- }
73
- }
@@ -1,32 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- #pragma once
5
-
6
- #include "winrt/Windows.Storage.h"
7
- #include "winrt/Windows.Foundation.h"
8
- #include "winrt/Windows.Data.Json.h"
9
- #include <string_view>
10
- #include <functional>
11
-
12
- namespace Microsoft::CodePush::ReactNative
13
- {
14
- struct CodePushDownloadHandler
15
- {
16
- winrt::Windows::Storage::StorageFile downloadFile;
17
- int64_t expectedContentLength;
18
- int64_t receivedContentLength;
19
- std::function<void(int64_t, int64_t)> progressCallback;
20
- std::wstring_view downloadUrl;
21
-
22
- CodePushDownloadHandler(
23
- winrt::Windows::Storage::StorageFile downloadFile,
24
- std::function<void(int64_t, int64_t)> progressCallback);
25
-
26
- // Returns true if the downloaded file is a zip file
27
- winrt::Windows::Foundation::IAsyncOperation<bool> Download(std::wstring_view url);
28
-
29
- private:
30
- static constexpr uint32_t BufferSize{ 256 * 1024 };
31
- };
32
- }