mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
[PM-6506] Fix double execution of command on returnType Go (#3039)
cherrypicked from: 4e0a18cce5
This commit is contained in:
parent
6bf7a492c6
commit
36c32fbabd
5 changed files with 30 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.Maui.Platform;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace Bit.App.Pages
|
|||
_apiEntry.ReturnCommand = new Command(() => _identityEntry.Focus());
|
||||
_identityEntry.ReturnType = ReturnType.Next;
|
||||
_identityEntry.ReturnCommand = new Command(() => _iconsEntry.Focus());
|
||||
_vm.SubmitSuccessAction = () => MainThread.BeginInvokeOnMainThread(async () => await SubmitSuccessAsync());
|
||||
_vm.SubmitSuccessTask = () => MainThread.InvokeOnMainThreadAsync(SubmitSuccessAsync);
|
||||
_vm.CloseAction = async () =>
|
||||
{
|
||||
await Navigation.PopModalAsync();
|
||||
|
@ -37,6 +38,12 @@ namespace Bit.App.Pages
|
|||
{
|
||||
_platformUtilsService.ShowToast("success", null, AppResources.EnvironmentSaved);
|
||||
await Navigation.PopModalAsync();
|
||||
#if ANDROID
|
||||
if (Platform.CurrentActivity.CurrentFocus != null)
|
||||
{
|
||||
Platform.CurrentActivity.HideKeyboard(Platform.CurrentActivity.CurrentFocus);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Close_Clicked(object sender, EventArgs e)
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Bit.App.Pages
|
|||
public string WebVaultUrl { get; set; }
|
||||
public string IconsUrl { get; set; }
|
||||
public string NotificationsUrls { get; set; }
|
||||
public Action SubmitSuccessAction { get; set; }
|
||||
public Func<Task> SubmitSuccessTask { get; set; }
|
||||
public Action CloseAction { get; set; }
|
||||
|
||||
public async Task SubmitAsync()
|
||||
|
@ -73,7 +73,10 @@ namespace Bit.App.Pages
|
|||
IconsUrl = resUrls.Icons;
|
||||
NotificationsUrls = resUrls.Notifications;
|
||||
|
||||
SubmitSuccessAction?.Invoke();
|
||||
if (SubmitSuccessTask != null)
|
||||
{
|
||||
await SubmitSuccessTask();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateUrls()
|
||||
|
|
|
@ -452,7 +452,11 @@ namespace Bit.iOS.Autofill
|
|||
ThemeManager.ApplyResourcesTo(environmentPage);
|
||||
if (environmentPage.BindingContext is EnvironmentPageViewModel vm)
|
||||
{
|
||||
vm.SubmitSuccessAction = () => DismissViewController(false, () => LaunchHomePage());
|
||||
vm.SubmitSuccessTask = async () =>
|
||||
{
|
||||
await DismissViewControllerAsync(false);
|
||||
await MainThread.InvokeOnMainThreadAsync(() => LaunchHomePage());
|
||||
};
|
||||
vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage());
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ using Bit.iOS.Core.Views;
|
|||
using Bit.iOS.Extension.Models;
|
||||
using CoreNFC;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.ApplicationModel;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Platform;
|
||||
using MobileCoreServices;
|
||||
|
@ -528,7 +529,11 @@ namespace Bit.iOS.Extension
|
|||
ThemeManager.ApplyResourcesTo(environmentPage);
|
||||
if (environmentPage.BindingContext is EnvironmentPageViewModel vm)
|
||||
{
|
||||
vm.SubmitSuccessAction = () => DismissViewController(false, () => LaunchHomePage());
|
||||
vm.SubmitSuccessTask = async () =>
|
||||
{
|
||||
await DismissViewControllerAsync(false);
|
||||
await MainThread.InvokeOnMainThreadAsync(() => LaunchHomePage());
|
||||
};
|
||||
vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ using Bit.iOS.Core.Views;
|
|||
using Bit.iOS.ShareExtension.Models;
|
||||
using CoreNFC;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.ApplicationModel;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Platform;
|
||||
using MobileCoreServices;
|
||||
|
@ -321,7 +322,11 @@ namespace Bit.iOS.ShareExtension
|
|||
ThemeManager.ApplyResourcesTo(environmentPage);
|
||||
if (environmentPage.BindingContext is EnvironmentPageViewModel vm)
|
||||
{
|
||||
vm.SubmitSuccessAction = () => DismissAndLaunch(() => LaunchHomePage());
|
||||
vm.SubmitSuccessTask = async () =>
|
||||
{
|
||||
await DismissViewControllerAsync(false);
|
||||
await MainThread.InvokeOnMainThreadAsync(() => LaunchHomePage());
|
||||
};
|
||||
vm.CloseAction = () => DismissAndLaunch(() => LaunchHomePage());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue