mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 21:33:36 +00:00
Fixed flickering on iOS while loading collections for the collection crash hotfix (#1852)
This commit is contained in:
committed by
GitHub
parent
1d9671bc5c
commit
383eee6ec7
@@ -283,7 +283,9 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
// TODO: refactor this
|
||||
if (Device.RuntimePlatform == Device.Android)
|
||||
if (Device.RuntimePlatform == Device.Android
|
||||
||
|
||||
GroupedItems.Any())
|
||||
{
|
||||
var items = new List<IGroupingsPageListItem>();
|
||||
foreach (var itemGroup in groupedItems)
|
||||
@@ -296,16 +298,30 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
// HACK: This waitings are to avoid crash on iOS
|
||||
GroupedItems.Clear();
|
||||
await Task.Delay(60);
|
||||
|
||||
// HACK: we need this on iOS, so that it doesn't crash when adding coming from an empty list
|
||||
var first = true;
|
||||
var items = new List<IGroupingsPageListItem>();
|
||||
foreach (var itemGroup in groupedItems)
|
||||
{
|
||||
GroupedItems.Add(new GroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
|
||||
await Task.Delay(60);
|
||||
if (!first)
|
||||
{
|
||||
items.Add(new GroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
items.AddRange(itemGroup);
|
||||
}
|
||||
|
||||
GroupedItems.AddRange(itemGroup);
|
||||
if (groupedItems.Any())
|
||||
{
|
||||
GroupedItems.ReplaceRange(new List<IGroupingsPageListItem> { new GroupingsPageHeaderListItem(groupedItems[0].Name, groupedItems[0].ItemCount) });
|
||||
GroupedItems.AddRange(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
GroupedItems.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user