Skip to content
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 @@ -178,7 +178,7 @@ fun FileItemViewPreviewDownloading() {
listOf(),
listOf(
DownloadingState(
fileEntry.path,
fileEntry.path, fileEntry.filename,
50, 100
)
),
Expand Down
3 changes: 3 additions & 0 deletions iosVariant/iosVariant/Views/Servers/FileItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ struct FileItemView: View {
DownloadingState(
path: DIRECTORY_LIST.filter { $0.isDirectory == false }.first!
.path,
filename: DIRECTORY_LIST.filter { $0.isDirectory == false }
.first!
.path,
received: 50,
total: 100
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.comixedproject.variant.model.state

data class DownloadingState(
val path: String,
val filename: String,
var received: Long,
var total: Long
)
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ open class VariantViewModel(
val password = this.password

viewModelScope.launch(Dispatchers.Main) {
val downloadingState = DownloadingState(path, 0, 0)
val downloadingState = DownloadingState(path, filename, 0, 0)
val state = mutableListOf<DownloadingState>()
state.addAll(_browsingState.value.downloadingState)
state.add(downloadingState)
Expand All @@ -217,7 +217,7 @@ open class VariantViewModel(
output,
onProgress = { received, total ->
viewModelScope.launch(Dispatchers.Main) {
val downloadingState = DownloadingState(path, received, total)
val downloadingState = DownloadingState(path, filename, received, total)
val state =
_browsingState.value.downloadingState.filter { !(it.path == path) }
.toMutableList()
Expand Down Expand Up @@ -259,8 +259,16 @@ open class VariantViewModel(
Log.debug(TAG, "Loading library contents: ${_libraryDirectory}")

val path = File(_libraryDirectory)
val ignored = this._browsingState.value.downloadingState.map { it.filename }.toList()
val contents =
path.directoryFiles()
.filter {
if (!ignored.contains(it.name)) {
true
} else {
false
}
}
.filter { !it.isDirectory }
.filter { it.size.toLong() > 0L }
.filter { it.extension.equals("cbz") || it.extension.equals("cbr") }
Expand Down