From baf785d9f1385e79b1cadc900a730492e4354e25 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Mon, 11 Dec 2017 12:51:16 -0800 Subject: [PATCH] App: LoginPage.cs: Use a logo for the login button (#200) * App: LoginPage.cs: Use a logo for the login button This adds a helper function which we can use to set logos for Windows platforms to ensure the user can see the UWP toolbar actions. This won't have an effect on non-Windows platforms. Signed-off-by: Alistair Francis * App: Pages: Set an icon for the save button on Windows Signed-off-by: Alistair Francis * App: Pages: Set an icon for submit, save and continue Set an icon for the submit, save and continue buttons when running on Windows platforms. Signed-off-by: Alistair Francis * App: Pages: Valut: Set an icon for the edit button Set the cog icon for the edit button when running on Windows platforms. Signed-off-by: Alistair Francis --- src/App/Pages/EnvironmentPage.cs | 3 ++- src/App/Pages/Lock/LockPasswordPage.cs | 2 +- src/App/Pages/LoginPage.cs | 2 +- src/App/Pages/LoginTwoFactorPage.cs | 2 +- src/App/Pages/PasswordHintPage.cs | 2 +- src/App/Pages/RegisterPage.cs | 2 +- src/App/Pages/Settings/SettingsAddFolderPage.cs | 2 +- src/App/Pages/Settings/SettingsEditFolderPage.cs | 2 +- src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs | 2 +- src/App/Pages/Vault/VaultAddCipherPage.cs | 2 +- src/App/Pages/Vault/VaultAttachmentsPage.cs | 2 +- src/App/Pages/Vault/VaultCustomFieldsPage.cs | 2 +- src/App/Pages/Vault/VaultEditCipherPage.cs | 2 +- src/App/Pages/Vault/VaultViewCipherPage.cs | 1 + src/App/Utilities/Helpers.cs | 11 +++++++++++ 15 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/App/Pages/EnvironmentPage.cs b/src/App/Pages/EnvironmentPage.cs index d7780e699..dc34c5f4f 100644 --- a/src/App/Pages/EnvironmentPage.cs +++ b/src/App/Pages/EnvironmentPage.cs @@ -2,6 +2,7 @@ using Bit.App.Abstractions; using Bit.App.Controls; using Bit.App.Resources; +using Bit.App.Utilities; using Xamarin.Forms; using XLabs.Ioc; using Acr.UserDialogs; @@ -111,7 +112,7 @@ namespace Bit.App.Pages Content = StackLayout }; - var toolbarItem = new ToolbarItem(AppResources.Save, null, async () => await SaveAsync(), + var toolbarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => await SaveAsync(), ToolbarItemOrder.Default, 0); if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows) diff --git a/src/App/Pages/Lock/LockPasswordPage.cs b/src/App/Pages/Lock/LockPasswordPage.cs index 26ac0db2a..5507825b7 100644 --- a/src/App/Pages/Lock/LockPasswordPage.cs +++ b/src/App/Pages/Lock/LockPasswordPage.cs @@ -81,7 +81,7 @@ namespace Bit.App.Pages table.EstimatedRowHeight = 70; } - var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () => + var loginToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("login.png"), async () => { await CheckPasswordAsync(); }, ToolbarItemOrder.Default, 0); diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index c70b41a91..2e7d1045b 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -112,7 +112,7 @@ namespace Bit.App.Pages })); } - var loginToolbarItem = new ToolbarItem(AppResources.LogIn, null, async () => + var loginToolbarItem = new ToolbarItem(AppResources.LogIn, Helpers.ToolbarImage("login.png"), async () => { await LogIn(); }, ToolbarItemOrder.Default, 0); diff --git a/src/App/Pages/LoginTwoFactorPage.cs b/src/App/Pages/LoginTwoFactorPage.cs index 8a3d77d91..0d2ef215a 100644 --- a/src/App/Pages/LoginTwoFactorPage.cs +++ b/src/App/Pages/LoginTwoFactorPage.cs @@ -114,7 +114,7 @@ namespace Bit.App.Pages else if(_providerType.Value == TwoFactorProviderType.Authenticator || _providerType.Value == TwoFactorProviderType.Email) { - var continueToolbarItem = new ToolbarItem(AppResources.Continue, null, async () => + var continueToolbarItem = new ToolbarItem(AppResources.Continue, Helpers.ToolbarImage("login.png"), async () => { var token = TokenCell?.Entry.Text.Trim().Replace(" ", ""); await LogInAsync(token); diff --git a/src/App/Pages/PasswordHintPage.cs b/src/App/Pages/PasswordHintPage.cs index 3c61b7fd2..db20e1216 100644 --- a/src/App/Pages/PasswordHintPage.cs +++ b/src/App/Pages/PasswordHintPage.cs @@ -80,7 +80,7 @@ namespace Bit.App.Pages table.EstimatedRowHeight = 70; } - var submitToolbarItem = new ToolbarItem(AppResources.Submit, null, async () => + var submitToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("ion_chevron_right.png"), async () => { await SubmitAsync(); }, ToolbarItemOrder.Default, 0); diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index 30a16bfc1..6236aeac4 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -117,7 +117,7 @@ namespace Bit.App.Pages Content = StackLayout }; - var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () => + var loginToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("ion_chevron_right.png"), async () => { await Register(); }, ToolbarItemOrder.Default, 0); diff --git a/src/App/Pages/Settings/SettingsAddFolderPage.cs b/src/App/Pages/Settings/SettingsAddFolderPage.cs index 0381548fe..cb17231df 100644 --- a/src/App/Pages/Settings/SettingsAddFolderPage.cs +++ b/src/App/Pages/Settings/SettingsAddFolderPage.cs @@ -56,7 +56,7 @@ namespace Bit.App.Pages table.EstimatedRowHeight = 70; } - var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () => + var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent()) { diff --git a/src/App/Pages/Settings/SettingsEditFolderPage.cs b/src/App/Pages/Settings/SettingsEditFolderPage.cs index 2d4b1528b..348cda4cc 100644 --- a/src/App/Pages/Settings/SettingsEditFolderPage.cs +++ b/src/App/Pages/Settings/SettingsEditFolderPage.cs @@ -73,7 +73,7 @@ namespace Bit.App.Pages mainTable.EstimatedRowHeight = 70; } - var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () => + var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent()) { diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index 6ec9199e6..523e68d27 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -112,7 +112,7 @@ namespace Bit.App.Pages if(_passwordValueAction != null) { - var selectToolBarItem = new ToolbarItem(AppResources.Select, null, async () => + var selectToolBarItem = new ToolbarItem(AppResources.Select, Helpers.ToolbarImage("ion_chevron_right.png"), async () => { if(_fromAutofill) { diff --git a/src/App/Pages/Vault/VaultAddCipherPage.cs b/src/App/Pages/Vault/VaultAddCipherPage.cs index 65cc33762..3a864f98f 100644 --- a/src/App/Pages/Vault/VaultAddCipherPage.cs +++ b/src/App/Pages/Vault/VaultAddCipherPage.cs @@ -572,7 +572,7 @@ namespace Bit.App.Pages private void InitSave() { - var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () => + var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent()) { diff --git a/src/App/Pages/Vault/VaultAttachmentsPage.cs b/src/App/Pages/Vault/VaultAttachmentsPage.cs index 9063bf51a..144a53733 100644 --- a/src/App/Pages/Vault/VaultAttachmentsPage.cs +++ b/src/App/Pages/Vault/VaultAttachmentsPage.cs @@ -132,7 +132,7 @@ namespace Bit.App.Pages Margin = new Thickness(0, 40, 0, 0) }; - var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () => + var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent() || _cipher == null) { diff --git a/src/App/Pages/Vault/VaultCustomFieldsPage.cs b/src/App/Pages/Vault/VaultCustomFieldsPage.cs index d68fe76a3..759f1db29 100644 --- a/src/App/Pages/Vault/VaultCustomFieldsPage.cs +++ b/src/App/Pages/Vault/VaultCustomFieldsPage.cs @@ -64,7 +64,7 @@ namespace Bit.App.Pages Margin = new Thickness(10, 40, 10, 0) }; - SaveToolbarItem = new ToolbarItem(AppResources.Save, null, async () => + SaveToolbarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent() || _cipher == null) { diff --git a/src/App/Pages/Vault/VaultEditCipherPage.cs b/src/App/Pages/Vault/VaultEditCipherPage.cs index a1ca91432..ca88e0ea8 100644 --- a/src/App/Pages/Vault/VaultEditCipherPage.cs +++ b/src/App/Pages/Vault/VaultEditCipherPage.cs @@ -438,7 +438,7 @@ namespace Bit.App.Pages private void InitSave() { - var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () => + var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent()) { diff --git a/src/App/Pages/Vault/VaultViewCipherPage.cs b/src/App/Pages/Vault/VaultViewCipherPage.cs index 40cdc86b7..0dab43c50 100644 --- a/src/App/Pages/Vault/VaultViewCipherPage.cs +++ b/src/App/Pages/Vault/VaultViewCipherPage.cs @@ -500,6 +500,7 @@ namespace Bit.App.Pages _page = page; _cipherId = cipherId; Text = AppResources.Edit; + Icon = Helpers.ToolbarImage("cog.png"); ClickAction = async () => await ClickedItem(); } diff --git a/src/App/Utilities/Helpers.cs b/src/App/Utilities/Helpers.cs index 7bd09a7d1..0f6f11346 100644 --- a/src/App/Utilities/Helpers.cs +++ b/src/App/Utilities/Helpers.cs @@ -73,6 +73,17 @@ namespace Bit.App.Utilities return " "; } + + public static string ToolbarImage(string image) + { + if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android) + { + return null; + } + + return image; + } + public static async void CipherMoreClickedAsync(Page page, VaultListPageModel.Cipher cipher, bool autofill) { var buttons = new List { AppResources.View, AppResources.Edit };