@@ -78,10 +78,7 @@ class SyncingService {
78
78
await attachmentsService.withContext ((context) async {
79
79
final attachments = await context.getActiveAttachments ();
80
80
logger.info (
81
- 'active attachments: ${attachments .map ((e ) => e .id ).toList ()}' ,
82
- );
83
- logger.info (
84
- 'SyncingService: Found ${attachments .length } active attachments' ,
81
+ 'Found ${attachments .length } active attachments' ,
85
82
);
86
83
await handleSync (attachments, context);
87
84
await deleteArchivedAttachments (context);
@@ -147,42 +144,42 @@ class SyncingService {
147
144
AbstractAttachmentContext context,
148
145
) async {
149
146
logger.info (
150
- 'SyncingService: Starting handleSync with ${attachments .length } attachments' ,
147
+ 'Starting handleSync with ${attachments .length } attachments' ,
151
148
);
152
149
final updatedAttachments = < Attachment > [];
153
150
154
151
for (final attachment in attachments) {
155
152
logger.info (
156
- 'SyncingService: Processing attachment ${attachment .id } with state: ${attachment .state }' ,
153
+ 'Processing attachment ${attachment .id } with state: ${attachment .state }' ,
157
154
);
158
155
try {
159
156
switch (attachment.state) {
160
157
case AttachmentState .queuedDownload:
161
- logger.info ('SyncingService: Downloading [${attachment .filename }]' );
158
+ logger.info ('Downloading [${attachment .filename }]' );
162
159
updatedAttachments.add (await downloadAttachment (attachment));
163
160
break ;
164
161
case AttachmentState .queuedUpload:
165
- logger.info ('SyncingService: Uploading [${attachment .filename }]' );
162
+ logger.info ('Uploading [${attachment .filename }]' );
166
163
updatedAttachments.add (await uploadAttachment (attachment));
167
164
break ;
168
165
case AttachmentState .queuedDelete:
169
- logger.info ('SyncingService: Deleting [${attachment .filename }]' );
166
+ logger.info ('Deleting [${attachment .filename }]' );
170
167
updatedAttachments.add (await deleteAttachment (attachment));
171
168
break ;
172
169
case AttachmentState .synced:
173
170
logger.info (
174
- 'SyncingService: Attachment ${attachment .id } is already synced' ,
171
+ 'Attachment ${attachment .id } is already synced' ,
175
172
);
176
173
break ;
177
174
case AttachmentState .archived:
178
175
logger.info (
179
- 'SyncingService: Attachment ${attachment .id } is archived' ,
176
+ 'Attachment ${attachment .id } is archived' ,
180
177
);
181
178
break ;
182
179
}
183
180
} catch (e, st) {
184
181
logger.warning (
185
- 'SyncingService: Error during sync for ${attachment .id }' ,
182
+ 'Error during sync for ${attachment .id }' ,
186
183
e,
187
184
st,
188
185
);
@@ -191,7 +188,7 @@ class SyncingService {
191
188
192
189
if (updatedAttachments.isNotEmpty) {
193
190
logger.info (
194
- 'SyncingService: Saving ${updatedAttachments .length } updated attachments' ,
191
+ 'Saving ${updatedAttachments .length } updated attachments' ,
195
192
);
196
193
await context.saveAttachments (updatedAttachments);
197
194
}
@@ -203,7 +200,7 @@ class SyncingService {
203
200
/// Returns the updated attachment with its new state.
204
201
Future <Attachment > uploadAttachment (Attachment attachment) async {
205
202
logger.info (
206
- 'SyncingService: Starting upload for attachment ${attachment .id }' ,
203
+ 'Starting upload for attachment ${attachment .id }' ,
207
204
);
208
205
try {
209
206
if (attachment.localUri == null ) {
@@ -214,23 +211,23 @@ class SyncingService {
214
211
attachment,
215
212
);
216
213
logger.info (
217
- 'SyncingService: Successfully uploaded attachment "${attachment .id }" to Cloud Storage' ,
214
+ 'Successfully uploaded attachment "${attachment .id }" to Cloud Storage' ,
218
215
);
219
216
return attachment.copyWith (
220
217
state: AttachmentState .synced,
221
218
hasSynced: true ,
222
219
);
223
220
} catch (e, st) {
224
221
logger.warning (
225
- 'SyncingService: Upload attachment error for attachment $attachment ' ,
222
+ 'Upload attachment error for attachment $attachment ' ,
226
223
e,
227
224
st,
228
225
);
229
226
if (errorHandler != null ) {
230
227
final shouldRetry = await errorHandler! .onUploadError (attachment, e);
231
228
if (! shouldRetry) {
232
229
logger.info (
233
- 'SyncingService: Attachment with ID ${attachment .id } has been archived' ,
230
+ 'Attachment with ID ${attachment .id } has been archived' ,
234
231
);
235
232
return attachment.copyWith (state: AttachmentState .archived);
236
233
}
@@ -245,7 +242,7 @@ class SyncingService {
245
242
/// Returns the updated attachment with its new state.
246
243
Future <Attachment > downloadAttachment (Attachment attachment) async {
247
244
logger.info (
248
- 'SyncingService: Starting download for attachment ${attachment .id }' ,
245
+ 'Starting download for attachment ${attachment .id }' ,
249
246
);
250
247
final attachmentPath = await getLocalUri (attachment.filename);
251
248
try {
@@ -255,11 +252,9 @@ class SyncingService {
255
252
fileStream.map ((chunk) => Uint8List .fromList (chunk)),
256
253
);
257
254
logger.info (
258
- 'SyncingService: Successfully downloaded file "${attachment .id }"' ,
255
+ 'Successfully downloaded file "${attachment .id }"' ,
259
256
);
260
257
261
- logger.info ('downloadAttachmentXY $attachment ' );
262
-
263
258
return attachment.copyWith (
264
259
localUri: attachmentPath,
265
260
state: AttachmentState .synced,
@@ -270,13 +265,13 @@ class SyncingService {
270
265
final shouldRetry = await errorHandler! .onDownloadError (attachment, e);
271
266
if (! shouldRetry) {
272
267
logger.info (
273
- 'SyncingService: Attachment with ID ${attachment .id } has been archived' ,
268
+ 'Attachment with ID ${attachment .id } has been archived' ,
274
269
);
275
270
return attachment.copyWith (state: AttachmentState .archived);
276
271
}
277
272
}
278
273
logger.warning (
279
- 'SyncingService: Download attachment error for attachment $attachment ' ,
274
+ 'Download attachment error for attachment $attachment ' ,
280
275
e,
281
276
st,
282
277
);
@@ -291,7 +286,7 @@ class SyncingService {
291
286
Future <Attachment > deleteAttachment (Attachment attachment) async {
292
287
try {
293
288
logger.info (
294
- 'SyncingService: Deleting attachment ${attachment .id } from remote storage' ,
289
+ 'Deleting attachment ${attachment .id } from remote storage' ,
295
290
);
296
291
await remoteStorage.deleteFile (attachment);
297
292
0 commit comments