File tree Expand file tree Collapse file tree 2 files changed +3
-15
lines changed
AnkiDroid/src/main/java/com/ichi2 Expand file tree Collapse file tree 2 files changed +3
-15
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import anki.media.CheckMediaResponse
2323import com.ichi2.anki.CollectionManager.withCol
2424import com.ichi2.anki.common.annotations.NeedsTest
2525import com.ichi2.anki.observability.undoableOp
26- import com.ichi2.async.deleteMedia
2726import kotlinx.coroutines.Job
2827import kotlinx.coroutines.flow.MutableStateFlow
2928import kotlinx.coroutines.flow.StateFlow
@@ -69,7 +68,8 @@ class MediaCheckViewModel : ViewModel() {
6968 // TODO: investigate: the underlying implementation exposes progress, which we do not yet handle.
7069 fun deleteUnusedMedia (): Job =
7170 viewModelScope.launch {
72- val deletedMedia = withCol { deleteMedia(this @withCol, _mediaCheckResult .value?.unusedList ? : listOf ()) }
73- deletedFilesCount.value = deletedMedia
71+ val unused = _mediaCheckResult .value?.unusedList ? : listOf ()
72+ withCol { media.trashFiles(unused) }
73+ deletedFilesCount.value = unused.size
7474 }
7575}
Original file line number Diff line number Diff line change @@ -22,18 +22,6 @@ import com.ichi2.anki.libanki.Collection
2222import com.ichi2.anki.libanki.NotetypeJson
2323import timber.log.Timber
2424
25- /* *
26- * Takes a list of media file names and removes them from the [Collection]
27- * @param unused List of media names to be deleted
28- */
29- fun deleteMedia (
30- col : Collection ,
31- unused : List <String >,
32- ): Int {
33- col.media.trashFiles(unused)
34- return unused.size
35- }
36-
3725/* *
3826 * Trashes the specified media files and immediately empties the trash in the given [Collection].
3927 *
You can’t perform that action at this time.
0 commit comments