|
|
@ -108,7 +108,11 @@ object BookHelp { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun hasContent(book: Book, bookChapter: BookChapter): Boolean { |
|
|
|
fun hasContent(book: Book, bookChapter: BookChapter): Boolean { |
|
|
|
if (downloadUri.isDocumentUri(App.INSTANCE)) { |
|
|
|
when { |
|
|
|
|
|
|
|
book.isLocalBook() -> { |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
downloadUri.isDocumentUri(App.INSTANCE) -> { |
|
|
|
DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root -> |
|
|
|
DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root -> |
|
|
|
return DocumentUtils.exists( |
|
|
|
return DocumentUtils.exists( |
|
|
|
root, |
|
|
|
root, |
|
|
@ -116,13 +120,15 @@ object BookHelp { |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
return FileUtils.exists( |
|
|
|
return FileUtils.exists( |
|
|
|
File(downloadPath), |
|
|
|
File(downloadPath), |
|
|
|
"${bookChapterName(bookChapter)}.nb", |
|
|
|
"${bookChapterName(bookChapter)}.nb", |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|