Skip to content

Commit

Permalink
Bump CommunityToolkit.Maui from 9.1.1 to 10.0.0 in /samples (#352)
Browse files Browse the repository at this point in the history
* Bump CommunityToolkit.Maui from 9.1.1 to 10.0.0 in /samples

Bumps [CommunityToolkit.Maui](https://github.com/CommunityToolkit/Maui) from 9.1.1 to 10.0.0.
- [Release notes](https://github.com/CommunityToolkit/Maui/releases)
- [Commits](CommunityToolkit/Maui@9.1.1...10.0.0)

---
updated-dependencies:
- dependency-name: CommunityToolkit.Maui
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add `[RequiresUnreferencedCode]`

* Add `RequiresUnreferencedCode`

* Move `[RequiresUnreferencedCode]` attribute

* Add `SelectStaticRegistrar` workaround

* Use Partial Properties

* Remove MacCatalyst Workaround

* Use Latest .NET Version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brandon Minnick <[email protected]>
  • Loading branch information
dependabot[bot] and brminnick authored Dec 18, 2024
1 parent 3a9db26 commit d2821ba
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- MAUI Specific -->
<MauiPackageVersion>9.0.21</MauiPackageVersion>
<NextMauiPackageVersion>10.0.0</NextMauiPackageVersion>
<MauiCommunityToolkitPackageVersion>9.1.1</MauiCommunityToolkitPackageVersion>
<MauiCommunityToolkitPackageVersion>10.0.0</MauiCommunityToolkitPackageVersion>
<MauiStrictXamlCompilation>true</MauiStrictXamlCompilation>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
<MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>
Expand Down
2 changes: 1 addition & 1 deletion 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)'
NET_VERSION: '9.0.100'
NET_VERSION: '9.0.x'
RunPoliCheck: false
PathToLibrarySolution: 'src/CommunityToolkit.Maui.Markup.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Markup.Sample.sln'
Expand Down
7 changes: 4 additions & 3 deletions samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
partial class AppShell : Shell
{
static readonly IReadOnlyDictionary<Type, string> pageRouteMappingDictionary = new Dictionary<Type, string>(
static readonly ReadOnlyDictionary<Type, string> pageRouteMappingDictionary = new Dictionary<Type, string>(
[
CreateRoutePageMapping<NewsPage, NewsViewModel>(),
CreateRoutePageMapping<SettingsPage, SettingsViewModel>(),
CreateRoutePageMapping<NewsDetailPage, NewsDetailViewModel>()
]);
]).AsReadOnly();

public AppShell(NewsPage newsPage)
{
Expand All @@ -21,7 +22,7 @@ public static string GetRoute<TPage, TViewModel>() where TPage : BaseContentPage
{
return GetRoute(typeof(TPage));
}

public static string GetRoute(Type type)
{
if (!pageRouteMappingDictionary.TryGetValue(type, out var route))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
<ProjectReference Include="..\..\src\CommunityToolkit.Maui.Markup\CommunityToolkit.Maui.Markup.csproj" />
<ProjectReference Include="..\..\src\CommunityToolkit.Maui.Markup.SourceGenerators\CommunityToolkit.Maui.Markup.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<!-- Workaround for https://github.com/dotnet/maui/issues/7272 -->
<Target Name="_SetPublishFolderTypeNoneOnDocFileItems" BeforeTargets="_ComputePublishLocation">
<ItemGroup>
<ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(ResolvedFileToPublish.Extension)' == '.xml' And '%(ResolvedFileToPublish.PublishFolderType)' == ''" PublishFolderType="None" />
</ItemGroup>
<!-- Fixes Static Registrar causing Linker error: https://github.com/xamarin/xamarin-macios/blob/main/docs/managed-static-registrar.md -->
<Target Name="SelectStaticRegistrar" AfterTargets="SelectRegistrar">
<PropertyGroup Condition="'$(Registrar)' == 'managed-static' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))=='maccatalyst'">
<Registrar>static</Registrar>
</PropertyGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics.CodeAnalysis;
namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
class HotReloadHandler : ICommunityToolkitHotReloadHandler
{
public async void OnHotReload(IReadOnlyList<Type> types)
Expand Down
4 changes: 3 additions & 1 deletion samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Microsoft.Extensions.Http.Resilience;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Http.Resilience;
using Polly;
using Refit;
namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class MauiProgram
{
public static MauiApp CreateMauiApp()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
namespace CommunityToolkit.Maui.Markup.Sample.Pages;
using System.Diagnostics.CodeAnalysis;

namespace CommunityToolkit.Maui.Markup.Sample.Pages;

sealed partial class NewsPage : BaseContentPage<NewsViewModel>
{
readonly IDispatcher dispatcher;
readonly RefreshView refreshView;

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
public NewsPage(IDispatcher dispatcher,
NewsViewModel newsViewModel) : base(newsViewModel, "Top Stories")
{
Expand Down Expand Up @@ -46,6 +49,7 @@ protected override void OnAppearing()
static bool IsNullOrEmpty(in IEnumerable? enumerable) => !enumerable?.GetEnumerator().MoveNext() ?? true;
}

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
ArgumentNullException.ThrowIfNull(sender);
Expand Down Expand Up @@ -82,12 +86,14 @@ bool TryRefreshCollectionView()

void HandleNumberOfTopStoriesToFetchChanged(object? sender, int e) => TryRefreshCollectionView();

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
Task NavigateToSettingsPage() => dispatcher.DispatchAsync(() =>
{
var route = AppShell.GetRoute<SettingsPage, SettingsViewModel>();
return Shell.Current.GoToAsync(route);
});

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
Task NavigateToNewsDetailPage(StoryModel storyModel) => dispatcher.DispatchAsync(() =>
{
var route = AppShell.GetRoute<NewsDetailPage, NewsDetailViewModel>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Microsoft.Maui.Layouts;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Maui.Layouts;

namespace CommunityToolkit.Maui.Markup.Sample.Pages;

sealed partial class SettingsPage : BaseContentPage<SettingsViewModel>
{
public SettingsPage(SettingsViewModel settingsViewModel) : base(settingsViewModel, "Settings")
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public SettingsPage(SettingsViewModel settingsViewModel) : base(settingsViewModel, "Settings")
{
Content = new AbsoluteLayout
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Foundation;
using System.Diagnostics.CodeAnalysis;
using Foundation;
namespace CommunityToolkit.Maui.Markup.Sample;

[Register(nameof(AppDelegate))]
[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Foundation;
using System.Diagnostics.CodeAnalysis;
using Foundation;
namespace CommunityToolkit.Maui.Markup.Sample;

[Register(nameof(AppDelegate))]
[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
Expand Down
8 changes: 4 additions & 4 deletions src/CommunityToolkit.Maui.Markup.Benchmarks/LabelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ namespace CommunityToolkit.Maui.Markup.Benchmarks;

public partial class LabelViewModel : ObservableObject
{
[ObservableProperty]
string text = string.Empty;
[ObservableProperty]
public partial string Text { get; set; } = string.Empty;

[ObservableProperty]
Color textColor = Colors.Black;
[ObservableProperty]
public partial Color TextColor { get; set; } = Colors.Black;
}

0 comments on commit d2821ba

Please sign in to comment.