Skip to content

Commit 10ded4e

Browse files
Formatting fixes
1 parent 126dadf commit 10ded4e

File tree

7 files changed

+19
-22
lines changed

7 files changed

+19
-22
lines changed

demos/supabase-todolist/lib/attachments/photo_capture_widget.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class TakePhotoWidget extends StatefulWidget {
99
final String todoId;
1010
final CameraDescription camera;
1111

12-
const TakePhotoWidget({super.key, required this.todoId, required this.camera});
12+
const TakePhotoWidget(
13+
{super.key, required this.todoId, required this.camera});
1314

1415
@override
1516
State<StatefulWidget> createState() {
@@ -45,19 +46,19 @@ class _TakePhotoWidgetState extends State<TakePhotoWidget> {
4546
log.info('Taking photo for todo: ${widget.todoId}');
4647
await _initializeControllerFuture;
4748
final XFile photo = await _cameraController.takePicture();
48-
49+
4950
// Read the photo data as bytes
5051
final photoFile = File(photo.path);
5152
if (!await photoFile.exists()) {
5253
log.warning('Photo file does not exist: ${photo.path}');
5354
return;
5455
}
55-
56+
5657
final photoData = await photoFile.readAsBytes();
57-
58+
5859
// Save the photo attachment with the byte data
5960
final attachment = await savePhotoAttachment(photoData, widget.todoId);
60-
61+
6162
log.info('Photo attachment saved with ID: ${attachment.id}');
6263
} catch (e) {
6364
log.severe('Error taking photo: $e');

demos/supabase-todolist/lib/attachments/queue.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ Future<void> initializeAttachmentQueue(PowerSyncDatabase db) async {
3333
await attachmentQueue.startSync();
3434
}
3535

36-
Future<Attachment> savePhotoAttachment(
37-
List<int> photoData, String todoId,
36+
Future<Attachment> savePhotoAttachment(List<int> photoData, String todoId,
3837
{String mediaType = 'image/jpeg'}) async {
3938
// Save the file using the AttachmentQueue API
4039
return await attachmentQueue.saveFile(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class TodoItemWidget extends StatelessWidget {
2323

2424
Future<void> deleteTodo(TodoItem todo) async {
2525
if (todo.photoId != null) {
26-
2726
await attachmentQueue.deleteFile(
2827
attachmentId: todo.photoId!,
2928
updateHook: (context, attachment) async {
30-
await context.execute("UPDATE todos SET photo_id = NULL WHERE id = ?", [todo.id]);
29+
await context.execute(
30+
"UPDATE todos SET photo_id = NULL WHERE id = ?", [todo.id]);
3131
},
3232
);
3333
}

demos/supabase-todolist/test/widget_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import 'package:powersync_flutter_demo/main.dart';
1313
void main() {
1414
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
1515
// Build our app and trigger a frame.
16-
await tester.pumpWidget(const MyApp(loggedIn: true,));
16+
await tester.pumpWidget(const MyApp(
17+
loggedIn: true,
18+
));
1719

1820
// Verify that our counter starts at 0.
1921
expect(find.text('0'), findsOneWidget);

packages/powersync_attachments_stream/lib/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export 'src/abstractions/attachment_service.dart';
55
export 'src/abstractions/attachment_context.dart';
66
export 'src/abstractions/local_storage.dart';
77
export 'src/abstractions/remote_storage.dart';
8-
export 'src/attachment_queue_service.dart';
8+
export 'src/attachment_queue_service.dart';

packages/powersync_attachments_stream/lib/src/attachment_queue_service.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'dart:async';
88

99
import 'package:logging/logging.dart';
1010
import 'package:powersync_core/powersync_core.dart';
11-
import 'package:sqlite_async/mutex.dart';
1211
import 'package:sqlite_async/sqlite_async.dart';
1312

1413
import 'attachment.dart';
@@ -108,11 +107,10 @@ class AttachmentQueue {
108107
}) : logger = logger ?? Logger('AttachmentQueue') {
109108
attachmentsService = AttachmentServiceImpl(
110109
db: db,
111-
logger: logger ?? Logger('AttachmentQueue'),
110+
logger: this.logger,
112111
maxArchivedCount: archivedCacheLimit,
113112
attachmentsQueueTableName: attachmentsQueueTableName,
114113
);
115-
116114
syncingService = SyncingService(
117115
remoteStorage: remoteStorage,
118116
localStorage: localStorage,

packages/powersync_attachments_stream/lib/src/sync/syncing_service.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ class SyncingService {
5656
}) : logger = logger ?? Logger('SyncingService');
5757

5858
/// Starts the syncing process, including periodic and event-driven sync operations.
59-
///
60-
/// [period] is the interval at which periodic sync operations are triggered.
61-
Future<void> startSync({
62-
Duration period = const Duration(seconds: 30),
63-
}) async {
59+
Future<void> startSync() async {
6460
if (_isClosed) return;
6561

6662
_syncSubscription?.cancel();
@@ -99,8 +95,8 @@ class SyncingService {
9995

10096
_syncSubscription = mergedStream;
10197

102-
// Start periodic sync
103-
_periodicSubscription = Stream<void>.periodic(period, (_) => null).listen((
98+
// Start periodic sync using instance period
99+
_periodicSubscription = Stream<void>.periodic(period, (_) {}).listen((
104100
_,
105101
) {
106102
logger.info('Periodically syncing attachments');
@@ -257,7 +253,8 @@ class SyncingService {
257253
///
258254
/// [attachment]: The attachment to delete.
259255
/// Returns the updated attachment with its new state.
260-
Future<Attachment> deleteAttachment(Attachment attachment, AbstractAttachmentContext context) async {
256+
Future<Attachment> deleteAttachment(
257+
Attachment attachment, AbstractAttachmentContext context) async {
261258
try {
262259
logger.info('Deleting attachment ${attachment.id} from remote storage');
263260
await remoteStorage.deleteFile(attachment);

0 commit comments

Comments
 (0)