From a03ea159ff57e5e28909f8a09533af1f3cc2fec8 Mon Sep 17 00:00:00 2001 From: starry-shivam Date: Fri, 9 Feb 2024 21:19:47 +0530 Subject: [PATCH 1/2] Fix crash due to title tag missing in opf index Signed-off-by: starry-shivam --- app/src/main/java/com/starry/myne/epub/EpubParser.kt | 6 ++---- app/src/main/java/com/starry/myne/repo/BookRepository.kt | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/starry/myne/epub/EpubParser.kt b/app/src/main/java/com/starry/myne/epub/EpubParser.kt index 31a99852..444c5f4e 100644 --- a/app/src/main/java/com/starry/myne/epub/EpubParser.kt +++ b/app/src/main/java/com/starry/myne/epub/EpubParser.kt @@ -47,9 +47,7 @@ data class EpubFile(val absPath: String, val data: ByteArray) { other as EpubFile if (absPath != other.absPath) return false - if (!data.contentEquals(other.data)) return false - - return true + return data.contentEquals(other.data) } override fun hashCode(): Int { @@ -95,7 +93,7 @@ private suspend fun parseAndCreateEpubBook(inputStream: FileInputStream): EpubBo ?: throw Exception(".opf file spine section missing") val metadataTitle = metadata.selectFirstChildTag("dc:title")?.textContent - ?: throw Exception(".opf metadata title tag missing") + ?: "Unknown Title" val metadataCoverId = metadata .selectChildTag("meta") diff --git a/app/src/main/java/com/starry/myne/repo/BookRepository.kt b/app/src/main/java/com/starry/myne/repo/BookRepository.kt index db1a673f..cd1be50c 100644 --- a/app/src/main/java/com/starry/myne/repo/BookRepository.kt +++ b/app/src/main/java/com/starry/myne/repo/BookRepository.kt @@ -111,7 +111,6 @@ class BookRepository { suspend fun getExtraInfo(bookName: String): ExtraInfo? = suspendCoroutine { continuation -> val encodedName = URLEncoder.encode(bookName, "UTF-8") val url = "${googleBooksUrl}?q=$encodedName&startIndex=0&maxResults=1&key=$googleApiKey" - println(url) val request = Request.Builder().get().url(url).build() okHttpClient.newCall(request).enqueue(object : Callback { override fun onFailure(call: Call, e: IOException) { From 71e96eea3eff8976ba1bd51641961481aeac6042 Mon Sep 17 00:00:00 2001 From: starry-shivam Date: Fri, 9 Feb 2024 21:28:02 +0530 Subject: [PATCH 2/2] Show full title in chapters screen in ebook reader Signed-off-by: starry-shivam --- .../myne/ui/screens/reader/composables/ReaderDetailScreen.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/com/starry/myne/ui/screens/reader/composables/ReaderDetailScreen.kt b/app/src/main/java/com/starry/myne/ui/screens/reader/composables/ReaderDetailScreen.kt index c5584412..434d8a0e 100644 --- a/app/src/main/java/com/starry/myne/ui/screens/reader/composables/ReaderDetailScreen.kt +++ b/app/src/main/java/com/starry/myne/ui/screens/reader/composables/ReaderDetailScreen.kt @@ -242,8 +242,6 @@ fun ReaderDetailScreen( fontSize = 24.sp, fontFamily = figeronaFont, fontWeight = FontWeight.Bold, - maxLines = 2, - overflow = TextOverflow.Ellipsis, color = MaterialTheme.colorScheme.onBackground, )