1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-11 22:03:27 +00:00
Files
mobile/src/iOS.Core/Renderers/CollectionView/ExtendedGroupableItemsViewController.cs
André Bispo b23f29511c [PM-868] Re-open app to item could crash the app (#2813)
* [PM-868] Check for previous page before loading vault. Remove exception throw.

* [PM-868] Continue to throw exceptions
2023-10-04 15:48:04 +01:00

50 lines
1.8 KiB
C#

using System;
using Bit.App.Controls;
using Bit.Core.Services;
using Foundation;
using UIKit;
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 UICollectionViewDelegateFlowLayout CreateDelegator()
{
return new ExtendedGroupableItemsViewDelegator<TItemsView, ExtendedGroupableItemsViewController<TItemsView>>(ItemsViewLayout, this);
}
protected override void UpdateTemplatedCell(TemplatedCell cell, NSIndexPath indexPath)
{
try
{
base.UpdateTemplatedCell(cell, indexPath);
}
catch (Exception ex) when (ItemsView?.ExtraDataForLogging != null)
{
var colEx = new CollectionException("Error in ExtendedCollectionView -> ExtendedGroupableItemsViewController, extra data: " + ItemsView.ExtraDataForLogging, ex);
try
{
LoggerHelper.LogEvenIfCantBeResolved(colEx);
}
catch
{
// Do nothing in here, this is temporary to get more info about the crash, if the logger fails, we want to get the info
// by crashing with the original exception and not the logger one
}
if (ex is IndexOutOfRangeException)
{
return;
}
throw colEx;
}
}
}
}