From 18ff6c797680e2017345444762825a2c223f6765 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 24 Apr 2019 23:37:47 -0400 Subject: [PATCH] refreshing --- .../Vault/GroupingsPage/GroupingsPage.xaml | 4 +-- .../GroupingsPage/GroupingsPageViewModel.cs | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml index 68f44b232..8ecc3b075 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -81,9 +81,9 @@ ItemsSource="{Binding GroupedItems}" VerticalOptions="FillAndExpand" HasUnevenRows="true" - RefreshCommand="{Binding LoadCommand}" + RefreshCommand="{Binding RefreshCommand}" IsPullToRefreshEnabled="true" - IsRefreshing="{Binding Loading, Mode=OneWay}" + IsRefreshing="{Binding Refreshing}" CachingStrategy="RecycleElement" ItemTemplate="{StaticResource listItemDataTemplateSelector}" IsGroupingEnabled="True" diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index 1dccc6d20..a027388cc 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -13,11 +13,12 @@ namespace Bit.App.Pages { public class GroupingsPageViewModel : BaseViewModel { - private bool _loading = false; - private bool _loaded = false; - private bool _showAddCipherButton = false; - private bool _showNoData = false; - private bool _showList = false; + private bool _refreshing; + private bool _loading; + private bool _loaded; + private bool _showAddCipherButton; + private bool _showNoData; + private bool _showList; private string _noDataText; private List _allCiphers; @@ -33,9 +34,14 @@ namespace Bit.App.Pages _collectionService = ServiceContainer.Resolve("collectionService"); _syncService = ServiceContainer.Resolve("syncService"); + Loading = true; PageTitle = AppResources.MyVault; GroupedItems = new ExtendedObservableCollection(); - LoadCommand = new Command(async () => await LoadAsync()); + RefreshCommand = new Command(async () => + { + Refreshing = true; + await LoadAsync(); + }); AddCipherCommand = new Command(() => { /* TODO */ }); } @@ -55,6 +61,11 @@ namespace Bit.App.Pages public List Collections { get; set; } public List> NestedCollections { get; set; } + public bool Refreshing + { + get => _refreshing; + set => SetProperty(ref _refreshing, value); + } public bool Loading { get => _loading; @@ -86,7 +97,7 @@ namespace Bit.App.Pages set => SetProperty(ref _showList, value); } public ExtendedObservableCollection GroupedItems { get; set; } - public Command LoadCommand { get; set; } + public Command RefreshCommand { get; set; } public Command AddCipherCommand { get; set; } public async Task LoadAsync() @@ -135,6 +146,7 @@ namespace Bit.App.Pages ShowList = !ShowNoData; Loaded = true; Loading = false; + Refreshing = false; } }