fix: event handler not found for ApplyDocDelta

This commit is contained in:
appflowy
2022-03-16 16:34:38 +08:00
parent 1c1e955151
commit 694c612c67
8 changed files with 5 additions and 60 deletions

View File

@ -18,7 +18,7 @@ class DocumentService {
final payload = BlockDelta.create() final payload = BlockDelta.create()
..blockId = docId ..blockId = docId
..deltaStr = data; ..deltaStr = data;
return FolderEventApplyDocDelta(payload).send(); return BlockEventApplyDelta(payload).send();
} }
Future<Either<Unit, FlowyError>> closeDocument({required String docId}) { Future<Either<Unit, FlowyError>> closeDocument({required String docId}) {

View File

@ -10,7 +10,7 @@ class ShareService {
..viewId = docId ..viewId = docId
..exportType = type; ..exportType = type;
return FolderEventExportDocument(request).send(); return BlockEventExportDocument(request).send();
} }
Future<Either<ExportData, FlowyError>> exportText(String docId) { Future<Either<ExportData, FlowyError>> exportText(String docId) {

View File

@ -377,37 +377,3 @@ class FolderEventDeleteAllTrash {
} }
} }
class FolderEventApplyDocDelta {
BlockDelta request;
FolderEventApplyDocDelta(this.request);
Future<Either<BlockDelta, FlowyError>> send() {
final request = FFIRequest.create()
..event = FolderEvent.ApplyDocDelta.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(BlockDelta.fromBuffer(okBytes)),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}
}
class FolderEventExportDocument {
ExportPayload request;
FolderEventExportDocument(this.request);
Future<Either<ExportData, FlowyError>> send() {
final request = FFIRequest.create()
..event = FolderEvent.ExportDocument.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(ExportData.fromBuffer(okBytes)),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}
}

View File

@ -33,8 +33,6 @@ class FolderEvent extends $pb.ProtobufEnum {
static const FolderEvent DeleteTrash = FolderEvent._(302, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteTrash'); static const FolderEvent DeleteTrash = FolderEvent._(302, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteTrash');
static const FolderEvent RestoreAllTrash = FolderEvent._(303, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RestoreAllTrash'); static const FolderEvent RestoreAllTrash = FolderEvent._(303, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RestoreAllTrash');
static const FolderEvent DeleteAllTrash = FolderEvent._(304, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteAllTrash'); static const FolderEvent DeleteAllTrash = FolderEvent._(304, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteAllTrash');
static const FolderEvent ApplyDocDelta = FolderEvent._(400, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ApplyDocDelta');
static const FolderEvent ExportDocument = FolderEvent._(500, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ExportDocument');
static const $core.List<FolderEvent> values = <FolderEvent> [ static const $core.List<FolderEvent> values = <FolderEvent> [
CreateWorkspace, CreateWorkspace,
@ -60,8 +58,6 @@ class FolderEvent extends $pb.ProtobufEnum {
DeleteTrash, DeleteTrash,
RestoreAllTrash, RestoreAllTrash,
DeleteAllTrash, DeleteAllTrash,
ApplyDocDelta,
ExportDocument,
]; ];
static final $core.Map<$core.int, FolderEvent> _byValue = $pb.ProtobufEnum.initByValue(values); static final $core.Map<$core.int, FolderEvent> _byValue = $pb.ProtobufEnum.initByValue(values);

View File

@ -35,10 +35,8 @@ const FolderEvent$json = const {
const {'1': 'DeleteTrash', '2': 302}, const {'1': 'DeleteTrash', '2': 302},
const {'1': 'RestoreAllTrash', '2': 303}, const {'1': 'RestoreAllTrash', '2': 303},
const {'1': 'DeleteAllTrash', '2': 304}, const {'1': 'DeleteAllTrash', '2': 304},
const {'1': 'ApplyDocDelta', '2': 400},
const {'1': 'ExportDocument', '2': 500},
], ],
}; };
/// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. /// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARINCghDb3B5TGluaxDOARISCg1TZXRMYXRlc3RWaWV3EM8BEg4KCUNsb3NlVmlldxDQARIOCglSZWFkVHJhc2gQrAISEQoMUHV0YmFja1RyYXNoEK0CEhAKC0RlbGV0ZVRyYXNoEK4CEhQKD1Jlc3RvcmVBbGxUcmFzaBCvAhITCg5EZWxldGVBbGxUcmFzaBCwAhISCg1BcHBseURvY0RlbHRhEJADEhMKDkV4cG9ydERvY3VtZW50EPQD'); final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARINCghDb3B5TGluaxDOARISCg1TZXRMYXRlc3RWaWV3EM8BEg4KCUNsb3NlVmlldxDQARIOCglSZWFkVHJhc2gQrAISEQoMUHV0YmFja1RyYXNoEK0CEhAKC0RlbGV0ZVRyYXNoEK4CEhQKD1Jlc3RvcmVBbGxUcmFzaBCvAhITCg5EZWxldGVBbGxUcmFzaBCwAg==');

View File

@ -147,12 +147,6 @@ pub enum FolderEvent {
#[event()] #[event()]
DeleteAllTrash = 304, DeleteAllTrash = 304,
#[event(input = "BlockDelta", output = "BlockDelta")]
ApplyDocDelta = 400,
#[event(input = "ExportPayload", output = "ExportData")]
ExportDocument = 500,
} }
pub trait FolderCouldServiceV1: Send + Sync { pub trait FolderCouldServiceV1: Send + Sync {

View File

@ -48,8 +48,6 @@ pub enum FolderEvent {
DeleteTrash = 302, DeleteTrash = 302,
RestoreAllTrash = 303, RestoreAllTrash = 303,
DeleteAllTrash = 304, DeleteAllTrash = 304,
ApplyDocDelta = 400,
ExportDocument = 500,
} }
impl ::protobuf::ProtobufEnum for FolderEvent { impl ::protobuf::ProtobufEnum for FolderEvent {
@ -82,8 +80,6 @@ impl ::protobuf::ProtobufEnum for FolderEvent {
302 => ::std::option::Option::Some(FolderEvent::DeleteTrash), 302 => ::std::option::Option::Some(FolderEvent::DeleteTrash),
303 => ::std::option::Option::Some(FolderEvent::RestoreAllTrash), 303 => ::std::option::Option::Some(FolderEvent::RestoreAllTrash),
304 => ::std::option::Option::Some(FolderEvent::DeleteAllTrash), 304 => ::std::option::Option::Some(FolderEvent::DeleteAllTrash),
400 => ::std::option::Option::Some(FolderEvent::ApplyDocDelta),
500 => ::std::option::Option::Some(FolderEvent::ExportDocument),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
@ -113,8 +109,6 @@ impl ::protobuf::ProtobufEnum for FolderEvent {
FolderEvent::DeleteTrash, FolderEvent::DeleteTrash,
FolderEvent::RestoreAllTrash, FolderEvent::RestoreAllTrash,
FolderEvent::DeleteAllTrash, FolderEvent::DeleteAllTrash,
FolderEvent::ApplyDocDelta,
FolderEvent::ExportDocument,
]; ];
values values
} }
@ -143,7 +137,7 @@ impl ::protobuf::reflect::ProtobufValue for FolderEvent {
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0fevent_map.proto*\xd7\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ \n\x0fevent_map.proto*\xae\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\
pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\ pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\
aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\ aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\
ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\ ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\
@ -154,8 +148,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x12\n\rSetLatestView\x10\xcf\x01\x12\x0e\n\tCloseView\x10\xd0\x01\x12\ \x12\n\rSetLatestView\x10\xcf\x01\x12\x0e\n\tCloseView\x10\xd0\x01\x12\
\x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\ \x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\
\x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\ \x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\
\x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02\x12\x12\n\rApplyDocDelta\ \x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02b\x06proto3\
\x10\x90\x03\x12\x13\n\x0eExportDocument\x10\xf4\x03b\x06proto3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -24,6 +24,4 @@ enum FolderEvent {
DeleteTrash = 302; DeleteTrash = 302;
RestoreAllTrash = 303; RestoreAllTrash = 303;
DeleteAllTrash = 304; DeleteAllTrash = 304;
ApplyDocDelta = 400;
ExportDocument = 500;
} }