PM-3350 Migrated the CustomViewCellRenderer for iOS

This commit is contained in:
Dinis Vieira 2023-10-17 22:23:04 +01:00
parent 8c623a2067
commit 455c3a257c
No known key found for this signature in database
GPG key ID: 9389160FF6C295F3
3 changed files with 28 additions and 1 deletions

View file

@ -5,7 +5,7 @@ using UIKit;
namespace Bit.iOS.Core.Handlers
{
//This is a Compatibility verion of the NavigationRenderer. Eventually we should see if there's a better way to implement this behavior.
//This is a Compatibility version of the NavigationRenderer. Eventually we should see if there's a better way to implement this behavior.
public class CustomNavigationHandler : Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer
{
public override void PushViewController(UIViewController viewController, bool animated)

View file

@ -0,0 +1,26 @@
using Bit.App.Utilities;
using UIKit;
namespace Bit.iOS.Core.Handlers
{
//This is a Compatibility version of the ViewCellRenderer. Eventually we should see if there's a better way to implement this behavior.
public class CustomViewCellHandler : Microsoft.Maui.Controls.Handlers.Compatibility.ViewCellRenderer
{
private bool _noSelectionStyle = false;
public CustomViewCellHandler()
{
_noSelectionStyle = !(ThemeManager.GetResourceColor("BackgroundColor").Equals(Colors.White));
}
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
if (_noSelectionStyle)
{
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
}
return cell;
}
}
}

View file

@ -47,6 +47,7 @@ namespace Bit.iOS.Core.Utilities
{
handlers.AddHandler(typeof(TabsPage), typeof(Handlers.CustomTabbedHandler));
handlers.AddHandler(typeof(NavigationPage), typeof(Handlers.CustomNavigationHandler));
handlers.AddHandler(typeof(ViewCell), typeof(Handlers.CustomViewCellHandler));
handlers.AddHandler(typeof(ContentPage), typeof(Handlers.CustomContentPageHandler));
Handlers.ButtonHandlerMappings.Setup();
Handlers.DatePickerHandlerMappings.Setup();