2022-03-16 21:19:51 +08:00
|
|
|
use dart_notify::DartNotifyBuilder;
|
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
|
|
|
const OBSERVABLE_CATEGORY: &str = "Grid";
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
2022-11-17 16:44:17 +08:00
|
|
|
pub enum GridDartNotification {
|
2022-03-16 21:19:51 +08:00
|
|
|
Unknown = 0,
|
2022-04-03 22:22:54 +08:00
|
|
|
DidCreateBlock = 11,
|
2022-12-09 20:03:39 +08:00
|
|
|
DidUpdateGridViewRows = 20,
|
|
|
|
DidUpdateGridViewRowsVisibility = 21,
|
|
|
|
DidUpdateGridFields = 22,
|
2022-04-05 22:46:23 +08:00
|
|
|
DidUpdateRow = 30,
|
2022-04-17 09:46:38 +08:00
|
|
|
DidUpdateCell = 40,
|
|
|
|
DidUpdateField = 50,
|
2022-08-21 13:56:06 +08:00
|
|
|
DidUpdateGroupView = 60,
|
|
|
|
DidUpdateGroup = 61,
|
2022-09-02 21:34:00 +08:00
|
|
|
DidGroupByNewField = 62,
|
2022-11-15 23:17:01 +08:00
|
|
|
DidUpdateFilter = 63,
|
2022-12-12 15:29:33 +08:00
|
|
|
DidUpdateSort = 64,
|
2022-09-03 16:47:58 +08:00
|
|
|
DidUpdateGridSetting = 70,
|
2022-03-16 21:19:51 +08:00
|
|
|
}
|
|
|
|
|
2022-11-17 16:44:17 +08:00
|
|
|
impl std::default::Default for GridDartNotification {
|
2022-03-16 21:19:51 +08:00
|
|
|
fn default() -> Self {
|
2022-11-17 16:44:17 +08:00
|
|
|
GridDartNotification::Unknown
|
2022-03-16 21:19:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-17 16:44:17 +08:00
|
|
|
impl std::convert::From<GridDartNotification> for i32 {
|
|
|
|
fn from(notification: GridDartNotification) -> Self {
|
2022-03-16 21:19:51 +08:00
|
|
|
notification as i32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tracing::instrument(level = "trace")]
|
2022-11-17 16:44:17 +08:00
|
|
|
pub fn send_dart_notification(id: &str, ty: GridDartNotification) -> DartNotifyBuilder {
|
2022-03-16 21:19:51 +08:00
|
|
|
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
|
|
|
}
|