🐛 Fix attachment uploading progress
This commit is contained in:
@ -198,13 +198,16 @@ class SnAttachmentProvider {
|
||||
data,
|
||||
place.rid,
|
||||
entry.key,
|
||||
onProgress: (progress) {
|
||||
final overallProgress = (currentTask + progress) / chunks.length;
|
||||
onProgress?.call(overallProgress);
|
||||
},
|
||||
);
|
||||
|
||||
currentTask++;
|
||||
final overallProgress = currentTask / chunks.length;
|
||||
onProgress?.call(overallProgress);
|
||||
|
||||
currentTask++;
|
||||
|
||||
if (result is SnAttachmentFragment) {
|
||||
place = result;
|
||||
} else {
|
||||
@ -232,13 +235,15 @@ class SnAttachmentProvider {
|
||||
Future<SnAttachment> updateOne(
|
||||
int id, {
|
||||
String? alt,
|
||||
String? thumbnail,
|
||||
int? thumbnailId,
|
||||
int? compressedId,
|
||||
Map<String, dynamic>? metadata,
|
||||
bool? isIndexable,
|
||||
}) async {
|
||||
final resp = await _sn.client.put('/cgi/uc/attachments/$id', data: {
|
||||
'alt': alt,
|
||||
'thumbnail': thumbnail,
|
||||
'thumbnail': thumbnailId,
|
||||
'compressed': compressedId,
|
||||
'metadata': metadata,
|
||||
'is_indexable': isIndexable,
|
||||
});
|
||||
|
@ -98,7 +98,10 @@ class PostMediaPendingList extends StatelessWidget {
|
||||
if (!context.mounted) return;
|
||||
|
||||
final attach = context.read<SnAttachmentProvider>();
|
||||
final newAttach = await attach.updateOne(attachments[idx].attachment!.id, thumbnail: thumbnail.rid);
|
||||
final newAttach = await attach.updateOne(
|
||||
attachments[idx].attachment!.id,
|
||||
thumbnailId: thumbnail.id,
|
||||
);
|
||||
|
||||
onUpdate!(idx, PostWriteMedia(newAttach));
|
||||
}
|
||||
|
Reference in New Issue
Block a user