Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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);
- Loading branch information
1 parent
fc7c109
commit be96f07
Showing
69 changed files
with
2,866 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require("./demo"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
6 changes: 6 additions & 0 deletions
6
Examples/CodePushDemoApp/windows/CodePushDemoApp.Wpf/App.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/> | ||
</startup> | ||
</configuration> |
5 changes: 5 additions & 0 deletions
5
Examples/CodePushDemoApp/windows/CodePushDemoApp.Wpf/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
107 changes: 107 additions & 0 deletions
107
Examples/CodePushDemoApp/windows/CodePushDemoApp.Wpf/App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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..."); | ||
} | ||
} | ||
} | ||
|
60 changes: 60 additions & 0 deletions
60
Examples/CodePushDemoApp/windows/CodePushDemoApp.Wpf/AppReactPage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.