-
Notifications
You must be signed in to change notification settings - Fork 1
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
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.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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:
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
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' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seriously? 😮💨
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice !
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)