Skip to content

Commit 3773ac8

Browse files
committed
refactor(attachments): make fileExtension part of queue initialization
1 parent ff62ed2 commit 3773ac8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/powersync_attachments_helper/lib/src/attachments_queue.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ abstract class AbstractAttachmentQueue {
4141
/// when the attachment queue is initialized.
4242
List<String>? subdirectories;
4343

44+
/// File extension to be used for the attachments queue
45+
/// Can be left null if no extension is used or if extension is part of the filename
46+
String? fileExtension;
47+
4448
AbstractAttachmentQueue(
4549
{required this.db,
4650
required this.remoteStorage,
@@ -49,7 +53,8 @@ abstract class AbstractAttachmentQueue {
4953
this.onDownloadError,
5054
this.onUploadError,
5155
this.intervalInMinutes = 5,
52-
this.subdirectories}) {
56+
this.subdirectories,
57+
this.fileExtension}) {
5358
attachmentsService = AttachmentsService(
5459
db, localStorage, attachmentDirectoryName, attachmentsQueueTableName);
5560
syncingService = SyncingService(
@@ -82,7 +87,7 @@ abstract class AbstractAttachmentQueue {
8287
}
8388
}
8489

85-
watchIds(fileExtension: 'jpg');
90+
watchIds(fileExtension: fileExtension);
8691
syncingService.watchAttachments();
8792
syncingService.startPeriodicSync(intervalInMinutes);
8893

0 commit comments

Comments
 (0)