From ec3076ecb771276b0eb4e5df828b4f49d32cad3e Mon Sep 17 00:00:00 2001 From: Ambarish Manna Date: Thu, 27 Feb 2025 21:48:59 +0530 Subject: [PATCH] #4236 Improved download notification strings replacing default Fetch's string --- .../FetchDownloadNotificationManager.kt | 14 ++++++++++++++ core/src/main/res/values-qq/strings.xml | 5 +++++ core/src/main/res/values/strings.xml | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/FetchDownloadNotificationManager.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/FetchDownloadNotificationManager.kt index 6c64661ec..2eed6a6b1 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/FetchDownloadNotificationManager.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/FetchDownloadNotificationManager.kt @@ -111,6 +111,20 @@ class FetchDownloadNotificationManager @Inject constructor( } } + override fun getSubtitleText( + context: Context, + downloadNotification: DownloadNotification + ): String { + return when { + downloadNotification.isCompleted -> context.getString(R.string.fetch_notification_download_complete) + downloadNotification.isFailed -> context.getString(R.string.fetch_notification_download_failed) + downloadNotification.isPaused -> context.getString(R.string.fetch_notification_download_paused) + downloadNotification.isQueued -> context.getString(R.string.fetch_notification_download_resuming) + downloadNotification.etaInMilliSeconds < 0 -> context.getString(R.string.fetch_notification_download_downloading) + else -> super.getSubtitleText(context, downloadNotification) + } + } + @RequiresApi(Build.VERSION_CODES.O) private fun createChannel(channelId: String, context: Context) = NotificationChannel( diff --git a/core/src/main/res/values-qq/strings.xml b/core/src/main/res/values-qq/strings.xml index c07eefb55..a1359d002 100644 --- a/core/src/main/res/values-qq/strings.xml +++ b/core/src/main/res/values-qq/strings.xml @@ -329,4 +329,9 @@ This is a text label, by clicking on this text user navigates to the app settings on their device. This message appears in the “Android Dialog” as an information message. When the user tries to run any functionality which requires notification access but the app does not have that access, then this message shows to the user to give notification access. {{Ignored}} + This appears in the "Android Notification" as a notification description message indicating the download is complete. + This appears in the "Android Notification" as a notification description message indicating the download failed. + This appears in the "Android Notification" as a notification description message indicating the download has been paused. + This appears in the "Android Notification" as a notification description message indicating a paused download is resuming. + This appears in the "Android Notification" as a notification description message indicating that a download is in progress. diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index e3c0d2011..328db5bef 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -402,4 +402,9 @@ Donate Today %s needs your help. Make a donation + Complete + Failed + Paused + Resuming + Downloading