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

Small improvements for Android backup + custom behavior when quota exceeded #882

Merged
merged 9 commits into from
Jul 26, 2023

Conversation

zatteo
Copy link
Contributor

@zatteo zatteo commented Jul 24, 2023

Small improvements for Android backup

Avoid notification flood in Android when uploading

patch-package react-native-background-upload to return server response code when server error to allow custom behavior depending on server error

Custom behavior when quota exceeded

When quota exceeded error, return status code to front end (see https://github.com/cozy/cozy-drive/pull/2941/files)

We must show a notification in Android because it is a background
upload but react-native-background-upload does not allow easily to do
1 notification for multiple files. It is 1 notification for 1 file.
So we add the autoClear: true property which remove the notification
when an upload is completed. It is a good workaround to avoid
notification flood.
@zatteo zatteo requested a review from Crash-- July 24, 2023 12:45
@zatteo zatteo changed the title Fix/android backup upload Small improvements for Android backup + custom behavior when quota exceeded Jul 24, 2023
export interface ErrorData extends EventData {
error: string
+ responseCode: number
+ responseBody: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you create an upstream PR? can you link it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

export const STACK_ERRORS_INTERRUPTING_BACKUP = [
413 // quota exceeded
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not true all the time. You can have a 413 error when the file is too big (5 GB) for our storage service (swift).

If you want to handle that correctly, see desktop:

https://github.com/cozy-labs/cozy-desktop/blob/eb1d431d382b9e7dcb93c49421e0555c60085951/core/remote/errors.js#L274-L287

Copy link
Contributor

Choose a reason for hiding this comment

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

can be done later, not a blocker ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not know about this! I will update with this new PR : https://github.com/cozy/cozy-stack/pull/4069/files

} else {
// When Live Photo has been modified, path is something like FullSizeRender.mov
return getPathWithoutExtension(photoPath) + '.mov'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

seriously? 😮‍💨

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...

One day we will update react-native-camera-roll to handle this correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Really? New version of camera-roll handle that? Why can't we upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No no I wanted to say "we will make a PR to add the feature directly on react-native-camera-roll"

Copy link
Contributor

@Crash-- Crash-- left a comment

Choose a reason for hiding this comment

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

Nice !

@zatteo zatteo force-pushed the fix/android-backup-upload branch from 3fe793f to 4309cf1 Compare July 26, 2023 08:54
@zatteo zatteo merged commit 86568cf into master Jul 26, 2023
1 check passed
@zatteo zatteo deleted the fix/android-backup-upload branch July 26, 2023 09:01
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