summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/components/feature/downloads/src
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/android-components/components/feature/downloads/src')
-rw-r--r--mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt12
-rw-r--r--mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadNotification.kt7
-rw-r--r--mobile/android/android-components/components/feature/downloads/src/main/res/values-ast/strings.xml3
3 files changed, 17 insertions, 5 deletions
diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt
index c7e480e038..ac5563aebb 100644
--- a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt
+++ b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadMiddleware.kt
@@ -27,6 +27,8 @@ import mozilla.components.feature.downloads.AbstractFetchDownloadService.Compani
import mozilla.components.lib.state.Middleware
import mozilla.components.lib.state.MiddlewareContext
import mozilla.components.lib.state.Store
+import mozilla.components.support.base.android.DefaultPowerManagerInfoProvider
+import mozilla.components.support.base.android.StartForegroundService
import mozilla.components.support.base.log.logger.Logger
import kotlin.coroutines.CoroutineContext
@@ -42,6 +44,9 @@ class DownloadMiddleware(
coroutineContext: CoroutineContext = Dispatchers.IO,
@get:VisibleForTesting
internal val downloadStorage: DownloadStorage = DownloadStorage(applicationContext),
+ private val startForegroundService: StartForegroundService = StartForegroundService(
+ powerManagerInfoProvider = DefaultPowerManagerInfoProvider(applicationContext),
+ ),
) : Middleware<BrowserState, BrowserAction> {
private val logger = Logger("DownloadMiddleware")
@@ -164,7 +169,12 @@ class DownloadMiddleware(
@VisibleForTesting
internal fun startForegroundService(intent: Intent) {
- ContextCompat.startForegroundService(applicationContext, intent)
+ /**
+ * @see [StartForegroundService]
+ */
+ startForegroundService {
+ ContextCompat.startForegroundService(applicationContext, intent)
+ }
}
@VisibleForTesting
diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadNotification.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadNotification.kt
index 9b9c9aa34c..95ef2b5eea 100644
--- a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadNotification.kt
+++ b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadNotification.kt
@@ -89,12 +89,17 @@ internal object DownloadNotification {
val percentCopied = downloadJobState.getPercent() ?: -1
return NotificationCompat.Builder(context, channelId)
+ .setStyle(
+ NotificationCompat.BigTextStyle()
+ .setBigContentTitle(downloadState.fileName)
+ .setSummaryText(downloadJobState.getProgress()),
+ )
.setSmallIcon(R.drawable.mozac_feature_download_ic_ongoing_download)
.setContentTitle(downloadState.fileName)
.setContentText(downloadJobState.getProgress())
.setColor(ContextCompat.getColor(context, notificationAccentColor))
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
- .setProgress(DownloadNotification.PERCENTAGE_MULTIPLIER, percentCopied, isIndeterminate)
+ .setProgress(PERCENTAGE_MULTIPLIER, percentCopied, isIndeterminate)
.setOngoing(true)
.setWhen(downloadJobState.createdTime)
.setOnlyAlertOnce(true)
diff --git a/mobile/android/android-components/components/feature/downloads/src/main/res/values-ast/strings.xml b/mobile/android/android-components/components/feature/downloads/src/main/res/values-ast/strings.xml
index 5f9d21334a..ae218de9c4 100644
--- a/mobile/android/android-components/components/feature/downloads/src/main/res/values-ast/strings.xml
+++ b/mobile/android/android-components/components/feature/downloads/src/main/res/values-ast/strings.xml
@@ -43,9 +43,6 @@
<!-- Message that appears when trying to download with an external app fails. %1$s will be replaced with the name the external app. -->--&gt;
<string name="mozac_feature_downloads_unable_to_open_third_party_app">Nun ye posible abrir «%1$s»</string>
- <!-- Text for the info dialog when write to storage permissions have been denied but user tries to download a file. -->
- <string name="mozac_feature_downloads_write_external_storage_permissions_needed_message">Tienes de permitir l\'accesu a los ficheros ya al conteníu multimedia pa baxar ficheros. Vete a la configuración d\'Android, dempués a los permisos ya toca Permitir.</string>
-
<!-- Alert dialog confirmation before cancelling downloads, this is the title -->
<string name="mozac_feature_downloads_cancel_active_downloads_warning_content_title">¿Quies encaboxar les descargues privaes?</string>
<!-- Alert dialog confirmation before cancelling private downloads, this is the body. %1$s will be replaced with the name of the file. -->