From 4c4a178b9eb081a885b9c720e4c2ffdc17d6f5f9 Mon Sep 17 00:00:00 2001 From: Smol Ame <155411819+Smol-Ame@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:53:50 -0700 Subject: [PATCH] WPComics: Add `monthWords` and `yearWords` (#3477) * WPComics: Add `monthWords` and `yearWords` * Simplified month & year --- lib-multisrc/wpcomics/build.gradle.kts | 2 +- .../src/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib-multisrc/wpcomics/build.gradle.kts b/lib-multisrc/wpcomics/build.gradle.kts index b21dd0bb4..e07fe6e71 100644 --- a/lib-multisrc/wpcomics/build.gradle.kts +++ b/lib-multisrc/wpcomics/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("lib-multisrc") } -baseVersionCode = 5 +baseVersionCode = 6 dependencies { api(project(":lib:i18n")) diff --git a/lib-multisrc/wpcomics/src/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt b/lib-multisrc/wpcomics/src/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt index 92962053e..4b5e68ce1 100644 --- a/lib-multisrc/wpcomics/src/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt +++ b/lib-multisrc/wpcomics/src/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt @@ -163,6 +163,8 @@ abstract class WPComics( val minuteWords = listOf("minute", "phút") val hourWords = listOf("hour", "giờ") val dayWords = listOf("day", "ngày") + val monthWords = listOf("month", "tháng") + val yearWords = listOf("year", "năm") val agoWords = listOf("ago", "trước") return try { @@ -171,6 +173,8 @@ abstract class WPComics( val calendar = Calendar.getInstance() when { + yearWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.YEAR, -trimmedDate[0].toInt()) } + monthWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.MONTH, -trimmedDate[0].toInt()) } dayWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.DAY_OF_MONTH, -trimmedDate[0].toInt()) } hourWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.HOUR_OF_DAY, -trimmedDate[0].toInt()) } minuteWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.MINUTE, -trimmedDate[0].toInt()) }