Compare commits

..

2 Commits

Author SHA1 Message Date
AbdallahMehiz
399e689969
lint 2 2024-01-28 11:34:29 +01:00
Abdallah
b1da3f3421
lint 2024-01-28 11:26:17 +01:00
4 changed files with 5 additions and 6 deletions

View File

@ -105,9 +105,8 @@ class ChapterLoader(
is Format.Directory -> DirectoryPageLoader(format.file) is Format.Directory -> DirectoryPageLoader(format.file)
is Format.Zip -> ZipPageLoader(tempFileManager.createTempFile(format.file)) is Format.Zip -> ZipPageLoader(tempFileManager.createTempFile(format.file))
is Format.SevenZip -> try { is Format.SevenZip -> try {
SevenZipPageLoader(tempFileManager.createTempFile(format.file)) SevenZipPageLoader(tempFileManager.createTempFile(format.file)) {
{ GlobalScope.launchUI {
GlobalScope.launchUI{
context.toast(context.stringResource(MR.strings.loader_7zip_slow_archives, it)) context.toast(context.stringResource(MR.strings.loader_7zip_slow_archives, it))
} }
} }

View File

@ -11,7 +11,7 @@ import java.io.File
*/ */
internal class SevenZipPageLoader( internal class SevenZipPageLoader(
private val file: File, private val file: File,
private val notifySlowArchive: (method: String) -> Unit private val notifySlowArchive: (method: String) -> Unit,
) : PageLoader() { ) : PageLoader() {
private val zip by lazy { SevenZFile(file) } private val zip by lazy { SevenZFile(file) }

View File

@ -26,7 +26,7 @@ object SevenZUtil {
.onEachIndexed { i, it -> .onEachIndexed { i, it ->
if (i > 0) return@onEachIndexed if (i > 0) return@onEachIndexed
val method = it.contentMethods.first().method val method = it.contentMethods.first().method
if(method !in GoodMethods) notifySlowArchives(method.name) if (method !in GoodMethods) notifySlowArchives(method.name)
} }
.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) } .sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
.map(::getInputStream) .map(::getInputStream)

View File

@ -344,7 +344,7 @@ actual class LocalSource(
} }
is Format.SevenZip -> { is Format.SevenZip -> {
SevenZFile(tempFileManager.createTempFile(format.file)).use { archive -> SevenZFile(tempFileManager.createTempFile(format.file)).use { archive ->
val entry = archive.getImages {} .firstOrNull() val entry = archive.getImages {}.firstOrNull()
entry?.let { coverManager.update(manga, it.inputStream()) } entry?.let { coverManager.update(manga, it.inputStream()) }
} }