From 98dd8298ea920e25b45938f805b005b5c70158e9 Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Tue, 15 Feb 2022 14:15:42 -0500 Subject: [PATCH] clear extra code and fix build --- .../Authenticator/AuthenticatorPage.xaml | 14 +- .../Authenticator/AuthenticatorPage.xaml.cs | 128 +++++++++--------- .../AuthenticatorPageViewModel.cs | 6 +- 3 files changed, 71 insertions(+), 77 deletions(-) diff --git a/src/App/Pages/Authenticator/AuthenticatorPage.xaml b/src/App/Pages/Authenticator/AuthenticatorPage.xaml index ed5e551c8..933183ba8 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPage.xaml +++ b/src/App/Pages/Authenticator/AuthenticatorPage.xaml @@ -4,14 +4,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Bit.App.Pages.Authenticator.AuthenticatorPage" xmlns:pages="clr-namespace:Bit.App.Pages" + xmlns:authenticator="clr-namespace:Bit.App.Pages.Authenticator" xmlns:controls="clr-namespace:Bit.App.Controls" - xmlns:u="clr-namespace:Bit.App.Utilities" - xmlns:pages1="clr-namespace:Bit.App.Pages.Authenticator" - x:DataType="pages:GeneratorPageViewModel" + x:DataType="authenticator:AuthenticatorPageViewModel" Title="{Binding PageTitle}"> - - - @@ -31,7 +25,7 @@ + IsVisible="{Binding ShowList}"> diff --git a/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs b/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs index ea25b66d1..9df5aad5a 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs +++ b/src/App/Pages/Authenticator/AuthenticatorPage.xaml.cs @@ -23,37 +23,37 @@ namespace Bit.App.Pages.Authenticator public AuthenticatorPage(bool fromTabPage, Action selectAction = null, TabsPage tabsPage = null) { - _tabsPage = tabsPage; + //_tabsPage = tabsPage; InitializeComponent(); - _broadcasterService = ServiceContainer.Resolve("broadcasterService"); + //_broadcasterService = ServiceContainer.Resolve("broadcasterService"); _vm = BindingContext as AuthenticatorPageViewModel; - _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); - } + //_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); + //} } public async Task InitAsync() @@ -64,26 +64,30 @@ namespace Bit.App.Pages.Authenticator protected async override void OnAppearing() { base.OnAppearing(); - if (!_fromTabPage) - { - await InitAsync(); - } - _broadcasterService.Subscribe(nameof(GeneratorPage), async (message) => - { - if (message.Command == "updatedTheme") - { - Device.BeginInvokeOnMainThread(() => - { - //_vm.RedrawPassword(); - }); - } - }); + //if (!_fromTabPage) + //{ + // await InitAsync(); + //} + //_broadcasterService.Subscribe(nameof(GeneratorPage), async (message) => + //{ + // if (message.Command == "updatedTheme") + // { + // Device.BeginInvokeOnMainThread(() => + // { + // //_vm.RedrawPassword(); + // }); + // } + //}); } protected override void OnDisappearing() { base.OnDisappearing(); - _broadcasterService.Unsubscribe(nameof(GeneratorPage)); + //_broadcasterService.Unsubscribe(nameof(GeneratorPage)); + } + + private async void RowSelected(object sender, SelectionChangedEventArgs e) + { } protected override bool OnBackButtonPressed() @@ -103,34 +107,24 @@ namespace Bit.App.Pages.Authenticator private async void More_Clicked(object sender, EventArgs e) { - if (!DoOnce()) - { - return; - } - var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel, - null, AppResources.PasswordHistory); - if (selection == AppResources.PasswordHistory) - { - var page = new GeneratorHistoryPage(); - await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page)); - } + //if (!DoOnce()) + //{ + // return; + //} + //var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel, + // null, AppResources.PasswordHistory); + //if (selection == AppResources.PasswordHistory) + //{ + // var page = new GeneratorHistoryPage(); + // await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page)); + //} } private void Select_Clicked(object sender, EventArgs e) { - _selectAction?.Invoke(_vm.Password); + //_selectAction?.Invoke(_vm.Password); } - private async void History_Clicked(object sender, EventArgs e) - { - var page = new GeneratorHistoryPage(); - await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page)); - } - - private async void LengthSlider_DragCompleted(object sender, EventArgs e) - { - await _vm.SliderChangedAsync(); - } private async void Close_Clicked(object sender, EventArgs e) { @@ -139,5 +133,7 @@ namespace Bit.App.Pages.Authenticator await Navigation.PopModalAsync(); } } + + } } diff --git a/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs b/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs index eaa466bd2..1876f8980 100644 --- a/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs +++ b/src/App/Pages/Authenticator/AuthenticatorPageViewModel.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Bit.Core.Abstractions; using Bit.Core.Utilities; +using Xamarin.Forms; namespace Bit.App.Pages.Authenticator { @@ -10,7 +11,7 @@ namespace Bit.App.Pages.Authenticator #region Members private readonly IClipboardService _clipboardService; - private bool _showList; + private bool _showList = true; private bool _refreshing; private readonly IUserService _userService; private readonly IVaultTimeoutService _vaultTimeoutService; @@ -58,6 +59,9 @@ namespace Bit.App.Pages.Authenticator #region Properties + public ExtendedObservableCollection Items { get; set; } + public Command RefreshCommand { get; set; } + public bool ShowList { get => _showList;