mirror of
https://github.com/bitwarden/android.git
synced 2024-12-26 19:08:32 +03:00
PM-3350 Removed TapGesture Window MAUI hack from iOS.Extension and iOS.ShareExtension
This commit is contained in:
parent
8e1a8b5f0e
commit
c6544b49e9
8 changed files with 2 additions and 117 deletions
|
@ -1,24 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ namespace Bit.iOS.Core.Utilities
|
||||||
{
|
{
|
||||||
var builder = Bit.Core.MauiProgram.ConfigureMauiAppBuilder(ConfigureMAUIEffects, handlers =>
|
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);
|
ConfigureMAUIHandlers(handlers);
|
||||||
})
|
})
|
||||||
.UseMauiEmbedding<Application>();
|
.UseMauiEmbedding<Application>();
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#if ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Bit.iOS.Core.Utilities;
|
|
||||||
using Bit.iOS.Extension.Models;
|
|
||||||
using Microsoft.Maui.Controls;
|
|
||||||
using Microsoft.Maui.Platform;
|
|
||||||
using UIKit;
|
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
|
||||||
{
|
|
||||||
public partial class LoadingViewController : UIViewController
|
|
||||||
{
|
|
||||||
const string STORYBOARD_NAME = "MainInterface";
|
|
||||||
Lazy<UIStoryboard> _storyboard = new Lazy<UIStoryboard>(() => UIStoryboard.FromName(STORYBOARD_NAME, null));
|
|
||||||
|
|
||||||
public void InitWithContext(Context context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
_shouldInitialize = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DismissLockAndContinue()
|
|
||||||
{
|
|
||||||
if (UIApplication.SharedApplication.KeyWindow is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UIApplication.SharedApplication.KeyWindow.RootViewController = _storyboard.Value.InstantiateInitialViewController();
|
|
||||||
|
|
||||||
if (UIApplication.SharedApplication.KeyWindow?.RootViewController is UINavigationController navContr)
|
|
||||||
{
|
|
||||||
var rootVC = navContr.ViewControllers.FirstOrDefault();
|
|
||||||
if (rootVC is LoadingViewController loadingVC)
|
|
||||||
{
|
|
||||||
loadingVC.InitWithContext(_context);
|
|
||||||
loadingVC.ContinueOn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NavigateToPage(ContentPage page)
|
|
||||||
{
|
|
||||||
var navigationPage = new NavigationPage(page);
|
|
||||||
|
|
||||||
var window = new Window(navigationPage);
|
|
||||||
window.ToHandler(MauiContextSingleton.Instance.MauiContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -18,6 +18,8 @@ using Bit.iOS.Core.Views;
|
||||||
using Bit.iOS.Extension.Models;
|
using Bit.iOS.Extension.Models;
|
||||||
using CoreNFC;
|
using CoreNFC;
|
||||||
using Foundation;
|
using Foundation;
|
||||||
|
using Microsoft.Maui.Controls;
|
||||||
|
using Microsoft.Maui.Platform;
|
||||||
using MobileCoreServices;
|
using MobileCoreServices;
|
||||||
using UIKit;
|
using UIKit;
|
||||||
|
|
||||||
|
@ -151,7 +153,6 @@ namespace Bit.iOS.Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND
|
|
||||||
public void DismissLockAndContinue()
|
public void DismissLockAndContinue()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("BW Log, Dismissing lock controller.");
|
Debug.WriteLine("BW Log, Dismissing lock controller.");
|
||||||
|
@ -166,7 +167,6 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
PresentViewController(uiController, true, null);
|
PresentViewController(uiController, true, null);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private void ContinueOn()
|
private void ContinueOn()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
|
|
||||||
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
|
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
|
||||||
|
|
||||||
<DefineConstants>$(DefineConstants);ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND</DefineConstants>
|
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
||||||
<RootNamespace>Bit.iOS.Extension</RootNamespace>
|
<RootNamespace>Bit.iOS.Extension</RootNamespace>
|
||||||
|
@ -75,7 +73,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<BundleResource Include="Resources\MaterialIcons_Regular.ttf" />
|
<BundleResource Include="Resources\MaterialIcons_Regular.ttf" />
|
||||||
<BundleResource Include="Resources\bwi-font.ttf" />
|
<BundleResource Include="Resources\bwi-font.ttf" />
|
||||||
<Compile Include="LoadingViewController.TapGestureHack.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Core\Core.csproj" />
|
<ProjectReference Include="..\Core\Core.csproj" />
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#if ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND
|
|
||||||
|
|
||||||
using Bit.iOS.Core.Utilities;
|
|
||||||
using Microsoft.Maui.Controls;
|
|
||||||
using Microsoft.Maui.Platform;
|
|
||||||
using UIKit;
|
|
||||||
|
|
||||||
namespace Bit.iOS.ShareExtension
|
|
||||||
{
|
|
||||||
public partial class LoadingViewController : UIViewController
|
|
||||||
{
|
|
||||||
private void NavigateToPage(ContentPage page)
|
|
||||||
{
|
|
||||||
var navigationPage = new NavigationPage(page);
|
|
||||||
|
|
||||||
var window = new Window(navigationPage);
|
|
||||||
window.ToHandler(MauiContextSingleton.Instance.MauiContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -137,23 +137,16 @@ namespace Bit.iOS.ShareExtension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND
|
|
||||||
|
|
||||||
private void NavigateToPage(ContentPage page)
|
private void NavigateToPage(ContentPage page)
|
||||||
{
|
{
|
||||||
var navigationPage = new NavigationPage(page);
|
var navigationPage = new NavigationPage(page);
|
||||||
|
|
||||||
var window = new Window(navigationPage);
|
|
||||||
window.ToHandler(MauiContextSingleton.Instance.MauiContext);
|
|
||||||
|
|
||||||
_currentModalController = navigationPage.ToUIViewController(MauiContextSingleton.Instance.MauiContext);
|
_currentModalController = navigationPage.ToUIViewController(MauiContextSingleton.Instance.MauiContext);
|
||||||
_currentModalController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
|
_currentModalController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
|
||||||
_presentingOnNavigationPage = true;
|
_presentingOnNavigationPage = true;
|
||||||
PresentViewController(_currentModalController, true, null);
|
PresentViewController(_currentModalController, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public void DismissLockAndContinue()
|
public void DismissLockAndContinue()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("BW Log, Dismissing lock controller.");
|
Debug.WriteLine("BW Log, Dismissing lock controller.");
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
|
|
||||||
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
|
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
|
||||||
|
|
||||||
<DefineConstants>$(DefineConstants);ENABLED_TAP_GESTURE_RECOGNIZER_MAUI_EMBEDDED_WORKAROUND</DefineConstants>
|
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
||||||
<RootNamespace>Bit.iOS.ShareExtension</RootNamespace>
|
<RootNamespace>Bit.iOS.ShareExtension</RootNamespace>
|
||||||
|
@ -67,7 +65,6 @@
|
||||||
<Compile Include="ExtensionNavigationController.designer.cs">
|
<Compile Include="ExtensionNavigationController.designer.cs">
|
||||||
<DependentUpon>ExtensionNavigationController.cs</DependentUpon>
|
<DependentUpon>ExtensionNavigationController.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="LoadingViewController.TapGestureHack.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BundleResource Include="..\App\Platforms\iOS\Resources\logo_white%403x.png">
|
<BundleResource Include="..\App\Platforms\iOS\Resources\logo_white%403x.png">
|
||||||
|
|
Loading…
Reference in a new issue