Skip to content

Commit 126dadf

Browse files
Remoed dynamic variables, implemented context.deleteAttachment() and fixed various formatting
1 parent e041fcd commit 126dadf

19 files changed

+116
-116
lines changed

demos/supabase-todolist/lib/widgets/todo_item_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TodoItemWidget extends StatelessWidget {
2727
await attachmentQueue.deleteFile(
2828
attachmentId: todo.photoId!,
2929
updateHook: (context, attachment) async {
30-
// await context.execute("UPDATE todos SET photo_id = NULL WHERE id = ?", [todo.id]);
30+
await context.execute("UPDATE todos SET photo_id = NULL WHERE id = ?", [todo.id]);
3131
},
3232
);
3333
}

demos/supabase-todolist/pubspec.lock

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,6 @@ packages:
567567
relative: true
568568
source: path
569569
version: "1.15.0"
570-
powersync_attachments_helper:
571-
dependency: "direct overridden"
572-
description:
573-
path: "../../packages/powersync_attachments_helper"
574-
relative: true
575-
source: path
576-
version: "0.6.18+11"
577570
powersync_attachments_stream:
578571
dependency: "direct main"
579572
description:
@@ -764,10 +757,10 @@ packages:
764757
dependency: transitive
765758
description:
766759
name: sqlite3
767-
sha256: "310af39c40dd0bb2058538333c9d9840a2725ae0b9f77e4fd09ad6696aa8f66e"
760+
sha256: f393d92c71bdcc118d6203d07c991b9be0f84b1a6f89dd4f7eed348131329924
768761
url: "https://pub.dev"
769762
source: hosted
770-
version: "2.7.5"
763+
version: "2.9.0"
771764
sqlite3_flutter_libs:
772765
dependency: transitive
773766
description:
@@ -1057,5 +1050,5 @@ packages:
10571050
source: hosted
10581051
version: "2.1.0"
10591052
sdks:
1060-
dart: ">=3.8.1 <4.0.0"
1053+
dart: ">=3.7.0 <4.0.0"
10611054
flutter: ">=3.27.0"

demos/supabase-todolist/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
powersync_attachments_stream:
14-
path: ../../packages/powersync_attachments_stream
13+
powersync_attachments_stream: ^0.0.1
1514
powersync: ^1.15.0
1615
path_provider: ^2.1.1
1716
supabase_flutter: ^2.0.1

packages/powersync_attachments_stream/.metadata

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/powersync_attachments_stream/lib/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export 'src/abstractions/sync_error_handler.dart';
44
export 'src/abstractions/attachment_service.dart';
55
export 'src/abstractions/attachment_context.dart';
66
export 'src/abstractions/local_storage.dart';
7-
export 'src/abstractions/remote_storage.dart';
7+
export 'src/abstractions/remote_storage.dart';
88
export 'src/attachment_queue_service.dart';
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/// Default exports for native platforms (dart:io). For web, use 'common.dart'.
22
export 'common.dart';
33
export 'src/storage/io_local_storage.dart';
4-
export 'src/attachment_queue_service.dart';

packages/powersync_attachments_stream/lib/src/abstractions/attachment_context.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'package:sqlite_async/sqlite_async.dart';
2+
13
import '../attachment.dart';
24

35
/// Context for performing Attachment operations.
@@ -8,8 +10,7 @@ abstract class AbstractAttachmentContext {
810
/// Delete the attachment from the attachment queue.
911
///
1012
/// [id]: The ID of the attachment to delete.
11-
/// [tx]: The database context to use for the operation.
12-
Future<void> deleteAttachment(String id, dynamic context);
13+
Future<void> deleteAttachment(String id);
1314

1415
/// Set the state of the attachment to ignore.
1516
Future<void> ignoreAttachment(String id);
@@ -38,12 +39,14 @@ abstract class AbstractAttachmentContext {
3839
/// Delete attachments which have been archived.
3940
///
4041
/// Returns true if all items have been deleted. Returns false if there might be more archived items remaining.
41-
Future<bool> deleteArchivedAttachments(Future<void> Function(List<Attachment>) callback);
42+
Future<bool> deleteArchivedAttachments(
43+
Future<void> Function(List<Attachment>) callback);
4244

4345
/// Upserts an attachment record given a database connection context.
4446
///
4547
/// [attachment]: The attachment to upsert.
4648
/// [context]: The database transaction/context to use for the operation.
4749
/// Returns the upserted [Attachment].
48-
Future<Attachment> upsertAttachment(Attachment attachment, dynamic context);
49-
}
50+
Future<Attachment> upsertAttachment(
51+
Attachment attachment, SqliteWriteContext context);
52+
}

packages/powersync_attachments_stream/lib/src/abstractions/attachment_service.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ abstract class AbstractAttachmentService {
88

99
/// Executes a callback with an exclusive lock on all attachment operations.
1010
/// This helps prevent race conditions between different updates.
11-
Future<R> withContext<R>(Future<R> Function(AbstractAttachmentContext context) action);
12-
}
11+
Future<R> withContext<R>(
12+
Future<R> Function(AbstractAttachmentContext context) action);
13+
}

packages/powersync_attachments_stream/lib/src/abstractions/local_storage.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:typed_data';
22

3-
abstract class AbstractLocalStorageAdapter {
3+
abstract interface class LocalStorageAdapter {
44
/// Saves binary data stream to storage at the specified file path
55
///
66
/// [filePath] - Path where the file will be stored

packages/powersync_attachments_stream/lib/src/abstractions/remote_storage.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'dart:async';
2-
2+
33
import '../attachment.dart';
44

55
/// Adapter for interfacing with remote attachment storage.

0 commit comments

Comments
 (0)