Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #159 from Daddoon/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Daddoon authored Feb 7, 2020
2 parents 7cf0b08 + 4c6a120 commit 637cae9
Show file tree
Hide file tree
Showing 39 changed files with 2,489 additions and 14,728 deletions.
119 changes: 116 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!

## Framework requirement

- **Blazor:** 3.1.0-preview3.19555.2

- **Blazor:** 3.2.0-preview1.20073.1
- **.NET Core 3.0:** For build tools
- **.NET Core 3.1:** ElectronNET

Expand Down Expand Up @@ -71,6 +72,7 @@ Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!
- [BlazorMobile 3.0.11-preview9.19465.2 to 3.0.12-preview9.19465.2](#blazormobile-3011-preview9194652-to-3012-preview9194652)
- [BlazorMobile 3.0.12-preview9.19465.2 to 3.1.0-preview1.19508.20](#blazormobile-3012-preview9194652-to-310-preview11950820)
- [BlazorMobile 3.1.0-preview1.19508.20 to 3.1.0-preview3.19555.2](#blazormobile-310-preview11950820-to-310-preview3195552)
- [BlazorMobile 3.1.0-preview3.19555.2 to 3.2.0-preview1.20073.1](#blazormobile-310-preview3195552-to-320-preview1200731)

## Difference between BlazorMobile & Progressive Web Apps (PWA)

Expand All @@ -93,7 +95,7 @@ The main differences / advantages of BlazorMobile are:
First install the template model with the following command from a command prompt:

```console
dotnet new -i BlazorMobile.Templates::3.1.0-preview3.19555.2
dotnet new -i BlazorMobile.Templates::3.2.0-preview1.20073.1
```

Then go the folder where you want your project to be created, and from a command prompt type the following command, and of course replace **MyProjectName** to your desired project name:
Expand Down Expand Up @@ -843,7 +845,21 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options)

When submiting an iOS app on the AppStore you may have this message: **ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.**

Please follow [this issue](https://github.com/xamarin/Xamarin.Forms/issues/7323) on Xamarin.Forms GitHub page.
Please follow [this issue](https://github.com/xamarin/Xamarin.Forms/issues/7323) on Xamarin.Forms GitHub page, or [this documentation](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#uiwebview-deprecation-and-app-store-rejection-itms-90809)

As stated, at the date of writing:

> UIWebView Deprecation and App Store Rejection (ITMS-90809)
>
>Starting in April 2020, Apple will reject apps that still use the deprecated UIWebView API. While Xamarin.Forms has switched to WKWebView as the default, there is still a reference to the older SDK in the Xamarin.Forms binaries. Current iOS linker behavior does not remove this, and as a result the deprecated UIWebView API will still appear to be referenced from your app when you submit to the App Store.
>
>A preview version of the linker is available to fix this issue. To enable the preview, you will need to supply an additional argument --optimize=experimental-xforms-product-type to the linker.
>
>The prerequisites for this to work are:
>
> Xamarin.Forms 4.5 or higher – Pre-release versions of Xamarin.Forms 4.5 can be used.
> Xamarin.iOS 13.10.0.17 or higher – Check your Xamarin.iOS version in Visual Studio. This version of Xamarin.iOS is included with Visual Studio for Mac 8.4.1 and Visual Studio 16.4.3.
> Remove references to UIWebView – Your code should not have any references to UIWebView or any classes that make use of UIWebView.
### Apple Rejection - Your app uses or references the following non-public APIs: LinkPresentation.framework, QuickLookThumbnailing.framework

Expand Down Expand Up @@ -1724,6 +1740,103 @@ If you need to include it in the future for a pure Blazor web app with support f

- For sanity check, delete all **obj** and **bin** folders of your solution manually, and rebuild your solution then.

### BlazorMobile 3.1.0-preview3.19555.2 to 3.2.0-preview1.20073.1

- Update your installed BlazorMobile.Templates to this version by calling:

```console
dotnet new -i BlazorMobile.Templates::3.2.0-preview1.20073.1
```

- Update your Blazor projects to **3.2.0-preview1.20073.1**. See [this documentation](https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-1-release-now-available/) for upgrading steps.

- Update all your BlazorMobile.* NuGet packages to **3.2.0-preview1.20073.1**.

- Update ElectronNET global tooling by uninstall and reinstalling it.

```console
dotnet tool uninstall ElectronNET.CLI -g
dotnet tool install ElectronNET.CLI -g
```

- If you followed the Blazor project migration for Blazor WebAssembly, this kind of project must not have any **Startup.cs** anymore.
So your code logic should have gone in your **Program.cs** file. The template **Program.cs** file of the Blazor project now look like this,
adapt the code with your custom logic:

```csharp
using BlazorMobile.Common;
using BlazorMobile.Common.Services;
using BlazorMobile.Sample.Blazor.Helpers;
using Microsoft.AspNetCore.Blazor.Hosting;
using System;
using System.Threading.Tasks;

namespace BlazorMobile.Sample.Blazor
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);

#region Services registration

ServicesHelper.ConfigureCommonServices(builder.Services);

#endregion

#region DEBUG

//Only if you want to test WebAssembly with remote debugging from a dev machine
BlazorMobileService.EnableClientToDeviceRemoteDebugging("127.0.0.1", 8888);

#endregion

BlazorMobileService.Init((bool success) =>
{
Console.WriteLine($"Initialization success: {success}");
Console.WriteLine("Device is: " + BlazorDevice.RuntimePlatform);
});

builder.RootComponents.Add<MobileApp>("app");

await builder.Build().RunAsync();
}
}
}
```

- BlazorMobile **Server** (for debugging) and **Desktop** (ElectronNET) projects must have theses additionnal lines in **Startup.cs**...

```csharp
services.AddRazorPages();
```

...in **ConfigureServices** method.

Also this:

```csharp
app.UseClientSideBlazorFiles<BlazorMobile.Sample.Blazor.Program>();
app.UseStaticFiles();
```

...in **Configure** method.

Note that **UseClientSideBlazorFiles** was already present, but now target **Program** instead of **Startup** class.

- Change any references of:

```csharp
services.AddBlazorMobileNativeServices<Startup>();
```

to:

```csharp
services.AddBlazorMobileNativeServices<Program>();
```

## Authors

- **Guillaume ZAHRA** - [Daddoon](https://github.com/Daddoon) - Software Developer - from Joinville-le-Pont, France. Entrepreneur & founder of 2Bee SASU, working since 10 years with .NET and C#.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Build mechanism for BlazorMobile toolset on Android target.</description>
<releaseNotes>See release notes on BlazorMobile project page</releaseNotes>
<copyright>Copyright 2019</copyright>
<copyright>Copyright 2020</copyright>
<tags>Blazor BlazorMobile Xamarin iOS Android Hybrid</tags>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorMobile.Build/BlazorMobile.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.3.1" />
<PackageReference Include="Microsoft.Net.Compilers" Version="3.3.1">
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.4.0" />
<PackageReference Include="Microsoft.Net.Compilers" Version="3.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorMobile.Build/BlazorMobile.Build.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<iconUrl>https://raw.githubusercontent.com/Daddoon/BlazorMobile/master/logo_blazormobile_256x256.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Build mechanism for BlazorMobile applications. This must be referenced in your Blazor web application project</description>
<releaseNotes>First release</releaseNotes>
<copyright>Copyright 2019</copyright>
<releaseNotes>Updated build target to match the expecting Afterbuild event on Blazor 3.2.0-preview1.20073.1</releaseNotes>
<copyright>Copyright 2020</copyright>
<tags>Blazor BlazorMobile Xamarin iOS Android Hybrid</tags>
<dependencies>
<dependency id="Microsoft.AspNetCore.Blazor.Build" version="3.1.0-preview3.19555.2" include="all" />
<dependency id="Microsoft.AspNetCore.Blazor.Build" version="3.2.0-preview1.20073.1" include="all" />
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<BlazorMobileBuildInput>&quot;$([MSBuild]::Escape($(MSBuildProjectFullPath)))&quot;</BlazorMobileBuildInput>
</PropertyGroup>

<Target Name="GenerateBlazorMobileBuild" AfterTargets="_BlazorBuildReport">
<Target Name="GenerateBlazorMobileBuild" AfterTargets="_BlazorCopyFilesToOutputDirectory">
<Exec Command="$(BlazorMobileBuildFileExe) pack-blazor-app --input $(BlazorMobileBuildInput) --distDir $(BlazorMobileBuildDistDir) --outputPath $(BlazorMobileBuildOutput)" />
</Target>

Expand Down
2 changes: 1 addition & 1 deletion src/BlazorMobile.Common/BlazorMobile.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorMobile.ElectronNET/BlazorMobile.ElectronNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ElectronNET.API" Version="5.30.1" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="ElectronNET.API" Version="7.30.2" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Xamarin.Forms" Version="3.5.0.169047" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -55,10 +59,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BlazorMobile.Build.Android">
<Version>3.1.0-preview3.19555.2</Version>
<Version>3.2.0-preview1.20073.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Blazor">
<Version>3.1.0-preview3.19555.2</Version>
<Version>3.2.0-preview1.20073.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.CustomTabs">
<Version>28.0.0.3</Version>
Expand Down Expand Up @@ -124,4 +128,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties XamarinHotReloadXFormsNugetUpgradeInfoBarBlazorMobileInteropAppAndroidHideInfoBar="True" />
</VisualStudio>
</ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<None Remove="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.6.3">
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.2.0-preview1.20073.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.7.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -39,4 +39,5 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties XamarinHotReloadXFormsNugetUpgradeInfoBarBlazorMobileInteropAppDesktopHideInfoBar="True" /></VisualStudio></ProjectExtensions>
</Project>
4 changes: 3 additions & 1 deletion src/BlazorMobile.InteropApp.Desktop/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddResponseCompression(opts =>
{
Expand Down Expand Up @@ -72,8 +73,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseExceptionHandler("/Home/Error");
}

app.UseClientSideBlazorFiles<InteropBlazorApp.Startup>();
app.UseClientSideBlazorFiles<InteropBlazorApp.Program>();

app.UseStaticFiles();
app.UseRouting();

app.UseEndpoints(endpoints =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.2.0-preview1.20073.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/BlazorMobile.InteropBlazorApp.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddResponseCompression(opts =>
{
Expand All @@ -53,7 +54,7 @@ public void ConfigureServices(IServiceCollection services)
});
}

services.AddBlazorMobileNativeServices<InteropBlazorApp.Startup>();
services.AddBlazorMobileNativeServices<InteropBlazorApp.Program>();
ServicesHelper.ConfigureCommonServices(services);
}

Expand All @@ -72,8 +73,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseExceptionHandler("/Home/Error");
}

app.UseClientSideBlazorFiles<InteropBlazorApp.Startup>();
app.UseClientSideBlazorFiles<InteropBlazorApp.Program>();

app.UseStaticFiles();
app.UseRouting();

app.UseEndpoints(endpoints =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
<RootNamespace>BlazorMobile.InteropBlazorApp</RootNamespace>
Expand All @@ -21,12 +21,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorMobile.Build" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview3.19555.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview3.19555.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.0-preview3.19555.2" />
<PackageReference Include="BlazorMobile.Build" Version="3.2.0-preview1.20073.1" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.2.0-preview1.20073.1" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.2.0-preview1.20073.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.2.0-preview1.20073.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview1.20073.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class ServicesHelper
{
public static void ConfigureCommonServices(IServiceCollection services)
{
services.AddBlazorMobileNativeServices<Startup>();
services.AddBlazorMobileNativeServices<Program>();
}
}
}
Loading

0 comments on commit 637cae9

Please sign in to comment.