Fixed detekt errors

This commit is contained in:
MohitMali 2023-09-05 19:03:53 +05:30 committed by MohitMaliFtechiz
parent b2c1c1ed5d
commit 7c23207225
5 changed files with 8 additions and 10 deletions

View File

@ -40,7 +40,9 @@ class LibkiwixBookmarks @Inject constructor(
) : PageDao { ) : PageDao {
private val bookmarksFolderPath: String by lazy { private val bookmarksFolderPath: String by lazy {
sharedPreferenceUtil.getPublicDirectoryPath(sharedPreferenceUtil.defaultStorage()) + "/kiwix/Bookmarks/" sharedPreferenceUtil.getPublicDirectoryPath(
sharedPreferenceUtil.defaultStorage()
) + "/kiwix/Bookmarks/"
} }
private val bookmarkFile: File by lazy { private val bookmarkFile: File by lazy {

View File

@ -20,7 +20,6 @@ package org.kiwix.kiwixmobile.core.data
import io.reactivex.Completable import io.reactivex.Completable
import io.reactivex.Flowable import io.reactivex.Flowable
import io.reactivex.Single import io.reactivex.Single
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.BookmarkItem
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem.HistoryItem import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem.HistoryItem

View File

@ -342,7 +342,6 @@ abstract class CoreReaderFragment :
private var navigationHistoryList: MutableList<NavigationHistoryListItem> = ArrayList() private var navigationHistoryList: MutableList<NavigationHistoryListItem> = ArrayList()
private var isReadSelection = false private var isReadSelection = false
private var isReadAloudServiceRunning = false private var isReadAloudServiceRunning = false
private var libKiwixBook: Book? = null
private var storagePermissionForNotesLauncher: ActivityResultLauncher<String>? = private var storagePermissionForNotesLauncher: ActivityResultLauncher<String>? =
registerForActivityResult( registerForActivityResult(
@ -1114,7 +1113,6 @@ abstract class CoreReaderFragment :
unRegisterReadAloudService() unRegisterReadAloudService()
storagePermissionForNotesLauncher?.unregister() storagePermissionForNotesLauncher?.unregister()
storagePermissionForNotesLauncher = null storagePermissionForNotesLauncher = null
libKiwixBook = null
} }
private fun updateTableOfContents() { private fun updateTableOfContents() {
@ -1653,16 +1651,16 @@ abstract class CoreReaderFragment :
fun toggleBookmark() { fun toggleBookmark() {
getCurrentWebView()?.url?.let { articleUrl -> getCurrentWebView()?.url?.let { articleUrl ->
zimReaderContainer?.zimFileReader?.let { zimFileReader -> zimReaderContainer?.zimFileReader?.let { zimFileReader ->
libKiwixBook = Book().apply { val libKiwixBook = Book().apply {
update(zimFileReader.jniKiwixReader) update(zimFileReader.jniKiwixReader)
} }
if (isBookmarked) { if (isBookmarked) {
repositoryActions?.deleteBookmark(libKiwixBook!!.id, articleUrl) repositoryActions?.deleteBookmark(libKiwixBook.id, articleUrl)
snackBarRoot?.snack(R.string.bookmark_removed) snackBarRoot?.snack(R.string.bookmark_removed)
} else { } else {
getCurrentWebView()?.title?.let { getCurrentWebView()?.title?.let {
repositoryActions?.saveBookmark( repositoryActions?.saveBookmark(
LibkiwixBookmarkItem(it, articleUrl, zimFileReader, libKiwixBook!!) LibkiwixBookmarkItem(it, articleUrl, zimFileReader, libKiwixBook)
) )
snackBarRoot?.snack( snackBarRoot?.snack(
stringId = R.string.bookmark_added, stringId = R.string.bookmark_added,

View File

@ -30,6 +30,6 @@ data class BookmarkState(
) : PageState<LibkiwixBookmarkItem>() { ) : PageState<LibkiwixBookmarkItem>() {
override val visiblePageItems: List<PageRelated> = filteredPageItems override val visiblePageItems: List<PageRelated> = filteredPageItems
override fun copyWithNewItems(newItems: List<LibkiwixBookmarkItem>): PageState<LibkiwixBookmarkItem> = override fun copyWithNewItems(newItems: List<LibkiwixBookmarkItem>):
copy(pageItems = newItems) PageState<LibkiwixBookmarkItem> = copy(pageItems = newItems)
} }

View File

@ -23,7 +23,6 @@ import io.reactivex.processors.PublishProcessor
import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.base.SideEffect
import org.kiwix.kiwixmobile.core.dao.PageDao import org.kiwix.kiwixmobile.core.dao.PageDao
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.cachedComponent import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.cachedComponent
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.BookmarkItem
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
import org.kiwix.kiwixmobile.core.page.viewmodel.PageState import org.kiwix.kiwixmobile.core.page.viewmodel.PageState
import org.kiwix.kiwixmobile.core.page.viewmodel.effects.DeletePageItems import org.kiwix.kiwixmobile.core.page.viewmodel.effects.DeletePageItems