dart_notification.rs 957 B

123456789101112131415161718192021222324252627282930313233343536
  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. DidUpdateGridBlock = 20,
  9. DidUpdateGridField = 21,
  10. DidUpdateRow = 30,
  11. DidUpdateCell = 40,
  12. DidUpdateField = 50,
  13. DidUpdateGroupView = 60,
  14. DidUpdateGroup = 61,
  15. DidGroupByNewField = 62,
  16. DidUpdateFilter = 63,
  17. DidUpdateGridSetting = 70,
  18. }
  19. impl std::default::Default for GridDartNotification {
  20. fn default() -> Self {
  21. GridDartNotification::Unknown
  22. }
  23. }
  24. impl std::convert::From<GridDartNotification> for i32 {
  25. fn from(notification: GridDartNotification) -> Self {
  26. notification as i32
  27. }
  28. }
  29. #[tracing::instrument(level = "trace")]
  30. pub fn send_dart_notification(id: &str, ty: GridDartNotification) -> DartNotifyBuilder {
  31. DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
  32. }