From 8b140b3558443e94d829e772809ca45f1d5aaa33 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Fri, 24 Dec 2021 09:00:56 -0500 Subject: [PATCH 01/13] fix h badge --- CurrentChangeLog.MD | 14 +------------- app/src/main/res/layout/manga_header_item.xml | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 58f5296f42..8605a409ab 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -1,17 +1,5 @@ ## 🥳 New -Lime Time Theme (@Jays2Kings) -Compress to cbz after downloading (@Seishirou101) ## 🏗️ Changes -Use official check if a12 device supports dynamic themes (@Jays2Kings) -Bottom Nav animation is fade in but not fade out (@Jays2Kings) -Updated mapping database for mal/anilist (@Goldbattle) ## 🐜 Fixes -Reading webtoon style no longer shows when default reading mode is webtoon (@Jays2Kings) -Incognito turning off when entering series from reader (@Jays2Kings) -Tako dark color (@Jays2Kings) -Saving split images (@Jays2Kings) -Split in webtoons when gif format is used (@Jays2Kings) -Manga Covers on tablets (@Jays2Kings) -Missing back/forward buttons on webview (@Jays2Kings) +H badge shows on top of cover now ## 🛠️ Other -update libraries \ No newline at end of file diff --git a/app/src/main/res/layout/manga_header_item.xml b/app/src/main/res/layout/manga_header_item.xml index 3072a34e13..06459f5962 100644 --- a/app/src/main/res/layout/manga_header_item.xml +++ b/app/src/main/res/layout/manga_header_item.xml @@ -204,7 +204,7 @@ android:text="H" android:textColor="@color/md_white_1000" android:textSize="14sp" - android:translationZ="1dp" + android:translationZ="2dp" android:layout_marginStart="4dp" android:visibility="gone" app:layout_constraintBottom_toTopOf="@+id/cover_card" From 6e785c56b426cc95caa65c49030b3e435219688d Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Fri, 24 Dec 2021 09:12:04 -0500 Subject: [PATCH 02/13] fix download notification badge --- CurrentChangeLog.MD | 1 + .../eu/kanade/tachiyomi/data/download/DownloadNotifier.kt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 8605a409ab..3f77586499 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -2,4 +2,5 @@ ## 🏗️ Changes ## 🐜 Fixes H badge shows on top of cover now +Download notification was old green ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index 37d6b93ee7..14e5ce0322 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -117,7 +117,7 @@ internal class DownloadNotifier(private val context: Context) { setAutoCancel(false) clearActions() // Open download manager when clicked - color = ContextCompat.getColor(context, R.color.secondaryTachiyomi) + color = ContextCompat.getColor(context, R.color.new_neko_accent) setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) isDownloading = true // Pause action @@ -160,7 +160,7 @@ internal class DownloadNotifier(private val context: Context) { setSmallIcon(R.drawable.ic_pause_24dp) setAutoCancel(false) setProgress(0, 0, false) - color = ContextCompat.getColor(context, R.color.secondaryTachiyomi) + color = ContextCompat.getColor(context, R.color.new_neko_accent) clearActions() // Open download manager when clicked setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) @@ -192,7 +192,7 @@ internal class DownloadNotifier(private val context: Context) { with(errorNotificationBuilder) { setContentTitle(context.getString(R.string.downloads)) setContentText(reason) - color = ContextCompat.getColor(context, R.color.secondaryTachiyomi) + color = ContextCompat.getColor(context, R.color.new_neko_accent) setSmallIcon(android.R.drawable.stat_sys_warning) setAutoCancel(true) clearActions() @@ -242,7 +242,7 @@ internal class DownloadNotifier(private val context: Context) { } else { setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) } - color = ContextCompat.getColor(context, R.color.secondaryTachiyomi) + color = ContextCompat.getColor(context, R.color.new_neko_accent) setProgress(0, 0, false) show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR) } From dabb0e35ebbaec39c9fd17bd1be70e86354609ba Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 14:42:04 -0500 Subject: [PATCH 03/13] Browse items fail to load when having the first 20 in library, and hide library enabled --- CurrentChangeLog.MD | 1 + .../kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 3f77586499..73ef67020c 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -3,4 +3,5 @@ ## 🐜 Fixes H badge shows on top of cover now Download notification was old green +Browse items fail to load when having the first 20 in library, and hide library enabled ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt index 88e878cd5c..cde1c467df 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt @@ -209,6 +209,9 @@ open class BrowseSourcePresenter( view.goDirectlyForDeepLink(mangaList.first().manga) } else { view.onAddPage(page, mangaList) + if (mangaList.isEmpty()) { + requestNext() + } } }, { _, error -> From 7951a553963b76d862ff0141ac571b4a70f3a641 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 14:53:10 -0500 Subject: [PATCH 04/13] Log file button didn't show on restore when only skipped titles and no errors --- CurrentChangeLog.MD | 1 + .../tachiyomi/data/backup/RestoreHelper.kt | 19 ++++++++++--------- .../tachiyomi/data/backup/full/FullRestore.kt | 4 ++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 73ef67020c..d2c34c1298 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -4,4 +4,5 @@ H badge shows on top of cover now Download notification was old green Browse items fail to load when having the first 20 in library, and hide library enabled +Log file button didn't show on restore when only skipped titles and no errors ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/RestoreHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/RestoreHelper.kt index 3e0b38d137..5c37e81962 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/RestoreHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/RestoreHelper.kt @@ -12,8 +12,6 @@ import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.notificationManager import java.io.File -import java.text.SimpleDateFormat -import java.util.Locale class RestoreHelper(val context: Context) { @@ -102,7 +100,7 @@ class RestoreHelper(val context: Context) { totalAmount: Int, cancelled: Int, errors: List, - trackingErrors: List, + trackingErrorsInitial: List, ) { val content = mutableListOf() if (categoriesAmount > 0) { @@ -141,7 +139,7 @@ class RestoreHelper(val context: Context) { ) } - val trackingErrors = trackingErrors.distinct() + val trackingErrors = trackingErrorsInitial.distinct() if (trackingErrors.isNotEmpty()) { val trackingErrorsString = trackingErrors.distinct().joinToString("\n") content.add(trackingErrorsString) @@ -160,12 +158,12 @@ class RestoreHelper(val context: Context) { .setSmallIcon(R.drawable.ic_neko_notification) .setColor(ContextCompat.getColor(context, R.color.new_neko_accent)) .setPriority(NotificationCompat.PRIORITY_HIGH) - if (errors.isNotEmpty() && !path.isNullOrEmpty() && !file.isNullOrEmpty()) { + if (!path.isNullOrEmpty() && !file.isNullOrEmpty()) { resultNotification.addAction( R.drawable.ic_close_24dp, context.getString( R.string - .view_all_errors + .view_log ), getErrorLogIntent(path, file) ) @@ -177,11 +175,14 @@ class RestoreHelper(val context: Context) { /** * Write errors to error log */ - fun writeErrorLog(errors: List, skippedAmount: Int, skippedTitles: List): File { + fun writeErrorLog( + errors: List, + skippedAmount: Int, + skippedTitles: List, + ): File? { try { if (errors.isNotEmpty() || skippedTitles.isNotEmpty()) { val destFile = File(context.externalCacheDir, "neko_restore.log") - val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault()) destFile.bufferedWriter().use { out -> if (skippedAmount > 0) { @@ -202,6 +203,6 @@ class RestoreHelper(val context: Context) { } catch (e: Exception) { XLog.e(e) } - return File("") + return null } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullRestore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullRestore.kt index 7aa5f16ee8..f9bec4090f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullRestore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullRestore.kt @@ -82,8 +82,8 @@ class FullRestore(val context: Context, val job: Job?) { val logFile = restoreHelper.writeErrorLog(errors, skippedAmount, skippedTitles) restoreHelper.showResultNotification( - logFile.parent, - logFile.name, + logFile?.parent, + logFile?.name, categoriesAmount, restoreProgress, restoreAmount, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26307dc686..d678004543 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -965,6 +965,7 @@ Unknown error Unpin Use default + View log View all errors View chapters Wi-Fi From 7641ffffc18c40b93dccf029bad628d89498f94c Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 15:18:46 -0500 Subject: [PATCH 05/13] Collapsing/Expanding a dynamic category was doing the action on all the categories --- CurrentChangeLog.MD | 1 + .../ui/library/LibraryHeaderHolder.kt | 19 +++++++++++++------ .../tachiyomi/ui/library/LibraryPresenter.kt | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index d2c34c1298..c9c9c5aa12 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -5,4 +5,5 @@ H badge shows on top of cover now Download notification was old green Browse items fail to load when having the first 20 in library, and hide library enabled Log file button didn't show on restore when only skipped titles and no errors +Collapsing/Expanding a dynamic category was doing the action on all the categories ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt index fba970a558..483305b905 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt @@ -41,7 +41,8 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd category?.isDynamic == false } binding.categoryTitle.setOnClickListener { - val category = (adapter.getItem(flexibleAdapterPosition) as? LibraryHeaderItem)?.category + val category = + (adapter.getItem(flexibleAdapterPosition) as? LibraryHeaderItem)?.category if (category?.isHidden == false && adapter.mode == SelectableAdapter.Mode.MULTI) { selectAll() } else { @@ -93,10 +94,16 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd val category = item.category binding.categoryTitle.text = - if (category.isAlone && !category.isDynamic) { "" } else { category.name } + - if (adapter.showNumber) { - " (${adapter.itemsPerCategory[item.catId]})" - } else { "" } + if (category.isAlone && !category.isDynamic) { + "" + } else { + category.name + } + + if (adapter.showNumber) { + " (${adapter.itemsPerCategory[item.catId]})" + } else { + "" + } binding.categoryTitle.setCompoundDrawablesRelative(null, null, null, null) val isAscending = category.isAscending() @@ -196,7 +203,7 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd @DrawableRes defaultDrawableRes: Int = R.drawable.ic_check_24dp, ): Int { sortingMode ?: return defaultDrawableRes - return when (val sortMode = LibrarySort.valueOf(sortingMode)) { + return when (LibrarySort.valueOf(sortingMode)) { LibrarySort.DragAndDrop -> defaultDrawableRes else -> { if (isAscending) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index fa0cc73537..9a12f35685 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -1024,7 +1024,8 @@ class LibraryPresenter( getLibrary() } - private fun getDynamicCategoryName(category: Category): String = groupType.toString() + private fun getDynamicCategoryName(category: Category): String = + groupType.toString() + dynamicCategorySplitter + category.name fun toggleAllCategoryVisibility() { if (groupType == BY_DEFAULT) { From 860a06fccdd872b4ac201b7e60d341f73a979e44 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 15:40:15 -0500 Subject: [PATCH 06/13] Changing download folder was not working until app was restarted --- CurrentChangeLog.MD | 1 + .../tachiyomi/data/download/DownloadProvider.kt | 17 +++-------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index c9c9c5aa12..233944c327 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -6,4 +6,5 @@ Download notification was old green Browse items fail to load when having the first 20 in library, and hide library enabled Log file button didn't show on restore when only skipped titles and no errors Collapsing/Expanding a dynamic category was doing the action on all the categories +Changing download folder was not working until app was restarted ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 2b3ef292f4..540f1d5f47 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -13,8 +13,6 @@ import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.isMergedChapter import eu.kanade.tachiyomi.util.lang.isUUID import eu.kanade.tachiyomi.util.storage.DiskUtil -import kotlinx.coroutines.flow.drop -import kotlinx.coroutines.flow.onEach import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy @@ -33,21 +31,12 @@ class DownloadProvider(private val context: Context) { private val preferences: PreferencesHelper by injectLazy() private val source = Injekt.get().getMangadex() - /** - * The root directory for downloads. - */ - private var downloadsDir = preferences.downloadsDirectory().get().let { + fun downloadsDir(): UniFile = preferences.downloadsDirectory().get().let { val dir = UniFile.fromUri(context, it.toUri()) DiskUtil.createNoMediaFile(dir, context) dir } - init { - preferences.downloadsDirectory().asFlow().drop(1).onEach { - downloadsDir = UniFile.fromUri(context, it.toUri()) - } - } - /** * Returns the download directory for a manga. For internal use only. * @@ -60,7 +49,7 @@ class DownloadProvider(private val context: Context) { val mangaDirName = getMangaDirName(manga) val sourceDirName = getSourceDirName() XLog.d("creating directory for $sourceDirName : $mangaDirName") - return downloadsDir.createDirectory(sourceDirName) + return downloadsDir().createDirectory(sourceDirName) .createDirectory(mangaDirName) } catch (e: Exception) { XLog.e("error getting download folder for ${manga.title}", e) @@ -74,7 +63,7 @@ class DownloadProvider(private val context: Context) { * @param source the source to query. */ fun findSourceDir(): UniFile? { - return downloadsDir.findFile(getSourceDirName(), true) + return downloadsDir().findFile(getSourceDirName(), true) } /** From a5be1cca2ce2a2629c152b605bd697128ad5d73b Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 19:30:30 -0500 Subject: [PATCH 07/13] changed data/datasaver/hash to the new location on the athome endpoint --- CurrentChangeLog.MD | 1 + .../source/online/handlers/PageHandler.kt | 30 +++++++++++-------- .../source/online/models/dto/AtHomeDto.kt | 8 +++++ .../source/online/models/dto/ChapterDto.kt | 15 ++++------ 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 233944c327..799f28a287 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -1,5 +1,6 @@ ## 🥳 New ## 🏗️ Changes +Update chapter api logic to correspond to MangaDex api changes ## 🐜 Fixes H badge shows on top of cover now Download notification was old green diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/PageHandler.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/PageHandler.kt index 614c24fc37..c0c737f28f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/PageHandler.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/PageHandler.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.source.online.handlers.external.BilibiliHandler import eu.kanade.tachiyomi.source.online.handlers.external.ComikeyHandler import eu.kanade.tachiyomi.source.online.handlers.external.MangaPlusHandler import eu.kanade.tachiyomi.source.online.models.dto.AtHomeDto -import eu.kanade.tachiyomi.source.online.models.dto.ChapterDto +import eu.kanade.tachiyomi.source.online.utils.MdUtil import eu.kanade.tachiyomi.util.log import eu.kanade.tachiyomi.util.throws import kotlinx.coroutines.Dispatchers @@ -35,16 +35,20 @@ class PageHandler { XLog.d("fetching page list") try { - val response = network.service.viewChapter(chapter.mangadex_chapter_id) + val chapterAttributesDto = network.service.viewChapter(chapter.mangadex_chapter_id) .onError { this.log("trying to fetch page list") throw Exception("error returned from chapterResponse") }.onException { this.log("trying to fetch page list") throw Exception("error returned from chapterResponse") - }.getOrThrow() + }.getOrThrow().data.attributes + + val externalUrl = chapterAttributesDto.externalUrl + val currentDate = System.currentTimeMillis() + val chapterDate = MdUtil.parseDate(chapterAttributesDto.publishAt) + val chapterDateNewer = chapterDate - currentDate > 0 - val externalUrl = response.data.attributes.externalUrl if (externalUrl != null) { when { "mangaplus".equals(chapter.scanlator, true) -> { @@ -54,7 +58,7 @@ class PageHandler { return@withContext comikeyHandler.fetchPageList(externalUrl) }*/ "bilibili comics".equals(chapter.scanlator, true) -> { - if (response.data.attributes.data.isEmpty()) { + if (chapterDateNewer) { return@withContext bilibiliHandler.fetchPageList(externalUrl) } } @@ -62,7 +66,7 @@ class PageHandler { } } - if (response.data.attributes.data.isEmpty()) { + if (chapterDateNewer) { throw Exception("This chapter has no pages, it might not be release yet, try refreshing") } @@ -86,7 +90,7 @@ class PageHandler { return@withContext pageListParse( - response, + chapter.mangadex_chapter_id, atHomeDto, preferences.dataSaver() ) @@ -98,23 +102,23 @@ class PageHandler { } fun pageListParse( - chapterDto: ChapterDto, + chapterId: String, atHomeDto: AtHomeDto, dataSaver: Boolean, ): List { - val hash = chapterDto.data.attributes.hash + val hash = atHomeDto.chapter.hash val pageArray = if (dataSaver) { - chapterDto.data.attributes.dataSaver.map { "/data-saver/$hash/$it" } + atHomeDto.chapter.dataSaver.map { "/data-saver/$hash/$it" } } else { - chapterDto.data.attributes.data.map { "/data/$hash/$it" } + atHomeDto.chapter.data.map { "/data/$hash/$it" } } val now = Date().time val pages = pageArray.mapIndexed { pos, imgUrl -> - Page(pos + 1, atHomeDto.baseUrl, imgUrl, chapterDto.data.id) + Page(pos + 1, atHomeDto.baseUrl, imgUrl, chapterId) } - imageHandler.updateTokenTracker(chapterDto.data.id, now) + imageHandler.updateTokenTracker(chapterId, now) return pages } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/AtHomeDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/AtHomeDto.kt index 9a89b96cdb..b9aef34c9d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/AtHomeDto.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/AtHomeDto.kt @@ -5,6 +5,14 @@ import kotlinx.serialization.Serializable @Serializable data class AtHomeDto( val baseUrl: String, + val chapter: AtHomeChapterDto, +) + +@Serializable +data class AtHomeChapterDto( + val hash: String, + val data: List, + val dataSaver: List, ) @Serializable diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/ChapterDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/ChapterDto.kt index ccba07f7a5..8e13fc4c73 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/ChapterDto.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/ChapterDto.kt @@ -2,6 +2,12 @@ package eu.kanade.tachiyomi.source.online.models.dto import kotlinx.serialization.Serializable +@Serializable +data class ChapterDto( + val result: String, + val data: ChapterDataDto, +) + @Serializable data class ChapterListDto( val limit: Int, @@ -11,12 +17,6 @@ data class ChapterListDto( val data: List, ) -@Serializable -data class ChapterDto( - val result: String, - val data: ChapterDataDto, -) - @Serializable data class ChapterDataDto( val id: String, @@ -32,10 +32,7 @@ data class ChapterAttributesDto( val chapter: String?, val translatedLanguage: String, val publishAt: String, - val data: List, - val dataSaver: List, val externalUrl: String? = null, - val hash: String, ) @Serializable From e55095b8b0c6f451014c7242fea899d9abeb6e53 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 19:41:16 -0500 Subject: [PATCH 08/13] reauthorize login before attempting to get reading statuses on library update --- CurrentChangeLog.MD | 1 + .../kanade/tachiyomi/data/library/LibraryUpdateService.kt | 6 +++++- .../kanade/tachiyomi/source/online/MangaDexLoginHelper.kt | 6 ++++++ .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 799f28a287..e8233a83c4 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -8,4 +8,5 @@ Browse items fail to load when having the first 20 in library, and hide library Log file button didn't show on restore when only skipped titles and no errors Collapsing/Expanding a dynamic category was doing the action on all the categories Changing download folder was not working until app was restarted +reauthorize login before attempting to get reading statuses on library update ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 78ee0fc7ab..0c954648a6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -27,6 +27,7 @@ import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.isMerged import eu.kanade.tachiyomi.source.model.isMergedChapter +import eu.kanade.tachiyomi.source.online.MangaDexLoginHelper import eu.kanade.tachiyomi.source.online.handlers.StatusHandler import eu.kanade.tachiyomi.source.online.utils.FollowStatus import eu.kanade.tachiyomi.source.online.utils.MdUtil @@ -70,6 +71,7 @@ class LibraryUpdateService( val preferences: PreferencesHelper = Injekt.get(), val downloadManager: DownloadManager = Injekt.get(), val trackManager: TrackManager = Injekt.get(), + val mangaDexLoginHelper: MangaDexLoginHelper = Injekt.get(), ) : Service() { /** @@ -552,13 +554,15 @@ class LibraryUpdateService( } suspend fun updateReadingStatus(mangaList: List?) { + XLog.d("Attempting to update reading statuses") if (mangaList.isNullOrEmpty()) return if (sourceManager.getMangadex().isLogged() && job?.isCancelled == false) { runCatching { + mangaDexLoginHelper.reAuthIfNeeded() val readingStatus = statusHandler.fetchReadingStatusForAllManga() if (readingStatus.isNotEmpty()) { XLog.d("Updating follow statuses") - mangaList!!.map { libraryManga -> + mangaList.map { libraryManga -> runCatching { db.getTracks(libraryManga).executeOnIO() .toMutableList() diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/MangaDexLoginHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/MangaDexLoginHelper.kt index 6f0a65bdac..bb15a76474 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/MangaDexLoginHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/MangaDexLoginHelper.kt @@ -119,4 +119,10 @@ class MangaDexLoginHelper { } return login(username, password) } + + suspend fun reAuthIfNeeded() { + if (!isAuthenticated() && !refreshToken()) { + login() + } + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index fb96659bd9..450f58f671 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -157,7 +157,7 @@ open class MainActivity : BaseActivity(), DownloadServiceLi override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - + // Do not let the launcher create a new activity http://stackoverflow.com/questions/16283079 if (!isTaskRoot && this !is SearchActivity) { finish() From 0f46f679db0e3fe3700fb0d6fc7e0ef3386917c2 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 19:49:11 -0500 Subject: [PATCH 09/13] slight fix to last commit --- .../eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 0c954648a6..da33633abb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -363,6 +363,7 @@ class LibraryUpdateService( if (mangaToUpdateMap[source] == null) return false var currentCount = 0 var hasDownloads = false + mangaDexLoginHelper.reAuthIfNeeded() while (currentCount < mangaToUpdateMap[source]!!.size) { val manga = mangaToUpdateMap[source]!![currentCount] @@ -558,7 +559,6 @@ class LibraryUpdateService( if (mangaList.isNullOrEmpty()) return if (sourceManager.getMangadex().isLogged() && job?.isCancelled == false) { runCatching { - mangaDexLoginHelper.reAuthIfNeeded() val readingStatus = statusHandler.fetchReadingStatusForAllManga() if (readingStatus.isNotEmpty()) { XLog.d("Updating follow statuses") From e4d2e5ccbf77b309edc89e13742645f482194439 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 20:38:29 -0500 Subject: [PATCH 10/13] ratings will show in MD again --- CurrentChangeLog.MD | 1 + .../network/services/MangaDexService.kt | 10 ++++++++++ .../source/online/handlers/ApiMangaParser.kt | 14 ++++++++++++++ .../source/online/models/dto/StatisticsDto.kt | 19 +++++++++++++++++++ .../tachiyomi/source/online/utils/MdApi.kt | 1 + 5 files changed, 45 insertions(+) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index e8233a83c4..42867c2247 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -1,4 +1,5 @@ ## 🥳 New +Rating will now show again in MangaDex (once they fix the api) ## 🏗️ Changes Update chapter api logic to correspond to MangaDex api changes ## 🐜 Fixes diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt b/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt index 9a95b4e325..bc81254c93 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt @@ -11,7 +11,9 @@ import eu.kanade.tachiyomi.source.online.models.dto.LegacyIdDto import eu.kanade.tachiyomi.source.online.models.dto.LegacyMappingDto import eu.kanade.tachiyomi.source.online.models.dto.MangaDto import eu.kanade.tachiyomi.source.online.models.dto.MangaListDto +import eu.kanade.tachiyomi.source.online.models.dto.RelationListDto import eu.kanade.tachiyomi.source.online.models.dto.ResultDto +import eu.kanade.tachiyomi.source.online.models.dto.StatisticResponseDto import eu.kanade.tachiyomi.source.online.utils.MdApi import eu.kanade.tachiyomi.source.online.utils.MdConstants import retrofit2.http.Body @@ -36,6 +38,14 @@ interface MangaDexService { @Query(value = "translatedLanguage[]") translatedLanguages: List, ): ApiResponse + @GET(MdApi.statistics) + suspend fun mangaStatistics( + @Query(value = "manga[]") mangaId: String, + ): ApiResponse + + @GET("${MdApi.manga}/{id}/relations?includes[]=${MdConstants.Types.manga}") + suspend fun relatedManga(@Path("id") id: String): ApiResponse + @Headers("Cache-Control: no-cache") @GET("${MdApi.manga}/{id}/feed?limit=500&contentRating[]=${MdConstants.ContentRating.safe}&contentRating[]=${MdConstants.ContentRating.suggestive}&contentRating[]=${MdConstants.ContentRating.erotica}&contentRating[]=${MdConstants.ContentRating.pornographic}&includes[]=${MdConstants.Types.scanlator}&order[volume]=desc&order[chapter]=desc") suspend fun viewChapters( diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt index da12d6c5c9..b83e575fb7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt @@ -52,6 +52,20 @@ class ApiMangaParser { ?: emptyList() } + withIOContext { + val stats = network.service.mangaStatistics(mangaDto.id) + .onError { + this.log("trying to get rating for ${mangaDto.id}") + }.onException { + this.log("trying to get rating for ${mangaDto.id}") + }.getOrNull() + val rating = stats?.statistics?.get(mangaDto.id)?.rating?.average ?: 0.0 + if (rating > 0) { + manga.rating = rating.toString() + } + } + + manga.description = MdUtil.cleanDescription(mangaAttributesDto.description.asMdMap()["en"] ?: "") diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt new file mode 100644 index 0000000000..33ae2d6a32 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt @@ -0,0 +1,19 @@ +package eu.kanade.tachiyomi.source.online.models.dto + +import kotlinx.serialization.Serializable + +@Serializable +data class StatisticResponseDto( + val result: String, + val statistics: Map, +) + +@Serializable +data class StatisticsDto( + val rating: RatingDto, +) + +@Serializable +data class RatingDto( + val average: Double, +) \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/utils/MdApi.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/utils/MdApi.kt index 64994d0ea3..234843bd4c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/utils/MdApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/utils/MdApi.kt @@ -7,6 +7,7 @@ object MdApi { const val refreshToken = "/auth/refresh" const val logout = "/auth/logout" const val manga = "/manga" + const val statistics = "/statistics/manga" const val chapter = "/chapter" const val group = "/group" const val author = "/author" From b856ffa4fc299f8b88ebf6afb4980f1fefa0171c Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 20:55:02 -0500 Subject: [PATCH 11/13] fix aggregate error --- .../source/online/handlers/ApiMangaParser.kt | 3 ++- .../tachiyomi/source/online/models/dto/MangaDto.kt | 12 ++++++++++-- .../source/online/models/dto/StatisticsDto.kt | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt index b83e575fb7..ca298c3902 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/ApiMangaParser.kt @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.models.dto.ChapterDataDto import eu.kanade.tachiyomi.source.online.models.dto.ChapterDto import eu.kanade.tachiyomi.source.online.models.dto.MangaDataDto +import eu.kanade.tachiyomi.source.online.models.dto.asMdAggregateVolumeMap import eu.kanade.tachiyomi.source.online.models.dto.asMdMap import eu.kanade.tachiyomi.source.online.utils.MdConstants import eu.kanade.tachiyomi.source.online.utils.MdUtil @@ -46,7 +47,7 @@ class ApiMangaParser { this.log("trying to aggregate for ${mangaDto.id}") }.getOrNull() - aggregateDto?.volumes?.values + aggregateDto?.volumes?.asMdAggregateVolumeMap()?.values ?.flatMap { it.chapters.values } ?.map { it.chapter } ?: emptyList() diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/MangaDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/MangaDto.kt index f73d59bef8..7e76a1b818 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/MangaDto.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/MangaDto.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.contentOrNull +import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive @Serializable @@ -124,7 +125,7 @@ data class CoverAttributesDto( @Serializable data class AggregateDto( val result: String, - val volumes: Map, + val volumes: JsonElement, ) @Serializable @@ -140,8 +141,15 @@ data class AggregateChapter( val count: String, ) +fun JsonElement.asMdAggregateVolumeMap(): Map { + return runCatching { + (this as JsonObject).map { it.key to (it.value.jsonObject as AggregateVolume) }.toMap() + }.getOrElse { emptyMap() } +} + fun JsonElement.asMdMap(): Map { return runCatching { - (this as JsonObject).map { it.key to (it.value.jsonPrimitive.contentOrNull ?: "") }.toMap() + (this as JsonObject).map { it.key to (it.value.jsonPrimitive.contentOrNull ?: "") } + .toMap() }.getOrElse { emptyMap() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt index 33ae2d6a32..b95a383ec9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/StatisticsDto.kt @@ -15,5 +15,5 @@ data class StatisticsDto( @Serializable data class RatingDto( - val average: Double, + val average: Double?, ) \ No newline at end of file From a44bb37fb6bb3953857e4bcdb2285bc18d44ab6d Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 21:11:52 -0500 Subject: [PATCH 12/13] add related manga to similar page --- CurrentChangeLog.MD | 2 ++ .../network/services/MangaDexService.kt | 2 +- .../source/online/handlers/SimilarHandler.kt | 30 +++++++++++++++++-- .../source/online/models/dto/SimilarDto.kt | 24 +++++++++++++-- .../tachiyomi/ui/similar/SimilarRepository.kt | 11 ++++++- app/src/main/res/values/strings.xml | 1 + 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/CurrentChangeLog.MD b/CurrentChangeLog.MD index 42867c2247..565e921f0a 100644 --- a/CurrentChangeLog.MD +++ b/CurrentChangeLog.MD @@ -1,5 +1,6 @@ ## 🥳 New Rating will now show again in MangaDex (once they fix the api) +Related Manga from MangaDex now show in the similar page ## 🏗️ Changes Update chapter api logic to correspond to MangaDex api changes ## 🐜 Fixes @@ -10,4 +11,5 @@ Log file button didn't show on restore when only skipped titles and no errors Collapsing/Expanding a dynamic category was doing the action on all the categories Changing download folder was not working until app was restarted reauthorize login before attempting to get reading statuses on library update +non visible error on aggregate endpoint ## 🛠️ Other diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt b/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt index bc81254c93..91040aa119 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/services/MangaDexService.kt @@ -43,7 +43,7 @@ interface MangaDexService { @Query(value = "manga[]") mangaId: String, ): ApiResponse - @GET("${MdApi.manga}/{id}/relations?includes[]=${MdConstants.Types.manga}") + @GET("${MdApi.manga}/{id}/relation") suspend fun relatedManga(@Path("id") id: String): ApiResponse @Headers("Cache-Control: no-cache") diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/SimilarHandler.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/SimilarHandler.kt index 916e0816db..88fd024674 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/SimilarHandler.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/handlers/SimilarHandler.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.source.online.handlers import com.elvishew.xlog.XLog import com.skydoves.sandwich.getOrElse +import com.skydoves.sandwich.getOrNull import com.skydoves.sandwich.getOrThrow import com.skydoves.sandwich.onError import com.skydoves.sandwich.onException @@ -20,6 +21,7 @@ import eu.kanade.tachiyomi.source.online.utils.MdUtil import eu.kanade.tachiyomi.source.online.utils.toBasicManga import eu.kanade.tachiyomi.util.log import eu.kanade.tachiyomi.util.manga.MangaMappings +import eu.kanade.tachiyomi.util.system.withIOContext import eu.kanade.tachiyomi.util.throws import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString @@ -32,6 +34,28 @@ class SimilarHandler { private val mappings: MangaMappings by injectLazy() private val preferencesHelper: PreferencesHelper by injectLazy() + suspend fun fetchRelated(dexId: String): List { + val related = withIOContext { + network.service.relatedManga(dexId) + .onError { + this.log("trying to get related manga") + } + .onException { + this.log("trying to get related manga") + } + .getOrNull() + } + related ?: return emptyList() + + val mangaIdList = related.data.mapNotNull { it.relationships.firstOrNull() }.map { it.id } + + val mangaList = similarGetMangadexMangaList(mangaIdList, false) + + val thumbQuality = preferencesHelper.thumbnailQuality() + + return mangaList.data.map { it.toBasicManga(thumbQuality) } + } + /** * fetch our similar mangaList */ @@ -354,11 +378,11 @@ class SimilarHandler { * this will get the manga objects with cover_art for all the specified ids */ private suspend fun similarGetMangadexMangaList( - mangaIds: List, + mangaIds: List, strictMatch: Boolean = true, ): MangaListDto { val queryMap = mutableMapOf( "limit" to mangaIds.size, - "ids[]" to mangaIds + "ids[]" to mangaIds, ) val responseBody = network.service.search(ProxyRetrofitQueryMap(queryMap)).onError { val type = "searching for manga in similar handler" @@ -370,7 +394,7 @@ class SimilarHandler { this.throws(type) }.getOrThrow() - if (responseBody.data.size != mangaIds.size) { + if (strictMatch && responseBody.data.size != mangaIds.size) { XLog.e("manga returned doesn't match number of manga expected") throw Exception("Unable to complete response ${responseBody.data.size} of ${mangaIds.size} returned") } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/SimilarDto.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/SimilarDto.kt index dc481294ef..b8ba57e793 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/SimilarDto.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/models/dto/SimilarDto.kt @@ -2,6 +2,28 @@ package eu.kanade.tachiyomi.source.online.models.dto import kotlinx.serialization.Serializable +@Serializable +data class RelationListDto( + val response: String, + val data: List, +) + +@Serializable +data class RelationDto( + val attributes: RelationAttributesDto, + val relationships: List, +) + +@Serializable +data class RelationMangaDto( + val id: String, +) + +@Serializable +data class RelationAttributesDto( + val relation: String, +) + @Serializable data class SimilarMangaDatabaseDto( var similarApi: SimilarMangaDto? = null, @@ -29,7 +51,6 @@ data class SimilarMangaMatchListDto( val score: Double, ) - @Serializable data class AnilistMangaRecommendationsDto( val data: AnilistMangaSimilarMedia, @@ -67,7 +88,6 @@ data class AnilistMangaSimilarMediaRecommend( val format: String, ) - @Serializable data class MalMangaRecommendationsDto( val request_hash: String, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/similar/SimilarRepository.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/similar/SimilarRepository.kt index 4eeffb320e..bb25bfe8c4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/similar/SimilarRepository.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/similar/SimilarRepository.kt @@ -32,6 +32,15 @@ class SimilarRepository { val dexId = MdUtil.getMangaId(manga.url) val similarDbEntry = db.getSimilar(dexId).executeAsBlocking() + val related = async { + kotlin.runCatching { + logTimeTaken(" Related Rec:") { + createGroup(R.string.related_type, + similarHandler.fetchRelated(dexId)) + } + }.getOrNull() + } + val similar = async { runCatching { logTimeTaken("Similar Recs:") { @@ -63,7 +72,7 @@ class SimilarRepository { }.getOrNull() } - listOfNotNull(similar.await(), anilist.await(), mal.await()) + listOfNotNull(related.await(), similar.await(), anilist.await(), mal.await()) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d678004543..435fd5af3c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1057,6 +1057,7 @@ Similar + Related Similar manga Similar Manga Settings From a12fdb5e5813c3fb90f570921671b97ef04fa3a2 Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Sun, 26 Dec 2021 21:12:35 -0500 Subject: [PATCH 13/13] 2.7.3 --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d351fa72a7..99e5c6318d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -9,8 +9,8 @@ object Configs { const val minSdkVersion = 24 const val targetSdkVersion = 30 const val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - const val versionCode = 135 - const val versionName = "2.7.2" + const val versionCode = 136 + const val versionName = "2.7.3" } plugins {