Skip to content

Commit

Permalink
Merge pull request #6997 from Bnyro/master
Browse files Browse the repository at this point in the history
fix: preference to only store watch positions for video doesn't work
  • Loading branch information
Bnyro authored Jan 22, 2025
2 parents bbe81ea + 6a8de0d commit a4253a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ object PlayerHelper {
get() = watchPositionsPref in listOf("always", "videos")

val watchPositionsAudio: Boolean
get() = watchPositionsPref == "always"
get() = watchPositionsPref in listOf("always", "audio")

val watchPositionsAny: Boolean
get() = watchPositionsVideo || watchPositionsAudio

val watchHistoryEnabled: Boolean
get() = PreferenceHelper.getBoolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ abstract class AbstractPlayerService : MediaLibraryService(), MediaLibrarySessio
abstract suspend fun startPlayback()

private fun saveWatchPosition() {
if (isTransitioning || !PlayerHelper.watchPositionsVideo) return
val watchPositionsEnabled =
(PlayerHelper.watchPositionsAudio && isAudioOnlyPlayer) || (PlayerHelper.watchPositionsVideo && !isAudioOnlyPlayer)

if (isTransitioning || !watchPositionsEnabled) return

exoPlayer?.let { PlayerHelper.saveWatchPosition(it, videoId) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class VideoOptionsBottomSheet : BaseBottomSheet() {
}

// show the mark as watched or unwatched option if watch positions are enabled
if (PlayerHelper.watchPositionsVideo || PlayerHelper.watchHistoryEnabled) {
if (PlayerHelper.watchPositionsAny || PlayerHelper.watchHistoryEnabled) {
val watchPositionEntry = runBlocking(Dispatchers.IO) {
DatabaseHolder.Database.watchPositionDao().findById(videoId)
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,14 @@
<string-array name="watchPosition">
<item>@string/always</item>
<item>@string/videos</item>
<item>@string/audio</item>
<item>@string/never</item>
</string-array>

<string-array name="watchPositionValues">
<item>always</item>
<item>videos</item>
<item>audio</item>
<item>never</item>
</string-array>

Expand Down

0 comments on commit a4253a7

Please sign in to comment.