Skip to content

Commit 7c03924

Browse files
authored
Merge pull request #535 from AppFlowy-IO/refactor/text_block_event
chore: rename some struct in Rust
2 parents 59a1b0d + 2dfb726 commit 7c03924

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

frontend/app_flowy/lib/workspace/application/doc/doc_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class DocumentService {
1212
await FolderEventSetLatestView(ViewId(value: docId)).send();
1313

1414
final payload = TextBlockId(value: docId);
15-
return BlockEventGetBlockData(payload).send();
15+
return TextBlockEventGetBlockData(payload).send();
1616
}
1717

1818
Future<Either<TextBlockDelta, FlowyError>> composeDelta({required String docId, required String data}) {
1919
final payload = TextBlockDelta.create()
2020
..blockId = docId
2121
..deltaStr = data;
22-
return BlockEventApplyDelta(payload).send();
22+
return TextBlockEventApplyDelta(payload).send();
2323
}
2424

2525
Future<Either<Unit, FlowyError>> closeDocument({required String docId}) {

frontend/app_flowy/lib/workspace/application/doc/share_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ShareService {
1010
..viewId = docId
1111
..exportType = type;
1212

13-
return BlockEventExportDocument(request).send();
13+
return TextBlockEventExportDocument(request).send();
1414
}
1515

1616
Future<Either<ExportData, FlowyError>> exportText(String docId) {

frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-text-block/dart_event.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
/// Auto generate. Do not edit
33
part of '../../dispatch.dart';
4-
class BlockEventGetBlockData {
4+
class TextBlockEventGetBlockData {
55
TextBlockId request;
6-
BlockEventGetBlockData(this.request);
6+
TextBlockEventGetBlockData(this.request);
77

88
Future<Either<TextBlockDelta, FlowyError>> send() {
99
final request = FFIRequest.create()
10-
..event = BlockEvent.GetBlockData.toString()
10+
..event = TextBlockEvent.GetBlockData.toString()
1111
..payload = requestToBytes(this.request);
1212

1313
return Dispatch.asyncRequest(request)
@@ -18,13 +18,13 @@ class BlockEventGetBlockData {
1818
}
1919
}
2020

21-
class BlockEventApplyDelta {
21+
class TextBlockEventApplyDelta {
2222
TextBlockDelta request;
23-
BlockEventApplyDelta(this.request);
23+
TextBlockEventApplyDelta(this.request);
2424

2525
Future<Either<TextBlockDelta, FlowyError>> send() {
2626
final request = FFIRequest.create()
27-
..event = BlockEvent.ApplyDelta.toString()
27+
..event = TextBlockEvent.ApplyDelta.toString()
2828
..payload = requestToBytes(this.request);
2929

3030
return Dispatch.asyncRequest(request)
@@ -35,13 +35,13 @@ class BlockEventApplyDelta {
3535
}
3636
}
3737

38-
class BlockEventExportDocument {
38+
class TextBlockEventExportDocument {
3939
ExportPayload request;
40-
BlockEventExportDocument(this.request);
40+
TextBlockEventExportDocument(this.request);
4141

4242
Future<Either<ExportData, FlowyError>> send() {
4343
final request = FFIRequest.create()
44-
..event = BlockEvent.ExportDocument.toString()
44+
..event = TextBlockEvent.ExportDocument.toString()
4545
..payload = requestToBytes(this.request);
4646

4747
return Dispatch.asyncRequest(request)

frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-text-block/event_map.pbenum.dart

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-text-block/event_map.pbjson.dart

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/rust-lib/flowy-text-block/src/event_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ pub fn create(block_manager: Arc<TextBlockManager>) -> Module {
99
let mut module = Module::new().name(env!("CARGO_PKG_NAME")).data(block_manager);
1010

1111
module = module
12-
.event(BlockEvent::GetBlockData, get_block_data_handler)
13-
.event(BlockEvent::ApplyDelta, apply_delta_handler)
14-
.event(BlockEvent::ExportDocument, export_handler);
12+
.event(TextBlockEvent::GetBlockData, get_block_data_handler)
13+
.event(TextBlockEvent::ApplyDelta, apply_delta_handler)
14+
.event(TextBlockEvent::ExportDocument, export_handler);
1515

1616
module
1717
}
1818

1919
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
2020
#[event_err = "FlowyError"]
21-
pub enum BlockEvent {
21+
pub enum TextBlockEvent {
2222
#[event(input = "TextBlockId", output = "TextBlockDelta")]
2323
GetBlockData = 0,
2424

frontend/rust-lib/flowy-text-block/src/protobuf/model/event_map.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,62 +24,62 @@
2424
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2;
2525

2626
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
27-
pub enum BlockEvent {
27+
pub enum TextBlockEvent {
2828
GetBlockData = 0,
2929
ApplyDelta = 1,
3030
ExportDocument = 2,
3131
}
3232

33-
impl ::protobuf::ProtobufEnum for BlockEvent {
33+
impl ::protobuf::ProtobufEnum for TextBlockEvent {
3434
fn value(&self) -> i32 {
3535
*self as i32
3636
}
3737

38-
fn from_i32(value: i32) -> ::std::option::Option<BlockEvent> {
38+
fn from_i32(value: i32) -> ::std::option::Option<TextBlockEvent> {
3939
match value {
40-
0 => ::std::option::Option::Some(BlockEvent::GetBlockData),
41-
1 => ::std::option::Option::Some(BlockEvent::ApplyDelta),
42-
2 => ::std::option::Option::Some(BlockEvent::ExportDocument),
40+
0 => ::std::option::Option::Some(TextBlockEvent::GetBlockData),
41+
1 => ::std::option::Option::Some(TextBlockEvent::ApplyDelta),
42+
2 => ::std::option::Option::Some(TextBlockEvent::ExportDocument),
4343
_ => ::std::option::Option::None
4444
}
4545
}
4646

4747
fn values() -> &'static [Self] {
48-
static values: &'static [BlockEvent] = &[
49-
BlockEvent::GetBlockData,
50-
BlockEvent::ApplyDelta,
51-
BlockEvent::ExportDocument,
48+
static values: &'static [TextBlockEvent] = &[
49+
TextBlockEvent::GetBlockData,
50+
TextBlockEvent::ApplyDelta,
51+
TextBlockEvent::ExportDocument,
5252
];
5353
values
5454
}
5555

5656
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
5757
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
5858
descriptor.get(|| {
59-
::protobuf::reflect::EnumDescriptor::new_pb_name::<BlockEvent>("BlockEvent", file_descriptor_proto())
59+
::protobuf::reflect::EnumDescriptor::new_pb_name::<TextBlockEvent>("TextBlockEvent", file_descriptor_proto())
6060
})
6161
}
6262
}
6363

64-
impl ::std::marker::Copy for BlockEvent {
64+
impl ::std::marker::Copy for TextBlockEvent {
6565
}
6666

67-
impl ::std::default::Default for BlockEvent {
67+
impl ::std::default::Default for TextBlockEvent {
6868
fn default() -> Self {
69-
BlockEvent::GetBlockData
69+
TextBlockEvent::GetBlockData
7070
}
7171
}
7272

73-
impl ::protobuf::reflect::ProtobufValue for BlockEvent {
73+
impl ::protobuf::reflect::ProtobufValue for TextBlockEvent {
7474
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
7575
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
7676
}
7777
}
7878

7979
static file_descriptor_proto_data: &'static [u8] = b"\
80-
\n\x0fevent_map.proto*B\n\nBlockEvent\x12\x10\n\x0cGetBlockData\x10\0\
81-
\x12\x0e\n\nApplyDelta\x10\x01\x12\x12\n\x0eExportDocument\x10\x02b\x06p\
82-
roto3\
80+
\n\x0fevent_map.proto*F\n\x0eTextBlockEvent\x12\x10\n\x0cGetBlockData\
81+
\x10\0\x12\x0e\n\nApplyDelta\x10\x01\x12\x12\n\x0eExportDocument\x10\x02\
82+
b\x06proto3\
8383
";
8484

8585
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

frontend/rust-lib/flowy-text-block/src/protobuf/proto/event_map.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
syntax = "proto3";
22

3-
enum BlockEvent {
3+
enum TextBlockEvent {
44
GetBlockData = 0;
55
ApplyDelta = 1;
66
ExportDocument = 2;

0 commit comments

Comments
 (0)