mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-10 07:48:30 -04:00
Added logs while reading reading the bookmarks/library data, and added logs before writing the library in file.
This commit is contained in:
parent
831d91df78
commit
f8ddf68aa5
@ -65,11 +65,11 @@ class LibkiwixBookmarks @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val bookmarkFile: File by lazy {
|
private val bookmarkFile: File by lazy {
|
||||||
File("$bookmarksFolderPath/bookmark.txt")
|
File("$bookmarksFolderPath/bookmark.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
private val libraryFile: File by lazy {
|
private val libraryFile: File by lazy {
|
||||||
File("$bookmarksFolderPath/library.txt")
|
File("$bookmarksFolderPath/library.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -83,6 +83,21 @@ class LibkiwixBookmarks @Inject constructor(
|
|||||||
if (!bookmarkFile.isFileExist()) bookmarkFile.createNewFile()
|
if (!bookmarkFile.isFileExist()) bookmarkFile.createNewFile()
|
||||||
// set up manager to read the bookmarks from this file
|
// set up manager to read the bookmarks from this file
|
||||||
manager.readBookmarkFile(bookmarkFile.canonicalPath)
|
manager.readBookmarkFile(bookmarkFile.canonicalPath)
|
||||||
|
|
||||||
|
library.booksIds
|
||||||
|
.asSequence()
|
||||||
|
.map(library::getBookById)
|
||||||
|
.forEach {
|
||||||
|
Log.e(
|
||||||
|
TAG,
|
||||||
|
"readLibraryFromFile: " +
|
||||||
|
"reading books from a file via the manager.readFile() method current books size" +
|
||||||
|
" current books size in the library is = ${library.booksIds.size}\n" +
|
||||||
|
"book path = ${it.path}\n" +
|
||||||
|
"book title = ${it.title}\n" +
|
||||||
|
"book id = ${it.name}\n",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bookmarks(): Flowable<List<Page>> =
|
fun bookmarks(): Flowable<List<Page>> =
|
||||||
@ -160,6 +175,20 @@ class LibkiwixBookmarks @Inject constructor(
|
|||||||
* to prevent potential data loss and ensures that the library holds the updated ZIM file paths and favicons.
|
* to prevent potential data loss and ensures that the library holds the updated ZIM file paths and favicons.
|
||||||
*/
|
*/
|
||||||
private fun writeBookMarksAndSaveLibraryToFile() {
|
private fun writeBookMarksAndSaveLibraryToFile() {
|
||||||
|
library.booksIds
|
||||||
|
.asSequence()
|
||||||
|
.map(library::getBookById)
|
||||||
|
.forEach {
|
||||||
|
Log.e(
|
||||||
|
TAG,
|
||||||
|
"writeBookMarksAndSaveLibraryToFile:" +
|
||||||
|
" Trying to write a file with the library.writeFile() method." +
|
||||||
|
" current books size in the library is = ${library.booksIds.size}\n" +
|
||||||
|
"book path = ${it.path}\n" +
|
||||||
|
"book title = ${it.title}\n" +
|
||||||
|
"book id = ${it.name}\n",
|
||||||
|
)
|
||||||
|
}
|
||||||
// Save the library, which contains ZIM file paths and favicons, to a file.
|
// Save the library, which contains ZIM file paths and favicons, to a file.
|
||||||
library.writeToFile(libraryFile.canonicalPath)
|
library.writeToFile(libraryFile.canonicalPath)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user