more options button for ios on folder add/edit

This commit is contained in:
Kyle Spearrin 2019-07-22 10:52:19 -04:00
parent 50623b9b29
commit 392e429dfd
3 changed files with 31 additions and 3 deletions

View File

@ -21,6 +21,15 @@
IsDestructive="True"
x:Name="_deleteItem" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" x:Name="_moreItem"
x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" />
</ResourceDictionary>
</ContentPage.Resources>
<ScrollView x:Name="_scrollView">
<StackLayout Spacing="20">

View File

@ -1,4 +1,6 @@
using Xamarin.Forms;
using Bit.App.Resources;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Bit.App.Pages
{
@ -19,6 +21,10 @@ namespace Bit.App.Pages
{
ToolbarItems.Remove(_deleteItem);
}
if(_vm.EditMode && Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(_moreItem);
}
if(Device.RuntimePlatform == Device.Android)
{
ToolbarItems.RemoveAt(0);
@ -61,5 +67,20 @@ namespace Bit.App.Pages
await Navigation.PopModalAsync();
}
}
private async void More_Clicked(object sender, System.EventArgs e)
{
if(!DoOnce())
{
return;
}
var options = new List<string> { };
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
_vm.EditMode ? AppResources.Delete : null, options.ToArray());
if(selection == AppResources.Delete)
{
await _vm.DeleteAsync();
}
}
}
}

View File

@ -10,14 +10,12 @@ namespace Bit.App.Pages
{
public class FoldersPageViewModel : BaseViewModel
{
private readonly IPlatformUtilsService _platformUtilsService;
private readonly IFolderService _folderService;
private bool _showNoData;
public FoldersPageViewModel()
{
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
_folderService = ServiceContainer.Resolve<IFolderService>("folderService");
PageTitle = AppResources.Folders;