dart_notification.rs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. use dart_notify::DartNotifyBuilder;
  2. use flowy_derive::ProtoBuf_Enum;
  3. const OBSERVABLE_CATEGORY: &str = "Grid";
  4. #[derive(ProtoBuf_Enum, Debug)]
  5. pub enum GridDartNotification {
  6. Unknown = 0,
  7. DidCreateBlock = 11,
  8. DidUpdateGridViewRows = 20,
  9. DidUpdateGridViewRowsVisibility = 21,
  10. DidUpdateGridFields = 22,
  11. DidUpdateRow = 30,
  12. DidUpdateCell = 40,
  13. DidUpdateField = 50,
  14. DidUpdateGroupView = 60,
  15. DidUpdateGroup = 61,
  16. DidGroupByNewField = 62,
  17. DidUpdateFilter = 63,
  18. DidUpdateSort = 64,
  19. DidUpdateGridSetting = 70,
  20. }
  21. impl std::default::Default for GridDartNotification {
  22. fn default() -> Self {
  23. GridDartNotification::Unknown
  24. }
  25. }
  26. impl std::convert::From<GridDartNotification> for i32 {
  27. fn from(notification: GridDartNotification) -> Self {
  28. notification as i32
  29. }
  30. }
  31. #[tracing::instrument(level = "trace")]
  32. pub fn send_dart_notification(id: &str, ty: GridDartNotification) -> DartNotifyBuilder {
  33. DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
  34. }