1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-21 02:33:36 +00:00

PS-785 Added logs for exceptions on UpdateTemplatedCell and the extra data on each ExtendedCollectionView usage (#1943)

This commit is contained in:
Federico Maccaroni
2022-06-07 15:57:53 -03:00
committed by GitHub
parent b223f5f16e
commit ec71b21264
13 changed files with 68 additions and 11 deletions

View File

@@ -0,0 +1,16 @@
using Bit.App.Controls;
using Bit.iOS.Core.Renderers.CollectionView;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(ExtendedCollectionView), typeof(ExtendedCollectionViewRenderer))]
namespace Bit.iOS.Core.Renderers.CollectionView
{
public class ExtendedCollectionViewRenderer : GroupableItemsViewRenderer<ExtendedCollectionView, GroupableItemsViewController<ExtendedCollectionView>>
{
protected override GroupableItemsViewController<ExtendedCollectionView> CreateController(ExtendedCollectionView itemsView, ItemsViewLayout layout)
{
return new ExtendedGroupableItemsViewController<ExtendedCollectionView>(itemsView, layout);
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using Bit.App.Controls;
using Foundation;
using Xamarin.Forms.Platform.iOS;
namespace Bit.iOS.Core.Renderers.CollectionView
{
public class ExtendedGroupableItemsViewController<TItemsView> : GroupableItemsViewController<TItemsView>
where TItemsView : ExtendedCollectionView
{
public ExtendedGroupableItemsViewController(TItemsView groupableItemsView, ItemsViewLayout layout)
: base(groupableItemsView, layout)
{
}
protected override void UpdateTemplatedCell(TemplatedCell cell, NSIndexPath indexPath)
{
try
{
base.UpdateTemplatedCell(cell, indexPath);
}
catch (Exception ex) when (ItemsView?.ExtraDataForLogging != null)
{
throw new Exception("Error in ExtendedCollectionView, extra data: " + ItemsView.ExtraDataForLogging, ex);
}
}
}
}

View File

@@ -138,6 +138,7 @@
<ItemGroup>
<Folder Include="Resources\" />
<Folder Include="Effects\" />
<Folder Include="Renderers\CollectionView\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
@@ -194,6 +195,8 @@
<Compile Include="Services\ClipboardService.cs" />
<Compile Include="Utilities\FontElementExtensions.cs" />
<Compile Include="Effects\ScrollViewContentInsetAdjustmentBehaviorEffect.cs" />
<Compile Include="Renderers\CollectionView\ExtendedCollectionViewRenderer.cs" />
<Compile Include="Renderers\CollectionView\ExtendedGroupableItemsViewController.cs" />
<Compile Include="Utilities\UISearchBarExtensions.cs" />
</ItemGroup>
<ItemGroup>