mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 13:57:02 +08:00
feat(editor): add blobState$ to BlobEngine (#11756)
Closes: [BS-3137](https://linear.app/affine-design/issue/BS-3137/在-bs-添加-blobstate-接口) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced real-time status tracking for file upload and download operations, allowing users to monitor progress and errors more effectively. - **Improvements** - Enhanced icon display for attachments, providing a refreshed visual experience. - Improved update frequency and accuracy for file synchronization status indicators. - **Bug Fixes** - Refined internal logic for filtering status updates, ensuring more precise feedback during file operations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -268,8 +268,8 @@ class WorkerBlobSync implements BlobSync {
|
||||
downloadBlob(blobId: string): Promise<boolean> {
|
||||
return this.client.call('blobSync.downloadBlob', blobId);
|
||||
}
|
||||
uploadBlob(blob: BlobRecord): Promise<true> {
|
||||
return this.client.call('blobSync.uploadBlob', blob);
|
||||
uploadBlob(blob: BlobRecord, force?: boolean): Promise<true> {
|
||||
return this.client.call('blobSync.uploadBlob', { blob, force });
|
||||
}
|
||||
fullDownload(peerId?: string, signal?: AbortSignal): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -216,7 +216,8 @@ class StoreConsumer {
|
||||
'blobSync.state': () => this.blobSync.state$,
|
||||
'blobSync.blobState': blobId => this.blobSync.blobState$(blobId),
|
||||
'blobSync.downloadBlob': key => this.blobSync.downloadBlob(key),
|
||||
'blobSync.uploadBlob': blob => this.blobSync.uploadBlob(blob),
|
||||
'blobSync.uploadBlob': ({ blob, force }) =>
|
||||
this.blobSync.uploadBlob(blob, force),
|
||||
'blobSync.fullDownload': peerId =>
|
||||
new Observable(subscriber => {
|
||||
const abortController = new AbortController();
|
||||
|
||||
@@ -110,7 +110,7 @@ interface GroupedWorkerOps {
|
||||
state: [void, BlobSyncState];
|
||||
blobState: [string, BlobSyncBlobState];
|
||||
downloadBlob: [string, boolean];
|
||||
uploadBlob: [BlobRecord, true];
|
||||
uploadBlob: [{ blob: BlobRecord; force?: boolean }, true];
|
||||
fullDownload: [string | null, void];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user