Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _TakePhotoWidgetState extends State<TakePhotoWidget> {
int photoSize = await photo.length();

TodoItem.addPhoto(photoId, widget.todoId);
attachmentQueue.savePhoto(photoId, photoSize);
attachmentQueue.saveFile(photoId, photoSize);
} catch (e) {
log.info('Error taking photo: $e');
}
Expand Down
17 changes: 10 additions & 7 deletions demos/supabase-todolist/lib/attachments/queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ class PhotoAttachmentQueue extends AbstractAttachmentQueue {
}

@override
Future<Attachment> savePhoto(String photoId, int size) async {
String filename = '$photoId.jpg';
Future<Attachment> saveFile(String fileId, int size,
{mediaType = 'image/jpeg'}) async {
String filename = '$fileId.jpg';

Attachment photoAttachment = Attachment(
id: photoId,
id: fileId,
filename: filename,
state: AttachmentState.queuedUpload.index,
mediaType: 'image/jpeg',
mediaType: mediaType,
localUri: getLocalFilePathSuffix(filename),
size: size,
);
Expand All @@ -54,10 +56,11 @@ class PhotoAttachmentQueue extends AbstractAttachmentQueue {
}

@override
Future<Attachment> deletePhoto(String photoId) async {
String filename = '$photoId.jpg';
Future<Attachment> deleteFile(String fileId) async {
String filename = '$fileId.jpg';

Attachment photoAttachment = Attachment(
id: photoId,
id: fileId,
filename: filename,
state: AttachmentState.queuedDelete.index);

Expand Down
2 changes: 1 addition & 1 deletion demos/supabase-todolist/lib/widgets/todo_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TodoItemWidget extends StatelessWidget {

Future<void> deleteTodo(TodoItem todo) async {
if (todo.photoId != null) {
attachmentQueue.deletePhoto(todo.photoId!);
attachmentQueue.deleteFile(todo.photoId!);
}
await todo.delete();
}
Expand Down
Loading