Added React Native Windows dotNet46 support (#684)

Added support react-native-windows dotNet
Added example for react-native-windows UWP based
Added example for react-native-windows dotNet based

Project structure:

CodePush.Shared - shared code between UWP and dotNet
CodePush - UWP specific code
CodePush.Net46 - dotNet specific code

For UWP solution it needs to be added the following projects:

CodePush.Shared
CodePush
For dotNet solution it needs to be added the following projects:

CodePush.Shared
CodePush.Net46
Examples:

Examples\CodePushDemoApp\windows\CodePushDemoApp.sln the solution contains both examples (UWP and dotNet).

Notes

Example for ARM configuration has not been tested. Since there is no changes in UWP part of implementation, there is low risk of failure.

In this implementation we tried to reuse UWP library as much as possible. The following issues are relevant for both platforms:

ZipFile.ExtractToDirectory is not reliable and throws exception if:
folder exists already
path is too long (> 250 chars)
Un-zipping is quite long operation. Does it make sense for async?
await UpdateUtils.UnzipBundleAsync(downloadFile.Path, unzippedFolder.Path);
This commit is contained in:
Alexander Bodalevsky
2017-02-14 02:23:20 +02:00
committed by Richard Hua
parent fc7c109535
commit be96f07eda
69 changed files with 2866 additions and 87 deletions

38
.gitignore vendored
View File

@@ -1,3 +1,5 @@
# gitignore contributors: remember to update .npmignore
# OSX
#
.DS_Store
@@ -152,4 +154,38 @@ captures/
code-push-plugin-testing-framework/node_modules
# RN New Version App Generation
Examples/testapp_rn
Examples/testapp_rn
# Windows
windows/.vs/
windows/obj/
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

View File

@@ -43,3 +43,45 @@ android/local.properties
android/.gradle
android/**/*.iml
android/.idea
# Windows
windows/.vs/
windows/obj/
#Tests
windows/CodePush.Net46.Test
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad
#NuGet
packages/
*.nupkg

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="myget.org" value="https://www.myget.org/F/chakracore-preview/api/v3/index.json" />
</packageSources>
</configuration>

View File

@@ -0,0 +1 @@
require("./demo");

View File

@@ -9,6 +9,7 @@
"babel-preset-react-native-stage-0": "1.0.1",
"react": "15.4.0",
"react-native": "0.40.0",
"react-native-code-push": "file:../../"
"react-native-code-push": "file:../../",
"react-native-windows": "0.40.0-rc.1"
}
}

View File

@@ -0,0 +1,89 @@
*AppPackages*
*BundleArtifacts*
*ReactAssets*
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
#MonoDevelop
*.pidb
*.userprefs
#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache
#Project files
[Bb]uild/
#Subversion files
.svn
# Office Temp Files
~$*
# vim Temp Files
*~
#NuGet
packages/
*.nupkg
#ncrunch
*ncrunch*
*crunch*.local.xml
# visual studio database projects
*.dbmdl
#Test files
*.testsettings
#Other files
*.DotSettings
.vs/
*project.lock.json

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>

View File

@@ -0,0 +1,5 @@
<Application x:Class="CodePushDemoApp.Wpf.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Application>

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
namespace CodePushDemoApp.Wpf
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private readonly AppReactPage _reactPage = new AppReactPage();
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
}
/// <summary>
/// Override method fired prior to the Startup event when the Run method of the Application object is called...
/// </summary>
/// <param name="e"></param>
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
OnCreate(e.Args);
}
/// <summary>
/// Called whenever the app is opened to initialized...
/// </summary>
/// <param name="arguments"></param>
private void OnCreate(string[] arguments)
{
var shellWindow = Application.Current.MainWindow;
if (shellWindow == null)
{
shellWindow = new Window
{
ShowActivated = true,
ShowInTaskbar = true,
Title = "CodePushDemoApp.WPF",
Height = 768,
Width = 1024,
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
Application.Current.MainWindow = shellWindow;
}
//Show Window if it is not already active...
if (!shellWindow.IsLoaded)
{
shellWindow.Show();
}
var rootFrame = shellWindow.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
_reactPage.OnCreate(arguments);
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
// Place the frame in the current Window
shellWindow.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Content = _reactPage;
}
// Ensure the current window is active
shellWindow.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page...");
}
}
}

View File

@@ -0,0 +1,60 @@
using CodePush.ReactNative;
using ReactNative;
using ReactNative.Modules.Core;
using ReactNative.Shell;
using System;
using System.Collections.Generic;
namespace CodePushDemoApp.Wpf
{
internal class AppReactPage : ReactPage
{
public override string MainComponentName
{
get
{
return "CodePushDemoApp";
}
}
private CodePushReactPackage codePushReactPackage = null;
public override string JavaScriptBundleFile
{
get
{
codePushReactPackage = new CodePushReactPackage("deployment-key-here", this);
#if BUNDLE
return codePushReactPackage.GetJavaScriptBundleFile();
#else
return null;
#endif
}
}
public override List<IReactPackage> Packages
{
get
{
return new List<IReactPackage>
{
new MainReactPackage(),
codePushReactPackage
};
}
}
public override bool UseDeveloperSupport
{
get
{
#if !BUNDLE || DEBUG
return true;
#else
return false;
#endif
}
}
}
}

View File

@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.ChakraCore.1.4.1-preview-00010-42060\build\netstandard1.0\Microsoft.ChakraCore.props" Condition="Exists('..\packages\Microsoft.ChakraCore.1.4.1-preview-00010-42060\build\netstandard1.0\Microsoft.ChakraCore.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodePushDemoApp.Wpf</RootNamespace>
<AssemblyName>CodePushDemoApp.Wpf</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugBundle|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\DebugBundle\</OutputPath>
<DefineConstants>TRACE;DEBUG;BUNDLE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseBundle|x86'">
<OutputPath>bin\x86\ReleaseBundle\</OutputPath>
<DefineConstants>TRACE;BUNDLE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugBundle|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\DebugBundle\</OutputPath>
<DefineConstants>TRACE;DEBUG;BUNDLE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseBundle|x64'">
<OutputPath>bin\x64\ReleaseBundle\</OutputPath>
<DefineConstants>TRACE;BUNDLE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Facebook.Yoga, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Facebook.Yoga.1.0.1-pre\lib\netstandard\Facebook.Yoga.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="AppReactPage.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\windows\CodePush.Net46\CodePush.Net46.csproj">
<Project>{4dfe3f9f-5e15-4f17-8fd4-33ff0519348e}</Project>
<Name>CodePush.Net46</Name>
</ProjectReference>
<ProjectReference Include="..\..\node_modules\react-native-windows\ReactWindows\ReactNative.Net46\ReactNative.Net46.csproj">
<Project>{22cbff9c-fe36-43e8-a246-266c7635e662}</Project>
<Name>ReactNative.Net46</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.ChakraCore.1.4.1-preview-00010-42060\build\netstandard1.0\Microsoft.ChakraCore.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.ChakraCore.1.4.1-preview-00010-42060\build\netstandard1.0\Microsoft.ChakraCore.props'))" />
<Error Condition="!Exists('..\packages\Facebook.Yoga.1.0.1-pre\build\netstandard\Facebook.Yoga.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Facebook.Yoga.1.0.1-pre\build\netstandard\Facebook.Yoga.targets'))" />
</Target>
<Import Project="..\packages\Facebook.Yoga.1.0.1-pre\build\netstandard\Facebook.Yoga.targets" Condition="Exists('..\packages\Facebook.Yoga.1.0.1-pre\build\netstandard\Facebook.Yoga.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodePushDemoApp.Wpf")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodePushDemoApp.Wpf")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodePushDemoApp.Wpf.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodePushDemoApp.Wpf.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodePushDemoApp.Wpf.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Facebook.Yoga" version="1.0.1-pre" targetFramework="net46" />
<package id="Microsoft.ChakraCore" version="1.4.1-preview-00010-42060" targetFramework="net46" developmentDependency="true" />
</packages>

View File

@@ -0,0 +1,245 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodePushDemoApp", "CodePushDemoApp\CodePushDemoApp.csproj", "{3E8198A5-7E41-43F1-880E-E7E2840E5A59}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ReactNative.Shared", "..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.shproj", "{EEA8B852-4D07-48E1-8294-A21AB5909FE5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodePush", "..\..\..\windows\CodePush\CodePush.csproj", "{446A85D9-55EB-4C7D-8B9D-448306C833D6}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CodePush.Shared", "..\..\..\windows\CodePush.Shared\CodePush.Shared.shproj", "{4AD4C826-CC26-4F1D-B60D-B97B22F52E90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative.Net46", "..\node_modules\react-native-windows\ReactWindows\ReactNative.Net46\ReactNative.Net46.csproj", "{22CBFF9C-FE36-43E8-A246-266C7635E662}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodePush.Net46", "..\..\..\windows\CodePush.Net46\CodePush.Net46.csproj", "{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodePushDemoApp.Wpf", "CodePushDemoApp.Wpf\CodePushDemoApp.Wpf.csproj", "{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodePush.Net46.Test", "..\..\..\windows\CodePush.Net46.Test\CodePush.Net46.Test.csproj", "{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{22cbff9c-fe36-43e8-a246-266c7635e662}*SharedItemsImports = 4
..\..\..\windows\CodePush.Shared\CodePush.Shared.projitems*{446a85d9-55eb-4c7d-8b9d-448306c833d6}*SharedItemsImports = 4
..\..\..\windows\CodePush.Shared\CodePush.Shared.projitems*{4ad4c826-cc26-4f1d-b60d-b97b22f52e90}*SharedItemsImports = 13
..\..\..\windows\CodePush.Shared\CodePush.Shared.projitems*{4dfe3f9f-5e15-4f17-8fd4-33ff0519348e}*SharedItemsImports = 4
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{c7673ad5-e3aa-468c-a5fd-fa38154e205c}*SharedItemsImports = 4
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{eea8b852-4d07-48e1-8294-a21ab5909fe5}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
DebugBundle|ARM = DebugBundle|ARM
DebugBundle|x64 = DebugBundle|x64
DebugBundle|x86 = DebugBundle|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
ReleaseBundle|ARM = ReleaseBundle|ARM
ReleaseBundle|x64 = ReleaseBundle|x64
ReleaseBundle|x86 = ReleaseBundle|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|ARM.ActiveCfg = Debug|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|ARM.Build.0 = Debug|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|ARM.Deploy.0 = Debug|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x64.ActiveCfg = Debug|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x64.Build.0 = Debug|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x64.Deploy.0 = Debug|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x86.ActiveCfg = Debug|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x86.Build.0 = Debug|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Debug|x86.Deploy.0 = Debug|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|ARM.ActiveCfg = DebugBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|ARM.Build.0 = DebugBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|ARM.Deploy.0 = DebugBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x64.ActiveCfg = DebugBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x64.Build.0 = DebugBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x64.Deploy.0 = DebugBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x86.ActiveCfg = DebugBundle|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x86.Build.0 = DebugBundle|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.DebugBundle|x86.Deploy.0 = DebugBundle|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|ARM.ActiveCfg = Release|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|ARM.Build.0 = Release|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|ARM.Deploy.0 = Release|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x64.ActiveCfg = Release|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x64.Build.0 = Release|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x64.Deploy.0 = Release|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x86.ActiveCfg = Release|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x86.Build.0 = Release|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.Release|x86.Deploy.0 = Release|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|ARM.ActiveCfg = ReleaseBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|ARM.Build.0 = ReleaseBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|ARM.Deploy.0 = ReleaseBundle|ARM
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x64.ActiveCfg = ReleaseBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x64.Build.0 = ReleaseBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x64.Deploy.0 = ReleaseBundle|x64
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x86.ActiveCfg = ReleaseBundle|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x86.Build.0 = ReleaseBundle|x86
{3E8198A5-7E41-43F1-880E-E7E2840E5A59}.ReleaseBundle|x86.Deploy.0 = ReleaseBundle|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|ARM.ActiveCfg = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|ARM.Build.0 = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x64.ActiveCfg = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x64.Build.0 = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x86.ActiveCfg = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.DebugBundle|x86.Build.0 = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|ARM.ActiveCfg = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|ARM.Build.0 = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x64.ActiveCfg = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x64.Build.0 = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x86.ActiveCfg = Release|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.ReleaseBundle|x86.Build.0 = Release|x86
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.ActiveCfg = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.Build.0 = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.ActiveCfg = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.Build.0 = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.ActiveCfg = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.Build.0 = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.ActiveCfg = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.Build.0 = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.ActiveCfg = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.Build.0 = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.ActiveCfg = Release|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.Build.0 = Release|Win32
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|ARM.ActiveCfg = Debug|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|ARM.Build.0 = Debug|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|x64.ActiveCfg = Debug|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|x64.Build.0 = Debug|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|x86.ActiveCfg = Debug|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Debug|x86.Build.0 = Debug|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|ARM.ActiveCfg = Debug|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|ARM.Build.0 = Debug|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|x64.ActiveCfg = Debug|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|x64.Build.0 = Debug|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|x86.ActiveCfg = Debug|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.DebugBundle|x86.Build.0 = Debug|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|ARM.ActiveCfg = Release|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|ARM.Build.0 = Release|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|x64.ActiveCfg = Release|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|x64.Build.0 = Release|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|x86.ActiveCfg = Release|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.Release|x86.Build.0 = Release|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|ARM.ActiveCfg = Release|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|ARM.Build.0 = Release|ARM
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|x64.ActiveCfg = Release|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|x64.Build.0 = Release|x64
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|x86.ActiveCfg = Release|x86
{446A85D9-55EB-4C7D-8B9D-448306C833D6}.ReleaseBundle|x86.Build.0 = Release|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|ARM.ActiveCfg = Debug|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|ARM.Build.0 = Debug|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|x64.ActiveCfg = Debug|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|x64.Build.0 = Debug|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|x86.ActiveCfg = Debug|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Debug|x86.Build.0 = Debug|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|ARM.ActiveCfg = Debug|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|ARM.Build.0 = Debug|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|x64.ActiveCfg = Debug|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|x64.Build.0 = Debug|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|x86.ActiveCfg = Debug|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.DebugBundle|x86.Build.0 = Debug|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|ARM.ActiveCfg = Release|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|ARM.Build.0 = Release|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|x64.ActiveCfg = Release|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|x64.Build.0 = Release|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|x86.ActiveCfg = Release|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.Release|x86.Build.0 = Release|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|ARM.ActiveCfg = Release|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|ARM.Build.0 = Release|ARM
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|x64.ActiveCfg = Release|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|x64.Build.0 = Release|x64
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|x86.ActiveCfg = Release|x86
{22CBFF9C-FE36-43E8-A246-266C7635E662}.ReleaseBundle|x86.Build.0 = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Debug|ARM.ActiveCfg = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Debug|x64.ActiveCfg = Debug|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Debug|x64.Build.0 = Debug|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Debug|x86.ActiveCfg = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Debug|x86.Build.0 = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.DebugBundle|ARM.ActiveCfg = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.DebugBundle|x64.ActiveCfg = Debug|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.DebugBundle|x64.Build.0 = Debug|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.DebugBundle|x86.ActiveCfg = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.DebugBundle|x86.Build.0 = Debug|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Release|ARM.ActiveCfg = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Release|x64.ActiveCfg = Release|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Release|x64.Build.0 = Release|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Release|x86.ActiveCfg = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.Release|x86.Build.0 = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.ReleaseBundle|ARM.ActiveCfg = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.ReleaseBundle|x64.ActiveCfg = Release|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.ReleaseBundle|x64.Build.0 = Release|x64
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.ReleaseBundle|x86.ActiveCfg = Release|x86
{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}.ReleaseBundle|x86.Build.0 = Release|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Debug|ARM.ActiveCfg = Debug|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Debug|x64.ActiveCfg = Debug|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Debug|x64.Build.0 = Debug|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Debug|x86.ActiveCfg = Debug|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Debug|x86.Build.0 = Debug|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.DebugBundle|ARM.ActiveCfg = Debug|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.DebugBundle|x64.ActiveCfg = DebugBundle|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.DebugBundle|x64.Build.0 = DebugBundle|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.DebugBundle|x86.ActiveCfg = DebugBundle|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.DebugBundle|x86.Build.0 = DebugBundle|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Release|ARM.ActiveCfg = Release|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Release|x64.ActiveCfg = Release|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Release|x64.Build.0 = Release|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Release|x86.ActiveCfg = Release|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.Release|x86.Build.0 = Release|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.ReleaseBundle|ARM.ActiveCfg = Release|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.ReleaseBundle|x64.ActiveCfg = ReleaseBundle|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.ReleaseBundle|x64.Build.0 = ReleaseBundle|x64
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.ReleaseBundle|x86.ActiveCfg = ReleaseBundle|x86
{96E3B61A-F3CA-4297-97FA-5D45C2DBC2BA}.ReleaseBundle|x86.Build.0 = ReleaseBundle|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Debug|ARM.ActiveCfg = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Debug|x64.ActiveCfg = Debug|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Debug|x64.Build.0 = Debug|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Debug|x86.ActiveCfg = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Debug|x86.Build.0 = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.DebugBundle|ARM.ActiveCfg = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.DebugBundle|x64.ActiveCfg = Debug|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.DebugBundle|x64.Build.0 = Debug|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.DebugBundle|x86.ActiveCfg = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.DebugBundle|x86.Build.0 = Debug|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Release|ARM.ActiveCfg = Release|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Release|x64.ActiveCfg = Release|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Release|x64.Build.0 = Release|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Release|x86.ActiveCfg = Release|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.Release|x86.Build.0 = Release|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.ReleaseBundle|ARM.ActiveCfg = Release|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.ReleaseBundle|x64.ActiveCfg = Release|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.ReleaseBundle|x64.Build.0 = Release|x64
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.ReleaseBundle|x86.ActiveCfg = Release|x86
{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}.ReleaseBundle|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<Application
x:Class="CodePushDemoApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CodePushDemoApp"
RequestedTheme="Light">
</Application>

View File

@@ -0,0 +1,147 @@
using ReactNative;
using ReactNative.Modules.Launch;
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace CodePushDemoApp
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
private readonly ReactPage _reactPage;
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.Resuming += OnResuming;
_reactPage = new MainPage();
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
base.OnLaunched(e);
OnCreate(e.Arguments);
}
/// <summary>
/// Invoked when the application is activated.
/// </summary>
/// <param name="args">The activated event arguments.</param>
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
switch (args.Kind)
{
case ActivationKind.Protocol:
case ActivationKind.ProtocolForResults:
var protocolArgs = (IProtocolActivatedEventArgs)args;
LauncherModule.SetActivatedUrl(protocolArgs.Uri.AbsoluteUri);
break;
}
if (args.PreviousExecutionState != ApplicationExecutionState.Running &&
args.PreviousExecutionState != ApplicationExecutionState.Suspended)
{
OnCreate(null);
}
}
/// <summary>
/// Called whenever the app is opened to initia
/// </summary>
/// <param name="arguments"></param>
private void OnCreate(string arguments)
{
_reactPage.OnResume(Exit);
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
AppViewBackButtonVisibility.Visible;
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
_reactPage.OnCreate(arguments);
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Content = _reactPage;
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
_reactPage.OnSuspend();
}
/// <summary>
/// Invoked when application execution is being resumed.
/// </summary>
/// <param name="sender">The source of the resume request.</param>
/// <param name="e">Details about the resume request.</param>
private void OnResuming(object sender, object e)
{
_reactPage.OnResume(Exit);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{3E8198A5-7E41-43F1-880E-E7E2840E5A59}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodePushDemoApp</RootNamespace>
<AssemblyName>CodePushDemoApp</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>CodePushDemoApp_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugBundle|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\DebugBundle\</OutputPath>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseBundle|x86'">
<OutputPath>bin\x86\ReleaseBundle\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugBundle|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\DebugBundle\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseBundle|ARM'">
<OutputPath>bin\ARM\ReleaseBundle\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugBundle|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\DebugBundle\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseBundle|x64'">
<OutputPath>bin\x64\ReleaseBundle\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;BUNDLE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="CodePushDemoApp_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\windows\CodePush\CodePush.csproj">
<Project>{446a85d9-55eb-4c7d-8b9d-448306c833d6}</Project>
<Name>CodePush</Name>
</ProjectReference>
<ProjectReference Include="..\..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj">
<Project>{c7673ad5-e3aa-468c-a5fd-fa38154e205c}</Project>
<Name>ReactNative</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'ReleaseBundle' or '$(Configuration)' == 'DebugBundle'">
<Content Include="ReactAssets\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
</PropertyGroup>
<ImportGroup>
<Import Project="$(NuGetPackageRoot)\Facebook.Yoga\1.0.1-pre\build\netstandard\Facebook.Yoga.targets" Condition="Exists('$(NuGetPackageRoot)\Facebook.Yoga\1.0.1-pre\build\netstandard\Facebook.Yoga.targets')" />
</ImportGroup>
</Project>

View File

@@ -0,0 +1,62 @@
using CodePush.ReactNative;
using ReactNative;
using ReactNative.Modules.Core;
using ReactNative.Shell;
using System.Collections.Generic;
namespace CodePushDemoApp
{
class MainPage : ReactPage
{
public override string MainComponentName
{
get
{
return "CodePushDemoApp";
}
}
private CodePushReactPackage codePushReactPackage = null;
public override string JavaScriptBundleFile
{
get
{
codePushReactPackage = new CodePushReactPackage("deployment-key-here", this);
#if BUNDLE
return codePushReactPackage.GetJavaScriptBundleFile();
#else
return null;
#endif
}
}
public override List<IReactPackage> Packages
{
get
{
return new List<IReactPackage>
{
new MainReactPackage(),
codePushReactPackage
};
}
}
public override bool UseDeveloperSupport
{
get
{
#if !BUNDLE || DEBUG
return true;
#else
return false;
#endif
}
}
}
}

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="4118c826-4d18-4e1d-84a5-5df16ea27dee"
Publisher="CN=publisher"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="4118c826-4d18-4e1d-84a5-5df16ea27dee" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>CodePushDemoApp</DisplayName>
<PublisherDisplayName>React Native for UWP</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="CodePushDemoApp.App">
<uap:VisualElements
DisplayName="CodePushDemoApp"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="CodePushDemoApp"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

View File

@@ -0,0 +1,29 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodePushDemoApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodePushDemoApp")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

View File

@@ -0,0 +1,31 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for CodePushDemoApp.MyClass and all of its public/private members
<Type Name="CodePushDemoApp.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="CodePushDemoApp.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

View File

@@ -0,0 +1,17 @@
{
"dependencies": {
"Facebook.Yoga": "1.0.1-pre",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value=".\packages" />
</config>
</configuration>

View File

@@ -28,12 +28,14 @@
"code-push-plugin-testing-framework": "file:./code-push-plugin-testing-framework",
"del": "latest",
"express": "latest",
"gulp-typescript": "2.12.2",
"gulp-insert": "latest",
"gulp-tslint": "latest",
"gulp-typescript": "2.12.2",
"mkdirp": "latest",
"q": "^1.4.1",
"run-sequence": "latest"
"run-sequence": "latest",
"tslint": "^4.3.1",
"typescript": "^2.1.5"
},
"rnpm": {
"android": {

View File

@@ -0,0 +1,105 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CodePush.Net46.Adapters.Storage;
using System.Threading.Tasks;
namespace CodePush.Net46.Test
{
[TestClass]
public class ApplicationDataContainerTest
{
readonly static string key1 = "key1";
readonly static string key2 = "key2";
readonly static string key3 = "key3";
readonly static string val1 = "string data1";
readonly static string val2 = "string data2";
readonly static string val3 = "string data1";
[TestMethod]
public void TestInMemmorySet()
{
var settings = new ApplicationDataContainer();
settings.Values[key1] = val1;
settings.Values[key2] = val2;
settings.Values[key3] = val3;
Assert.AreEqual(settings.Values[key1], val1);
Assert.AreEqual(settings.Values[key2], val2);
Assert.AreEqual(settings.Values[key3], val3);
settings.DeleteAsync().Wait();
}
[TestMethod]
public void TestInMemmoryReset()
{
var settings = new ApplicationDataContainer();
settings.Values[key1] = val1;
settings.Values[key1] = val2;
settings.Values[key1] = val3;
Assert.AreEqual(settings.Values[key1], val3);
settings.DeleteAsync().Wait();
}
[TestMethod]
public void TestInMemmoryRemove()
{
var settings = new ApplicationDataContainer();
settings.Values[key1] = val1;
settings.Values[key2] = val2;
settings.Values[key3] = val3;
settings.Values.Remove(key2);
Assert.AreEqual(settings.Values[key1], val1);
Assert.IsNull(settings.Values[key2]);
Assert.AreEqual(settings.Values[key3], val3);
settings.DeleteAsync().Wait();
}
[TestMethod]
public void TestPersistentSet()
{
var settings = new ApplicationDataContainer();
settings.Values[key1] = val1;
settings.Values[key2] = val2;
settings.Values[key3] = val3;
settings = new ApplicationDataContainer();
Assert.AreEqual(settings.Values[key1], val1);
Assert.AreEqual(settings.Values[key2], val2);
Assert.AreEqual(settings.Values[key3], val3);
settings.DeleteAsync().Wait();
}
[TestMethod]
public void TestPersistentRemove()
{
var settings = new ApplicationDataContainer();
settings.Values[key1] = val1;
settings.Values[key2] = val2;
settings.Values[key3] = val3;
settings.Values.Remove(key2);
settings = new ApplicationDataContainer();
Assert.AreEqual(settings.Values[key1], val1);
Assert.IsNull(settings.Values[key2]);
Assert.AreEqual(settings.Values[key3], val3);
settings.DeleteAsync().Wait();
}
}
}

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BBB48F0B-AF6F-4A14-AFA4-306D3FB0B7CF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodePush.Net46.Test</RootNamespace>
<AssemblyName>CodePush.Net46.Test</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="ApplicationDataContainerTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodePush.Net46\CodePush.Net46.csproj">
<Project>{4dfe3f9f-5e15-4f17-8fd4-33ff0519348e}</Project>
<Name>CodePush.Net46</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodePush.Net46.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodePush.Net46.Test")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bbb48f0b-af6f-4a14-afa4-306d3fb0b7cf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,28 @@
using System;
namespace CodePush.Net46.Adapters.Http
{
public enum HttpProgressStage
{
None = 0,
DetectingProxy = 10,
ResolvingName = 20,
ConnectingToServer = 30,
NegotiatingSsl = 40,
SendingHeaders = 50,
SendingContent = 60,
WaitingForResponse = 70,
ReceivingHeaders = 80,
ReceivingContent = 90
}
public struct HttpProgress
{
public UInt64 BytesReceived;
public UInt64 BytesSent;
public UInt32 Retries;
public HttpProgressStage Stage;
public UInt64? TotalBytesToReceive;
public UInt64? TotalBytesToSend;
}
}

View File

@@ -0,0 +1,103 @@
using CodePush.ReactNative;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PCLStorage;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace CodePush.Net46.Adapters.Storage
{
public enum ApplicationDataCreateDisposition
{
Always = 0,
Existing = 1
}
public class DictionaryWithDefault<TKey, TValue> : Dictionary<TKey, TValue>
{
TValue _default;
public TValue DefaultValue
{
get { return _default; }
set { _default = value; }
}
public DictionaryWithDefault() : base() { }
public DictionaryWithDefault(TValue defaultValue) : base()
{
_default = defaultValue;
}
public new TValue this[TKey key]
{
get
{
TValue t;
return base.TryGetValue(key, out t) ? t : _default;
}
set
{
base[key] = value;
DataChanged(this, null);
}
}
public bool Remove(TKey key)
{
var found = base.Remove(key);
if (found)
DataChanged(this, null);
return found;
}
public event EventHandler DataChanged;
}
// A naive implementation of Windows.Storage.ApplicationDataContainer
public class ApplicationDataContainer
{
public DictionaryWithDefault<string, string> Values;
private readonly SemaphoreSlim mutex = new SemaphoreSlim(1, 1);
const string STORAGE_NAME = "AppStorage.data";
IFile storageFile = null;
public ApplicationDataContainer(string name = STORAGE_NAME)
{
storageFile = FileSystem.Current.LocalStorage.CreateFileAsync(name, CreationCollisionOption.OpenIfExists).Result;
var data = CodePushUtils.GetJObjectFromFileAsync(storageFile).Result;
if (data != null)
{
Values = data.ToObject<DictionaryWithDefault<string, string>>();
}
else
{
Values = new DictionaryWithDefault<string, string>();
}
Values.DataChanged += async (s, e) => await SaveAsync();
}
~ApplicationDataContainer()
{
mutex.Dispose();
}
async Task SaveAsync()
{
await mutex.WaitAsync().ConfigureAwait(false);
var jobject = JObject.FromObject(Values);
await storageFile.WriteAllTextAsync(JsonConvert.SerializeObject(jobject)).ConfigureAwait(false);
mutex.Release();
}
public async Task DeleteAsync()
{
Values.Clear();
await storageFile.DeleteAsync();
}
}
}

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4DFE3F9F-5E15-4F17-8FD4-33FF0519348E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodePush.Net46</RootNamespace>
<AssemblyName>CodePush.Net46</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SolutionDir)\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SolutionDir)\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="Adapters\Http\HttpProgress.cs" />
<Compile Include="Adapters\Storage\ApplicationDataContainer.cs" />
<Compile Include="CodePushUtils.cs" />
<Compile Include="FileUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UpdateManager.cs" />
<Compile Include="UpdateUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\react-native-windows\ReactWindows\ReactNative.Net46\ReactNative.Net46.csproj">
<Project>{22cbff9c-fe36-43e8-a246-266c7635e662}</Project>
<Name>ReactNative.Net46</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="..\CodePush.Shared\CodePush.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,53 @@
using Newtonsoft.Json.Linq;
using PCLStorage;
using System;
using System.Management;
using System.Threading.Tasks;
namespace CodePush.ReactNative
{
internal partial class CodePushUtils
{
internal async static Task<JObject> GetJObjectFromFileAsync(IFile file)
{
string jsonString = await file.ReadAllTextAsync().ConfigureAwait(false);
if (jsonString.Length == 0)
{
return new JObject();
}
try
{
return JObject.Parse(jsonString);
}
catch (Exception)
{
return null;
}
}
static string GetDeviceIdImpl()
{
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
ManagementObjectCollection moc = mos.Get();
string mbId = String.Empty;
foreach (ManagementObject mo in moc)
{
mbId = (string)mo["SerialNumber"];
break;
}
ManagementObjectCollection mbsList = null;
ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * From Win32_processor");
mbsList = mbs.Get();
string procId = string.Empty;
foreach (ManagementObject mo in mbsList)
{
procId = mo["ProcessorID"].ToString();
break;
}
return procId + "-" + mbId;
}
}
}

View File

@@ -0,0 +1,55 @@
using PCLStorage;
using System;
using System.IO;
using System.Threading.Tasks;
namespace CodePush.ReactNative
{
internal class FileUtils
{
internal async static Task MergeFoldersAsync(IFolder source, IFolder target)
{
foreach (IFile sourceFile in await source.GetFilesAsync().ConfigureAwait(false))
{
await CopyFileAsync(sourceFile.Path, Path.Combine(target.Path, sourceFile.Name)).ConfigureAwait(false);
}
foreach (IFolder sourceDirectory in await source.GetFoldersAsync().ConfigureAwait(false))
{
var nextTargetSubDir = await target.CreateFolderAsync(sourceDirectory.Name, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
await MergeFoldersAsync(sourceDirectory, nextTargetSubDir).ConfigureAwait(false);
}
}
internal async static Task ClearReactDevBundleCacheAsync()
{
if (await FileSystem.Current.LocalStorage.CheckExistsAsync(CodePushConstants.ReactDevBundleCacheFileName).ConfigureAwait(false) != ExistenceCheckResult.FileExists)
return;
var devBundleCacheFile = await FileSystem.Current.LocalStorage.GetFileAsync(CodePushConstants.ReactDevBundleCacheFileName).ConfigureAwait(false);
await devBundleCacheFile.DeleteAsync().ConfigureAwait(false);
}
internal static Task<long> GetBinaryResourcesModifiedTimeAsync(string fileName)
{
var pathToAssembly = CodePushUtils.GetAppFolder();
var pathToAssemblyResource = Path.Combine(pathToAssembly, CodePushConstants.AssetsBundlePrefix, fileName);
var lastUpdateTime = File.GetCreationTime(pathToAssemblyResource);
return Task.FromResult(new DateTimeOffset(lastUpdateTime).ToUnixTimeMilliseconds());
}
internal async static Task CopyFileAsync(string sourcePath, string destinationPath)
{
using (var source = File.Open(sourcePath, FileMode.Open, System.IO.FileAccess.Read))
{
using (var destination = File.Create(destinationPath)) // Replace if exists
{
await source.CopyToAsync(destination);
}
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodePush.Net46")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodePush.Net46")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4dfe3f9f-5e15-4f17-8fd4-33ff0519348e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,313 @@
using CodePush.Net46.Adapters.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PCLStorage;
using System;
using System.IO;
using System.IO.Compression;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
[assembly: InternalsVisibleTo("CodePush.Net46.UnitTest")]
namespace CodePush.ReactNative
{
internal class UpdateManager
{
#region Internal methods
internal async Task ClearUpdatesAsync()
{
await (await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false)).DeleteAsync().ConfigureAwait(false);
}
internal async Task DownloadPackageAsync(JObject updatePackage, string expectedBundleFileName, Progress<HttpProgress> downloadProgress)
{
// Using its hash, get the folder where the new update will be saved
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
var newUpdateHash = (string)updatePackage[CodePushConstants.PackageHashKey];
var newUpdateFolder = await GetPackageFolderAsync(newUpdateHash, false).ConfigureAwait(false);
if (newUpdateFolder != null)
{
// This removes any stale data in newUpdateFolder that could have been left
// uncleared due to a crash or error during the download or install process.
await newUpdateFolder.DeleteAsync().ConfigureAwait(false);
}
newUpdateFolder = await GetPackageFolderAsync(newUpdateHash, true).ConfigureAwait(false);
var newUpdateMetadataFile = await newUpdateFolder.CreateFileAsync(CodePushConstants.PackageFileName, CreationCollisionOption.ReplaceExisting).ConfigureAwait(false);
var downloadUrlString = (string)updatePackage[CodePushConstants.DownloadUrlKey];
var downloadFile = await GetDownloadFileAsync().ConfigureAwait(false);
await UpdateUtils.DownloadBundleAsync(downloadUrlString, downloadFile.Path, downloadProgress);
try
{
// Unzip the downloaded file and then delete the zip
var unzippedFolder = await GetUnzippedFolderAsync().ConfigureAwait(false);
/**
* TODO:
* 1) ZipFile.ExtractToDirectory is not reliable and throws exception if:
* - folder exists already
* - path is too long (> 250 chars)
*
* 2) Un-zipping is quite long operation. Does it make sense for async?
* await UpdateUtils.UnzipBundleAsync(downloadFile.Path, unzippedFolder.Path);
*
* Possible implementation
*
* internal async static Task UnzipBundleAsync(string zipFileName, string targetDir)
* {
* await Task.Run(() =>
* {
* ZipFile.ExtractToDirectory(zipFileName, targetDir)
* return Task.CompletedTask;
* });
* }
*/
ZipFile.ExtractToDirectory(downloadFile.Path, unzippedFolder.Path);
await downloadFile.DeleteAsync().ConfigureAwait(false);
// Merge contents with current update based on the manifest
IFile diffManifestFile = null;
try
{
diffManifestFile = await unzippedFolder.GetFileAsync(CodePushConstants.DiffManifestFileName).ConfigureAwait(false);
}
catch (FileNotFoundException)
{
//file may not be present in folder just skip it
}
if (diffManifestFile != null)
{
var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
if (currentPackageFolder == null)
{
throw new InvalidDataException("Received a diff update, but there is no current version to diff against.");
}
await UpdateUtils.CopyNecessaryFilesFromCurrentPackageAsync(diffManifestFile, currentPackageFolder, newUpdateFolder).ConfigureAwait(false);
await diffManifestFile.DeleteAsync().ConfigureAwait(false);
}
await FileUtils.MergeFoldersAsync(unzippedFolder, newUpdateFolder).ConfigureAwait(false);
await unzippedFolder.DeleteAsync().ConfigureAwait(false);
// For zip updates, we need to find the relative path to the jsBundle and save it in the
// metadata so that we can find and run it easily the next time.
var relativeBundlePath = await UpdateUtils.FindJSBundleInUpdateContentsAsync(newUpdateFolder, expectedBundleFileName).ConfigureAwait(false);
if (relativeBundlePath == null)
{
throw new InvalidDataException("Update is invalid - A JS bundle file named \"" + expectedBundleFileName + "\" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.");
}
else
{
if (diffManifestFile != null)
{
// TODO verify hash for diff update
// CodePushUpdateUtils.verifyHashForDiffUpdate(newUpdateFolderPath, newUpdateHash);
}
updatePackage[CodePushConstants.RelativeBundlePathKey] = relativeBundlePath;
}
}
catch (InvalidDataException)
{
// Downloaded file is not a zip, assume it is a jsbundle
await downloadFile.RenameAsync(expectedBundleFileName).ConfigureAwait(false);
await downloadFile.MoveAsync(newUpdateFolder.Path, NameCollisionOption.ReplaceExisting).ConfigureAwait(false);
}
// Save metadata to the folder
await newUpdateMetadataFile.WriteAllTextAsync(JsonConvert.SerializeObject(updatePackage)).ConfigureAwait(false);
}
internal async Task<JObject> GetCurrentPackageAsync()
{
var packageHash = await GetCurrentPackageHashAsync().ConfigureAwait(false);
return packageHash == null ? null : await GetPackageAsync(packageHash).ConfigureAwait(false);
}
internal async Task<IFile> GetCurrentPackageBundleAsync(string bundleFileName)
{
var packageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
if (packageFolder == null)
{
return null;
}
var currentPackage = await GetCurrentPackageAsync().ConfigureAwait(false);
var relativeBundlePath = (string)currentPackage[CodePushConstants.RelativeBundlePathKey];
return relativeBundlePath == null
? await packageFolder.GetFileAsync(bundleFileName).ConfigureAwait(false)
: await packageFolder.GetFileAsync(relativeBundlePath).ConfigureAwait(false);
}
internal async Task<string> GetCurrentPackageHashAsync()
{
var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
var currentPackageShortHash = (string)info[CodePushConstants.CurrentPackageKey];
if (currentPackageShortHash == null)
{
return null;
}
var currentPackageMetadata = await GetPackageAsync(currentPackageShortHash).ConfigureAwait(false);
return currentPackageMetadata == null ? null : (string)currentPackageMetadata[CodePushConstants.PackageHashKey];
}
internal async Task<JObject> GetPackageAsync(string packageHash)
{
var packageFolder = await GetPackageFolderAsync(packageHash, false).ConfigureAwait(false);
if (packageFolder == null)
{
return null;
}
try
{
var packageFile = await packageFolder.GetFileAsync(CodePushConstants.PackageFileName).ConfigureAwait(false);
return await CodePushUtils.GetJObjectFromFileAsync(packageFile).ConfigureAwait(false);
}
catch (IOException)
{
return null;
}
}
internal async Task<IFolder> GetPackageFolderAsync(string packageHash, bool createIfNotExists)
{
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
try
{
packageHash = ShortenPackageHash(packageHash);
return createIfNotExists
? await codePushFolder.CreateFolderAsync(packageHash, CreationCollisionOption.OpenIfExists).ConfigureAwait(false)
: await codePushFolder.GetFolderAsync(packageHash).ConfigureAwait(false);
}
catch (FileNotFoundException)
{
return null;
}
catch (DirectoryNotFoundException)
{
return null;
}
}
internal async Task<JObject> GetPreviousPackageAsync()
{
var packageHash = await GetPreviousPackageHashAsync().ConfigureAwait(false);
return packageHash == null ? null : await GetPackageAsync(packageHash).ConfigureAwait(false);
}
internal async Task<string> GetPreviousPackageHashAsync()
{
var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
var previousPackageShortHash = (string)info[CodePushConstants.PreviousPackageKey];
if (previousPackageShortHash == null)
{
return null;
}
var previousPackageMetadata = await GetPackageAsync(previousPackageShortHash).ConfigureAwait(false);
return previousPackageMetadata == null ? null : (string)previousPackageMetadata[CodePushConstants.PackageHashKey];
}
internal async Task InstallPackageAsync(JObject updatePackage, bool currentUpdateIsPending)
{
var packageHash = (string)updatePackage[CodePushConstants.PackageHashKey];
var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
if (currentUpdateIsPending)
{
// Don't back up current update to the "previous" position because
// it is an unverified update which should not be rolled back to.
var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
if (currentPackageFolder != null)
{
await currentPackageFolder.DeleteAsync().ConfigureAwait(false);
}
}
else
{
var previousPackageHash = await GetPreviousPackageHashAsync().ConfigureAwait(false);
if (previousPackageHash != null && !previousPackageHash.Equals(packageHash))
{
var previousPackageFolder = await GetPackageFolderAsync(previousPackageHash, false).ConfigureAwait(false);
if (previousPackageFolder != null)
{
await previousPackageFolder.DeleteAsync().ConfigureAwait(false);
}
}
info[CodePushConstants.PreviousPackageKey] = info[CodePushConstants.CurrentPackageKey];
}
info[CodePushConstants.CurrentPackageKey] = packageHash;
await UpdateCurrentPackageInfoAsync(info).ConfigureAwait(false);
}
internal async Task RollbackPackageAsync()
{
var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
var currentPackageFolder = await GetCurrentPackageFolderAsync().ConfigureAwait(false);
if (currentPackageFolder != null)
{
await currentPackageFolder.DeleteAsync().ConfigureAwait(false);
}
info[CodePushConstants.CurrentPackageKey] = info[CodePushConstants.PreviousPackageKey];
info[CodePushConstants.PreviousPackageKey] = null;
await UpdateCurrentPackageInfoAsync(info).ConfigureAwait(false);
}
#endregion
#region Private methods
private async Task<IFolder> GetCurrentPackageFolderAsync()
{
var info = await GetCurrentPackageInfoAsync().ConfigureAwait(false);
var packageHash = (string)info[CodePushConstants.CurrentPackageKey];
return packageHash == null ? null : await GetPackageFolderAsync(packageHash, false).ConfigureAwait(false);
}
private async Task<JObject> GetCurrentPackageInfoAsync()
{
var statusFile = await GetStatusFileAsync().ConfigureAwait(false);
return await CodePushUtils.GetJObjectFromFileAsync(statusFile).ConfigureAwait(false);
}
private async Task<IFile> GetDownloadFileAsync()
{
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
return await codePushFolder.CreateFileAsync(CodePushConstants.DownloadFileName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
}
private async Task<IFile> GetStatusFileAsync()
{
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
return await codePushFolder.CreateFileAsync(CodePushConstants.StatusFileName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
}
private async Task<IFolder> GetUnzippedFolderAsync()
{
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
return await codePushFolder.CreateFolderAsync(CodePushConstants.UnzippedFolderName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
}
private string ShortenPackageHash(string longPackageHash)
{
return longPackageHash.Substring(0, 8);
}
private async Task UpdateCurrentPackageInfoAsync(JObject packageInfo)
{
var file = await GetStatusFileAsync().ConfigureAwait(false);
await file.WriteAllTextAsync(JsonConvert.SerializeObject(packageInfo)).ConfigureAwait(false);
}
#endregion
}
}

View File

@@ -0,0 +1,70 @@
using CodePush.Net46.Adapters.Http;
using Newtonsoft.Json.Linq;
using PCLStorage;
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
namespace CodePush.ReactNative
{
internal class UpdateUtils
{
internal async static Task CopyNecessaryFilesFromCurrentPackageAsync(IFile diffManifestFile, IFolder currentPackageFolder, IFolder newPackageFolder)
{
await FileUtils.MergeFoldersAsync(currentPackageFolder, newPackageFolder).ConfigureAwait(false);
JObject diffManifest = await CodePushUtils.GetJObjectFromFileAsync(diffManifestFile).ConfigureAwait(false);
var deletedFiles = (JArray)diffManifest["deletedFiles"];
foreach (string fileNameToDelete in deletedFiles)
{
var fileToDelete = await newPackageFolder.GetFileAsync(fileNameToDelete).ConfigureAwait(false);
await fileToDelete.DeleteAsync().ConfigureAwait(false);
}
}
internal async static Task<string> FindJSBundleInUpdateContentsAsync(IFolder updateFolder, string expectedFileName)
{
foreach (IFile file in await updateFolder.GetFilesAsync().ConfigureAwait(false))
{
string fileName = file.Name;
if (fileName.Equals(expectedFileName))
{
return fileName;
}
}
foreach (IFolder folder in await updateFolder.GetFoldersAsync().ConfigureAwait(false))
{
string mainBundlePathInSubFolder = await FindJSBundleInUpdateContentsAsync(folder, expectedFileName).ConfigureAwait(false);
if (mainBundlePathInSubFolder != null)
{
return Path.Combine(folder.Name, mainBundlePathInSubFolder);
}
}
return null;
}
internal async static Task DownloadBundleAsync(string url, string fileName, IProgress<HttpProgress> downloadProgress)
{
var uri = new Uri(url);
var client = new WebClient();
client.DownloadProgressChanged += (s, e) =>
{
downloadProgress.Report(new HttpProgress
{
BytesReceived = (ulong)e.BytesReceived, //conversion long to ulong is safe
TotalBytesToReceive = (ulong)e.TotalBytesToReceive //because size can't be negative
});
};
await client.DownloadFileTaskAsync(uri, fileName);
}
internal static async Task<IFolder> GetCodePushFolderAsync()
{
var pathToCodePush = Path.Combine(CodePushUtils.GetAppFolder(), CodePushConstants.CodePushFolderPrefix);
return await FileSystem.Current.LocalStorage.CreateFolderAsync(pathToCodePush, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="PCLStorage" version="1.0.2" targetFramework="net46" />
</packages>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>4ad4c826-cc26-4f1d-b60d-b97b22f52e90</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>CodePush.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)CodePushConstants.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CodePushNativeModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CodePushReactPackage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CodePushUtils.cs" />
<Compile Include="$(MSBuildThisFileDirectory)InstallMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MinimumBackgroundListener.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SettingsManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UpdateState.cs" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>4ad4c826-cc26-4f1d-b60d-b97b22f52e90</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="CodePush.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

View File

@@ -2,7 +2,6 @@
{
internal class CodePushConstants
{
internal const string AssetsBundlePrefix = "ms-appx:///ReactAssets/";
internal const string BinaryModifiedTimeKey = "binaryModifiedTime";
internal const string CodePushServerUrl = "https://codepush.azurewebsites.net/";
internal const string CodePushFolderPrefix = "CodePush";
@@ -14,7 +13,6 @@
internal const string DownloadProgressEventName = "CodePushDownloadProgress";
internal const string DownloadUrlKey = "downloadUrl";
internal const string FailedUpdatesKey = "CODE_PUSH_FAILED_UPDATES";
internal const string FileBundlePrefix = "ms-appdata:///local";
internal const string PackageFileName = "app.json";
internal const string PackageHashKey = "packageHash";
internal const string PendingUpdateHashKey = "hash";
@@ -27,5 +25,11 @@
internal const string RelativeBundlePathKey = "bundlePath";
internal const string StatusFileName = "codepush.json";
internal const string UnzippedFolderName = "unzipped";
#if WINDOWS_UWP
internal const string AssetsBundlePrefix = "ms-appx:///ReactAssets/";
internal const string FileBundlePrefix = "ms-appdata:///local";
#else
internal const string AssetsBundlePrefix = "ReactAssets/";
#endif
}
}

View File

@@ -7,7 +7,11 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
#if WINDOWS_UWP
using Windows.Web.Http;
#else
using CodePush.Net46.Adapters.Http;
#endif
namespace CodePush.ReactNative
{
@@ -57,7 +61,7 @@ namespace CodePush.ReactNative
{
try
{
updatePackage[CodePushConstants.BinaryModifiedTimeKey] = "" + await _codePush.GetBinaryResourcesModifiedTimeAsync().ConfigureAwait(false);
updatePackage[CodePushConstants.BinaryModifiedTimeKey] = "" + await FileUtils.GetBinaryResourcesModifiedTimeAsync(_codePush.AssetsBundleFileName).ConfigureAwait(false);
await _codePush.UpdateManager.DownloadPackageAsync(
updatePackage,
_codePush.AssetsBundleFileName,
@@ -194,7 +198,7 @@ namespace CodePush.ReactNative
await LoadBundleAsync().ConfigureAwait(false);
});
};
_minimumBackgroundListener = new MinimumBackgroundListener(loadBundleAction, minimumBackgroundDuration);
_reactContext.AddLifecycleEventListener(_minimumBackgroundListener);
}
@@ -240,17 +244,22 @@ namespace CodePush.ReactNative
await LoadBundleAsync().ConfigureAwait(false);
}
}
internal async Task LoadBundleAsync()
{
// #1) Get the private ReactInstanceManager, which is what includes
// the logic to reload the current React context.
FieldInfo info = typeof(ReactPage)
.GetField("_reactInstanceManager", BindingFlags.NonPublic | BindingFlags.Instance);
#if WINDOWS_UWP
var reactInstanceManager = (ReactInstanceManager)typeof(ReactPage)
.GetField("_reactInstanceManager", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(_codePush.MainPage);
#else
var reactInstanceManager = ((Lazy<IReactInstanceManager>)typeof(ReactPage)
.GetField("_reactInstanceManager", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(_codePush.MainPage)).Value as ReactInstanceManager;
#endif
// #2) Update the locally stored JS bundle file path
Type reactInstanceManagerType = typeof(ReactInstanceManager);

View File

@@ -1,25 +1,18 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using ReactNative;
using ReactNative.Bridge;
using ReactNative.Modules.Core;
using ReactNative.UIManager;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Storage;
using Windows.Web.Http;
namespace CodePush.ReactNative
{
public sealed class CodePushReactPackage : IReactPackage
{
private static CodePushReactPackage CurrentInstance;
private static bool NeedToReportRollback = false;
private CodePushNativeModule _codePushNativeModule;
internal string AppVersion { get; private set; }
internal string DeploymentKey { get; private set; }
@@ -31,7 +24,7 @@ namespace CodePush.ReactNative
public CodePushReactPackage(string deploymentKey, ReactPage mainPage)
{
AppVersion = Package.Current.Id.Version.Major + "." + Package.Current.Id.Version.Minor + "." + Package.Current.Id.Version.Build;
AppVersion = CodePushUtils.GetAppVersion();
DeploymentKey = deploymentKey;
MainPage = mainPage;
UpdateManager = new UpdateManager();
@@ -84,8 +77,9 @@ namespace CodePush.ReactNative
public async Task<string> GetJavaScriptBundleFileAsync(string assetsBundleFileName)
{
AssetsBundleFileName = assetsBundleFileName;
string binaryJsBundleUrl = CodePushConstants.AssetsBundlePrefix + assetsBundleFileName;
var binaryResourcesModifiedTime = await GetBinaryResourcesModifiedTimeAsync().ConfigureAwait(false);
string binaryJsBundleUrl = CodePushUtils.GetAssetsBundlePrefix() + assetsBundleFileName;
var binaryResourcesModifiedTime = await FileUtils.GetBinaryResourcesModifiedTimeAsync(AssetsBundleFileName).ConfigureAwait(false);
var packageFile = await UpdateManager.GetCurrentPackageBundleAsync(AssetsBundleFileName).ConfigureAwait(false);
if (packageFile == null)
{
@@ -111,7 +105,7 @@ namespace CodePush.ReactNative
{
CodePushUtils.LogBundleUrl(packageFile.Path);
IsRunningBinaryVersion = false;
return CodePushConstants.FileBundlePrefix + packageFile.Path.Replace(ApplicationData.Current.LocalFolder.Path, "").Replace("\\", "/");
return CodePushUtils.GetFileBundlePrefix() + packageFile.Path.Replace(CodePushUtils.GetAppFolder(), "").Replace("\\", "/");
}
else
{
@@ -128,17 +122,10 @@ namespace CodePush.ReactNative
}
}
#endregion
#endregion
#region Internal methods
#region Internal methods
internal async Task<long> GetBinaryResourcesModifiedTimeAsync()
{
var assetJSBundleFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(CodePushConstants.AssetsBundlePrefix + AssetsBundleFileName)).AsTask().ConfigureAwait(false);
var fileProperties = await assetJSBundleFile.GetBasicPropertiesAsync().AsTask().ConfigureAwait(false);
return fileProperties.DateModified.ToUnixTimeMilliseconds();
}
internal void InitializeUpdateAfterRestart()
{
JObject pendingUpdate = SettingsManager.GetPendingUpdate();
@@ -150,7 +137,6 @@ namespace CodePush.ReactNative
// Pending update was initialized, but notifyApplicationReady was not called.
// Therefore, deduce that it is a broken update and rollback.
CodePushUtils.Log("Update did not finish loading the last time, rolling back to a previous version.");
NeedToReportRollback = true;
RollbackPackageAsync().Wait();
}
else
@@ -159,7 +145,7 @@ namespace CodePush.ReactNative
// Clear the React dev bundle cache so that new updates can be loaded.
if (MainPage.UseDeveloperSupport)
{
ClearReactDevBundleCacheAsync().Wait();
FileUtils.ClearReactDevBundleCacheAsync().Wait();
}
// Mark that we tried to initialize the new update, so that if it crashes,
// we will know that we need to rollback when the app next starts.
@@ -175,18 +161,9 @@ namespace CodePush.ReactNative
SettingsManager.RemoveFailedUpdates();
}
#endregion
#endregion
#region Private methods
private async Task ClearReactDevBundleCacheAsync()
{
var devBundleCacheFile = (StorageFile)await ApplicationData.Current.LocalFolder.TryGetItemAsync(CodePushConstants.ReactDevBundleCacheFileName).AsTask().ConfigureAwait(false);
if (devBundleCacheFile != null)
{
await devBundleCacheFile.DeleteAsync().AsTask().ConfigureAwait(false);
}
}
#region Private methods
private async Task RollbackPackageAsync()
{
@@ -196,6 +173,6 @@ namespace CodePush.ReactNative
SettingsManager.RemovePendingUpdate();
}
#endregion
#endregion
}
}

View File

@@ -0,0 +1,74 @@
using System;
using System.Diagnostics;
#if WINDOWS_UWP
using Windows.ApplicationModel;
using Windows.Storage;
#else
using System.IO;
#endif
namespace CodePush.ReactNative
{
internal partial class CodePushUtils
{
internal static void Log(string message)
{
Debug.WriteLine("[CodePush] " + message, CodePushConstants.ReactNativeLogCategory);
}
internal static void LogBundleUrl(string path)
{
Log("Loading JS bundle from \"" + path + "\"");
}
static string _deviceId = String.Empty;
internal static string GetDeviceId()
{
//It's quite long operation, cache it
if (!String.IsNullOrEmpty(_deviceId))
return _deviceId;
_deviceId = GetDeviceIdImpl();
return _deviceId;
}
internal static string GetAppVersion()
{
#if WINDOWS_UWP
return Package.Current.Id.Version.Major + "." + Package.Current.Id.Version.Minor + "." + Package.Current.Id.Version.Build;
#else
var version = FileVersionInfo.GetVersionInfo(Environment.GetCommandLineArgs()[0]);
return $"{version.FileMajorPart}.{version.FileMinorPart}.{version.FileBuildPart}";
#endif
}
internal static string GetAppFolder()
{
#if WINDOWS_UWP
return ApplicationData.Current.LocalFolder.Path;
#else
return AppDomain.CurrentDomain.BaseDirectory;
#endif
}
internal static string GetAssetsBundlePrefix()
{
#if WINDOWS_UWP
return CodePushConstants.AssetsBundlePrefix;
#else
return Path.Combine(GetAppFolder(), CodePushConstants.AssetsBundlePrefix);
#endif
}
internal static string GetFileBundlePrefix()
{
#if WINDOWS_UWP
return CodePushConstants.FileBundlePrefix;
#else
return GetAppFolder();
#endif
}
}
}

View File

@@ -1,13 +1,29 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
#if WINDOWS_UWP
using Windows.Storage;
#else
using CodePush.Net46.Adapters.Storage;
using System.IO;
#endif
namespace CodePush.ReactNative
{
internal class SettingsManager
{
private static ApplicationDataContainer Settings = ApplicationData.Current.LocalSettings.CreateContainer(CodePushConstants.CodePushPreferences, ApplicationDataCreateDisposition.Always);
private static ApplicationDataContainer Settings = null;
static SettingsManager ()
{
#if WINDOWS_UWP
Settings = ApplicationData.Current.LocalSettings.CreateContainer(CodePushConstants.CodePushPreferences, ApplicationDataCreateDisposition.Always);
#else
var folder = UpdateUtils.GetCodePushFolderAsync().Result;
Settings = new ApplicationDataContainer(Path.Combine(folder.Path, CodePushConstants.CodePushPreferences));
#endif
}
public static JArray GetFailedUpdates()
{

View File

@@ -17,25 +17,6 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
@@ -107,18 +88,11 @@
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="CodePushReactPackage.cs" />
<Compile Include="CodePushConstants.cs" />
<Compile Include="MinimumBackgroundListener.cs" />
<Compile Include="InstallMode.cs" />
<Compile Include="CodePushNativeModule.cs" />
<Compile Include="UpdateManager.cs" />
<Compile Include="UpdateState.cs" />
<Compile Include="UpdateUtils.cs" />
<Compile Include="CodePushUtils.cs" />
<Compile Include="FileUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingsManager.cs" />
<EmbeddedResource Include="Properties\CodePush.rd.xml" />
</ItemGroup>
<ItemGroup>
@@ -132,6 +106,7 @@
<Name>ReactNative</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\CodePush.Shared\CodePush.Shared.projitems" Label="Shared" />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>

View File

@@ -1,6 +1,5 @@
using Newtonsoft.Json.Linq;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Streams;
@@ -8,7 +7,7 @@ using Windows.System.Profile;
namespace CodePush.ReactNative
{
internal class CodePushUtils
internal partial class CodePushUtils
{
internal async static Task<JObject> GetJObjectFromFileAsync(StorageFile file)
{
@@ -28,17 +27,7 @@ namespace CodePush.ReactNative
}
}
internal static void Log(string message)
{
Debug.WriteLine("[CodePush] " + message, CodePushConstants.ReactNativeLogCategory);
}
internal static void LogBundleUrl(string path)
{
Log("Loading JS bundle from \"" + path + "\"");
}
internal static string GetDeviceId()
static string GetDeviceIdImpl()
{
HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = token.Id;

View File

@@ -19,5 +19,22 @@ namespace CodePush.ReactNative
await MergeFoldersAsync(sourceDirectory, nextTargetSubDir).ConfigureAwait(false);
}
}
internal async static Task ClearReactDevBundleCacheAsync()
{
var devBundleCacheFile = (StorageFile)await ApplicationData.Current.LocalFolder.TryGetItemAsync(CodePushConstants.ReactDevBundleCacheFileName).AsTask().ConfigureAwait(false);
if (devBundleCacheFile != null)
{
await devBundleCacheFile.DeleteAsync().AsTask().ConfigureAwait(false);
}
}
internal async static Task<long> GetBinaryResourcesModifiedTimeAsync(string fileName)
{
var assetJSBundleFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(CodePushConstants.AssetsBundlePrefix + fileName)).AsTask().ConfigureAwait(false);
var fileProperties = await assetJSBundleFile.GetBasicPropertiesAsync().AsTask().ConfigureAwait(false);
return fileProperties.DateModified.ToUnixTimeMilliseconds();
}
}
}

View File

@@ -22,13 +22,13 @@ namespace CodePush.ReactNative
internal async Task DownloadPackageAsync(JObject updatePackage, string expectedBundleFileName, Progress<HttpProgress> downloadProgress)
{
// Using its hash, get the folder where the new update will be saved
// Using its hash, get the folder where the new update will be saved
StorageFolder codePushFolder = await GetCodePushFolderAsync().ConfigureAwait(false);
var newUpdateHash = (string)updatePackage[CodePushConstants.PackageHashKey];
StorageFolder newUpdateFolder = await GetPackageFolderAsync(newUpdateHash, false).ConfigureAwait(false);
if (newUpdateFolder != null)
{
// This removes any stale data in newPackageFolderPath that could have been left
// This removes any stale data in newUpdateFolder that could have been left
// uncleared due to a crash or error during the download or install process.
await newUpdateFolder.DeleteAsync().AsTask().ConfigureAwait(false);
}
@@ -98,6 +98,11 @@ namespace CodePush.ReactNative
await downloadFile.RenameAsync(expectedBundleFileName).AsTask().ConfigureAwait(false);
await downloadFile.MoveAsync(newUpdateFolder).AsTask().ConfigureAwait(false);
}
/*TODO: ZipFile.ExtractToDirectory is not reliable and throws exceptions if:
- folder exists already
- path is too long
it needs to be handled
*/
// Save metadata to the folder
await FileIO.WriteTextAsync(newUpdateMetadataFile, JsonConvert.SerializeObject(updatePackage)).AsTask().ConfigureAwait(false);