mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Fix duplicating downloads
This commit is contained in:
parent
1710340bbf
commit
e241207c1c
@ -23,10 +23,10 @@ import com.github.libretube.helpers.DownloadHelper
|
|||||||
import com.github.libretube.helpers.PreferenceHelper
|
import com.github.libretube.helpers.PreferenceHelper
|
||||||
import com.github.libretube.util.TextUtils
|
import com.github.libretube.util.TextUtils
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.IOException
|
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
|
|
||||||
class DownloadDialog(
|
class DownloadDialog(
|
||||||
|
@ -74,9 +74,10 @@ class DownloadsFragment : Fragment() {
|
|||||||
|
|
||||||
val dbDownloads = runBlocking(Dispatchers.IO) {
|
val dbDownloads = runBlocking(Dispatchers.IO) {
|
||||||
Database.downloadDao().getAll()
|
Database.downloadDao().getAll()
|
||||||
}
|
}.takeIf { it.isNotEmpty() } ?: return
|
||||||
|
|
||||||
|
downloads.clear()
|
||||||
downloads.addAll(dbDownloads)
|
downloads.addAll(dbDownloads)
|
||||||
if (downloads.isEmpty()) return
|
|
||||||
|
|
||||||
binding.downloadsEmpty.visibility = View.GONE
|
binding.downloadsEmpty.visibility = View.GONE
|
||||||
binding.downloads.visibility = View.VISIBLE
|
binding.downloads.visibility = View.VISIBLE
|
||||||
|
Loading…
Reference in New Issue
Block a user