From 3ac2580742bb9862490dc6e709cae6753054d7d0 Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Thu, 17 Feb 2022 11:26:14 -0500 Subject: [PATCH 1/2] add toolbar icons --- .../Authenticator/AuthenticatorPage.xaml | 107 ++++++++++++++---- .../Authenticator/AuthenticatorPage.xaml.cs | 98 ++++++++-------- .../AuthenticatorPageViewModel.cs | 5 +- src/App/Pages/TabsPage.cs | 2 +- 4 files changed, 135 insertions(+), 77 deletions(-) diff --git a/src/App/Pages/Authenticator/AuthenticatorPage.xaml b/src/App/Pages/Authenticator/AuthenticatorPage.xaml index 6632216c8..fde715061 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPage.xaml +++ b/src/App/Pages/Authenticator/AuthenticatorPage.xaml @@ -2,38 +2,95 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + + + + + + + + + diff --git a/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs b/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs index 9df5aad5a..f21e464b1 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs +++ b/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs @@ -7,7 +7,7 @@ using Xamarin.Forms; using Xamarin.Forms.PlatformConfiguration; using Xamarin.Forms.PlatformConfiguration.iOSSpecific; -namespace Bit.App.Pages.Authenticator +namespace Bit.App.Pages { public partial class AuthenticatorPage : BaseContentPage { @@ -30,30 +30,19 @@ namespace Bit.App.Pages.Authenticator //_vm.Page = this; //_fromTabPage = fromTabPage; //_selectAction = selectAction; - //var isIos = Device.RuntimePlatform == Device.iOS; - //if (selectAction != null) - //{ - // if (isIos) - // { - // ToolbarItems.Add(_closeItem); - // } - // ToolbarItems.Add(_selectItem); - //} - //else - //{ - // if (isIos) - // { - // ToolbarItems.Add(_moreItem); - // } - // else - // { - // ToolbarItems.Add(_historyItem); - // } - //} - //if (isIos) - //{ - // _typePicker.On().SetUpdateMode(UpdateMode.WhenFinished); - //} + + if (Device.RuntimePlatform == Device.iOS) + { + _absLayout.Children.Remove(_fab); + ToolbarItems.Add(_aboutIconItem); + ToolbarItems.Add(_addItem); + } + else + { + ToolbarItems.Add(_syncItem); + ToolbarItems.Add(_lockItem); + ToolbarItems.Add(_aboutTextItem); + } } public async Task InitAsync() @@ -80,26 +69,44 @@ namespace Bit.App.Pages.Authenticator //}); } - protected override void OnDisappearing() + + private async void Search_Clicked(object sender, EventArgs e) { - base.OnDisappearing(); - //_broadcasterService.Unsubscribe(nameof(GeneratorPage)); + if (DoOnce()) + { + // var page = new SendsPage(_vm.Filter, _vm.Type != null); + // await Navigation.PushModalAsync(new NavigationPage(page)); + } + } + + private async void Sync_Clicked(object sender, EventArgs e) + { + // await _vm.SyncAsync(); + } + + private async void Lock_Clicked(object sender, EventArgs e) + { + // await _vaultTimeoutService.LockAsync(true, true); + } + + private void About_Clicked(object sender, EventArgs e) + { + // _vm.ShowAbout(); + } + + private async void AddButton_Clicked(object sender, EventArgs e) + { + if (DoOnce()) + { + // var page = new SendAddEditPage(null, null, _vm.Type); + // await Navigation.PushModalAsync(new NavigationPage(page)); + } } private async void RowSelected(object sender, SelectionChangedEventArgs e) { } - protected override bool OnBackButtonPressed() - { - if (Device.RuntimePlatform == Device.Android && _tabsPage != null) - { - _tabsPage.ResetToVaultPage(); - return true; - } - return base.OnBackButtonPressed(); - } - private async void Copy_Clicked(object sender, EventArgs e) { //await _vm.CopyAsync(); @@ -120,20 +127,11 @@ namespace Bit.App.Pages.Authenticator //} } - private void Select_Clicked(object sender, EventArgs e) + protected override void OnDisappearing() { - //_selectAction?.Invoke(_vm.Password); + base.OnDisappearing(); + //_broadcasterService.Unsubscribe(nameof(GeneratorPage)); } - - - private async void Close_Clicked(object sender, EventArgs e) - { - if (DoOnce()) - { - await Navigation.PopModalAsync(); - } - } - } } diff --git a/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs b/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs index 1876f8980..49f12075a 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs +++ b/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs @@ -1,10 +1,11 @@ using System; using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Utilities; using Xamarin.Forms; -namespace Bit.App.Pages.Authenticator +namespace Bit.App.Pages { public class AuthenticatorPageViewModel : BaseViewModel { @@ -24,6 +25,8 @@ namespace Bit.App.Pages.Authenticator { _userService = ServiceContainer.Resolve("userService"); _vaultTimeoutService = ServiceContainer.Resolve("vaultTimeoutService"); + + PageTitle = AppResources.Authenticator; } #endregion diff --git a/src/App/Pages/TabsPage.cs b/src/App/Pages/TabsPage.cs index e6685839c..0a7f5304f 100644 --- a/src/App/Pages/TabsPage.cs +++ b/src/App/Pages/TabsPage.cs @@ -30,7 +30,7 @@ namespace Bit.App.Pages Children.Add(_groupingsPage); - _authenticatorPage = new NavigationPage(new Authenticator.AuthenticatorPage(true, null, this)) + _authenticatorPage = new NavigationPage(new AuthenticatorPage(true, null, this)) { Title = AppResources.Authenticator, IconImageSource = "info.png" From 0b626cedc7405ab7a20950159bd6b13f9a1202e3 Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Fri, 4 Mar 2022 16:44:22 -0500 Subject: [PATCH 2/2] got the countdown working --- .../AuthenticatorViewCell.xaml | 86 ++++++++++-- .../AuthenticatorViewCell.xaml.cs | 98 +++++++++---- .../AuthenticatorViewCellViewModel.cs | 36 ++++- .../Authenticator/AuthenticatorPage.xaml | 25 ++-- .../Authenticator/AuthenticatorPage.xaml.cs | 43 +++++- .../AuthenticatorPageListItem.cs | 129 ++++++++++++++++++ .../AuthenticatorPageViewModel.cs | 85 +++++++++++- 7 files changed, 442 insertions(+), 60 deletions(-) create mode 100644 src/App/Pages/Authenticator/AuthenticatorPageListItem.cs diff --git a/src/App/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml b/src/App/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml index 4d4e82554..2c5a31042 100644 --- a/src/App/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml +++ b/src/App/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml @@ -3,35 +3,92 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Bit.App.Controls.AuthenticatorViewCell" xmlns:controls="clr-namespace:Bit.App.Controls" + xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:u="clr-namespace:Bit.App.Utilities" xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:core="clr-namespace:Bit.Core;assembly=BitwardenCore" StyleClass="list-row, list-row-platform" RowSpacing="0" ColumnSpacing="0" - x:DataType="controls:AuthenticatorViewCellViewModel"> + x:DataType="pages:AuthenticatorPageListItem"> + + + + + + + - + - - + -