dart_notification.rs 907 B

1234567891011121314151617181920212223242526272829303132333435
  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 GridNotification {
  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. DidUpdateGridSetting = 70,
  17. }
  18. impl std::default::Default for GridNotification {
  19. fn default() -> Self {
  20. GridNotification::Unknown
  21. }
  22. }
  23. impl std::convert::From<GridNotification> for i32 {
  24. fn from(notification: GridNotification) -> Self {
  25. notification as i32
  26. }
  27. }
  28. #[tracing::instrument(level = "trace")]
  29. pub fn send_dart_notification(id: &str, ty: GridNotification) -> DartNotifyBuilder {
  30. DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
  31. }