From 22ed163c8f97136f3b7679ae48adba7e6b7c727c Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Oct 2021 17:29:27 -0400 Subject: [PATCH] Fix what's new link in dialog --- .../kanade/tachiyomi/data/updater/AppUpdateChecker.kt | 10 ++++++++++ .../tachiyomi/ui/main/WhatsNewDialogController.kt | 3 ++- .../eu/kanade/tachiyomi/ui/more/AboutController.kt | 8 ++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt index 2e638fcc71..7a202a9ea2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt @@ -70,3 +70,13 @@ val GITHUB_REPO: String by lazy { "tachiyomiorg/tachiyomi" } } + +val RELEASE_TAG: String by lazy { + if (BuildConfig.PREVIEW) { + "r${BuildConfig.COMMIT_COUNT}" + } else { + "v${BuildConfig.VERSION_NAME}" + } +} + +val RELEASE_URL = "https://github.com/$GITHUB_REPO/releases/tag/$RELEASE_TAG" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/WhatsNewDialogController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/WhatsNewDialogController.kt index 9cedc6c2cf..f69eb34c9e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/WhatsNewDialogController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/WhatsNewDialogController.kt @@ -5,6 +5,7 @@ import android.os.Bundle import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.updater.RELEASE_URL import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.openInBrowser @@ -16,7 +17,7 @@ class WhatsNewDialogController(bundle: Bundle? = null) : DialogController(bundle .setTitle(activity!!.getString(R.string.updated_version, BuildConfig.VERSION_NAME)) .setPositiveButton(android.R.string.ok, null) .setNeutralButton(R.string.whats_new) { _, _ -> - openInBrowser("https://github.com/tachiyomiorg/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}") + openInBrowser(RELEASE_URL) } .create() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 162cb90d46..81794456a8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.updater.AppUpdateChecker import eu.kanade.tachiyomi.data.updater.AppUpdateResult +import eu.kanade.tachiyomi.data.updater.RELEASE_URL import eu.kanade.tachiyomi.ui.base.controller.NoAppBarElevationController import eu.kanade.tachiyomi.ui.base.controller.openInBrowser import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction @@ -73,12 +74,7 @@ class AboutController : SettingsController(), NoAppBarElevationController { titleRes = R.string.whats_new onClick { - val url = if (BuildConfig.PREVIEW) { - "https://github.com/tachiyomiorg/tachiyomi-preview/releases/tag/r${BuildConfig.COMMIT_COUNT}" - } else { - "https://github.com/tachiyomiorg/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}" - } - openInBrowser(url) + openInBrowser(RELEASE_URL) } } }