mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-18 16:01:44 +00:00
fix: trakt duplicating same timestamp history
This commit is contained in:
parent
70d3eee9d2
commit
ac48ab11b2
4 changed files with 40 additions and 3 deletions
|
|
@ -382,8 +382,10 @@ object WatchProgressRepository {
|
|||
ContinueWatchingPreferencesRepository.removeDismissedNextUpKeysForContent(entry.parentMetaId)
|
||||
}
|
||||
|
||||
val useTraktProgress = shouldUseTraktProgress()
|
||||
|
||||
entriesByVideoId[session.videoId] = entry
|
||||
if (shouldUseTraktProgress()) {
|
||||
if (useTraktProgress) {
|
||||
TraktProgressRepository.applyOptimisticProgress(entry)
|
||||
}
|
||||
publish()
|
||||
|
|
@ -392,7 +394,9 @@ object WatchProgressRepository {
|
|||
resolveRemoteMetadata()
|
||||
}
|
||||
pushScrobbleToServer(entry)
|
||||
WatchingActions.onProgressEntryUpdated(entry)
|
||||
if (shouldCascadeCompletedProgressToWatchedHistory(entry, useTraktProgress)) {
|
||||
WatchingActions.onProgressEntryUpdated(entry)
|
||||
}
|
||||
}
|
||||
|
||||
private fun pushScrobbleToServer(entry: WatchProgressEntry) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@ internal fun WatchProgressEntry.shouldUseAsCompletedSeedForContinueWatching(): B
|
|||
return explicitPercent >= WatchProgressTraktPlaybackNextUpSeedPercentThreshold
|
||||
}
|
||||
|
||||
internal fun shouldCascadeCompletedProgressToWatchedHistory(
|
||||
entry: WatchProgressEntry,
|
||||
isUsingTraktProgress: Boolean,
|
||||
): Boolean = !isUsingTraktProgress && entry.normalizedCompletion().isCompleted
|
||||
|
||||
internal fun String?.isSeriesTypeForContinueWatching(): Boolean =
|
||||
equals("series", ignoreCase = true) || equals("tv", ignoreCase = true)
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,34 @@ class WatchProgressRulesTest {
|
|||
assertFalse(history.shouldTreatAsInProgressForContinueWatching())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `completed progress does not cascade to watched history while Trakt progress is active`() {
|
||||
val completed = entry(
|
||||
videoId = "movie-complete",
|
||||
isCompleted = true,
|
||||
)
|
||||
val inProgress = completed.copy(isCompleted = false)
|
||||
|
||||
assertFalse(
|
||||
shouldCascadeCompletedProgressToWatchedHistory(
|
||||
entry = completed,
|
||||
isUsingTraktProgress = true,
|
||||
),
|
||||
)
|
||||
assertTrue(
|
||||
shouldCascadeCompletedProgressToWatchedHistory(
|
||||
entry = completed,
|
||||
isUsingTraktProgress = false,
|
||||
),
|
||||
)
|
||||
assertFalse(
|
||||
shouldCascadeCompletedProgressToWatchedHistory(
|
||||
entry = inProgress,
|
||||
isUsingTraktProgress = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `codec normalizes completed entries inferred from percent`() {
|
||||
val payload = WatchProgressCodec.encodeEntries(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
CURRENT_PROJECT_VERSION=62
|
||||
MARKETING_VERSION=0.1.20
|
||||
MARKETING_VERSION=0.1.0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue