From 287e92b0d20e0b77d75041d41f13cde7edc75c77 Mon Sep 17 00:00:00 2001 From: Acclorite <140836141+Acclorite@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:12:43 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Move=20links=20to=20Con?= =?UTF-8?q?stants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moved links to Constants from strings.xml --- .../UpdatesNotificationServiceImpl.kt | 5 +++-- .../presentation/core/constants/Constants.kt | 17 ++++++++++++++++- .../presentation/screens/about/AboutScreen.kt | 7 ++++--- .../about/components/AboutUpdateDialog.kt | 3 ++- app/src/main/res/values/strings.xml | 14 -------------- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/ua/acclorite/book_story/data/local/notification/UpdatesNotificationServiceImpl.kt b/app/src/main/java/ua/acclorite/book_story/data/local/notification/UpdatesNotificationServiceImpl.kt index 8339ada8..764c969b 100644 --- a/app/src/main/java/ua/acclorite/book_story/data/local/notification/UpdatesNotificationServiceImpl.kt +++ b/app/src/main/java/ua/acclorite/book_story/data/local/notification/UpdatesNotificationServiceImpl.kt @@ -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( diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/core/constants/Constants.kt b/app/src/main/java/ua/acclorite/book_story/presentation/core/constants/Constants.kt index eb2d63c1..d9897650 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/core/constants/Constants.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/core/constants/Constants.kt @@ -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( @@ -597,4 +603,13 @@ private fun provideSecondaryScrollbar() = ScrollbarSettings( thumbShape = RectangleShape, hideDisplacement = 0.dp, scrollbarPadding = 0.dp -) \ No newline at end of file +) + +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" \ No newline at end of file diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/AboutScreen.kt b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/AboutScreen.kt index 68b28047..14492be9 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/AboutScreen.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/AboutScreen.kt @@ -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) diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/components/AboutUpdateDialog.kt b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/components/AboutUpdateDialog.kt index a9a3c456..21d63f42 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/components/AboutUpdateDialog.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/components/AboutUpdateDialog.kt @@ -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( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index acca882d..efcc7e57 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,20 +3,6 @@ 1.2.0 Book\'s Story - - - https://www.github.com/Acclorite/book-story/releases/latest/download/book-story.apk - - - https://www.github.com/Acclorite/book-story/releases/latest - - - https://www.github.com/Acclorite/book-story/issues - - - https://hosted.weblate.org/projects/book-story - - New updates New update of Book\'s Story!