mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Fix compatibility with previous backups
This commit is contained in:
parent
26a4eeea6f
commit
f0857633e9
@ -112,8 +112,8 @@ object PreferenceKeys {
|
||||
const val LAST_STREAM_VIDEO_ID = "last_stream_video_id"
|
||||
const val LAST_WATCHED_FEED_TIME = "last_watched_feed_time"
|
||||
const val HIDE_WATCHED_FROM_FEED = "hide_watched_from_feed"
|
||||
const val SELECTED_FEED_FILTER = "selected_feed_filer"
|
||||
const val FEED_SORT_ORDER = "feed_sort_oder"
|
||||
const val SELECTED_FEED_FILTER = "selected_filer_feed"
|
||||
const val FEED_SORT_ORDER = "sort_oder_feed"
|
||||
|
||||
/**
|
||||
* Advanced
|
||||
|
@ -25,6 +25,8 @@ import com.github.libretube.ui.adapters.PlaylistsAdapter
|
||||
import com.github.libretube.ui.adapters.VideosAdapter
|
||||
import com.github.libretube.ui.base.BaseFragment
|
||||
import com.github.libretube.ui.models.SubscriptionsViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class HomeFragment : BaseFragment() {
|
||||
private lateinit var binding: FragmentHomeBinding
|
||||
@ -94,12 +96,13 @@ class HomeFragment : BaseFragment() {
|
||||
}
|
||||
|
||||
private suspend fun loadFeed() {
|
||||
val savedFeed = withContext(Dispatchers.Main) {
|
||||
subscriptionsViewModel.videoFeed.value
|
||||
}
|
||||
val feed = if (
|
||||
PreferenceHelper.getBoolean(PreferenceKeys.SAVE_FEED, false) &&
|
||||
!subscriptionsViewModel.videoFeed.value.isNullOrEmpty()
|
||||
) {
|
||||
subscriptionsViewModel.videoFeed.value.orEmpty()
|
||||
} else {
|
||||
!savedFeed.isNullOrEmpty()
|
||||
) { savedFeed } else {
|
||||
runCatching {
|
||||
SubscriptionHelper.getFeed()
|
||||
}.getOrElse { return }
|
||||
@ -122,8 +125,8 @@ class HomeFragment : BaseFragment() {
|
||||
private fun loadBookmarks() {
|
||||
val bookmarkedPlaylists = awaitQuery {
|
||||
DatabaseHolder.Database.playlistBookmarkDao().getAll()
|
||||
}
|
||||
if (bookmarkedPlaylists.isEmpty()) return
|
||||
}.takeIf { it.isNotEmpty() } ?: return
|
||||
|
||||
runOnUiThread {
|
||||
makeVisible(binding.bookmarksTV, binding.bookmarksRV)
|
||||
binding.bookmarksRV.layoutManager = LinearLayoutManager(
|
||||
|
Loading…
Reference in New Issue
Block a user