Skip to content

Commit

Permalink
(feat): fetch chapters on app load to display numNewUnread
Browse files Browse the repository at this point in the history
- so if any new chapters were released since you last opened the app,
  it will update immediately and indicate if there are any new unread
  chapters as of just now
  - prev would only show new unread chapters since the last time you
    clicked into the manga, which was bound to be out-of-date
  - other than multiple providers, this is the last big, must-have
    feature I really needed to make me consistently return & use this
    app instead of others
    - others are more "nice-to-have" or "very-nice-to-have", but not
      necessarily dealbreakers for me at least
  • Loading branch information
agilgur5 committed Nov 22, 2019
1 parent 43abaf5 commit 62f0424
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ persist('@mangaStoreKey', appStore, {
'mangas',
'favorites'
]
}).then(() => {
// fetch chapters on app load so that numNewUnread is updated
appStore.loadFavoritesChapters()
})

const App = () => (
Expand Down
4 changes: 4 additions & 0 deletions models/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const AppModel = types.model('App', {
self.favorites.splice(self.favorites.findIndex((elem) => {
return elem === self.selectedManga
}), 1)
},

loadFavoritesChapters () {
self.favorites.forEach((favorite) => favorite.loadChapters())
}}
})

Expand Down

0 comments on commit 62f0424

Please sign in to comment.