mirror of
https://github.com/bitwarden/mobile
synced 2025-12-30 15:13:24 +00:00
PM-3350 iOS extensions TapGestureRecognizer try Window workaround
This commit is contained in:
24
src/iOS.Core/Handlers/CustomWindowHandler.cs
Normal file
24
src/iOS.Core/Handlers/CustomWindowHandler.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class CustomWindowHandler : ElementHandler<IWindow, UIWindow>, IWindowHandler
|
||||
{
|
||||
public static IPropertyMapper<IWindow, IWindowHandler> Mapper = new PropertyMapper<IWindow, IWindowHandler>(ElementHandler.ElementMapper)
|
||||
{
|
||||
};
|
||||
|
||||
public CustomWindowHandler() : base(Mapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override UIWindow CreatePlatformElement()
|
||||
{
|
||||
// Haven't tested
|
||||
return UIApplication.SharedApplication.Delegate.GetWindow();
|
||||
//return Platform.GetCurrentUIViewController().View.Window;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@ namespace Bit.iOS.Core.Utilities
|
||||
|
||||
public static void SetupMaui()
|
||||
{
|
||||
var builder = Bit.Core.MauiProgram.ConfigureMauiAppBuilder(ConfigureMAUIEffects, ConfigureMAUIHandlers)
|
||||
var builder = Bit.Core.MauiProgram.ConfigureMauiAppBuilder(ConfigureMAUIEffects, handlers =>
|
||||
{
|
||||
// WORKAROUND: This is needed to make TapGestureRecognizer work on extensions.
|
||||
handlers.AddHandler(typeof(Window), typeof(Handlers.CustomWindowHandler));
|
||||
ConfigureMAUIHandlers(handlers);
|
||||
})
|
||||
.UseMauiEmbedding<Application>();
|
||||
// Register the Window
|
||||
builder.Services.Add(new ServiceDescriptor(typeof(UIWindow), UIApplication.SharedApplication.KeyWindow));
|
||||
|
||||
Reference in New Issue
Block a user