Skip to content

Commit

Permalink
fix(teaching): update file name failing when already scheduled (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato authored Jun 17, 2024
1 parent e1f6822 commit a5ab7a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: d5c36294933aa344046699700b9ae9c2e10db18e
Expand Down
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"jest": "^29.2.1",
"lint-staged": "^13.0.3",
"metro-react-native-babel-preset": "0.76.9",
"pod-install": "0.1.38",
"pod-install": "^0.2.2",
"prettier": "^2.7.1",
"react-test-renderer": "18.2.0",
"standard-version": "^9.5.0",
Expand Down
12 changes: 8 additions & 4 deletions src/core/hooks/useDownloadCourseFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ export const useDownloadCourseFile = (
updateDownload({ isDownloaded: true });
} else {
// Update the name when changed
await mkdir(dirname(toFile));
await moveFile(cachedFilePath, toFile);
await cleanupEmptyFolders(coursesFilesCachePath);
refresh();
try {
await mkdir(dirname(toFile));
await moveFile(cachedFilePath, toFile);
await cleanupEmptyFolders(coursesFilesCachePath);
refresh();
} catch (_) {
// File rename was already scheduled
}
}
} else {
updateDownload({ isDownloaded: false });
Expand Down

0 comments on commit a5ab7a6

Please sign in to comment.