diff --git a/src/App/Pages/Vault/AttachmentsPage.xaml b/src/App/Pages/Vault/AttachmentsPage.xaml
index dd2b58605..0b56ab9c1 100644
--- a/src/App/Pages/Vault/AttachmentsPage.xaml
+++ b/src/App/Pages/Vault/AttachmentsPage.xaml
@@ -17,7 +17,7 @@
-
+
diff --git a/src/App/Pages/Vault/AttachmentsPage.xaml.cs b/src/App/Pages/Vault/AttachmentsPage.xaml.cs
index 6e9391866..9e5fb6d4e 100644
--- a/src/App/Pages/Vault/AttachmentsPage.xaml.cs
+++ b/src/App/Pages/Vault/AttachmentsPage.xaml.cs
@@ -51,14 +51,6 @@ namespace Bit.App.Pages
}
}
- private async void Save_Clicked(object sender, EventArgs e)
- {
- if (DoOnce())
- {
- await _vm.SubmitAsync();
- }
- }
-
private async void ChooseFile_Clicked(object sender, EventArgs e)
{
if (DoOnce())
diff --git a/src/App/Pages/Vault/AttachmentsPageViewModel.cs b/src/App/Pages/Vault/AttachmentsPageViewModel.cs
index 9dc284b42..6216f5ec9 100644
--- a/src/App/Pages/Vault/AttachmentsPageViewModel.cs
+++ b/src/App/Pages/Vault/AttachmentsPageViewModel.cs
@@ -1,6 +1,8 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using System.Windows.Input;
using Bit.App.Abstractions;
using Bit.App.Resources;
using Bit.Core.Abstractions;
@@ -8,6 +10,7 @@ using Bit.Core.Exceptions;
using Bit.Core.Models.Domain;
using Bit.Core.Models.View;
using Bit.Core.Utilities;
+using Xamarin.CommunityToolkit.ObjectModel;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -20,6 +23,7 @@ namespace Bit.App.Pages
private readonly IStateService _stateService;
private readonly IVaultTimeoutService _vaultTimeoutService;
private readonly IPlatformUtilsService _platformUtilsService;
+ private readonly ILogger _logger;
private CipherView _cipher;
private Cipher _cipherDomain;
private bool _hasAttachments;
@@ -35,8 +39,10 @@ namespace Bit.App.Pages
_platformUtilsService = ServiceContainer.Resolve("platformUtilsService");
_stateService = ServiceContainer.Resolve("stateService");
_vaultTimeoutService = ServiceContainer.Resolve("vaultTimeoutService");
+ _logger = ServiceContainer.Resolve();
Attachments = new ExtendedObservableCollection();
DeleteAttachmentCommand = new Command(DeleteAsync);
+ SubmitAsyncCommand = new AsyncCommand(SubmitAsync, allowsMultipleExecutions: false);
PageTitle = AppResources.Attachments;
}
@@ -59,6 +65,7 @@ namespace Bit.App.Pages
}
public byte[] FileData { get; set; }
public Command DeleteAttachmentCommand { get; set; }
+ public ICommand SubmitAsyncCommand { get; }
public async Task InitAsync()
{
@@ -125,6 +132,7 @@ namespace Bit.App.Pages
}
catch (ApiException e)
{
+ _logger.Exception(e);
await _deviceActionService.HideLoadingAsync();
if (e?.Error != null)
{
@@ -132,6 +140,12 @@ namespace Bit.App.Pages
AppResources.AnErrorHasOccurred);
}
}
+ catch (Exception e)
+ {
+ _logger.Exception(e);
+ await _deviceActionService.HideLoadingAsync();
+ await _platformUtilsService.ShowDialogAsync(AppResources.GenericErrorMessage, AppResources.AnErrorHasOccurred);
+ }
return false;
}