Conversation
There was a problem hiding this comment.
Code Review
This pull request successfully adds the functionality to attach files to calendrical events and exams. The changes are well-integrated, reusing existing filesharing flows and updating models, UI components, and gateways accordingly. The logic for creating, editing, and deleting events now correctly handles attachment references. I've found one area for improvement in TimetableEditEventBloc to make the code more concise and idiomatic, which I've detailed in a specific comment.
| Function(List<LocalFile>) get addLocalFiles => (localFiles) { | ||
| final list = <LocalFile>[]; | ||
| list.addAll(_localFilesSubject.value); | ||
| list.addAll(localFiles); | ||
| _localFilesSubject.sink.add(list); | ||
| }; | ||
| Function(LocalFile) get removeLocalFile => (localFile) { | ||
| final list = <LocalFile>[]; | ||
| list.addAll(_localFilesSubject.value); | ||
| list.remove(localFile); | ||
| _localFilesSubject.sink.add(list); | ||
| }; | ||
| Function(CloudFile) get removeCloudFile => (cloudFile) { | ||
| final list = <CloudFile>[]; | ||
| list.addAll(_cloudFilesSubject.value); | ||
| list.remove(cloudFile); | ||
| _cloudFilesSubject.sink.add(list); | ||
| }; |
There was a problem hiding this comment.
These methods for updating file lists can be made more concise and idiomatic by using modern Dart collection features like the spread operator to create new lists. This improves readability and aligns with the style guide's recommendation to use collection literals where possible.
Function(List<LocalFile>) get addLocalFiles => (localFiles) {
_localFilesSubject.sink.add([..._localFilesSubject.value, ...localFiles]);
};
Function(LocalFile) get removeLocalFile => (localFile) {
final newList = [..._localFilesSubject.value]..remove(localFile);
_localFilesSubject.sink.add(newList);
};
Function(CloudFile) get removeCloudFile => (cloudFile) {
final newList = [..._cloudFilesSubject.value]..remove(cloudFile);
_cloudFilesSubject.sink.add(newList);
};References
- The style guide recommends using collection literals when possible (line 86). The suggested change uses list literals with the spread operator for a more concise implementation. (link)
|
Visit the preview URL for this PR (updated for commit 5635241): https://sharezone-website-dev--pr2138-codex-add-file-uploa-xivetof7.web.app (expires Fri, 06 Feb 2026 21:34:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 372b0431a96247f908d9a97d5d865de1c8b3b04e |
|
Visit the preview URL for this PR (updated for commit 5635241): https://sharezone-test--pr2138-codex-add-file-uploa-5tug6tay.web.app (expires Fri, 06 Feb 2026 21:38:19 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
|
Visit the preview URL for this PR (updated for commit 5635241): https://sharezone-console-dev--pr2138-codex-add-file-uploa-tab59jbx.web.app (expires Fri, 06 Feb 2026 21:38:52 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 471536afe3f6ec4895d9ea75513730b515d17eb6 |
Motivation
Description
attachments: List<String>toCalendricalEventand include it in serialization/deserialization andcopyWithso events can store attachment IDs.ReferenceType.eventso files can be referenced by events.FileSharingGateway.uploadAttachments, persist returned file IDs on the event, and add reference data to each file;TimetableGateway.createEventnow returns the createdeventIDneeded for reference tracking.attachmentslist and saves it.AttachFile/AttachFileBasewidgets so users can add/remove attachments when creating or editing events.AttachmentStreamList, and remove file references when an event is deleted.attachmentsfield.Testing
fvm flutter test app/test/timetable/timetable_dialog_test.dartand the test suite passed.fvm flutter test app/test/timetable/timetable_bloc_test.dartand the test suite passed.Codex Task