Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backup): Stop background backup when not supported #920

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

zatteo
Copy link
Contributor

@zatteo zatteo commented Sep 4, 2023

On iOS, it is not supported.

On Android, it is supported until Android 11 because android-upload-service uses Service to start foreground task in background which is deprecated since Android 12.

On iOS, it is not supported.

On Android, it is supported until Android 11 because
android-upload-service uses Service to start foreground task in
background which is deprecated since Android 12.
@@ -124,6 +124,20 @@ export const startBackup = async (
postUploadLocalBackupConfig.currentBackup.totalMediasToBackupCount,
message: partialSuccessMessage
})

await showLocalNotification({
Copy link
Member

@Ldoppea Ldoppea Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The only difference between if and else blocks are only the status, and the title/body translation keys. So you can ease identifying differences by:

let status = 'success'
let titleKey = 'services.backup.notifications.backupSuccessTitle'
let bodyKey = 'services.backup.notifications.backupSuccessBody'

if (partialSuccessMessage) {
  status = 'partial_success'
  titleKey = 'services.backup.notifications.backupPartialSuccessTitle'
  bodyKey = 'services.backup.notifications.backupPartialSuccessBody'
}

await setLastBackup(...)

await showLocalNotification(...)

@zatteo zatteo merged commit 1f0c7eb into master Sep 5, 2023
2 checks passed
@zatteo zatteo deleted the fix/stop-backup-when-going-to-background branch September 5, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants