@@ -197,7 +197,7 @@ open class VariantViewModel(
197197 val password = this .password
198198
199199 viewModelScope.launch(Dispatchers .Main ) {
200- val downloadingState = DownloadingState (path, 0 , 0 )
200+ val downloadingState = DownloadingState (path, filename, 0 , 0 )
201201 val state = mutableListOf<DownloadingState >()
202202 state.addAll(_browsingState .value.downloadingState)
203203 state.add(downloadingState)
@@ -217,7 +217,7 @@ open class VariantViewModel(
217217 output,
218218 onProgress = { received, total ->
219219 viewModelScope.launch(Dispatchers .Main ) {
220- val downloadingState = DownloadingState (path, received, total)
220+ val downloadingState = DownloadingState (path, filename, received, total)
221221 val state =
222222 _browsingState .value.downloadingState.filter { ! (it.path == path) }
223223 .toMutableList()
@@ -259,8 +259,16 @@ open class VariantViewModel(
259259 Log .debug(TAG , " Loading library contents: ${_libraryDirectory } " )
260260
261261 val path = File (_libraryDirectory )
262+ val ignored = this ._browsingState .value.downloadingState.map { it.filename }.toList()
262263 val contents =
263264 path.directoryFiles()
265+ .filter {
266+ if (! ignored.contains(it.name)) {
267+ true
268+ } else {
269+ false
270+ }
271+ }
264272 .filter { ! it.isDirectory }
265273 .filter { it.size.toLong() > 0L }
266274 .filter { it.extension.equals(" cbz" ) || it.extension.equals(" cbr" ) }
0 commit comments