@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.
Files changed (66) hide show
  1. package/CONTRIBUTING.md +20 -9
  2. package/package.json +1 -1
  3. package/windows/CodePush/CodePush.def +0 -3
  4. package/windows/CodePush/CodePush.vcxproj +0 -198
  5. package/windows/CodePush/CodePush.vcxproj.filters +0 -91
  6. package/windows/CodePush/CodePushConfig.cpp +0 -104
  7. package/windows/CodePush/CodePushConfig.h +0 -66
  8. package/windows/CodePush/CodePushConfig.idl +0 -12
  9. package/windows/CodePush/CodePushDownloadHandler.cpp +0 -73
  10. package/windows/CodePush/CodePushDownloadHandler.h +0 -32
  11. package/windows/CodePush/CodePushNativeModule.cpp +0 -937
  12. package/windows/CodePush/CodePushNativeModule.h +0 -247
  13. package/windows/CodePush/CodePushPackage.cpp +0 -456
  14. package/windows/CodePush/CodePushPackage.h +0 -49
  15. package/windows/CodePush/CodePushTelemetryManager.cpp +0 -213
  16. package/windows/CodePush/CodePushTelemetryManager.h +0 -29
  17. package/windows/CodePush/CodePushUpdateUtils.cpp +0 -86
  18. package/windows/CodePush/CodePushUpdateUtils.h +0 -38
  19. package/windows/CodePush/CodePushUtils.cpp +0 -29
  20. package/windows/CodePush/CodePushUtils.h +0 -18
  21. package/windows/CodePush/FileUtils.cpp +0 -131
  22. package/windows/CodePush/FileUtils.h +0 -28
  23. package/windows/CodePush/PropertySheet.props +0 -16
  24. package/windows/CodePush/ReactPackageProvider.cpp +0 -15
  25. package/windows/CodePush/ReactPackageProvider.h +0 -22
  26. package/windows/CodePush/ReactPackageProvider.idl +0 -9
  27. package/windows/CodePush/miniz/LICENSE +0 -22
  28. package/windows/CodePush/miniz/miniz.c +0 -7657
  29. package/windows/CodePush/miniz/miniz.h +0 -1338
  30. package/windows/CodePush/miniz/readme.md +0 -37
  31. package/windows/CodePush/packages.config +0 -4
  32. package/windows/CodePush/pch.cpp +0 -1
  33. package/windows/CodePush/pch.h +0 -4
  34. package/windows-legacy/CodePush/CodePush.csproj +0 -128
  35. package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
  36. package/windows-legacy/CodePush/FileUtils.cs +0 -40
  37. package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
  38. package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
  39. package/windows-legacy/CodePush/UpdateManager.cs +0 -305
  40. package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
  41. package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
  42. package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
  43. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
  44. package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
  45. package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
  46. package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
  47. package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
  48. package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
  49. package/windows-legacy/CodePush.Net46/packages.config +0 -5
  50. package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
  51. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
  52. package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
  53. package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
  54. package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
  55. package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
  56. package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
  57. package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
  58. package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
  59. package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
  60. package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
  61. package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
  62. package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
  63. package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
  64. package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
  65. package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
  66. package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
package/CONTRIBUTING.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### Environment setup
6
6
 
7
- `node.js` and `npm` are needed for using this project. `npm` comes bundled with the `node.js` installer. You can download the `node.js` installer here: https://nodejs.org/download/.
7
+ `node.js` and `npm` are needed for using this project. `npm` comes bundled with the `node.js` installer. You can download the `node.js` installer here: <https://nodejs.org/download/>.
8
8
 
9
9
  Once you have installed `node.js` and `npm`, install the dev dependencies for the project.
10
10
 
@@ -15,19 +15,22 @@ npm install
15
15
  ### Using the plugin manually
16
16
 
17
17
  Follow these steps to test your modifications to the plugin manually:
18
+
18
19
  - clone this repository
19
20
  - install the dependencies
20
21
 
21
- Navigate to the root folder from your command line console and run:
22
- ```
23
- npm install
24
- ```
22
+ Navigate to the root folder from your command line console and run:
23
+ ```
24
+ npm install
25
+ ```
26
+
25
27
  - install the plugin in a React-Native project
26
28
 
27
- Navigate to the root folder of your React-Native project from your command line console and run:
28
- ```
29
- npm install local_path_to_your_clone_of_this_repo
30
- ```
29
+ Navigate to the root folder of your React-Native project from your command line console and run:
30
+ ```
31
+ npm install local_path_to_your_clone_of_this_repo
32
+ ```
33
+
31
34
  - configure the plugin using the steps in the README.md
32
35
  - build and run your app on an emulator or device
33
36
 
@@ -81,6 +84,7 @@ If you would like to pull the plugin from NPM rather than running the tests on t
81
84
  #### Default
82
85
 
83
86
  To run all of the unit tests on Android and iOS:
87
+
84
88
  ```
85
89
  npm run test
86
90
  ```
@@ -88,6 +92,7 @@ npm run test
88
92
  #### iOS
89
93
 
90
94
  To run all of the unit tests on iOS:
95
+
91
96
  ```
92
97
  npm run test:ios
93
98
  ```
@@ -95,6 +100,7 @@ npm run test:ios
95
100
  #### Android
96
101
 
97
102
  To run all of the unit tests on Android:
103
+
98
104
  ```
99
105
  npm run test:android
100
106
  ```
@@ -107,26 +113,31 @@ The platforms are ordered as follows, and ran in that order:
107
113
  android, ios
108
114
 
109
115
  To run the core unit tests on Android:
116
+
110
117
  ```
111
118
  CORE=true npm run test:android
112
119
  ```
113
120
 
114
121
  To run all of the unit tests on iOS and pull the plugin from NPM:
122
+
115
123
  ```
116
124
  NPM=true npm run test:ios
117
125
  ```
118
126
 
119
127
  To run all of the unit tests on Android and iOS without building first:
128
+
120
129
  ```
121
130
  npm run test:fast
122
131
  ```
123
132
 
124
133
  To run all of the unit tests on iOS and restart the emulators:
134
+
125
135
  ```
126
136
  CLEAN=true npm run test:ios
127
137
  ```
128
138
 
129
139
  To run the core unit tests on Android and pull the plugin from NPM:
140
+
130
141
  ```
131
142
  NPM=true CORE=true npm run test:android
132
143
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcpush/react-native-code-push",
3
- "version": "1.0.3-develop.2",
3
+ "version": "1.0.3-develop.4",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",
@@ -1,3 +0,0 @@
1
- EXPORTS
2
- DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
3
- DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
@@ -1,198 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props')" />
4
- <PropertyGroup Label="Globals">
5
- <CppWinRTOptimized>true</CppWinRTOptimized>
6
- <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7
- <CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
8
- <MinimalCoreWin>true</MinimalCoreWin>
9
- <ProjectGuid>{a6b6216e-fa3f-45e2-9c8e-40023cce9132}</ProjectGuid>
10
- <ProjectName>CodePush</ProjectName>
11
- <RootNamespace>Microsoft.CodePush.ReactNative</RootNamespace>
12
- <DefaultLanguage>en-US</DefaultLanguage>
13
- <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
14
- <AppContainerApplication>true</AppContainerApplication>
15
- <ApplicationType>Windows Store</ApplicationType>
16
- <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17
- <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0</WindowsTargetPlatformVersion>
18
- <WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
19
- </PropertyGroup>
20
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21
- <PropertyGroup Label="ReactNativeWindowsProps">
22
- <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
23
- </PropertyGroup>
24
- <ItemGroup Label="ProjectConfigurations">
25
- <ProjectConfiguration Include="Debug|ARM">
26
- <Configuration>Debug</Configuration>
27
- <Platform>ARM</Platform>
28
- </ProjectConfiguration>
29
- <ProjectConfiguration Include="Debug|ARM64">
30
- <Configuration>Debug</Configuration>
31
- <Platform>ARM64</Platform>
32
- </ProjectConfiguration>
33
- <ProjectConfiguration Include="Debug|Win32">
34
- <Configuration>Debug</Configuration>
35
- <Platform>Win32</Platform>
36
- </ProjectConfiguration>
37
- <ProjectConfiguration Include="Debug|x64">
38
- <Configuration>Debug</Configuration>
39
- <Platform>x64</Platform>
40
- </ProjectConfiguration>
41
- <ProjectConfiguration Include="Release|ARM">
42
- <Configuration>Release</Configuration>
43
- <Platform>ARM</Platform>
44
- </ProjectConfiguration>
45
- <ProjectConfiguration Include="Release|ARM64">
46
- <Configuration>Release</Configuration>
47
- <Platform>ARM64</Platform>
48
- </ProjectConfiguration>
49
- <ProjectConfiguration Include="Release|Win32">
50
- <Configuration>Release</Configuration>
51
- <Platform>Win32</Platform>
52
- </ProjectConfiguration>
53
- <ProjectConfiguration Include="Release|x64">
54
- <Configuration>Release</Configuration>
55
- <Platform>x64</Platform>
56
- </ProjectConfiguration>
57
- </ItemGroup>
58
- <PropertyGroup Label="Configuration">
59
- <ConfigurationType>DynamicLibrary</ConfigurationType>
60
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
61
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
62
- <CharacterSet>Unicode</CharacterSet>
63
- <GenerateManifest>false</GenerateManifest>
64
- </PropertyGroup>
65
- <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
66
- <UseDebugLibraries>true</UseDebugLibraries>
67
- <LinkIncremental>true</LinkIncremental>
68
- </PropertyGroup>
69
- <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
70
- <UseDebugLibraries>false</UseDebugLibraries>
71
- <WholeProgramOptimization>true</WholeProgramOptimization>
72
- <LinkIncremental>false</LinkIncremental>
73
- </PropertyGroup>
74
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
75
- <ImportGroup Label="ExtensionSettings">
76
- </ImportGroup>
77
- <ImportGroup Label="Shared">
78
- </ImportGroup>
79
- <ImportGroup Label="PropertySheets">
80
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
81
- </ImportGroup>
82
- <ImportGroup Label="PropertySheets">
83
- <Import Project="PropertySheet.props" />
84
- </ImportGroup>
85
- <ImportGroup Label="ReactNativeWindowsPropertySheets">
86
- <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" />
87
- </ImportGroup>
88
- <PropertyGroup Label="UserMacros" />
89
- <PropertyGroup />
90
- <ItemDefinitionGroup>
91
- <ClCompile>
92
- <PrecompiledHeader>Use</PrecompiledHeader>
93
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
94
- <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
95
- <WarningLevel>Level4</WarningLevel>
96
- <AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
97
- <!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
98
- <AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
99
- <DisableSpecificWarnings>
100
- </DisableSpecificWarnings>
101
- <PreprocessorDefinitions>_WINRT_DLL;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
102
- <AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
103
- </ClCompile>
104
- <Link>
105
- <SubSystem>Console</SubSystem>
106
- <GenerateWindowsMetadata>true</GenerateWindowsMetadata>
107
- <ModuleDefinitionFile>CodePush.def</ModuleDefinitionFile>
108
- </Link>
109
- </ItemDefinitionGroup>
110
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
111
- <ClCompile>
112
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
113
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
114
- </ClCompile>
115
- </ItemDefinitionGroup>
116
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
117
- <ClCompile>
118
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
119
- </ClCompile>
120
- <Link>
121
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
122
- <OptimizeReferences>true</OptimizeReferences>
123
- </Link>
124
- </ItemDefinitionGroup>
125
- <ItemGroup>
126
- <ClInclude Include="CodePushConfig.h" />
127
- <ClInclude Include="CodePushDownloadHandler.h" />
128
- <ClInclude Include="CodePushNativeModule.h" />
129
- <ClInclude Include="CodePushPackage.h" />
130
- <ClInclude Include="CodePushTelemetryManager.h" />
131
- <ClInclude Include="CodePushUpdateUtils.h" />
132
- <ClInclude Include="CodePushUtils.h" />
133
- <ClInclude Include="FileUtils.h" />
134
- <ClInclude Include="miniz\miniz.h" />
135
- <ClInclude Include="pch.h" />
136
- <ClInclude Include="ReactPackageProvider.h">
137
- <DependentUpon>ReactPackageProvider.idl</DependentUpon>
138
- </ClInclude>
139
- </ItemGroup>
140
- <ItemGroup>
141
- <ClCompile Include="CodePushConfig.cpp" />
142
- <ClCompile Include="CodePushDownloadHandler.cpp" />
143
- <ClCompile Include="CodePushNativeModule.cpp" />
144
- <ClCompile Include="CodePushPackage.cpp" />
145
- <ClCompile Include="CodePushTelemetryManager.cpp" />
146
- <ClCompile Include="CodePushUpdateUtils.cpp" />
147
- <ClCompile Include="CodePushUtils.cpp" />
148
- <ClCompile Include="FileUtils.cpp" />
149
- <ClCompile Include="miniz\miniz.c">
150
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
151
- </ClCompile>
152
- <ClCompile Include="pch.cpp">
153
- <PrecompiledHeader>Create</PrecompiledHeader>
154
- </ClCompile>
155
- <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
156
- <ClCompile Include="ReactPackageProvider.cpp">
157
- <DependentUpon>ReactPackageProvider.idl</DependentUpon>
158
- </ClCompile>
159
- </ItemGroup>
160
- <ItemGroup>
161
- <Midl Include="CodePushConfig.idl" />
162
- <Midl Include="ReactPackageProvider.idl" />
163
- </ItemGroup>
164
- <ItemGroup>
165
- <None Include="CodePush.def" />
166
- </ItemGroup>
167
- <ItemGroup>
168
- <None Include="packages.config" />
169
- <None Include="PropertySheet.props" />
170
- </ItemGroup>
171
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
172
- <ImportGroup Label="ReactNativeWindowsTargets">
173
- <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
174
- </ImportGroup>
175
- <Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
176
- <PropertyGroup>
177
- <ErrorText>This project references targets in your node_modules\react-native-windows folder that are missing. The missing file is {0}.</ErrorText>
178
- </PropertyGroup>
179
- <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
180
- <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
181
- </Target>
182
- <ImportGroup Label="ExtensionTargets">
183
- <Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets')" />
184
- </ImportGroup>
185
- <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
186
- <PropertyGroup>
187
- <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
188
- </PropertyGroup>
189
- <Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props'))" />
190
- <Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets'))" />
191
- </Target>
192
- <ItemGroup>
193
- <ProjectReference Update="$(ReactNativeWindowsDir)\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
194
- <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
195
- <LinkLibraryDependencies>true</LinkLibraryDependencies>
196
- </ProjectReference>
197
- </ItemGroup>
198
- </Project>
@@ -1,91 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <ItemGroup>
4
- <Filter Include="Resources">
5
- <UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
6
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
7
- </Filter>
8
- <Filter Include="CodePush">
9
- <UniqueIdentifier>{c2eae772-39a8-4b12-aad7-60e9ca2072ef}</UniqueIdentifier>
10
- </Filter>
11
- <Filter Include="miniz">
12
- <UniqueIdentifier>{53513ea0-fe7c-4f69-8d3e-c1a9efbb7333}</UniqueIdentifier>
13
- </Filter>
14
- </ItemGroup>
15
- <ItemGroup>
16
- <ClCompile Include="pch.cpp" />
17
- <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
18
- <ClCompile Include="miniz\miniz.c">
19
- <Filter>miniz</Filter>
20
- </ClCompile>
21
- <ClCompile Include="CodePushConfig.cpp">
22
- <Filter>CodePush</Filter>
23
- </ClCompile>
24
- <ClCompile Include="CodePushDownloadHandler.cpp">
25
- <Filter>CodePush</Filter>
26
- </ClCompile>
27
- <ClCompile Include="CodePushNativeModule.cpp">
28
- <Filter>CodePush</Filter>
29
- </ClCompile>
30
- <ClCompile Include="CodePushPackage.cpp">
31
- <Filter>CodePush</Filter>
32
- </ClCompile>
33
- <ClCompile Include="CodePushTelemetryManager.cpp">
34
- <Filter>CodePush</Filter>
35
- </ClCompile>
36
- <ClCompile Include="CodePushUpdateUtils.cpp">
37
- <Filter>CodePush</Filter>
38
- </ClCompile>
39
- <ClCompile Include="CodePushUtils.cpp">
40
- <Filter>CodePush</Filter>
41
- </ClCompile>
42
- <ClCompile Include="FileUtils.cpp">
43
- <Filter>CodePush</Filter>
44
- </ClCompile>
45
- <ClCompile Include="ReactPackageProvider.cpp" />
46
- </ItemGroup>
47
- <ItemGroup>
48
- <ClInclude Include="pch.h" />
49
- <ClInclude Include="miniz\miniz.h">
50
- <Filter>miniz</Filter>
51
- </ClInclude>
52
- <ClInclude Include="CodePushConfig.h">
53
- <Filter>CodePush</Filter>
54
- </ClInclude>
55
- <ClInclude Include="CodePushDownloadHandler.h">
56
- <Filter>CodePush</Filter>
57
- </ClInclude>
58
- <ClInclude Include="CodePushNativeModule.h">
59
- <Filter>CodePush</Filter>
60
- </ClInclude>
61
- <ClInclude Include="CodePushPackage.h">
62
- <Filter>CodePush</Filter>
63
- </ClInclude>
64
- <ClInclude Include="CodePushTelemetryManager.h">
65
- <Filter>CodePush</Filter>
66
- </ClInclude>
67
- <ClInclude Include="CodePushUpdateUtils.h">
68
- <Filter>CodePush</Filter>
69
- </ClInclude>
70
- <ClInclude Include="CodePushUtils.h">
71
- <Filter>CodePush</Filter>
72
- </ClInclude>
73
- <ClInclude Include="FileUtils.h">
74
- <Filter>CodePush</Filter>
75
- </ClInclude>
76
- <ClInclude Include="ReactPackageProvider.h" />
77
- </ItemGroup>
78
- <ItemGroup>
79
- <None Include="CodePush.def" />
80
- <None Include="packages.config" />
81
- </ItemGroup>
82
- <ItemGroup>
83
- <None Include="PropertySheet.props" />
84
- </ItemGroup>
85
- <ItemGroup>
86
- <Midl Include="ReactPackageProvider.idl" />
87
- <Midl Include="CodePushConfig.idl">
88
- <Filter>CodePush</Filter>
89
- </Midl>
90
- </ItemGroup>
91
- </Project>
@@ -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://codepush.appcenter.ms/");
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
- }