Skip to content

Commit

Permalink
Merge pull request #171 from Gamhub-io/fix/crash_feed_again
Browse files Browse the repository at this point in the history
Fix: crash feed again
  • Loading branch information
bricefriha authored Jan 24, 2025
2 parents 70ce313 + 0880889 commit 3215db2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: ['develop']
types: [opened, synchronize, reopened]
env:
BUILD_VERSION: '1.6'
BUILD_VERSION: '1.5'
DOTNET_VERSION: 9.0.x
XCODE_VERSION: 16.2
DOTNET_VERSION_TARGETS: net9.0
Expand Down
18 changes: 13 additions & 5 deletions App/ViewModels/FeedsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public int CurrentFeedIndex
set
{
_currentFeedIndex = value;
//SwitchTabs(_currentFeedIndex);


OnPropertyChanged(nameof(CurrentFeedIndex));

Expand Down Expand Up @@ -398,7 +398,7 @@ private async Task AggregateFeed(Feed feed, bool force = true)
if (force)
{
// Update list of articles
InsertArticles(articles);
InsertArticles(articles, force);
SelectedFeed.IsLoaded = true;

IsRefreshing = false;
Expand Down Expand Up @@ -426,14 +426,22 @@ private async Task AggregateFeed(Feed feed, bool force = true)
/// Insert a set of articles in the current list
/// </summary>
/// <param name="articles">articles to add</param>
private void InsertArticles(IEnumerable<Article> articles)
/// <param name="force">if true we overwrite the current article list</param>
private void InsertArticles(IEnumerable<Article> articles, bool force = false)
{
ObservableRangeCollection<Article> articlesOld = new (_articles);
Articles = new ObservableRangeCollection<Article>();
if (force)
{
Articles = new ObservableRangeCollection<Article>(articles);
return;
}

Articles = new ObservableRangeCollection<Article>();

Articles.AddRange(articles);
if (articlesOld.Any())
Articles.AddRange(articlesOld);
Articles.AddRange(articlesOld);

}

// See detail of the article
Expand Down

0 comments on commit 3215db2

Please sign in to comment.