settings about dialog

This commit is contained in:
Kyle Spearrin 2019-05-15 09:14:49 -04:00
parent 291c201b00
commit 67e458833f
2 changed files with 24 additions and 6 deletions

View file

@ -40,6 +40,10 @@ namespace Bit.App.Pages
{ {
await Navigation.PushModalAsync(new NavigationPage(new FoldersPage())); await Navigation.PushModalAsync(new NavigationPage(new FoldersPage()));
} }
else if(item.Name == AppResources.About)
{
await _vm.AboutAsync();
}
} }
} }
} }

View file

@ -1,26 +1,40 @@
using Bit.App.Resources; using Bit.App.Resources;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Input; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public class SettingsPageViewModel : BaseViewModel public class SettingsPageViewModel : BaseViewModel
{ {
private readonly IPlatformUtilsService _platformUtilsService;
public SettingsPageViewModel() public SettingsPageViewModel()
{ {
PageTitle = AppResources.Settings; _platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
ButtonCommand = new Command(() => Page.DisplayAlert("Button 1 Command", "Button 1 message", "Cancel")); PageTitle = AppResources.Settings;
Button2Command = new Command(() => Page.DisplayAlert("Button 2 Command", "Button 2 message", "Cancel"));
BuildList(); BuildList();
} }
public ICommand ButtonCommand { get; }
public ICommand Button2Command { get; }
public List<SettingsPageListGroup> GroupedItems { get; set; } public List<SettingsPageListGroup> GroupedItems { get; set; }
public async Task AboutAsync()
{
var debugText = string.Format("{0}: {1}", AppResources.Version,
_platformUtilsService.GetApplicationVersion());
var text = string.Format("© 8bit Solutions LLC 2015-{0}\n\n{1}", DateTime.Now.Year, debugText);
var copy = await _platformUtilsService.ShowDialogAsync(text, AppResources.Bitwarden, AppResources.Copy,
AppResources.Close);
if(copy)
{
await _platformUtilsService.CopyToClipboardAsync(debugText);
}
}
private void BuildList() private void BuildList()
{ {
var doUpper = Device.RuntimePlatform != Device.Android; var doUpper = Device.RuntimePlatform != Device.Android;