handle some loading race conditions
This commit is contained in:
parent
28166f79a1
commit
8df4c27203
|
@ -6,7 +6,6 @@ using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
@ -78,6 +77,10 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
else if(message.Command == "syncCompleted")
|
else if(message.Command == "syncCompleted")
|
||||||
{
|
{
|
||||||
|
if(!_vm.LoadedOnce)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
Device.BeginInvokeOnMainThread(() =>
|
||||||
{
|
{
|
||||||
|
@ -92,8 +95,15 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
if(!_syncService.SyncInProgress)
|
if(!_syncService.SyncInProgress)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
try
|
||||||
await _vm.LoadAsync();
|
{
|
||||||
|
await _vm.LoadAsync();
|
||||||
|
}
|
||||||
|
catch(Exception e) when(e.Message.Contains("No key."))
|
||||||
|
{
|
||||||
|
await Task.Delay(5000);
|
||||||
|
await _vm.LoadAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,6 +126,7 @@ namespace Bit.App.Pages
|
||||||
public ExtendedObservableCollection<GroupingsPageListGroup> GroupedItems { get; set; }
|
public ExtendedObservableCollection<GroupingsPageListGroup> GroupedItems { get; set; }
|
||||||
public Command RefreshCommand { get; set; }
|
public Command RefreshCommand { get; set; }
|
||||||
public Command<CipherView> CipherOptionsCommand { get; set; }
|
public Command<CipherView> CipherOptionsCommand { get; set; }
|
||||||
|
public bool LoadedOnce { get; set; }
|
||||||
|
|
||||||
public async Task LoadAsync()
|
public async Task LoadAsync()
|
||||||
{
|
{
|
||||||
|
@ -134,6 +135,7 @@ namespace Bit.App.Pages
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_doingLoad = true;
|
_doingLoad = true;
|
||||||
|
LoadedOnce = true;
|
||||||
ShowNoData = false;
|
ShowNoData = false;
|
||||||
Loading = true;
|
Loading = true;
|
||||||
ShowList = false;
|
ShowList = false;
|
||||||
|
|
Loading…
Reference in New Issue