mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-27 17:08:00 +01:00
Fixed flickering on iOS while loading collections for the collection crash hotfix (#1852)
This commit is contained in:
parent
1d9671bc5c
commit
383eee6ec7
@ -178,7 +178,9 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
// TODO: refactor this
|
||||
if (Device.RuntimePlatform == Device.Android)
|
||||
if (Device.RuntimePlatform == Device.Android
|
||||
||
|
||||
GroupedSends.Any())
|
||||
{
|
||||
var items = new List<ISendGroupingsPageListItem>();
|
||||
foreach (var itemGroup in groupedSends)
|
||||
@ -191,16 +193,30 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
// HACK: This waitings are to avoid crash on iOS
|
||||
GroupedSends.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<ISendGroupingsPageListItem>();
|
||||
foreach (var itemGroup in groupedSends)
|
||||
{
|
||||
GroupedSends.Add(new SendGroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
|
||||
await Task.Delay(60);
|
||||
if (!first)
|
||||
{
|
||||
items.Add(new SendGroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
items.AddRange(itemGroup);
|
||||
}
|
||||
|
||||
GroupedSends.AddRange(itemGroup);
|
||||
if (groupedSends.Any())
|
||||
{
|
||||
GroupedSends.ReplaceRange(new List<ISendGroupingsPageListItem> { new SendGroupingsPageHeaderListItem(groupedSends[0].Name, groupedSends[0].ItemCount) });
|
||||
GroupedSends.AddRange(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
GroupedSends.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,9 @@ namespace Bit.App.Pages
|
||||
};
|
||||
|
||||
// TODO: refactor this
|
||||
if (Device.RuntimePlatform == Device.Android)
|
||||
if (Device.RuntimePlatform == Device.Android
|
||||
||
|
||||
GroupedItems.Any())
|
||||
{
|
||||
var items = new List<ISettingsPageListItem>();
|
||||
foreach (var itemGroup in settingsListGroupItems)
|
||||
@ -528,20 +530,31 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.InvokeOnMainThreadAsync(async () =>
|
||||
// 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<ISettingsPageListItem>();
|
||||
foreach (var itemGroup in settingsListGroupItems)
|
||||
{
|
||||
// HACK: This waitings are to avoid crash on iOS
|
||||
GroupedItems.Clear();
|
||||
await Task.Delay(60);
|
||||
|
||||
foreach (var itemGroup in settingsListGroupItems)
|
||||
if (!first)
|
||||
{
|
||||
GroupedItems.Add(new SettingsPageHeaderListItem(itemGroup.Name));
|
||||
await Task.Delay(60);
|
||||
|
||||
GroupedItems.AddRange(itemGroup);
|
||||
items.Add(new SettingsPageHeaderListItem(itemGroup.Name));
|
||||
}
|
||||
}).FireAndForget();
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
items.AddRange(itemGroup);
|
||||
}
|
||||
|
||||
if (settingsListGroupItems.Any())
|
||||
{
|
||||
GroupedItems.ReplaceRange(new List<ISettingsPageListItem> { new SettingsPageHeaderListItem(settingsListGroupItems[0].Name) });
|
||||
GroupedItems.AddRange(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
GroupedItems.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,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)
|
||||
@ -121,16 +123,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();
|
||||
}
|
||||
}
|
||||
ShowList = groupedItems.Any();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user