Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preference to only store watch positions for video doesn't work #6997

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading