Skip to content

Commit

Permalink
Issue fix: favorites page not updating each time you unfavorite a game
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamboooz committed Dec 6, 2023
1 parent 500d547 commit 6f9ad32
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
11 changes: 10 additions & 1 deletion Gavilya/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,16 @@ private void CreateJumpLists(GameList games)
IconResourcePath = Assembly.GetEntryAssembly()?.Location
});

jumpList.JumpItems.Add(new JumpTask()
jumpList.JumpItems.Add(new JumpTask()
{
Title = Gavilya.Properties.Resources.Favorites,
Arguments = "/page 2",
Description = Gavilya.Properties.Resources.Favorites,
CustomCategory = Gavilya.Properties.Resources.Tasks,
IconResourcePath = Assembly.GetEntryAssembly()?.Location
});

jumpList.JumpItems.Add(new JumpTask()
{
Title = Gavilya.Properties.Resources.MyProfile,
Arguments = "/page 3",
Expand Down
6 changes: 3 additions & 3 deletions Gavilya/Models/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public enum Page
{
Home,
Library,
Recent,
Profile,
Favorites
Favorites,
Recent,
Profile
}

public enum View
Expand Down
6 changes: 6 additions & 0 deletions Gavilya/ViewModels/GameCardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ private void Fav(object? obj)
IsFavorite = !IsFavorite;
_game.IsFavorite = IsFavorite;
_games[_games.IndexOf(_game)] = _game;

// update the favorites page each time you change the favorite state of a game card, so when the last game is unfavorited the favorites page empty card appears
if (_mainViewModel.CurrentViewModel is FavPageViewModel)
{
_mainViewModel.CurrentViewModel = new FavPageViewModel(_mainViewModel.Games, _tags, _mainViewModel);
}
}

private void Check(object? obj)
Expand Down
1 change: 0 additions & 1 deletion Gavilya/ViewModels/NavBarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ private void FavoritesPage(object? obj)
_mainViewModel.CurrentViewModel = new FavPageViewModel(Games, _tags, _mainViewModel);
}


private void RecentPage(object? obj)
{
_mainViewModel.CurrentViewModel = new RecentPageViewModel(Games, _tags, _mainViewModel);
Expand Down

0 comments on commit 6f9ad32

Please sign in to comment.