-
Notifications
You must be signed in to change notification settings - Fork 30
Attachment package refactor #311
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
base: main
Are you sure you want to change the base?
Conversation
packages/powersync_attachments_stream/lib/src/local_storage.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/local_storage.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_service.dart
Outdated
Show resolved
Hide resolved
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.
Some more comments from a quick look.
Also, I assume supabase-todolist-new-attachments was copied from the old one? For a review it would be easier if the changes were in the same project so I can see what has changed. But that can happen in the end.
packages/powersync_attachments_stream/lib/powersync_attachments_stream.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/powersync_attachments_stream.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/test/local_storage_test.dart
Outdated
Show resolved
Hide resolved
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.
A few more comments, most of them pretty minor again :)
packages/powersync_attachments_stream/lib/src/abstractions/local_storage.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/implementations/attachment_context.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/implementations/attachment_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/storage/io_local_storage.dart
Outdated
Show resolved
Hide resolved
attachment.copyWith(state: AttachmentState.archived), | ||
); | ||
} | ||
break; |
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.
You don't need this break
anymore in recent Dart versions.
packages/powersync_attachments_stream/lib/src/storage/io_local_storage.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/sync/syncing_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
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.
The implementation looks good now, I have a few nits on types. I also think we should strive to not introduce classes / interfaces we don't strictly need, especially if they're publicly exported. Also more generally:
- Please run
dart format
on the package. I also recommend enabling format on save. - I think a few more tests with an actual database would be nice to have, you can take a look at the Kotlin tests for attachments for inspiration. We can test on native platforms only in the beginning, you can probably copy something like this to set up databases. But it's still a bit tricky, let me know if you need help with this. I can also push a basic scaffold for tests to this branch.
packages/powersync_attachments_stream/lib/powersync_attachments_stream.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/abstractions/attachment_context.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/abstractions/attachment_context.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/abstractions/attachment_context.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/abstractions/local_storage.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart
Outdated
Show resolved
Hide resolved
…handling in powersync_attachments_stream package and added unit tests
…/powersync.dart into attachment-package-refactor
…_stream package. Removed unused imports, improved error handling during file uploads and downloads, and enhanced and renamed logging for better traceability of attachment operations.
…hods, improving clarity on attachment lifecycle management, state handling, and local storage operations.
…hments package implementation to supabase-todolist demo.
… path for local storage in the powersync_attachments_stream package. Simplified the attachment watching logic. Updated README for clarity on schema and attachment states.
… classes to utilize the new interface and adjusted README for consistency.
… package. Updated attachment queue initialization to use localStorage, and enhanced README for clarity on storage handling. Added tests for edge cases and robustness in local storage operations.
…consistency. Removed outdated comment regarding attachments directory in attachment queue service documentation.
…dated photo capture widget to save attachments as byte data instead of streams, and modified related methods in the attachment queue service to accept byte data. Updated tests to reflect changes in data handling.
…comments, replacing multiple error handler parameters with a single optional error handler for sync-related errors.
…fixed various formatting
fa2f16e
to
248d748
Compare
No description provided.