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

feat: Add support for mouse back button navigation. #392

Merged
merged 1 commit into from
Feb 9, 2024
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

Prefix your items with `(Template)` if the change is about the template and not the resulting application.

## 3.2.X
- Added support for mouse back button navigation.

## 3.1.X
- Updated to .NET 8.
- Added MAUI essentials on Windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<TrimMode>partial</TrimMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Chinook.BackButtonManager.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.BackButtonManager.Uno.WinUI" Version="2.1.0" />
<PackageReference Include="Chinook.DataLoader.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.DynamicMvvm.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.SectionsNavigation.Uno.WinUI" Version="3.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PackageReference Include="Chinook.DynamicMvvm.CollectionTracking" Version="2.0.0" />
<PackageReference Include="Chinook.DataLoader" Version="2.0.0" />
<PackageReference Include="Chinook.DataLoader.DynamicMvvm" Version="2.0.0" />
<PackageReference Include="Chinook.BackButtonManager" Version="2.0.0" />
<PackageReference Include="Chinook.BackButtonManager" Version="2.1.0" />
<PackageReference Include="Chinook.SectionsNavigation" Version="3.0.0" />
<PackageReference Include="Chinook.SectionsNavigation.Reactive" Version="3.0.0" />
<PackageReference Include="MessageDialogService" Version="2.0.0" />
Expand Down
22 changes: 22 additions & 0 deletions src/app/ApplicationTemplate.Shared.Views/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected override async Task StartViewServices(IServiceProvider services, bool
await SetShellViewModel();

await AddSystemBackButtonSource(services);
await AddMouseBackButtonSource(services);

HandleSystemBackVisibility(services);

Expand Down Expand Up @@ -194,6 +195,27 @@ void AddSystemBackButtonSourceInner()
//+:cnd:noEmit
}

/// <summary>
/// Adds mouse back button to the IBackButtonManager.
/// </summary>
private async Task AddMouseBackButtonSource(IServiceProvider services)
{
//-:cnd:noEmit
#if __WINDOWS__
var dispatcherQueue = services.GetRequiredService<DispatcherQueue>();
var backButtonManager = services.GetRequiredService<IBackButtonManager>();
await dispatcherQueue.EnqueueAsync(AddSystemBackButtonSourceInner, DispatcherQueuePriority.High);

// Runs on main thread.
void AddSystemBackButtonSourceInner()
{
var source = new PointerXButton1BackButtonSource(App.Instance.Shell);
backButtonManager.AddSource(source);
}
#endif
//+:cnd:noEmit
}

private void SetStatusBarColor(IServiceProvider services)
{
//-:cnd:noEmit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Chinook.BackButtonManager.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.BackButtonManager.Uno.WinUI" Version="2.1.0" />
<PackageReference Include="Chinook.DataLoader.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.DynamicMvvm.Uno.WinUI" Version="2.0.0" />
<PackageReference Include="Chinook.SectionsNavigation.Uno.WinUI" Version="3.0.0" />
Expand Down
Loading