2022-03-16 13:19:51 +00:00
|
|
|
use dart_notify::DartNotifyBuilder;
|
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
|
|
|
const OBSERVABLE_CATEGORY: &str = "Grid";
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
|
|
|
pub enum GridNotification {
|
|
|
|
Unknown = 0,
|
2022-04-03 14:22:54 +00:00
|
|
|
DidCreateBlock = 11,
|
2022-06-24 10:13:40 +00:00
|
|
|
DidUpdateGridBlock = 20,
|
2022-04-17 01:46:38 +00:00
|
|
|
DidUpdateGridField = 21,
|
2022-04-05 14:46:23 +00:00
|
|
|
DidUpdateRow = 30,
|
2022-04-17 01:46:38 +00:00
|
|
|
DidUpdateCell = 40,
|
|
|
|
DidUpdateField = 50,
|
2022-03-16 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl std::default::Default for GridNotification {
|
|
|
|
fn default() -> Self {
|
|
|
|
GridNotification::Unknown
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::convert::From<GridNotification> for i32 {
|
|
|
|
fn from(notification: GridNotification) -> Self {
|
|
|
|
notification as i32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
pub fn send_dart_notification(id: &str, ty: GridNotification) -> DartNotifyBuilder {
|
|
|
|
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
pub fn send_anonymous_dart_notification(ty: GridNotification) -> DartNotifyBuilder {
|
|
|
|
DartNotifyBuilder::new("", ty, OBSERVABLE_CATEGORY)
|
|
|
|
}
|