Skip to content
Permalink
Browse files

Force season data refresh when show follow status changes

  • Loading branch information...
chrisbanes committed Aug 27, 2019
1 parent e877b6a commit 6408a4ae5499f7e2930cd3e806f9d00ef133a9c5
@@ -109,7 +109,7 @@ class SeasonsEpisodesRepository @Inject constructor(
}
}

suspend fun updateShowEpisodeWatchesIfNeeded(
suspend fun updateShowEpisodeWatches(
showId: Long,
refreshType: RefreshType = RefreshType.QUICK,
forceRefresh: Boolean = false,
@@ -44,4 +44,6 @@ open class EntityLastRequestStore(
suspend fun updateLastRequest(entityId: Long, timestamp: Instant = Instant.now()) {
dao.insert(LastRequest(request = request, entityId = entityId, timestamp = timestamp))
}

suspend fun invalidateLastRequest(entityId: Long) = updateLastRequest(entityId, Instant.EPOCH)
}
@@ -43,6 +43,8 @@ open class GroupLastRequestStore(
dao.insert(LastRequest(request = request, entityId = DEFAULT_ID, timestamp = timestamp))
}

suspend fun invalidateLastRequest() = updateLastRequest(Instant.EPOCH)

companion object {
private const val DEFAULT_ID = 0L
}
@@ -46,10 +46,8 @@ class ChangeShowFollowStatus @Inject constructor(
followedShowsRepository.addFollowedShow(showId)
// Update seasons, episodes and watches
if (!params.deferDataFetch) {
if (seasonsEpisodesRepository.needShowSeasonsUpdate(showId)) {
seasonsEpisodesRepository.updateSeasonsEpisodes(showId)
}
seasonsEpisodesRepository.updateShowEpisodeWatchesIfNeeded(showId)
seasonsEpisodesRepository.updateSeasonsEpisodes(showId)
seasonsEpisodesRepository.updateShowEpisodeWatches(showId, forceRefresh = true)
}
}

@@ -66,7 +66,7 @@ class UpdateFollowedShows @Inject constructor(
seasonEpisodeRepository.updateSeasonsEpisodes(it.showId)
}

seasonEpisodeRepository.updateShowEpisodeWatchesIfNeeded(
seasonEpisodeRepository.updateShowEpisodeWatches(
it.showId,
params.type,
params.forceRefresh,

0 comments on commit 6408a4a

Please sign in to comment.
You can’t perform that action at this time.