-
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
Backup: Lots of fixes, refactoring and documentation #887
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d0597f6
fix(backup): Upload could crash when response body undefined
zatteo 826d3c5
fix(backup): Stop backup only if quota exceeded and not if file too l…
zatteo a17d491
refactor(backup): Create an upload service distinct from Media model
zatteo fe5822f
feat(backup): Create backups in /Photos instead of /
zatteo d332981
fix(backup): Set backup as to do on new start after killing app
zatteo b5d3084
feat(backup): Disable album management on Android
zatteo ce52f19
fix(backup): Stop considering trashed files as backuped when restoring
zatteo 82ba33b
fix(backup): Fix restoring when media at backup root path
zatteo 2a1d096
fix(backup): Try to fix "stream was reset: CANCEL" error
zatteo 84c256b
fix(backup): Allow users to rename is backup folder
zatteo a187a28
feat(backup): Send modification date when uploading
zatteo 1d9348e
feat(backup): Duplicate file and append a number when upload conflict
zatteo 9b50fba
docs(backup): Add schema about backup
zatteo 321c68d
Revert "fix(backup): Try to fix "stream was reset: CANCEL" error"
Crash-- d7ba638
fix: Add Size to upload URL
Crash-- c4aa505
chore: Add a task to generate the dependancies graph
Crash-- d0cfea6
fix: Use okhttp5.0.0-alpha.1 for react-native-background-upload
Crash-- f7cf0f8
fix: Better check for Upload error type in `uploadMedias()`
Ldoppea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '/app/domain/backup/hooks/useInitBackup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useEffect } from 'react' | ||
|
||
import { useClient } from 'cozy-client' | ||
|
||
import { | ||
getLocalBackupConfig, | ||
setBackupAsToDo | ||
} from '/app/domain/backup/services/manageLocalBackupConfig' | ||
|
||
import Minilog from 'cozy-minilog' | ||
|
||
const log = Minilog('💿 Backup') | ||
|
||
export const useInitBackup = (): void => { | ||
const client = useClient() | ||
|
||
useEffect(() => { | ||
const checkAndFixIfBackupStuckInRunning = async (): Promise<void> => { | ||
if (!client) { | ||
return | ||
} | ||
|
||
const backupConfig = await getLocalBackupConfig(client) | ||
|
||
if (backupConfig.currentBackup.status === 'running') { | ||
log.debug('A running backup has been set as to do.') | ||
await setBackupAsToDo(client) | ||
} | ||
} | ||
|
||
void checkAndFixIfBackupStuckInRunning() | ||
}, [client]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How do we ensure this is called only on startup if there is a dependency on client? (however if the client changes I suppose it is expected to clear the backup status)