Zync Attachment Manager
Manager class for handling attachment operations. Provides offline-first attachment management with automatic sync capabilities.
Functions
Add a new attachment to the system. This method reads the file from the provided path, copies it to the app-specific directory, calculates its hash, and stores the attachment information in the database.
Delete an attachment. This will also remove the physical file from storage.
Delete multiple attachments in a single operation. Each attachment will be marked as deleted and its physical file removed if possible.
Get an attachment by its UID.
Get paginated attachments with simple result-based API. Client handles loading states externally.
Get paginated attachments grouped by date with simple result-based API. Client handles loading states externally.
Get all unique tags associated with attachments for a specific module UID. This method queries all attachments matching the provided module UID and returns the distinct tags that are associated with those attachments.
Validates that a file URI has a valid scheme and format.
Observe attachment changes and upload progress for a specific module and module UID. The subscription remains active while the returned Flow is collected.
Remove a tag from an existing attachment. This removes the relationship between the attachment and tag, queuing the operation for sync.
Rename an existing attachment.
Update the description of an attachment.
Update the image/file of an attachment. This method reads the new file, calculates its hash, and only copies it if the hash differs.
Upload a single attachment immediately, bypassing the regular upload queue. This method stops any current upload work, uploads the specified file, and then resumes normal upload operations.
Upload attachments immediately, bypassing the regular upload queue. This method stops any current upload work, uploads the specified files, and then resumes normal upload operations.