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

Implements tizen platform #692

Merged
merged 29 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b33e87e
Implements tizen platform
myroot Oct 11, 2022
90d9000
Apply review comment
myroot Oct 15, 2022
c042667
Update src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.tizen.cs
VladislavAntonyuk Oct 15, 2022
377773e
Update src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.tizen.cs
VladislavAntonyuk Oct 15, 2022
4cfe693
Update src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.tizen.cs
VladislavAntonyuk Oct 15, 2022
e212b87
Update src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.tizen.cs
VladislavAntonyuk Oct 16, 2022
636b387
Apply review comment
myroot Oct 16, 2022
2c97be7
attempt to use 6.0.300
VladislavAntonyuk Oct 18, 2022
ce550ba
6.0.400
VladislavAntonyuk Oct 18, 2022
a2c860f
6.0.424
VladislavAntonyuk Oct 18, 2022
3327e8c
486
VladislavAntonyuk Oct 18, 2022
a5f05f7
540
VladislavAntonyuk Oct 18, 2022
9ad0e8a
Merge branch 'main' into add-tizen-handlers
brminnick Oct 21, 2022
c431204
Update azure-pipelines.yml
brminnick Oct 21, 2022
947056d
Formatting Updates
brminnick Oct 21, 2022
c7ff665
Add
brminnick Oct 21, 2022
0434c1e
Remove duplicate enums
brminnick Oct 21, 2022
e654f33
Fix variable conflicts
brminnick Oct 21, 2022
186938f
Defer to thread pool thread
brminnick Oct 21, 2022
a5a964d
Merge branch 'main' into add-tizen-handlers
pictos Oct 23, 2022
29d147c
Fix MauiPopup anchor position
myroot Oct 24, 2022
08bf36d
Apply review comment
myroot Oct 24, 2022
91e9cc7
Fix GetImageStream without await
myroot Oct 24, 2022
6af8ec7
Add UnsupportedOSPlatform attribute on unsupported behaviors
myroot Oct 24, 2022
c000bcb
Merge branch 'main' into add-tizen-handlers
brminnick Oct 27, 2022
4cdb7a4
Merge branch 'main' into add-tizen-handlers
JoonghyunCho Nov 1, 2022
2005cd5
Merge branch 'main' into add-tizen-handlers
JoonghyunCho Nov 8, 2022
06d23e0
Merge branch 'main' into add-tizen-handlers
brminnick Nov 8, 2022
43e1fda
Merge branch 'main' into add-tizen-handlers
JoonghyunCho Nov 8, 2022
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
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
<ItemGroup>
<InternalsVisibleTo Include="CommunityToolkit.Maui.UnitTests" />
</ItemGroup>
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' and $([MSBuild]::IsOSPlatform('windows')) == 'true'">
JoonghyunCho marked this conversation as resolved.
Show resolved Hide resolved
<IncludeTizenTargetFrameworks>true</IncludeTizenTargetFrameworks>
</PropertyGroup>
</Project>
16 changes: 13 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variables:
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
NugetPackageVersion: '$(CurrentSemanticVersion)'
TOOLKIT_NET_VERSION: '6.0.300'
TOOLKIT_NET_VERSION: '6.0.400'
LATEST_NET_VERSION: '6.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
Expand All @@ -15,7 +15,7 @@ variables:
PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj'
PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/6.0.312.json'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/6.0.540.json'
ShouldCheckDependencies: true

trigger:
Expand Down Expand Up @@ -62,6 +62,11 @@ jobs:
- powershell: dotnet workload install maui
displayName: Install Latest .NET MAUI Workload

- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1 -DotnetTargetVersionBand $(TOOLKIT_NET_VERSION)
displayName: Install Tizen Workload

# build sample
- task: CmdLine@2
displayName: 'Build Community Toolkit Sample'
Expand Down Expand Up @@ -112,6 +117,11 @@ jobs:
inputs:
script: dotnet workload install maui --from-rollback-file $(DotNetMauiRollbackFile) --source https://api.nuget.org/v3/index.json

- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1 -DotnetTargetVersionBand $(TOOLKIT_NET_VERSION)
displayName: Install Tizen Workload

- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Analyzers'
inputs:
Expand Down Expand Up @@ -205,4 +215,4 @@ jobs:
displayName: 'Publish NuGets'
inputs:
artifactName: nuget
pathToPublish: '$(Build.ArtifactStagingDirectory)'
pathToPublish: '$(Build.ArtifactStagingDirectory)'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0-ios;net6.0-android;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(IncludeTizenTargetFrameworks)' == 'true'">$(TargetFrameworks);net6.0-tizen</TargetFrameworks>
<OutputType>Exe</OutputType>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
Expand Down Expand Up @@ -50,6 +51,7 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>

Expand Down
16 changes: 16 additions & 0 deletions samples/CommunityToolkit.Maui.Sample/Platforms/Tizen/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Hosting;

namespace CommunityToolkit.Maui.Sample;

class Program : MauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="maui-application-id-placeholder" exec="CommunityToolkit.Maui.Sample.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>maui-application-title-placeholder</label>
<icon>maui-appicon-placeholder</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
<Style x:Key="ConfirmButton" TargetType="Button">
<Setter Property="VerticalOptions" Value="EndAndExpand" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
</ResourceDictionary>
</VerticalStackLayout.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
<Style x:Key="CancelButton" TargetType="Button">
<Setter Property="Background" Value="#FFF" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="VerticalStackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
</ResourceDictionary>
</VerticalStackLayout.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
</ResourceDictionary>
</VerticalStackLayout.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
<Style x:Key="ConfirmButton" TargetType="Button">
<Setter Property="VerticalOptions" Value="EndAndExpand" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
</ResourceDictionary>
</VerticalStackLayout.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
<Style x:Key="ConfirmButton" TargetType="Button">
<Setter Property="VerticalOptions" Value="EndAndExpand" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Setter Property="VerticalTextAlignment" Value="Center" />
</Style>
<Style x:Key="PopupLayout" TargetType="StackLayout">
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5}" />
<Setter Property="Padding" Value="{OnPlatform Android=20, WinUI=20, iOS=5, MacCatalyst=5, Tizen=20}" />
</Style>
</ResourceDictionary>
</VerticalStackLayout.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(IncludeTizenTargetFrameworks)' == 'true'">$(TargetFrameworks);net6.0-tizen</TargetFrameworks>
<UseMauiCore>true</UseMauiCore>
<UseMauiEssentials>true</UseMauiEssentials>
<SingleProject>true</SingleProject>
Expand Down Expand Up @@ -73,6 +74,12 @@
<Compile Remove="**\windows\**\*.cs" />
<None Include="**\windows\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-tizen')) != true ">
<Compile Remove="**\*.tizen.cs" />
<None Include="**\*.tizen.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\tizen\**\*.cs" />
<None Include="**\tizen\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="!($(TargetFramework.StartsWith('net')) == true AND $(TargetFramework.EndsWith('.0')) == true AND $(TargetFramework.Contains('-')) != true)"> <!-- e.g net6.0 or net7.0 -->
<Compile Remove="**\*.net.cs" />
<None Include="**\*.net.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public DrawingViewHandler() : this(DrawingViewMapper, DrawingViewCommandMapper)
}
}

#if ANDROID || IOS || MACCATALYST || WINDOWS
#if ANDROID || IOS || MACCATALYST || WINDOWS || TIZEN
public partial class DrawingViewHandler : ViewHandler<IDrawingView, MauiDrawingView>, IDrawingViewHandler
{

Expand Down
103 changes: 103 additions & 0 deletions src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using CommunityToolkit.Maui.Core.Views;
using Tizen.UIExtensions.NUI;

namespace CommunityToolkit.Maui.Core.Handlers;

public partial class PopupHandler : Microsoft.Maui.Handlers.ElementHandler<IPopup, MauiPopup>
{
/// <summary>
/// Action that's triggered when the Popup is closed.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
/// <param name="result">The result that should return from this Popup.</param>
public static void MapOnClosed(PopupHandler handler, IPopup view, object? result)
{
var popup = handler.PlatformView;

if (popup.IsOpen)
{
popup.Close();
}

handler.DisconnectHandler(popup);
}

/// <summary>
/// Action that's triggered when the Popup is Opened.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
/// <param name="result">We don't need to provide the result parameter here.</param>
public static void MapOnOpened(PopupHandler handler, IPopup view, object? result)
{
handler.PlatformView.ShowPopup();
}

/// <summary>
/// Action that's triggered when the Popup is dismissed by tapping outside of the Popup.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
/// <param name="result">The result that should return from this Popup.</param>
public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
{
if (view.CanBeDismissedByTappingOutsideOfPopup)
{
view.OnDismissedByTappingOutsideOfPopup();
}
}

/// <summary>
/// Action that's triggered when the Popup <see cref="IPopup.Anchor"/> property changes.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
public static void MapAnchor(PopupHandler handler, IPopup view)
{
myroot marked this conversation as resolved.
Show resolved Hide resolved
// On Tizen, Anchor only update when popup is opened
}

/// <summary>
/// Action that's triggered when the Popup <see cref="IPopup.CanBeDismissedByTappingOutsideOfPopup"/> property changes.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
JoonghyunCho marked this conversation as resolved.
Show resolved Hide resolved
{
// this property directly access on platform view
}

/// <summary>
/// Action that's triggered when the Popup <see cref="IPopup.Color"/> property changes.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
public static void MapColor(PopupHandler handler, IPopup view)
{
// this property directly access on platform view
}

/// <summary>
/// Action that's triggered when the Popup <see cref="IPopup.Size"/> property changes.
/// </summary>
/// <param name="handler">An instance of <see cref="PopupHandler"/>.</param>
/// <param name="view">An instance of <see cref="IPopup"/>.</param>
public static void MapSize(PopupHandler handler, IPopup view)
{
handler.PlatformView.UpdateContentSize();
}

/// <inheritdoc/>
protected override void ConnectHandler(MauiPopup platformView)
{
platformView.SetElement(VirtualView);
}

/// <inheritdoc/>
protected override MauiPopup CreatePlatformElement()
{
var mauiContext = MauiContext ?? throw new InvalidOperationException("${nameof(MauiContext)} cannot be null");
return new MauiPopup(mauiContext);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Runtime.Versioning;
using Microsoft.Maui.Platform;

namespace CommunityToolkit.Maui.Core.Platform;

[UnsupportedOSPlatform("Tizen")]
static partial class StatusBar
{
static void PlatformSetColor(Color color)
{
throw new NotSupportedException("Tizen does not currently support changing the status bar color");
}

static void PlatformSetStyle(StatusBarStyle style)
{
throw new NotSupportedException("Tizen does not currently support changing the status bar color");
}
}
Loading