diff --git a/src/App/Pages/Vault/AddEditPage.xaml b/src/App/Pages/Vault/AddEditPage.xaml index f89ce6d2d..ac4193031 100644 --- a/src/App/Pages/Vault/AddEditPage.xaml +++ b/src/App/Pages/Vault/AddEditPage.xaml @@ -15,17 +15,7 @@ - - - @@ -33,16 +23,31 @@ + + x:Key="collectionsItem" + x:Name="_collectionsItem" + Clicked="Collections_Clicked" + Order="Secondary" /> + x:Key="shareItem" + x:Name="_shareItem" + Clicked="Share_Clicked" + Order="Secondary" /> + + + diff --git a/src/App/Pages/Vault/AddEditPage.xaml.cs b/src/App/Pages/Vault/AddEditPage.xaml.cs index 0ebcb73b7..e7f27ec99 100644 --- a/src/App/Pages/Vault/AddEditPage.xaml.cs +++ b/src/App/Pages/Vault/AddEditPage.xaml.cs @@ -46,14 +46,15 @@ namespace Bit.App.Pages _vm.DefaultUri = uri ?? appOptions?.Uri; _vm.Init(); SetActivityIndicator(); - if(!_vm.EditMode || Device.RuntimePlatform == Device.iOS) + if(_vm.EditMode && Device.RuntimePlatform == Device.Android) { - ToolbarItems.Remove(_attachmentsItem); - ToolbarItems.Remove(_deleteItem); + ToolbarItems.Add(_attachmentsItem); + ToolbarItems.Add(_deleteItem); } - if(Device.RuntimePlatform == Device.Android) + if(Device.RuntimePlatform == Device.iOS) { - ToolbarItems.RemoveAt(0); + ToolbarItems.Add(_closeItem); + ToolbarItems.Add(_moreItem); } _typePicker.ItemDisplayBinding = new Binding("Key"); @@ -237,6 +238,43 @@ namespace Bit.App.Pages } } + private async void More_Clicked(object sender, System.EventArgs e) + { + if(!DoOnce()) + { + return; + } + var options = new List { AppResources.Attachments }; + if(_vm.EditMode) + { + options.Add(_vm.Cipher.OrganizationId != null ? AppResources.Share : AppResources.Collections); + } + var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel, + _vm.EditMode ? AppResources.Delete : null, options.ToArray()); + if(selection == AppResources.Delete) + { + if(await _vm.DeleteAsync()) + { + await Navigation.PopModalAsync(); + } + } + else if(selection == AppResources.Attachments) + { + var page = new AttachmentsPage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + else if(selection == AppResources.Collections) + { + var page = new CollectionsPage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + else if(selection == AppResources.Share) + { + var page = new SharePage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + } + private async void Close_Clicked(object sender, System.EventArgs e) { if(DoOnce()) diff --git a/src/App/Pages/Vault/ViewPage.xaml b/src/App/Pages/Vault/ViewPage.xaml index d26b7dac0..92017518d 100644 --- a/src/App/Pages/Vault/ViewPage.xaml +++ b/src/App/Pages/Vault/ViewPage.xaml @@ -16,13 +16,6 @@ - - - - - - - @@ -38,6 +31,16 @@ x:Name="_shareItem" Clicked="Share_Clicked" Order="Secondary" /> + + + + + diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs index 4640ed368..c285f1c89 100644 --- a/src/App/Pages/Vault/ViewPage.xaml.cs +++ b/src/App/Pages/Vault/ViewPage.xaml.cs @@ -1,4 +1,5 @@ -using Bit.Core.Abstractions; +using Bit.App.Resources; +using Bit.Core.Abstractions; using Bit.Core.Utilities; using System.Collections.Generic; using System.Threading.Tasks; @@ -25,15 +26,16 @@ namespace Bit.App.Pages if(Device.RuntimePlatform == Device.iOS) { _absLayout.Children.Remove(_fab); - ToolbarItems.RemoveAt(2); - ToolbarItems.RemoveAt(2); + ToolbarItems.Add(_closeItem); + ToolbarItems.Add(_editItem); + ToolbarItems.Add(_moreItem); } else { - ToolbarItems.RemoveAt(0); - ToolbarItems.RemoveAt(0); _fab.Clicked = EditButton_Clicked; _mainLayout.Padding = new Thickness(0, 0, 0, 75); + ToolbarItems.Add(_attachmentsItem); + ToolbarItems.Add(_deleteItem); } } @@ -145,6 +147,40 @@ namespace Bit.App.Pages } } + private async void More_Clicked(object sender, System.EventArgs e) + { + if(!DoOnce()) + { + return; + } + var options = new List { AppResources.Attachments }; + options.Add(_vm.Cipher.OrganizationId != null ? AppResources.Share : AppResources.Collections); + var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel, + AppResources.Delete, options.ToArray()); + if(selection == AppResources.Delete) + { + if(await _vm.DeleteAsync()) + { + await Navigation.PopModalAsync(); + } + } + else if(selection == AppResources.Attachments) + { + var page = new AttachmentsPage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + else if(selection == AppResources.Collections) + { + var page = new CollectionsPage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + else if(selection == AppResources.Share) + { + var page = new SharePage(_vm.CipherId); + await Navigation.PushModalAsync(new NavigationPage(page)); + } + } + private async void Close_Clicked(object sender, System.EventArgs e) { if(DoOnce()) diff --git a/src/iOS/Resources/more.png b/src/iOS/Resources/more.png new file mode 100644 index 000000000..c54bb2da0 Binary files /dev/null and b/src/iOS/Resources/more.png differ diff --git a/src/iOS/Resources/more@2x.png b/src/iOS/Resources/more@2x.png new file mode 100644 index 000000000..0b5b03261 Binary files /dev/null and b/src/iOS/Resources/more@2x.png differ diff --git a/src/iOS/Resources/more@3x.png b/src/iOS/Resources/more@3x.png new file mode 100644 index 000000000..d587310ba Binary files /dev/null and b/src/iOS/Resources/more@3x.png differ diff --git a/src/iOS/Resources/more_vert.png b/src/iOS/Resources/more_vert.png new file mode 100644 index 000000000..c09d0888e Binary files /dev/null and b/src/iOS/Resources/more_vert.png differ diff --git a/src/iOS/Resources/more_vert@2x.png b/src/iOS/Resources/more_vert@2x.png new file mode 100644 index 000000000..7ad71d8d4 Binary files /dev/null and b/src/iOS/Resources/more_vert@2x.png differ diff --git a/src/iOS/Resources/more_vert@3x.png b/src/iOS/Resources/more_vert@3x.png new file mode 100644 index 000000000..ae39a7835 Binary files /dev/null and b/src/iOS/Resources/more_vert@3x.png differ diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 37689dbc9..c90a1b54c 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -331,4 +331,22 @@ false + + + + + + + + + + + + + + + + + + \ No newline at end of file