1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

SG-396 Fix tappable area after hiding account switching (#1956)

This commit is contained in:
Federico Maccaroni 2022-06-16 18:09:50 -03:00 committed by GitHub
parent 7c311fbb55
commit b2500557e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -65,6 +65,8 @@ namespace Bit.App.Controls
public bool LongPressAccountEnabled { get; set; } = true; public bool LongPressAccountEnabled { get; set; } = true;
public Action AfterHide { get; set; }
public async Task ToggleVisibilityAsync() public async Task ToggleVisibilityAsync()
{ {
if (IsVisible) if (IsVisible)
@ -137,6 +139,8 @@ namespace Bit.App.Controls
// remove overlay // remove overlay
IsVisible = false; IsVisible = false;
AfterHide?.Invoke();
}); });
} }

View File

@ -32,7 +32,14 @@ namespace Bit.iOS.Core.Utilities
{ {
var overlay = new AccountSwitchingOverlayView() var overlay = new AccountSwitchingOverlayView()
{ {
LongPressAccountEnabled = false LongPressAccountEnabled = false,
AfterHide = () =>
{
if (containerView != null)
{
containerView.Hidden = true;
}
}
}; };
var vm = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) var vm = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
@ -40,6 +47,7 @@ namespace Bit.iOS.Core.Utilities
FromIOSExtension = true FromIOSExtension = true
}; };
overlay.BindingContext = vm; overlay.BindingContext = vm;
overlay.IsVisible = false;
var renderer = Platform.CreateRenderer(overlay.Content); var renderer = Platform.CreateRenderer(overlay.Content);
renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height)); renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height));
@ -63,8 +71,13 @@ namespace Bit.iOS.Core.Utilities
public void OnToolbarItemActivated(AccountSwitchingOverlayView accountSwitchingOverlayView, UIView containerView) public void OnToolbarItemActivated(AccountSwitchingOverlayView accountSwitchingOverlayView, UIView containerView)
{ {
var overlayVisible = accountSwitchingOverlayView.IsVisible; var overlayVisible = accountSwitchingOverlayView.IsVisible;
if (!overlayVisible)
{
// So that the animation doesn't break we only care about showing it
// and the hiding if done through AccountSwitchingOverlayView -> AfterHide
containerView.Hidden = false;
}
accountSwitchingOverlayView.ToggleVisibililtyCommand.Execute(null); accountSwitchingOverlayView.ToggleVisibililtyCommand.Execute(null);
containerView.Hidden = false;
containerView.UserInteractionEnabled = !overlayVisible; containerView.UserInteractionEnabled = !overlayVisible;
containerView.Subviews[0].UserInteractionEnabled = !overlayVisible; containerView.Subviews[0].UserInteractionEnabled = !overlayVisible;
} }