diff --git a/src/App/Pages/BaseContentPage.cs b/src/App/Pages/BaseContentPage.cs index 7db32ae72..dce78688b 100644 --- a/src/App/Pages/BaseContentPage.cs +++ b/src/App/Pages/BaseContentPage.cs @@ -18,7 +18,7 @@ namespace Bit.App.Pages protected async Task LoadOnAppearedAsync(View viewToSet, bool fromModal, Func workFunction) { - async Task LoadAsync() + async Task DoWorkAsync() { await workFunction.Invoke(); if(viewToSet != null) @@ -26,15 +26,15 @@ namespace Bit.App.Pages Content = viewToSet; } } - if(Device.RuntimePlatform == Device.iOS) + if(!fromModal || Device.RuntimePlatform == Device.iOS) { - await LoadAsync(); + await DoWorkAsync(); return; } await Task.Run(async () => { - await Task.Delay(fromModal ? 400 : 200); - Device.BeginInvokeOnMainThread(async () => await LoadAsync()); + await Task.Delay(400); + Device.BeginInvokeOnMainThread(async () => await DoWorkAsync()); }); } } diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml index fb0ea25f3..d52a90aef 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -1,5 +1,5 @@  - - - + - + diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs index a34b5a8f0..f2c6379ea 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs @@ -1,17 +1,12 @@ using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -using Xamarin.Forms.Xaml; namespace Bit.App.Pages { - public partial class GroupingsPage : ContentPage + public partial class GroupingsPage : BaseContentPage { private readonly IBroadcasterService _broadcasterService; private readonly ISyncService _syncService; @@ -25,6 +20,7 @@ namespace Bit.App.Pages string collectionId = null, string pageTitle = null) { InitializeComponent(); + SetActivityIndicator(); _broadcasterService = ServiceContainer.Resolve("broadcasterService"); _syncService = ServiceContainer.Resolve("syncService"); _viewModel = BindingContext as GroupingsPageViewModel; @@ -52,18 +48,21 @@ namespace Bit.App.Pages } }); - if(!_syncService.SyncInProgress) + await LoadOnAppearedAsync(_mainLayout, false, async () => { - await _viewModel.LoadAsync(); - } - else - { - await Task.Delay(5000); - if(!_viewModel.Loaded) + if(!_syncService.SyncInProgress) { await _viewModel.LoadAsync(); } - } + else + { + await Task.Delay(5000); + if(!_viewModel.Loaded) + { + await _viewModel.LoadAsync(); + } + } + }); } protected override void OnDisappearing()