fix: reload favorites after modified

This commit is contained in:
2020-05-16 17:27:14 +08:00
parent 8a471b6272
commit 02ae52d5cc
4 changed files with 50 additions and 10 deletions

View File

@@ -21,6 +21,24 @@ namespace Pixiview.Illust
protected override ActivityIndicator LoadingIndicator => activityLoading;
protected override bool IsDelayLoading => true;
protected override void OnAppearing()
{
if (lastUpdated != LastUpdated)
{
StartLoad();
}
else
{
var favorites = Stores.Favorites;
if (favorites.Changed)
{
favorites.Reload();
lastUpdated = default;
StartLoad();
}
}
}
protected override IEnumerable<IllustItem> DoGetIllustList(IllustItem[] data)
{
return data;

View File

@@ -695,12 +695,6 @@ namespace Pixiview.Illust
}
}
public class IllustFavorite
{
public DateTime LastFavoriteUtc { get; set; }
public List<IllustItem> Illusts { get; set; }
}
public enum IllustType
{
Illust = 0,

View File

@@ -135,8 +135,7 @@ namespace Pixiview.Illust
fontIconLove = (ImageSource)Application.Current.Resources[ThemeBase.FontIconLove];
fontIconNotLove = (ImageSource)Application.Current.Resources[ThemeBase.FontIconNotLove];
var favorites = Stores.Favorites;
FavoriteIcon = favorites.Any(i => i.Id == illust.Id)
FavoriteIcon = Stores.Favorites.Any(i => i.Id == illust.Id)
? fontIconLove
: fontIconNotLove;