Small improvements for Android backup + custom behavior when quota exceeded#882
Small improvements for Android backup + custom behavior when quota exceeded#882
Conversation
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.
| export interface ErrorData extends EventData { | ||
| error: string | ||
| + responseCode: number | ||
| + responseBody: string |
There was a problem hiding this comment.
Did you create an upstream PR? can you link it?
There was a problem hiding this comment.
Added in the commit Vydia/react-native-background-upload#337
| } | ||
|
|
||
| export const STACK_ERRORS_INTERRUPTING_BACKUP = [ | ||
| 413 // quota exceeded |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
can be done later, not a blocker ;)
There was a problem hiding this comment.
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' | ||
| } |
There was a problem hiding this comment.
...
One day we will update react-native-camera-roll to handle this correctly.
There was a problem hiding this comment.
Really? New version of camera-roll handle that? Why can't we upgrade?
There was a problem hiding this comment.
No no I wanted to say "we will make a PR to add the feature directly on react-native-camera-roll"
server answer This will allow to do work depending on the server answer, like file conflict or quota exceeded. Upstream PR : Vydia/react-native-background-upload#337
By returning a stringified object with a status code, we allow backup front end to have a custom behavior depending of errors.
3fe793f to
4309cf1
Compare
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)