Skip to content

Commit

Permalink
.NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavAntonyuk committed Aug 24, 2023
1 parent ca36f5f commit 13539d5
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<PropertyGroup>
<NetVersion>net7.0</NetVersion>
<NetVersion>net8.0</NetVersion>
<!-- Fixes https://github.com/dotnet/maui/pull/12114 -->
<PublishReadyToRun>false</PublishReadyToRun>
<LangVersion>latest</LangVersion>
Expand Down
12 changes: 7 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ variables:
NugetPackageVersion: '$(CurrentSemanticVersion)'
NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)'
NugetPackageVersionMaps: '$(CurrentSemanticVersion)'
TOOLKIT_NET_VERSION: '7.0.200'
LATEST_NET_VERSION: '7.0.x'
TOOLKIT_NET_VERSION: '8.0.100-preview.7.23376.3'
LATEST_NET_VERSION: '8.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj'
Expand All @@ -21,9 +21,9 @@ variables:
PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/7.0.59.json'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.0-preview.7.8842.json'
CommunityToolkitSampleApp_Xcode_Version: '14.3.0'
CommunityToolkitLibrary_Xcode_Version: '14.0.1'
CommunityToolkitLibrary_Xcode_Version: '14.3.0'

trigger:
branches:
Expand Down Expand Up @@ -70,6 +70,7 @@ jobs:
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: true

- powershell: dotnet workload install maui
displayName: Install Latest .NET MAUI Workload
Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
image: 'macos-12'
image: 'macos-13'
pool:
vmImage: $(image)
steps:
Expand Down Expand Up @@ -173,6 +174,7 @@ jobs:
inputs:
packageType: 'sdk'
version: '$(TOOLKIT_NET_VERSION)'
includePreviewVersions: true

- task: CmdLine@2
displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)'
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.200",
"version": "8.0.100-preview.7.23376.3",
"rollForward": "latestFeature",
"allowPrerelease": false
"allowPrerelease": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.7.8842" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Sample.Converters;

sealed class SecondsToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not double && value is not TimeSpan)
{
Expand Down Expand Up @@ -42,7 +42,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Views"
x:Class="CommunityToolkit.Maui.Sample.Pages.Views.BasicMapsPage"
Expand Down Expand Up @@ -32,7 +33,7 @@
<Label Text="Scroll enabled" VerticalOptions="Center"/>
</HorizontalStackLayout>
<Button Text="Move to region" Clicked="Button_OnClicked" Grid.Row="3"/>
<Map x:Name="BasicMap" Grid.Row="4"
<maps:Map x:Name="BasicMap" Grid.Row="4"
IsShowingUser="{Binding IsToggled, Source={x:Reference ShowUserLocationSwitch}}"
IsTrafficEnabled="{Binding IsToggled, Source={x:Reference ShowTrafficSwitch}}"
IsZoomEnabled="{Binding IsToggled, Source={x:Reference ZoomEnabledSwitch}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Views"
x:DataType="vm:MapsPinsViewModel"
Expand All @@ -14,6 +15,6 @@
<Button Text="Remove Pin" Clicked="RemovePin_Clicked" />
<Button Text="Add 10 Pins" Clicked="Add10Pins_Clicked" />
</HorizontalStackLayout>
<Map x:Name="PinsMap" Grid.Row="1" MapClicked="PinsMap_MapClicked" />
<maps:Map x:Name="PinsMap" Grid.Row="1" MapClicked="PinsMap_MapClicked" />
</Grid>
</pages:BasePage>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.7.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.7.8842" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Microsoft.Maui.Core" Version="8.0.0-preview.7.8842" />
<PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.0-preview.7.8842" />
<PackageReference Include="System.Speech" Version="7.0.0" Condition="'$(TargetFramework)' == '$(NetVersion)-windows10.0.19041.0'" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public static Task<bool> ShowKeyboardAsync(this ITextInput targetView, Cancellat
{
var showKeyboardTCS = new TaskCompletionSource<bool>();

handler.Invoke(nameof(IView.Focus), new FocusRequest(false));
var focusRequest = new FocusRequest();
focusRequest.SetResult(false);
handler.Invoke(nameof(IView.Focus), focusRequest);

handler.GetRequiredService<IDispatcher>().Dispatch(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static Stream GetBitmapStream(Bitmap? image, Size imageSize)

using var resizedImage = GetMaximumBitmap(image, (float)imageSize.Width, (float)imageSize.Height);
var stream = new MemoryStream();
var compressResult = resizedImage.Compress(Bitmap.CompressFormat.Png, 100, stream);
var compressResult = resizedImage.Compress(Bitmap.CompressFormat.Png!, 100, stream);

resizedImage.Recycle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls.Maps" Version="7.0.86" />
<PackageReference Include="Microsoft.Maui.Controls.Maps" Version="8.0.0-preview.7.8842" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetVersion);$(NetVersion)-android;$(NetVersion)-ios;$(NetVersion)-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);$(NetVersion)-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(IncludeTizenTargetFrameworks)' == 'true'">$(TargetFrameworks);$(NetVersion)-tizen</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<PropertyGroup>
<TargetFrameworks>$(NetVersion);$(NetVersion)-android;$(NetVersion)-ios;$(NetVersion)-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);$(NetVersion)-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(IncludeTizenTargetFrameworks)' == 'true'">$(TargetFrameworks);$(NetVersion)-tizen</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<RootNamespace>CommunityToolkit.Maui</RootNamespace>
<AndroidGenerateResourceDesigner>false</AndroidGenerateResourceDesigner>
</PropertyGroup>
</PropertyGroup>

<PropertyGroup>
<GitInfoReportImportance>high</GitInfoReportImportance>
Expand Down Expand Up @@ -53,7 +53,7 @@
<None Include="ReadMe.txt" pack="true" PackagePath="." />
</ItemGroup>

<ItemGroup>
<ItemGroup>
<None Include="..\CommunityToolkit.Maui.MediaElement.Analyzers\bin\$(Configuration)\netstandard2.0\CommunityToolkit.Maui.MediaElement.Analyzers.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="..\CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes\bin\$(Configuration)\netstandard2.0\CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
Expand All @@ -62,4 +62,7 @@
<PackageReference Include="Xam.Plugins.Android.ExoPlayer" Version="2.18.10" />
<PackageReference Include="Xam.Plugins.Android.ExoPlayer.Transformer" Version="2.18.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.7.8842" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.7.8842" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ namespace CommunityToolkit.Maui.UnitTests.Mocks;

class MockValueConverter : IValueConverter
{
readonly Func<object, object> returnValue;
readonly Func<object?, object> returnValue;

public MockValueConverter(Func<object, object> returnValue)
public MockValueConverter(Func<object?, object> returnValue)
{
this.returnValue = returnValue;
}

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return returnValue.Invoke(value);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return returnValue.Invoke(value);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Globalization;
using System.Reflection;
using System.Windows.Input;
using CommunityToolkit.Maui.Converters;

Expand Down Expand Up @@ -134,7 +135,7 @@ void UnregisterEvent()
protected virtual void OnTriggerHandled(object? sender = null, object? eventArgs = null)
{
var parameter = CommandParameter
?? EventArgsConverter?.Convert(eventArgs, typeof(object), null, null);
?? EventArgsConverter?.Convert(eventArgs, typeof(object), null, CultureInfo.InvariantCulture);

var command = Command;
if (command?.CanExecute(parameter) ?? false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CommunityToolkit.Maui.Behaviors;
using System.Globalization;

namespace CommunityToolkit.Maui.Behaviors;

/// <summary>
/// This <see cref="EventToCommandBehavior"/> cast the sender object to a specific type defined by the user.
Expand All @@ -10,7 +12,7 @@ public sealed class EventToCommandBehavior<TType> : EventToCommandBehavior
protected override void OnTriggerHandled(object? sender = null, object? eventArgs = null)
{
var parameter = CommandParameter
?? EventArgsConverter?.Convert(eventArgs, typeof(object), null, null)
?? EventArgsConverter?.Convert(eventArgs, typeof(object), null, CultureInfo.InvariantCulture)
?? eventArgs;

if (parameter is not TType)
Expand Down
1 change: 1 addition & 0 deletions src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.7.8842" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public interface ICommunityToolkitValueConverter : IValueConverter
new object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo? culture);

/// <inheritdoc />
object? IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
object? IValueConverter.Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
Convert(value, targetType, parameter, culture);

/// <inheritdoc />
object? IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
object? IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
ConvertBack(value, targetType, parameter, culture);
}
5 changes: 3 additions & 2 deletions src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public partial class Popup : Element, IPopup, IWindowController, IPropertyPropag

TaskCompletionSource popupDismissedTaskCompletionSource = new();
TaskCompletionSource<object?> resultTaskCompletionSource = new();
Window? window;
Window window;

/// <summary>
/// Instantiates a new instance of <see cref="Popup"/>.
Expand All @@ -56,6 +56,7 @@ public Popup()
platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Popup>>(() => new(this));

VerticalOptions = HorizontalOptions = LayoutAlignment.Center;
window = Window;
}

/// <summary>
Expand Down Expand Up @@ -165,7 +166,7 @@ public bool CanBeDismissedByTappingOutsideOfPopup
/// <summary>
/// Property that represents the Window that's showing the Popup.
/// </summary>
public Window? Window
public Window Window
{
get => window;
set
Expand Down

0 comments on commit 13539d5

Please sign in to comment.