Эх сурвалжийг харах

Fix what's new link in dialog

arkon 3 жил өмнө
parent
commit
22ed163c8f

+ 10 - 0
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"

+ 2 - 1
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()
     }

+ 2 - 6
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)
                 }
             }
         }