notification.rs 654 B

123456789101112131415161718192021222324252627
  1. use flowy_derive::ProtoBuf_Enum;
  2. use flowy_notification::NotificationBuilder;
  3. const OBSERVABLE_CATEGORY: &str = "Document";
  4. #[derive(ProtoBuf_Enum, Debug)]
  5. pub(crate) enum DocumentNotification {
  6. Unknown = 0,
  7. DidReceiveUpdate = 1,
  8. }
  9. impl std::default::Default for DocumentNotification {
  10. fn default() -> Self {
  11. DocumentNotification::Unknown
  12. }
  13. }
  14. impl std::convert::From<DocumentNotification> for i32 {
  15. fn from(notification: DocumentNotification) -> Self {
  16. notification as i32
  17. }
  18. }
  19. pub(crate) fn send_notification(id: &str, ty: DocumentNotification) -> NotificationBuilder {
  20. NotificationBuilder::new(id, ty, OBSERVABLE_CATEGORY)
  21. }