diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index b3369fec9..7549c82c5 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -455,7 +455,10 @@ class PlayerFragment : Fragment() { if (!relatedStreamsEnabled) toggleComments() // prepare for autoplay initAutoPlay() - PreferenceHelper.addToWatchHistory(requireContext(), videoId!!, response) + val watchHistoryEnabled = + PreferenceHelper.getBoolean(requireContext(), "Watch_history_toggle", true) + if (watchHistoryEnabled) + PreferenceHelper.addToWatchHistory(requireContext(), videoId!!, response) } } } diff --git a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt index 3fb39c7e8..91a38d072 100644 --- a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt @@ -18,12 +18,20 @@ class AdvancedSettings : PreferenceFragmentCompat() { val settingsActivity = activity as SettingsActivity settingsActivity.binding.topBarTextView.text = getString(R.string.advanced) + // clear search history val clearHistory = findPreference("clear_history") clearHistory?.setOnPreferenceClickListener { PreferenceHelper.removePreference(requireContext(), "search_history") true } + // clear watch history + val clearWatchHistory = findPreference("clear_watch_history") + clearWatchHistory?.setOnPreferenceClickListener { + PreferenceHelper.removePreference(requireContext(), "watch_history") + true + } + val resetSettings = findPreference("reset_settings") resetSettings?.setOnPreferenceClickListener { showResetDialog() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3abd7ec36..483374be3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -79,7 +79,7 @@ OK History Search History - Clear History + Clear search history YT Music Songs YT Music Videos YT Music Albums @@ -207,4 +207,5 @@ Delete your Piped account Account Restore + Watch history \ No newline at end of file diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml index a9e92a024..ad17cd058 100644 --- a/app/src/main/res/xml/advanced_settings.xml +++ b/app/src/main/res/xml/advanced_settings.xml @@ -46,6 +46,21 @@ + + + + + + + +