Skip to content

Commit

Permalink
feat(backup): Add custom text for Android notification
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Jul 25, 2023
1 parent ed50f7e commit 3fe793f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/app/domain/backup/services/uploadMedia.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import RNBackgroundUpload, {

import { getMimeType } from '/app/domain/backup/services/getMedias'
import { Media, UploadMediaResult } from '/app/domain/backup/models/Media'
import { t } from '/locales/i18n'

import CozyClient, { StackErrors, IOCozyFile } from 'cozy-client'

Expand Down Expand Up @@ -41,7 +42,32 @@ export const uploadMedia = async (
},
notification: {
enabled: true,
autoClear: true
autoClear: true,
onProgressTitle: t('services.backup.notifications.onProgressTitle'),
onProgressMessage: t(
'services.backup.notifications.onProgressMessage',
{
filename: media.name
}
),
onCompleteTitle: t('services.backup.notifications.onCompleteTitle'),
onCompleteMessage: t(
'services.backup.notifications.onCompleteMessage',
{
filename: media.name
}
),
onErrorTitle: t('services.backup.notifications.onErrorTitle'),
onErrorMessage: t('services.backup.notifications.onErrorMessage', {
filename: media.name
}),
onCancelledTitle: t('services.backup.notifications.onCancelledTitle'),
onCancelledMessage: t(
'services.backup.notifications.onCancelledMessage',
{
filename: media.name
}
)
}
} as UploadOptions

Expand Down
10 changes: 10 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
"services": {
"backup": {
"backupRootPath": "/Mobile backup",
"notifications": {
"onProgressTitle": "Uploading",
"onProgressMessage": "{{filename}} is being uploaded",
"onCompleteTitle": "Upload finished",
"onCompleteMessage": "{{filename}} has been uploaded",
"onErrorTitle": "Oops",
"onErrorMessage": "Your backup encountered an error. Open the app to see more details",
"onCancelledTitle": "Backup canceled",
"onCancelledMessage": "Open the app to resume the process"
},
"errors": {
"fileNotFound": "File not found",
"fileNotSupported": "File not supported for backup",
Expand Down
10 changes: 10 additions & 0 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
"services": {
"backup": {
"backupRootPath": "/Sauvegardé depuis mon mobile",
"notifications": {
"onProgressTitle": "Envoi en cours",
"onProgressMessage": "{{filename}} est en cours de sauvegarde",
"onCompleteTitle": "Envoi terminé",
"onCompleteMessage": "{{filename}} a été sauvegardé",
"onErrorTitle": "Oops",
"onErrorMessage": "Votre sauvegarde a rencontré une erreur. Ouvrez l'app pour obtenir plus de détails",
"onCancelledTitle": "Sauvegarde arrêtée",
"onCancelledMessage": "Votre sauvegarde a été arrêtée. Ouvrez l'app pour la reprendre"
},
"errors": {
"fileNotFound": "Fichier non trouvé",
"fileNotSupported": "Fichier non supporté pour la sauvegarde",
Expand Down

0 comments on commit 3fe793f

Please sign in to comment.