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

fix(teaching): update file name fails if already scheduled #496

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading