1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-21 10:43:22 +00:00

[PM-5154] Implement combined view for passwords and passkeys on iOS Autofill extension (#3075)

* PM-5154 Implemented combined view of passwords and passkeys and improved search and items UI

* PM-5154 Code improvement from PR feedback

* PM-5154 Code improvement to log unknown exceptions
This commit is contained in:
Federico Maccaroni
2024-03-13 12:06:08 -03:00
committed by GitHub
parent 53aedea93a
commit 144fc7c727
18 changed files with 775 additions and 203 deletions

View File

@@ -1,14 +1,14 @@
using System;
using System.Threading.Tasks;
using Bit.Core.Resources.Localization;
using Bit.Core.Services;
using Bit.iOS.Autofill.Models;
using Bit.iOS.Autofill.Utilities;
using Bit.iOS.Core.Controllers;
using Bit.iOS.Core.Utilities;
using Bit.iOS.Core.Views;
using Foundation;
using UIKit;
using Bit.iOS.Core.Controllers;
using Bit.Core.Resources.Localization;
using Bit.iOS.Core.Views;
using Bit.iOS.Autofill.Utilities;
using Bit.iOS.Core.Utilities;
using Bit.App.Abstractions;
using Bit.Core.Utilities;
namespace Bit.iOS.Autofill
{
@@ -26,22 +26,35 @@ namespace Bit.iOS.Autofill
public async override void ViewDidLoad()
{
base.ViewDidLoad();
NavItem.Title = AppResources.SearchVault;
CancelBarButton.Title = AppResources.Cancel;
SearchBar.Placeholder = AppResources.Search;
SearchBar.BackgroundColor = SearchBar.BarTintColor = ThemeHelpers.ListHeaderBackgroundColor;
SearchBar.UpdateThemeIfNeeded();
try
{
base.ViewDidLoad();
TableView.RowHeight = UITableView.AutomaticDimension;
TableView.EstimatedRowHeight = 44;
var tableSource = new TableSource(this);
TableView.Source = tableSource;
tableSource.RegisterTableViewCells(TableView);
SearchBar.Delegate = new ExtensionSearchDelegate(TableView);
await ((TableSource)TableView.Source).LoadAsync(false, SearchBar.Text);
NavItem.Title = AppResources.SearchVault;
CancelBarButton.Title = AppResources.Cancel;
SearchBar.Placeholder = AppResources.Search;
SearchBar.BackgroundColor = SearchBar.BarTintColor = ThemeHelpers.ListHeaderBackgroundColor;
SearchBar.UpdateThemeIfNeeded();
TableView.RowHeight = UITableView.AutomaticDimension;
TableView.EstimatedRowHeight = 55;
var tableSource = new TableSource(this);
TableView.Source = tableSource;
tableSource.RegisterTableViewCells(TableView);
if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
{
TableView.SectionHeaderTopPadding = 0;
}
SearchBar.Delegate = new ExtensionSearchDelegate(TableView);
await ReloadItemsAsync();
}
catch (Exception ex)
{
LoggerHelper.LogEvenIfCantBeResolved(ex);
}
}
public override void ViewDidAppear(bool animated)
@@ -90,11 +103,20 @@ namespace Bit.iOS.Autofill
{
DismissViewController(true, async () =>
{
await ((TableSource)TableView.Source).LoadAsync(false, SearchBar.Text);
TableView.ReloadData();
await ReloadItemsAsync();
});
}
public void OnItemsLoaded(string searchFilter) { }
public async Task ReloadItemsAsync()
{
await((TableSource)TableView.Source).LoadAsync(false, SearchBar.Text);
TableView.ReloadData();
}
public void ReloadTableViewData() => TableView.ReloadData();
public class TableSource : BaseLoginListTableSource<LoginSearchViewController>
{
public TableSource(LoginSearchViewController controller)