From 8c623a20678e9244b1b9a40bfaa9ea7b5f0420fe Mon Sep 17 00:00:00 2001 From: Dinis Vieira Date: Mon, 16 Oct 2023 20:45:58 +0100 Subject: [PATCH] PM-3349 ToolbarHandler created for setting text on Android go back buttons. --- src/App/MauiProgram.cs | 1 + .../Handlers/ToolbarHandlerMappings.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/App/Platforms/Android/Handlers/ToolbarHandlerMappings.cs diff --git a/src/App/MauiProgram.cs b/src/App/MauiProgram.cs index 85c1ed0f8..5e9f88886 100644 --- a/src/App/MauiProgram.cs +++ b/src/App/MauiProgram.cs @@ -26,6 +26,7 @@ Bit.App.Handlers.StepperHandlerMappings.Setup(); Bit.App.Handlers.TimePickerHandlerMappings.Setup(); Bit.App.Handlers.ButtonHandlerMappings.Setup(); + Bit.App.Handlers.ToolbarHandlerMappings.Setup(); handlers.AddHandler(typeof(Bit.App.Pages.TabsPage), typeof(Bit.App.Handlers.CustomTabbedPageHandler)); #else diff --git a/src/App/Platforms/Android/Handlers/ToolbarHandlerMappings.cs b/src/App/Platforms/Android/Handlers/ToolbarHandlerMappings.cs new file mode 100644 index 000000000..1f4b8704b --- /dev/null +++ b/src/App/Platforms/Android/Handlers/ToolbarHandlerMappings.cs @@ -0,0 +1,21 @@ +using Bit.Core.Resources.Localization; +using Microsoft.Maui.Handlers; + +namespace Bit.App.Handlers +{ + public class ToolbarHandlerMappings + { + public static void Setup() + { + ToolbarHandler.Mapper.AppendToMapping(nameof(IToolbar.BackButtonVisible), (handler, view) => + { + handler.PlatformView.NavigationContentDescription = AppResources.TapToGoBack; + }); + + ToolbarHandler.Mapper.AppendToMapping(nameof(Toolbar.BackButtonTitle), (handler, view) => + { + handler.PlatformView.NavigationContentDescription = AppResources.TapToGoBack; + }); + } + } +}