From e05708979d61be54bb628a11faefe19a427ff8b4 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 11 Jun 2019 21:31:51 -0400 Subject: [PATCH] close buttons for ios --- src/App/Pages/Accounts/EnvironmentPage.xaml | 1 + .../Pages/Accounts/EnvironmentPage.xaml.cs | 12 +++++ src/App/Pages/Accounts/HintPage.xaml | 1 + src/App/Pages/Accounts/HintPage.xaml.cs | 13 +++++ src/App/Pages/Accounts/LoginPage.xaml | 1 + src/App/Pages/Accounts/LoginPage.xaml.cs | 12 +++++ src/App/Pages/Accounts/RegisterPage.xaml | 1 + src/App/Pages/Accounts/RegisterPage.xaml.cs | 12 +++++ src/App/Pages/Accounts/TwoFactorPage.xaml | 4 ++ src/App/Pages/Accounts/TwoFactorPage.xaml.cs | 12 +++++ .../Pages/Generator/GeneratorHistoryPage.xaml | 1 + .../Generator/GeneratorHistoryPage.xaml.cs | 8 +++ src/App/Pages/Settings/FolderAddEditPage.xaml | 1 + .../Pages/Settings/FolderAddEditPage.xaml.cs | 18 ++++++- src/App/Pages/Settings/FoldersPage.xaml | 4 ++ src/App/Pages/Settings/FoldersPage.xaml.cs | 9 ++++ src/App/Pages/Settings/OptionsPage.xaml | 4 ++ src/App/Pages/Settings/OptionsPage.xaml.cs | 9 ++++ src/App/Pages/Settings/SyncPage.xaml | 5 ++ src/App/Pages/Settings/SyncPage.xaml.cs | 13 +++++ src/App/Pages/Vault/AddEditPage.xaml | 1 + src/App/Pages/Vault/AddEditPage.xaml.cs | 14 +++++- src/App/Pages/Vault/AttachmentsPage.xaml | 1 + src/App/Pages/Vault/AttachmentsPage.xaml.cs | 12 +++++ src/App/Pages/Vault/CiphersPage.xaml | 4 ++ src/App/Pages/Vault/CiphersPage.xaml.cs | 12 +++++ src/App/Pages/Vault/CollectionsPage.xaml | 1 + src/App/Pages/Vault/CollectionsPage.xaml.cs | 12 +++++ src/App/Pages/Vault/PasswordHistoryPage.xaml | 4 ++ .../Pages/Vault/PasswordHistoryPage.xaml.cs | 13 +++++ src/App/Pages/Vault/ScanPage.xaml | 4 ++ src/App/Pages/Vault/ScanPage.xaml.cs | 12 +++++ src/App/Pages/Vault/SharePage.xaml | 1 + src/App/Pages/Vault/SharePage.xaml.cs | 12 +++++ src/App/Pages/Vault/ViewPage.xaml | 1 + src/App/Pages/Vault/ViewPage.xaml.cs | 50 +++++++++++-------- 36 files changed, 271 insertions(+), 24 deletions(-) diff --git a/src/App/Pages/Accounts/EnvironmentPage.xaml b/src/App/Pages/Accounts/EnvironmentPage.xaml index 9d8c87ca5..d78da40ba 100644 --- a/src/App/Pages/Accounts/EnvironmentPage.xaml +++ b/src/App/Pages/Accounts/EnvironmentPage.xaml @@ -13,6 +13,7 @@ + diff --git a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs index ba49650bb..9f32d8b57 100644 --- a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs +++ b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs @@ -12,6 +12,10 @@ namespace Bit.App.Pages InitializeComponent(); _vm = BindingContext as EnvironmentPageViewModel; _vm.Page = this; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } _webVaultEntry.ReturnType = ReturnType.Next; _webVaultEntry.ReturnCommand = new Command(() => _apiEntry.Focus()); @@ -28,5 +32,13 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Accounts/HintPage.xaml b/src/App/Pages/Accounts/HintPage.xaml index 51599e599..64b73e1b4 100644 --- a/src/App/Pages/Accounts/HintPage.xaml +++ b/src/App/Pages/Accounts/HintPage.xaml @@ -13,6 +13,7 @@ + diff --git a/src/App/Pages/Accounts/HintPage.xaml.cs b/src/App/Pages/Accounts/HintPage.xaml.cs index ca94490c7..5eb5c09f5 100644 --- a/src/App/Pages/Accounts/HintPage.xaml.cs +++ b/src/App/Pages/Accounts/HintPage.xaml.cs @@ -1,4 +1,5 @@ using System; +using Xamarin.Forms; namespace Bit.App.Pages { @@ -11,6 +12,10 @@ namespace Bit.App.Pages InitializeComponent(); _vm = BindingContext as HintPageViewModel; _vm.Page = this; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } protected override void OnAppearing() @@ -26,5 +31,13 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Accounts/LoginPage.xaml b/src/App/Pages/Accounts/LoginPage.xaml index 603066461..ad5af3525 100644 --- a/src/App/Pages/Accounts/LoginPage.xaml +++ b/src/App/Pages/Accounts/LoginPage.xaml @@ -20,6 +20,7 @@ + diff --git a/src/App/Pages/Accounts/LoginPage.xaml.cs b/src/App/Pages/Accounts/LoginPage.xaml.cs index 000a76e9a..3913bcdef 100644 --- a/src/App/Pages/Accounts/LoginPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginPage.xaml.cs @@ -14,6 +14,10 @@ namespace Bit.App.Pages _vm.Page = this; _vm.Email = email; MasterPasswordEntry = _masterPassword; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } _email.ReturnType = ReturnType.Next; _email.ReturnCommand = new Command(() => _masterPassword.Focus()); @@ -50,5 +54,13 @@ namespace Bit.App.Pages Navigation.PushModalAsync(new NavigationPage(new HintPage())); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Accounts/RegisterPage.xaml b/src/App/Pages/Accounts/RegisterPage.xaml index 4e869c61d..787dfb50b 100644 --- a/src/App/Pages/Accounts/RegisterPage.xaml +++ b/src/App/Pages/Accounts/RegisterPage.xaml @@ -20,6 +20,7 @@ + diff --git a/src/App/Pages/Accounts/RegisterPage.xaml.cs b/src/App/Pages/Accounts/RegisterPage.xaml.cs index e7c60dc13..54d95eb73 100644 --- a/src/App/Pages/Accounts/RegisterPage.xaml.cs +++ b/src/App/Pages/Accounts/RegisterPage.xaml.cs @@ -21,6 +21,10 @@ namespace Bit.App.Pages }; MasterPasswordEntry = _masterPassword; ConfirmMasterPasswordEntry = _confirmMasterPassword; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } _email.ReturnType = ReturnType.Next; _email.ReturnCommand = new Command(() => _masterPassword.Focus()); @@ -46,5 +50,13 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml b/src/App/Pages/Accounts/TwoFactorPage.xaml index 3347da6f0..a17c229c0 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml @@ -22,6 +22,10 @@ + + + + diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs index 5526eaa33..52f0d84b0 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs @@ -24,6 +24,10 @@ namespace Bit.App.Pages _vm = BindingContext as TwoFactorPageViewModel; _vm.Page = this; DuoWebView = _duoWebView; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } public HybridWebView DuoWebView { get; set; } @@ -126,5 +130,13 @@ namespace Bit.App.Pages await _vm.SendEmailAsync(true, true); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Generator/GeneratorHistoryPage.xaml b/src/App/Pages/Generator/GeneratorHistoryPage.xaml index 7bd473634..48f635d52 100644 --- a/src/App/Pages/Generator/GeneratorHistoryPage.xaml +++ b/src/App/Pages/Generator/GeneratorHistoryPage.xaml @@ -23,6 +23,7 @@ + + + + + + diff --git a/src/App/Pages/Settings/FoldersPage.xaml.cs b/src/App/Pages/Settings/FoldersPage.xaml.cs index 5066cfccb..ceae14c21 100644 --- a/src/App/Pages/Settings/FoldersPage.xaml.cs +++ b/src/App/Pages/Settings/FoldersPage.xaml.cs @@ -21,6 +21,7 @@ namespace Bit.App.Pages } else { + ToolbarItems.RemoveAt(0); _fab.Clicked = AddButton_Clicked; } } @@ -57,5 +58,13 @@ namespace Bit.App.Pages await Navigation.PushModalAsync(new NavigationPage(page)); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Settings/OptionsPage.xaml b/src/App/Pages/Settings/OptionsPage.xaml index 95332be53..fe0c1edf0 100644 --- a/src/App/Pages/Settings/OptionsPage.xaml +++ b/src/App/Pages/Settings/OptionsPage.xaml @@ -12,6 +12,10 @@ + + + + diff --git a/src/App/Pages/Settings/OptionsPage.xaml.cs b/src/App/Pages/Settings/OptionsPage.xaml.cs index d9e7cc5a0..7333b268b 100644 --- a/src/App/Pages/Settings/OptionsPage.xaml.cs +++ b/src/App/Pages/Settings/OptionsPage.xaml.cs @@ -21,6 +21,7 @@ namespace Bit.App.Pages _clearClipboardPicker.ItemDisplayBinding = new Binding("Value"); if(Device.RuntimePlatform == Device.Android) { + ToolbarItems.RemoveAt(0); _vm.ShowAndroidAccessibilitySettings = true; _vm.ShowAndroidAutofillSettings = _deviceActionService.SupportsAutofillService(); _themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ", @@ -44,5 +45,13 @@ namespace Bit.App.Pages { await _vm.UpdateAutofillBlacklistedUris(); } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Settings/SyncPage.xaml b/src/App/Pages/Settings/SyncPage.xaml index b7b7488f3..5dee35dbe 100644 --- a/src/App/Pages/Settings/SyncPage.xaml +++ b/src/App/Pages/Settings/SyncPage.xaml @@ -7,10 +7,15 @@ xmlns:u="clr-namespace:Bit.App.Utilities" x:DataType="pages:SyncPageViewModel" Title="{Binding PageTitle}"> + + + + + + + diff --git a/src/App/Pages/Vault/AttachmentsPage.xaml.cs b/src/App/Pages/Vault/AttachmentsPage.xaml.cs index 06620a10f..163a00fb2 100644 --- a/src/App/Pages/Vault/AttachmentsPage.xaml.cs +++ b/src/App/Pages/Vault/AttachmentsPage.xaml.cs @@ -18,6 +18,10 @@ namespace Bit.App.Pages _vm.Page = this; _vm.CipherId = cipherId; SetActivityIndicator(); + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } protected override async void OnAppearing() @@ -59,5 +63,13 @@ namespace Bit.App.Pages await _vm.ChooseFileAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/CiphersPage.xaml b/src/App/Pages/Vault/CiphersPage.xaml index eb12cebf5..71f29893e 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml +++ b/src/App/Pages/Vault/CiphersPage.xaml @@ -15,6 +15,10 @@ + + + + diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs index 15a9143b2..544a41daf 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml.cs +++ b/src/App/Pages/Vault/CiphersPage.xaml.cs @@ -40,6 +40,10 @@ namespace Bit.App.Pages _vm.PageTitle = AppResources.SearchVault; } + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } _deviceActionService = ServiceContainer.Resolve("deviceActionService"); } @@ -116,5 +120,13 @@ namespace Bit.App.Pages await _vm.SelectCipherAsync(cipher); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/CollectionsPage.xaml b/src/App/Pages/Vault/CollectionsPage.xaml index 6f8031af0..18cd8487a 100644 --- a/src/App/Pages/Vault/CollectionsPage.xaml +++ b/src/App/Pages/Vault/CollectionsPage.xaml @@ -14,6 +14,7 @@ + diff --git a/src/App/Pages/Vault/CollectionsPage.xaml.cs b/src/App/Pages/Vault/CollectionsPage.xaml.cs index 13d08385f..aa75a1e23 100644 --- a/src/App/Pages/Vault/CollectionsPage.xaml.cs +++ b/src/App/Pages/Vault/CollectionsPage.xaml.cs @@ -13,6 +13,10 @@ namespace Bit.App.Pages _vm.Page = this; _vm.CipherId = cipherId; SetActivityIndicator(); + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } protected override async void OnAppearing() @@ -33,5 +37,13 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/PasswordHistoryPage.xaml b/src/App/Pages/Vault/PasswordHistoryPage.xaml index 4adc60f61..0720612f4 100644 --- a/src/App/Pages/Vault/PasswordHistoryPage.xaml +++ b/src/App/Pages/Vault/PasswordHistoryPage.xaml @@ -15,6 +15,10 @@ + + + + diff --git a/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs b/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs index 48fb9a570..a96e8c8c1 100644 --- a/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs +++ b/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs @@ -1,4 +1,5 @@ using System; +using Xamarin.Forms; namespace Bit.App.Pages { @@ -13,6 +14,10 @@ namespace Bit.App.Pages _vm = BindingContext as PasswordHistoryPageViewModel; _vm.Page = this; _vm.CipherId = cipherId; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } protected override async void OnAppearing() @@ -22,5 +27,13 @@ namespace Bit.App.Pages await _vm.InitAsync(); }); } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/ScanPage.xaml b/src/App/Pages/Vault/ScanPage.xaml index b6b6fff8a..91a96a545 100644 --- a/src/App/Pages/Vault/ScanPage.xaml +++ b/src/App/Pages/Vault/ScanPage.xaml @@ -9,6 +9,10 @@ x:Name="_page" Title="{u:I18n ScanQrTitle}"> + + + + diff --git a/src/App/Pages/Vault/ScanPage.xaml.cs b/src/App/Pages/Vault/ScanPage.xaml.cs index aad084545..afef77d45 100644 --- a/src/App/Pages/Vault/ScanPage.xaml.cs +++ b/src/App/Pages/Vault/ScanPage.xaml.cs @@ -21,6 +21,10 @@ namespace Bit.App.Pages PossibleFormats = new List { ZXing.BarcodeFormat.QR_CODE }, AutoRotate = false, }; + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } } protected override void OnAppearing() @@ -75,5 +79,13 @@ namespace Bit.App.Pages } _callback(null); } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/SharePage.xaml b/src/App/Pages/Vault/SharePage.xaml index d0f50250f..69b851b5f 100644 --- a/src/App/Pages/Vault/SharePage.xaml +++ b/src/App/Pages/Vault/SharePage.xaml @@ -14,6 +14,7 @@ + diff --git a/src/App/Pages/Vault/SharePage.xaml.cs b/src/App/Pages/Vault/SharePage.xaml.cs index 37b4be847..aac4f71cb 100644 --- a/src/App/Pages/Vault/SharePage.xaml.cs +++ b/src/App/Pages/Vault/SharePage.xaml.cs @@ -13,6 +13,10 @@ namespace Bit.App.Pages _vm.Page = this; _vm.CipherId = cipherId; SetActivityIndicator(); + if(Device.RuntimePlatform == Device.Android) + { + ToolbarItems.RemoveAt(0); + } _organizationPicker.ItemDisplayBinding = new Binding("Key"); } @@ -34,5 +38,13 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } + + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } } } diff --git a/src/App/Pages/Vault/ViewPage.xaml b/src/App/Pages/Vault/ViewPage.xaml index 5a79dae7b..1a906d35f 100644 --- a/src/App/Pages/Vault/ViewPage.xaml +++ b/src/App/Pages/Vault/ViewPage.xaml @@ -16,6 +16,7 @@ + diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs index 61df0945e..4640ed368 100644 --- a/src/App/Pages/Vault/ViewPage.xaml.cs +++ b/src/App/Pages/Vault/ViewPage.xaml.cs @@ -25,9 +25,12 @@ namespace Bit.App.Pages if(Device.RuntimePlatform == Device.iOS) { _absLayout.Children.Remove(_fab); + ToolbarItems.RemoveAt(2); + ToolbarItems.RemoveAt(2); } else { + ToolbarItems.RemoveAt(0); ToolbarItems.RemoveAt(0); _fab.Clicked = EditButton_Clicked; _mainLayout.Padding = new Thickness(0, 0, 0, 75); @@ -142,35 +145,40 @@ namespace Bit.App.Pages } } + private async void Close_Clicked(object sender, System.EventArgs e) + { + if(DoOnce()) + { + await Navigation.PopModalAsync(); + } + } + private void AdjustToolbar() { - if(Device.RuntimePlatform == Device.Android) + if(Device.RuntimePlatform != Device.Android || _vm.Cipher == null) { - if(_vm.Cipher == null) + return; + } + if(_vm.Cipher.OrganizationId == null) + { + if(ToolbarItems.Contains(_collectionsItem)) { - return; + ToolbarItems.Remove(_collectionsItem); } - if(_vm.Cipher.OrganizationId == null) + if(!ToolbarItems.Contains(_shareItem)) { - if(ToolbarItems.Contains(_collectionsItem)) - { - ToolbarItems.Remove(_collectionsItem); - } - if(!ToolbarItems.Contains(_shareItem)) - { - ToolbarItems.Insert(1, _shareItem); - } + ToolbarItems.Insert(1, _shareItem); } - else + } + else + { + if(ToolbarItems.Contains(_shareItem)) { - if(ToolbarItems.Contains(_shareItem)) - { - ToolbarItems.Remove(_shareItem); - } - if(!ToolbarItems.Contains(_collectionsItem)) - { - ToolbarItems.Insert(1, _collectionsItem); - } + ToolbarItems.Remove(_shareItem); + } + if(!ToolbarItems.Contains(_collectionsItem)) + { + ToolbarItems.Insert(1, _collectionsItem); } } }