Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/maui #1119

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BlazorComponent
Submodule BlazorComponent updated 603 files
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net7.0-ios'">
<CodesignKey>Apple Development: Created via API (MN65C39P5Z)</CodesignKey>
<CodesignKey>Apple Development: Vic Parker (LXZ3399LT9)</CodesignKey>
<CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup>

Expand Down
33 changes: 32 additions & 1 deletion src/Masa.Blazor.Maui.Plugin/Masa.Blazor.Full.sln
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaPickSample", "MediaPic
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "iOSPush", "iOSPush", "{0DA1E67D-9550-4DA5-9ED4-FD1D3B14E2A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOSPushSample", "iOSPushSample\iOSPushSample.csproj", "{57747E94-7876-4D9F-AAF8-75EA306511BE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "iOSPushSample", "iOSPushSample\iOSPushSample.csproj", "{57747E94-7876-4D9F-AAF8-75EA306511BE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JPush", "JPush", "{CDFC36CF-64AC-4E0B-81E0-2D387CBD65B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Blazor.JPush.Binding", "Masa.Blazor.JPush.Binding\Masa.Blazor.JPush.Binding.csproj", "{55395B66-860B-4CB7-BAB0-45D5729A2D71}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Blazor.JPush.Sample", "Masa.Blazor.JPush.Sample\Masa.Blazor.JPush.Sample.csproj", "{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Video", "Video", "{08CE11D5-6B0F-4D22-B6A0-06C4BBEF0126}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlayVideoSample", "PlayVideoSample\PlayVideoSample.csproj", "{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PictureMask", "PictureMask", "{D1E6BE72-E9B1-46E2-90BB-71B65C150503}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -133,6 +145,22 @@ Global
{57747E94-7876-4D9F-AAF8-75EA306511BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57747E94-7876-4D9F-AAF8-75EA306511BE}.Release|Any CPU.Build.0 = Release|Any CPU
{57747E94-7876-4D9F-AAF8-75EA306511BE}.Release|Any CPU.Deploy.0 = Release|Any CPU
{55395B66-860B-4CB7-BAB0-45D5729A2D71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55395B66-860B-4CB7-BAB0-45D5729A2D71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55395B66-860B-4CB7-BAB0-45D5729A2D71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55395B66-860B-4CB7-BAB0-45D5729A2D71}.Release|Any CPU.Build.0 = Release|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Release|Any CPU.Build.0 = Release|Any CPU
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1}.Release|Any CPU.Deploy.0 = Release|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Release|Any CPU.Build.0 = Release|Any CPU
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -153,6 +181,9 @@ Global
{BB195AC4-3068-4122-B13C-64576EC289D4} = {ADF847FC-9E99-4718-BA0A-A895761A2883}
{D5DBC320-F0F3-44A9-801B-1DAB9C308D58} = {2B242685-3450-4573-8C4F-5BB6FAF98C70}
{57747E94-7876-4D9F-AAF8-75EA306511BE} = {0DA1E67D-9550-4DA5-9ED4-FD1D3B14E2A1}
{55395B66-860B-4CB7-BAB0-45D5729A2D71} = {CDFC36CF-64AC-4E0B-81E0-2D387CBD65B5}
{FB193C72-7D61-4D88-A11D-94F25EDF8BD1} = {CDFC36CF-64AC-4E0B-81E0-2D387CBD65B5}
{9630CF02-4DF0-4A43-AB4B-1C067CAAAB07} = {08CE11D5-6B0F-4D22-B6A0-06C4BBEF0126}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F999AB5B-4C79-44A5-A1BA-90C268DFB039}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Additions allow you to add arbitrary C# to the generated classes
before they are compiled. This can be helpful for providing convenience
methods or adding pure C# classes.

== Adding Methods to Generated Classes ==

Let's say the library being bound has a Rectangle class with a constructor
that takes an x and y position, and a width and length size. It will look like
this:

public partial class Rectangle
{
public Rectangle (int x, int y, int width, int height)
{
// JNI bindings
}
}

Imagine we want to add a constructor to this class that takes a Point and
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
with a partial class containing our new method:

public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}

At compile time, the additions class will be added to the generated class
and the final assembly will a Rectangle class with both constructors.


== Adding C# Classes ==

Another thing that can be done is adding fully C# managed classes to the
generated library. In the above example, let's assume that there isn't a
Point class available in Java or our library. The one we create doesn't need
to interact with Java, so we'll create it like a normal class in C#.

By adding a Point.cs file with this class, it will end up in the binding library:

public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This directory is for Android .jars.

There are 2 types of jars that are supported:

== Input Jar ==

This is the jar that bindings should be generated for.

For example, if you were binding the Google Maps library, this would
be Google's "maps.jar".

Set the build action for these jars in the properties page to "InputJar".


== Reference Jars ==

These are jars that are referenced by the input jar. C# bindings will
not be created for these jars. These jars will be used to resolve
types used by the input jar.

NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
based on the Target Framework selected.

Set the build action for these jars in the properties page to "ReferenceJar".
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<EmbeddedNativeLibrary Include="Jars\arm64-v8a\libjcore410.so" />
<EmbeddedNativeLibrary Include="Jars\armeabi-v7a\libjcore410.so" />
</ItemGroup>
<ItemGroup>
<EmbeddedJar Include="Jars\jcore-android-4.1.0.jar" />
<EmbeddedJar Include="Jars\jpush-android-4.9.0.jar" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<enum-field-mappings>
<!--
This example converts the constants Fragment_id, Fragment_name,
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
to an enum called Android.Support.V4.App.FragmentTagType with values
Id, Name, and Tag.

<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
<field jni-name="Fragment_name" clr-name="Name" value="0" />
<field jni-name="Fragment_id" clr-name="Id" value="1" />
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
</mapping>
-->
</enum-field-mappings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<enum-method-mappings>
<!--
This example changes the Java method:
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
to be:
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
when bound in C#.

<mapping jni-class="android/support/v4/app/Fragment.SavedState">
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
</mapping>
-->
</enum-method-mappings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />

This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->
</metadata>
26 changes: 26 additions & 0 deletions src/Masa.Blazor.Maui.Plugin/Masa.Blazor.JPush.Sample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Masa.Blazor.JPush.Sample"
x:Class="Masa.Blazor.JPush.Sample.App">
<Application.Resources>
<ResourceDictionary>

<Color x:Key="PageBackgroundColor">#512bdf</Color>
<Color x:Key="PrimaryTextColor">White</Color>

<Style TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
</Style>

<Style TargetType="Button">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="BackgroundColor" Value="#2b0b98" />
<Setter Property="Padding" Value="14,10" />
</Style>

</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions src/Masa.Blazor.Maui.Plugin/Masa.Blazor.JPush.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Masa.Blazor.JPush.Sample
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new MainPage();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Masa.Blazor.JPush.Sample.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Masa.Blazor.JPush.Sample.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
11 changes: 11 additions & 0 deletions src/Masa.Blazor.Maui.Plugin/Masa.Blazor.JPush.Sample/Main.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Router AppAssembly="@typeof(Main).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
14 changes: 14 additions & 0 deletions src/Masa.Blazor.Maui.Plugin/Masa.Blazor.JPush.Sample/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Masa.Blazor.JPush.Sample"
x:Class="Masa.Blazor.JPush.Sample.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</BlazorWebView.RootComponents>
</BlazorWebView>

</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Masa.Blazor.JPush.Sample
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>net7.0-android</TargetFrameworks>

<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Masa.Blazor.JPush.Sample</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>

<!-- Display name -->
<ApplicationTitle>Masa.Blazor.JPush.Sample</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.JPushDemo.masa</ApplicationId>
<!--<ApplicationId>com.JPushDemo.masa</ApplicationId>-->
<ApplicationIdGuid>AF0727FF-CD57-4FE5-BE53-93BB53CD2C09</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>

</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0-android'">
<ProjectReference Include="..\Masa.Blazor.JPush.Binding\Masa.Blazor.JPush.Binding.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Platforms\Android\Resources\anim\" />
<Folder Include="Platforms\Android\Resources\drawable-xxhdpi\" />
<Folder Include="Platforms\Android\Resources\drawable\" />
</ItemGroup>

</Project>
Loading