🛠️ Move links to Constants

* Moved links to Constants from strings.xml
This commit is contained in:
Acclorite 2024-09-10 20:12:43 +03:00
parent e212733300
commit 287e92b0d2
5 changed files with 25 additions and 21 deletions

View file

@ -10,6 +10,7 @@ import android.graphics.drawable.Icon
import android.net.Uri
import ua.acclorite.book_story.R
import ua.acclorite.book_story.data.remote.dto.LatestReleaseInfo
import ua.acclorite.book_story.presentation.core.constants.Constants
import javax.inject.Inject
class UpdatesNotificationServiceImpl @Inject constructor(
@ -22,11 +23,11 @@ class UpdatesNotificationServiceImpl @Inject constructor(
override fun postNotification(releaseInfo: LatestReleaseInfo) {
val downloadLatestVersionIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse(application.getString(R.string.download_latest_release_page))
Uri.parse(Constants.DOWNLOAD_LATEST_RELEASE_PAGE)
)
val latestReleaseIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse(application.getString(R.string.releases_page))
Uri.parse(Constants.RELEASES_PAGE)
)
val downloadLatestVersionPendingIntent = PendingIntent.getActivity(

View file

@ -67,6 +67,12 @@ object Constants {
// Scrollbars (Primary unused, awaiting for fixes)
val PRIMARY_SCROLLBAR @Composable get() = providePrimaryScrollbar()
val SECONDARY_SCROLLBAR @Composable get() = provideSecondaryScrollbar()
// Links
val DOWNLOAD_LATEST_RELEASE_PAGE = provideDownloadLatestReleasePage()
val RELEASES_PAGE = provideReleasesPage()
val ISSUES_PAGE = provideIssuesPage()
val TRANSLATION_PAGE = provideTranslationPage()
}
private fun provideSupportedExtensions() = listOf(
@ -598,3 +604,12 @@ private fun provideSecondaryScrollbar() = ScrollbarSettings(
hideDisplacement = 0.dp,
scrollbarPadding = 0.dp
)
private fun provideDownloadLatestReleasePage() =
"https://www.github.com/Acclorite/book-story/releases/latest/download/book-story.apk"
private fun provideReleasesPage() = "https://www.github.com/Acclorite/book-story/releases/latest"
private fun provideIssuesPage() = "https://www.github.com/Acclorite/book-story/issues"
private fun provideTranslationPage() = "https://hosted.weblate.org/projects/book-story"

View file

@ -32,6 +32,7 @@ import ua.acclorite.book_story.presentation.core.components.CustomLazyColumn
import ua.acclorite.book_story.presentation.core.components.GoBackButton
import ua.acclorite.book_story.presentation.core.components.LocalAboutViewModel
import ua.acclorite.book_story.presentation.core.components.collapsibleUntilExitScrollBehaviorWithLazyListState
import ua.acclorite.book_story.presentation.core.constants.Constants
import ua.acclorite.book_story.presentation.core.navigation.LocalOnNavigate
import ua.acclorite.book_story.presentation.core.navigation.Screen
import ua.acclorite.book_story.presentation.core.util.showToast
@ -158,7 +159,7 @@ private fun AboutScreen() {
) {
onEvent(
AboutEvent.OnNavigateToBrowserPage(
context.getString(R.string.issues_page),
Constants.ISSUES_PAGE,
context,
noAppsFound = {
context.getString(R.string.error_no_browser)
@ -176,7 +177,7 @@ private fun AboutScreen() {
) {
onEvent(
AboutEvent.OnNavigateToBrowserPage(
context.getString(R.string.releases_page),
Constants.RELEASES_PAGE,
context,
noAppsFound = {
context.getString(R.string.error_no_browser)
@ -216,7 +217,7 @@ private fun AboutScreen() {
) {
onEvent(
AboutEvent.OnNavigateToBrowserPage(
context.getString(R.string.translation_page),
Constants.TRANSLATION_PAGE,
context,
noAppsFound = {
context.getString(R.string.error_no_browser)

View file

@ -9,6 +9,7 @@ import androidx.compose.ui.res.stringResource
import ua.acclorite.book_story.R
import ua.acclorite.book_story.presentation.core.components.LocalAboutViewModel
import ua.acclorite.book_story.presentation.core.components.custom_dialog.CustomDialogWithContent
import ua.acclorite.book_story.presentation.core.constants.Constants
import ua.acclorite.book_story.presentation.core.util.showToast
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
@ -38,7 +39,7 @@ fun AboutUpdateDialog() {
onAction = {
onEvent(
AboutEvent.OnNavigateToBrowserPage(
page = context.getString(R.string.download_latest_release_page),
page = Constants.RELEASES_PAGE,
context = context,
noAppsFound = {
context.getString(R.string.error_no_browser).showToast(

View file

@ -3,20 +3,6 @@
<string name="app_version" translatable="false">1.2.0</string>
<string name="app_name" translatable="false">Book\'s Story</string>
<!-- About sites -->
<string name="download_latest_release_page" translatable="false">
https://www.github.com/Acclorite/book-story/releases/latest/download/book-story.apk
</string>
<string name="releases_page" translatable="false">
https://www.github.com/Acclorite/book-story/releases/latest
</string>
<string name="issues_page" translatable="false">
https://www.github.com/Acclorite/book-story/issues
</string>
<string name="translation_page" translatable="false">
https://hosted.weblate.org/projects/book-story
</string>
<!-- Notifications -->
<string name="updates_notification_channel">New updates</string>
<string name="updates_notification_title">New update of Book\'s Story!</string>