mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
* Enable Encrypted json export of vaults * Match jslib export of non-org ciphers * Clean up export * Update src/App/Pages/Settings/ExportVaultPage.xaml.cs Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using System;
|
|
using Bit.Core.Abstractions;
|
|
using Bit.Core.Utilities;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Bit.App.Pages
|
|
{
|
|
public partial class ExportVaultPage : BaseContentPage
|
|
{
|
|
private readonly ExportVaultPageViewModel _vm;
|
|
private readonly IBroadcasterService _broadcasterService;
|
|
|
|
public ExportVaultPage()
|
|
{
|
|
InitializeComponent();
|
|
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
|
_vm = BindingContext as ExportVaultPageViewModel;
|
|
_vm.Page = this;
|
|
_fileFormatPicker.ItemDisplayBinding = new Binding("Value");
|
|
MasterPasswordEntry = _masterPassword;
|
|
}
|
|
|
|
protected async override void OnAppearing()
|
|
{
|
|
base.OnAppearing();
|
|
await _vm.InitAsync();
|
|
_broadcasterService.Subscribe(nameof(ExportVaultPage), (message) =>
|
|
{
|
|
if (message.Command == "selectSaveFileResult")
|
|
{
|
|
Device.BeginInvokeOnMainThread(() =>
|
|
{
|
|
var data = message.Data as Tuple<string, string>;
|
|
if (data == null)
|
|
{
|
|
return;
|
|
}
|
|
_vm.SaveFileSelected(data.Item1, data.Item2);
|
|
});
|
|
}
|
|
});
|
|
RequestFocus(_masterPassword);
|
|
}
|
|
|
|
protected async override void OnDisappearing()
|
|
{
|
|
base.OnDisappearing();
|
|
_broadcasterService.Unsubscribe(nameof(ExportVaultPage));
|
|
}
|
|
|
|
public Entry MasterPasswordEntry { get; set; }
|
|
|
|
private async void Close_Clicked(object sender, System.EventArgs e)
|
|
{
|
|
if (DoOnce())
|
|
{
|
|
await Navigation.PopModalAsync();
|
|
}
|
|
}
|
|
|
|
private async void ExportVault_Clicked(object sender, EventArgs e)
|
|
{
|
|
if (DoOnce())
|
|
{
|
|
await _vm.ExportVaultAsync();
|
|
}
|
|
}
|
|
|
|
void FileFormat_Changed(object sender, EventArgs e)
|
|
{
|
|
_vm?.UpdateWarning();
|
|
}
|
|
}
|
|
}
|