notification.rs 556 B

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