[fix&feat] Fix local judgment logic to prevent partial downloaded projects from being judged as local, Better playlists
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import com.acitelight.aether.model.BookMark
|
import com.acitelight.aether.model.BookMark
|
||||||
import com.acitelight.aether.model.Comic
|
import com.acitelight.aether.model.Comic
|
||||||
import com.acitelight.aether.model.Video
|
import com.acitelight.aether.model.Video
|
||||||
|
import com.acitelight.aether.model.VideoDownloadItemState
|
||||||
import com.tonyodev.fetch2.Status
|
import com.tonyodev.fetch2.Status
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
@@ -44,15 +45,34 @@ class MediaManager @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun queryVideo(klass: String, id: String, model: VideoDownloadItemState): Video?
|
||||||
|
{
|
||||||
|
if(model.status == Status.COMPLETED)
|
||||||
|
{
|
||||||
|
val jsonString = File(
|
||||||
|
context.getExternalFilesDir(null),
|
||||||
|
"videos/$klass/$id/summary.json"
|
||||||
|
).readText()
|
||||||
|
return Json.decodeFromString<Video>(jsonString).toLocal(context.getExternalFilesDir(null)?.path!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
val j = ApiClient.api!!.queryVideo(klass, id, token)
|
||||||
|
return Video(klass = klass, id = id, token=token, isLocal = false, localBase = "", video = j)
|
||||||
|
}catch (_: Exception)
|
||||||
|
{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun queryVideo(klass: String, id: String): Video?
|
suspend fun queryVideo(klass: String, id: String): Video?
|
||||||
{
|
{
|
||||||
val downloaded = fetchManager.getAllDownloadsAsync().filter {
|
val downloaded = fetchManager.getAllDownloadsAsync().filter {
|
||||||
it.status == Status.COMPLETED &&
|
|
||||||
it.extras.getString("id", "") == id &&
|
it.extras.getString("id", "") == id &&
|
||||||
it.extras.getString("class", "") == klass
|
it.extras.getString("class", "") == klass
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!downloaded.isEmpty())
|
if(downloaded.all{ it.status == Status.COMPLETED })
|
||||||
{
|
{
|
||||||
val jsonString = File(
|
val jsonString = File(
|
||||||
context.getExternalFilesDir(null),
|
context.getExternalFilesDir(null),
|
||||||
@@ -72,16 +92,16 @@ class MediaManager @Inject constructor(
|
|||||||
|
|
||||||
suspend fun queryVideoBulk(klass: String, id: List<String>): List<Video>? {
|
suspend fun queryVideoBulk(klass: String, id: List<String>): List<Video>? {
|
||||||
return try {
|
return try {
|
||||||
val completedDownloads = fetchManager.getAllDownloadsAsync()
|
val downloads = fetchManager.getAllDownloadsAsync()
|
||||||
.filter { it.status == Status.COMPLETED }
|
|
||||||
val localIds = mutableSetOf<String>()
|
val localIds = mutableSetOf<String>()
|
||||||
val remoteIds = mutableListOf<String>()
|
val remoteIds = mutableListOf<String>()
|
||||||
|
|
||||||
for (videoId in id) {
|
for (videoId in id) {
|
||||||
if (completedDownloads.any {
|
if (downloads.filter {
|
||||||
it.extras.getString("id", "") == videoId &&
|
it.extras.getString("id", "") == videoId &&
|
||||||
it.extras.getString("class", "") == klass
|
it.extras.getString("class", "") == klass
|
||||||
}) {
|
}.all{ it.status == Status.COMPLETED} ) {
|
||||||
localIds.add(videoId)
|
localIds.add(videoId)
|
||||||
} else {
|
} else {
|
||||||
remoteIds.add(videoId)
|
remoteIds.add(videoId)
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -28,7 +30,9 @@ import kotlinx.coroutines.launch
|
|||||||
@Composable
|
@Composable
|
||||||
fun PlaylistPanel(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel)
|
fun PlaylistPanel(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel)
|
||||||
{
|
{
|
||||||
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
val name by videoPlayerViewModel.currentName
|
val name by videoPlayerViewModel.currentName
|
||||||
|
val id by videoPlayerViewModel.currentId
|
||||||
|
|
||||||
LazyRow(
|
LazyRow(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
@@ -48,7 +52,13 @@ fun PlaylistPanel(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel
|
|||||||
videoPlayerViewModel.viewModelScope.launch {
|
videoPlayerViewModel.viewModelScope.launch {
|
||||||
videoPlayerViewModel.startPlay(it)
|
videoPlayerViewModel.startPlay(it)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
colors =
|
||||||
|
if (it.id == id)
|
||||||
|
CardDefaults.cardColors(containerColor = colorScheme.primary)
|
||||||
|
else
|
||||||
|
CardDefaults.cardColors()
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Box(Modifier.padding(8.dp).fillMaxSize())
|
Box(Modifier.padding(8.dp).fillMaxSize())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import kotlinx.coroutines.launch
|
|||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import kotlin.collections.sortedWith
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TransmissionScreen(
|
fun TransmissionScreen(
|
||||||
@@ -120,9 +121,12 @@ private fun VideoDownloadCard(
|
|||||||
{
|
{
|
||||||
val downloaded = viewModel.fetchManager.getAllDownloadsAsync().filter {
|
val downloaded = viewModel.fetchManager.getAllDownloadsAsync().filter {
|
||||||
it.status == Status.COMPLETED && it.extras.getString(
|
it.status == Status.COMPLETED && it.extras.getString(
|
||||||
"isComic",
|
"class",
|
||||||
""
|
""
|
||||||
) != "true"
|
) != "comic" && it.extras.getString(
|
||||||
|
"type",
|
||||||
|
""
|
||||||
|
) == "main"
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsonQuery = downloaded.map {
|
val jsonQuery = downloaded.map {
|
||||||
@@ -152,7 +156,7 @@ private fun VideoDownloadCard(
|
|||||||
|
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
val group = fv.filter { it.klass == video.klass && it.video.group == video.video.group }
|
val group = fv.filter { it.klass == video.klass && it.video.group == video.video.group }
|
||||||
for (i in group) {
|
for (i in group.sortedWith(compareBy(naturalOrder()) { it.video.name })) {
|
||||||
playList.add("${i.klass}/${i.id}")
|
playList.add("${i.klass}/${i.id}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,11 @@ fun VideoPlayerPortal(
|
|||||||
val duration by videoPlayerViewModel.currentDuration
|
val duration by videoPlayerViewModel.currentDuration
|
||||||
|
|
||||||
ToggleFullScreen(false)
|
ToggleFullScreen(false)
|
||||||
Column(Modifier
|
Column(
|
||||||
.nestedScroll(nestedScrollConnection)
|
Modifier
|
||||||
.fillMaxHeight())
|
.nestedScroll(nestedScrollConnection)
|
||||||
|
.fillMaxHeight()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Box {
|
Box {
|
||||||
PortalCorePlayer(
|
PortalCorePlayer(
|
||||||
@@ -194,13 +196,15 @@ fun VideoPlayerPortal(
|
|||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
)
|
)
|
||||||
|
|
||||||
Row(Modifier
|
Row(
|
||||||
.align(Alignment.Start)
|
Modifier
|
||||||
.padding(horizontal = 4.dp)
|
.align(Alignment.Start)
|
||||||
.alpha(0.5f)) {
|
.padding(horizontal = 4.dp)
|
||||||
|
.alpha(0.5f)
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(horizontal = 8.dp),
|
modifier = Modifier.padding(horizontal = 8.dp),
|
||||||
text = klass,
|
text = "$klass.$id",
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
@@ -217,12 +221,18 @@ fun VideoPlayerPortal(
|
|||||||
|
|
||||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
||||||
|
|
||||||
PlaylistPanel(
|
if (videoPlayerViewModel.videos.size > 1) {
|
||||||
Modifier,
|
PlaylistPanel(
|
||||||
videoPlayerViewModel = videoPlayerViewModel
|
Modifier,
|
||||||
)
|
videoPlayerViewModel = videoPlayerViewModel
|
||||||
|
)
|
||||||
|
|
||||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
HorizontalDivider(
|
||||||
|
Modifier.padding(vertical = 8.dp),
|
||||||
|
1.dp,
|
||||||
|
DividerDefaults.color
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
HorizontalGallery(videoPlayerViewModel)
|
HorizontalGallery(videoPlayerViewModel)
|
||||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.acitelight.aether.model.Video
|
|||||||
import com.acitelight.aether.model.VideoDownloadItemState
|
import com.acitelight.aether.model.VideoDownloadItemState
|
||||||
import com.acitelight.aether.service.ApiClient.createOkHttp
|
import com.acitelight.aether.service.ApiClient.createOkHttp
|
||||||
import com.acitelight.aether.service.FetchManager
|
import com.acitelight.aether.service.FetchManager
|
||||||
|
import com.acitelight.aether.service.MediaManager
|
||||||
import com.acitelight.aether.service.VideoLibrary
|
import com.acitelight.aether.service.VideoLibrary
|
||||||
import com.tonyodev.fetch2.Download
|
import com.tonyodev.fetch2.Download
|
||||||
import com.tonyodev.fetch2.FetchListener
|
import com.tonyodev.fetch2.FetchListener
|
||||||
@@ -27,6 +28,7 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
val fetchManager: FetchManager,
|
val fetchManager: FetchManager,
|
||||||
@ApplicationContext val context: Context,
|
@ApplicationContext val context: Context,
|
||||||
val videoLibrary: VideoLibrary,
|
val videoLibrary: VideoLibrary,
|
||||||
|
val mediaManager: MediaManager,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
var imageLoader: ImageLoader? = null
|
var imageLoader: ImageLoader? = null
|
||||||
val downloads: SnapshotStateList<VideoDownloadItemState> = mutableStateListOf()
|
val downloads: SnapshotStateList<VideoDownloadItemState> = mutableStateListOf()
|
||||||
@@ -34,8 +36,7 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
// map id -> state object reference (no index bookkeeping)
|
// map id -> state object reference (no index bookkeeping)
|
||||||
private val idToState: MutableMap<Int, VideoDownloadItemState> = mutableMapOf()
|
private val idToState: MutableMap<Int, VideoDownloadItemState> = mutableMapOf()
|
||||||
|
|
||||||
fun modelToVideo(model: VideoDownloadItemState): Video?
|
fun modelToVideo(model: VideoDownloadItemState): Video? {
|
||||||
{
|
|
||||||
val fv = videoLibrary.classesMap.map { it.value }.flatten()
|
val fv = videoLibrary.classesMap.map { it.value }.flatten()
|
||||||
return fv.firstOrNull { it.klass == model.klass && it.id == model.vid }
|
return fv.firstOrNull { it.klass == model.klass && it.id == model.vid }
|
||||||
}
|
}
|
||||||
@@ -54,9 +55,7 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onProgress(
|
override fun onProgress(
|
||||||
download: Download,
|
download: Download, etaInMilliSeconds: Long, downloadedBytesPerSecond: Long
|
||||||
etaInMilliSeconds: Long,
|
|
||||||
downloadedBytesPerSecond: Long
|
|
||||||
) {
|
) {
|
||||||
handleUpsert(download)
|
handleUpsert(download)
|
||||||
}
|
}
|
||||||
@@ -73,12 +72,21 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
handleUpsert(download)
|
handleUpsert(download)
|
||||||
|
|
||||||
if (download.extras.getString("type", "") == "main") {
|
if (download.extras.getString("type", "") == "main") {
|
||||||
val ii = videoLibrary.classesMap[download.extras.getString("class", "")]
|
val ii = videoLibrary.classesMap[download.extras.getString(
|
||||||
?.indexOfFirst { it.id == download.extras.getString("id", "") }!!
|
"class",
|
||||||
|
""
|
||||||
|
)]?.indexOfFirst { it.id == download.extras.getString("id", "") }
|
||||||
|
|
||||||
val newi = videoLibrary.classesMap[download.extras.getString("class", "")]!![ii]
|
if (ii != null) {
|
||||||
videoLibrary.classesMap[download.extras.getString("class", "")]!![ii] =
|
val newi =
|
||||||
newi.toLocal(context.getExternalFilesDir(null)!!.path)
|
videoLibrary.classesMap[download.extras.getString("class", "")]?.get(ii)
|
||||||
|
if (newi != null) videoLibrary.classesMap[download.extras.getString(
|
||||||
|
"class",
|
||||||
|
""
|
||||||
|
)]?.set(
|
||||||
|
ii, newi.toLocal(context.getExternalFilesDir(null)!!.path)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,25 +103,19 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDownloadBlockUpdated(
|
override fun onDownloadBlockUpdated(
|
||||||
download: Download,
|
download: Download, downloadBlock: DownloadBlock, totalBlocks: Int
|
||||||
downloadBlock: DownloadBlock,
|
|
||||||
totalBlocks: Int
|
|
||||||
) {
|
) {
|
||||||
handleUpsert(download)
|
handleUpsert(download)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStarted(
|
override fun onStarted(
|
||||||
download: Download,
|
download: Download, downloadBlocks: List<DownloadBlock>, totalBlocks: Int
|
||||||
downloadBlocks: List<DownloadBlock>,
|
|
||||||
totalBlocks: Int
|
|
||||||
) {
|
) {
|
||||||
handleUpsert(download)
|
handleUpsert(download)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(
|
override fun onError(
|
||||||
download: Download,
|
download: Download, error: com.tonyodev.fetch2.Error, throwable: Throwable?
|
||||||
error: com.tonyodev.fetch2.Error,
|
|
||||||
throwable: Throwable?
|
|
||||||
) {
|
) {
|
||||||
handleUpsert(download)
|
handleUpsert(download)
|
||||||
}
|
}
|
||||||
@@ -123,6 +125,23 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
viewModelScope.launch(Dispatchers.Main) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
upsertOnMain(download)
|
upsertOnMain(download)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val state = downloadToState(download)
|
||||||
|
|
||||||
|
if (videoLibrary.classes.contains(state.klass)) videoLibrary.classes.add(state.klass)
|
||||||
|
|
||||||
|
if (!videoLibrary.classesMap.containsKey(state.klass)) videoLibrary.classesMap[state.klass] =
|
||||||
|
mutableStateListOf()
|
||||||
|
|
||||||
|
if (videoLibrary.classesMap[state.klass]?.any { it.id == state.vid } != true) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val v = mediaManager.queryVideo(state.klass, state.vid, state)
|
||||||
|
if (v != null) {
|
||||||
|
videoLibrary.classesMap[state.klass]?.add(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleRemove(id: Int) {
|
private fun handleRemove(id: Int) {
|
||||||
@@ -198,25 +217,34 @@ class TransmissionScreenViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
imageLoader = ImageLoader.Builder(context)
|
imageLoader = ImageLoader.Builder(context).components {
|
||||||
.components {
|
add(OkHttpNetworkFetcherFactory(createOkHttp()))
|
||||||
add(OkHttpNetworkFetcherFactory(createOkHttp()))
|
}.build()
|
||||||
}
|
|
||||||
.build()
|
|
||||||
|
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
fetchManager.setListener(fetchListener)
|
fetchManager.setListener(fetchListener)
|
||||||
withContext(Dispatchers.Main) {
|
val downloaded = fetchManager.getAllDownloadsAsync()
|
||||||
fetchManager.getAllDownloads { list ->
|
|
||||||
downloads.clear()
|
downloads.clear()
|
||||||
idToState.clear()
|
idToState.clear()
|
||||||
list.sortedBy { it.extras.getString("name", "") }.forEach { d ->
|
downloaded.sortedWith(compareBy(naturalOrder()) { it.extras.getString("name", "") })
|
||||||
val s = downloadToState(d)
|
.forEach { d ->
|
||||||
downloads.add(s)
|
val s = downloadToState(d)
|
||||||
idToState[s.id] = s
|
downloads.add(s)
|
||||||
|
idToState[s.id] = s
|
||||||
|
|
||||||
|
if (videoLibrary.classes.contains(s.klass)) videoLibrary.classes.add(s.klass)
|
||||||
|
|
||||||
|
if (!videoLibrary.classesMap.containsKey(s.klass)) videoLibrary.classesMap[s.klass] =
|
||||||
|
mutableStateListOf()
|
||||||
|
|
||||||
|
if (videoLibrary.classesMap[s.klass]?.any { it.id == s.vid } != true) {
|
||||||
|
val v = mediaManager.queryVideo(s.klass, s.vid, s)
|
||||||
|
if (v != null) {
|
||||||
|
videoLibrary.classesMap[s.klass]?.add(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,16 @@ class VideoScreenViewModel @Inject constructor(
|
|||||||
|
|
||||||
if (Global.loggedIn) {
|
if (Global.loggedIn) {
|
||||||
videoLibrary.classes.addAll(mediaManager.listVideoKlasses())
|
videoLibrary.classes.addAll(mediaManager.listVideoKlasses())
|
||||||
|
videoLibrary.classes.distinct()
|
||||||
|
|
||||||
if(videoLibrary.classes.isEmpty())
|
if(videoLibrary.classes.isEmpty())
|
||||||
return
|
return
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
for (it in videoLibrary.classes) {
|
for (it in videoLibrary.classes) {
|
||||||
videoLibrary.updatingMap[i++] = false
|
videoLibrary.updatingMap[i++] = false
|
||||||
videoLibrary.classesMap[it] = mutableStateListOf<Video>()
|
if(!videoLibrary.classesMap.containsKey(it))
|
||||||
|
videoLibrary.classesMap[it] = mutableStateListOf()
|
||||||
}
|
}
|
||||||
videoLibrary.updatingMap[0] = true
|
videoLibrary.updatingMap[0] = true
|
||||||
val vl =
|
val vl =
|
||||||
@@ -69,6 +72,7 @@ class VideoScreenViewModel @Inject constructor(
|
|||||||
if (vl != null) {
|
if (vl != null) {
|
||||||
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
||||||
videoLibrary.classesMap[videoLibrary.classes[0]]?.addAll(r)
|
videoLibrary.classesMap[videoLibrary.classes[0]]?.addAll(r)
|
||||||
|
videoLibrary.classesMap[videoLibrary.classes[0]]?.distinctBy { it.id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -77,7 +81,7 @@ class VideoScreenViewModel @Inject constructor(
|
|||||||
videoLibrary.classesMap["Offline"] = mutableStateListOf<Video>()
|
videoLibrary.classesMap["Offline"] = mutableStateListOf<Video>()
|
||||||
|
|
||||||
val downloaded = fetchManager.getAllDownloadsAsync().filter {
|
val downloaded = fetchManager.getAllDownloadsAsync().filter {
|
||||||
it.status == Status.COMPLETED && it.extras.getString("isComic", "") != "true"
|
it.status == Status.COMPLETED && it.extras.getString("class", "") != "comic"
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsonQuery = downloaded.map{ File(
|
val jsonQuery = downloaded.map{ File(
|
||||||
@@ -107,6 +111,7 @@ class VideoScreenViewModel @Inject constructor(
|
|||||||
if (vl != null) {
|
if (vl != null) {
|
||||||
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
||||||
videoLibrary.classesMap[videoLibrary.classes[index]]?.addAll(r)
|
videoLibrary.classesMap[videoLibrary.classes[index]]?.addAll(r)
|
||||||
|
videoLibrary.classesMap[videoLibrary.classes[index]]?.distinctBy { it.id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user