Fix what's new link in dialog

This commit is contained in:
arkon 2021-10-23 17:29:27 -04:00
parent 93e2b88d41
commit 22ed163c8f
3 changed files with 14 additions and 7 deletions

View File

@ -70,3 +70,13 @@ val GITHUB_REPO: String by lazy {
"tachiyomiorg/tachiyomi" "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"

View File

@ -5,6 +5,7 @@ import android.os.Bundle
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R 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.DialogController
import eu.kanade.tachiyomi.ui.base.controller.openInBrowser 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)) .setTitle(activity!!.getString(R.string.updated_version, BuildConfig.VERSION_NAME))
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.setNeutralButton(R.string.whats_new) { _, _ -> .setNeutralButton(R.string.whats_new) { _, _ ->
openInBrowser("https://github.com/tachiyomiorg/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}") openInBrowser(RELEASE_URL)
} }
.create() .create()
} }

View File

@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
import eu.kanade.tachiyomi.data.updater.AppUpdateResult 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.NoAppBarElevationController
import eu.kanade.tachiyomi.ui.base.controller.openInBrowser import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
@ -73,12 +74,7 @@ class AboutController : SettingsController(), NoAppBarElevationController {
titleRes = R.string.whats_new titleRes = R.string.whats_new
onClick { onClick {
val url = if (BuildConfig.PREVIEW) { openInBrowser(RELEASE_URL)
"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)
} }
} }
} }