Update booksOnDiskListItem variable name

This commit is contained in:
Yash Khare 2020-04-09 22:01:31 +05:30
parent fbf7c50f78
commit ce6ded65d2

View File

@ -31,7 +31,7 @@ import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDis
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import javax.inject.Inject import javax.inject.Inject
data class DeleteFiles(private val booksOnDiskListItem: List<BookOnDisk>) : data class DeleteFiles(private val booksOnDiskListItems: List<BookOnDisk>) :
SideEffect<Unit> { SideEffect<Unit> {
@Inject lateinit var dialogShower: DialogShower @Inject lateinit var dialogShower: DialogShower
@ -41,18 +41,19 @@ data class DeleteFiles(private val booksOnDiskListItem: List<BookOnDisk>) :
override fun invokeWith(activity: AppCompatActivity) { override fun invokeWith(activity: AppCompatActivity) {
(activity as ZimManageActivity).cachedComponent.inject(this) (activity as ZimManageActivity).cachedComponent.inject(this)
val name = booksOnDiskListItem.joinToString(separator = "\n") { it.book.title } val name = booksOnDiskListItems.joinToString(separator = "\n") { it.book.title }
dialogShower.show(DeleteZims(name), { dialogShower.show(DeleteZims(name), {
val booksDeleted = booksOnDiskListItem.fold(true) { _, book -> val booksDeleted = booksOnDiskListItems.fold(true) { acc, book ->
if (deleteSpecificZimFile(book)) { acc &&
(if (deleteSpecificZimFile(book)) {
if (book.file.canonicalPath == zimReaderContainer.zimCanonicalPath) { if (book.file.canonicalPath == zimReaderContainer.zimCanonicalPath) {
zimReaderContainer.setZimFile(null) zimReaderContainer.setZimFile(null)
} }
true true
} else { } else {
false false
} })
} }
activity.toast(if (booksDeleted) R.string.delete_zims_toast else R.string.delete_zim_failed) activity.toast(if (booksDeleted) R.string.delete_zims_toast else R.string.delete_zim_failed)