33 lines
970 B
Rust
Raw Normal View History

use flowy_dart_notify::DartNotifyBuilder;
2021-07-21 15:43:05 +08:00
use flowy_derive::ProtoBuf_Enum;
const OBSERVABLE_CATEGORY: &'static str = "Workspace";
#[derive(ProtoBuf_Enum, Debug)]
2021-10-13 11:10:29 +08:00
pub(crate) enum Notification {
2021-09-06 16:18:34 +08:00
Unknown = 0,
UserCreateWorkspace = 10,
UserDeleteWorkspace = 11,
WorkspaceUpdated = 12,
WorkspaceCreateApp = 13,
WorkspaceDeleteApp = 14,
WorkspaceListUpdated = 15,
AppUpdated = 21,
2021-10-13 23:11:45 +08:00
AppViewsChanged = 24,
2021-09-06 16:18:34 +08:00
ViewUpdated = 31,
UserUnauthorized = 100,
2021-07-21 15:43:05 +08:00
}
2021-10-13 11:10:29 +08:00
impl std::default::Default for Notification {
fn default() -> Self { Notification::Unknown }
2021-07-21 15:43:05 +08:00
}
2021-10-13 11:10:29 +08:00
impl std::convert::Into<i32> for Notification {
2021-09-07 23:30:43 +08:00
fn into(self) -> i32 { self as i32 }
2021-07-21 15:43:05 +08:00
}
2021-10-13 11:10:29 +08:00
pub(crate) fn dart_notify(id: &str, ty: Notification) -> DartNotifyBuilder {
tracing::Span::current().record("dart_notify", &format!("{:?} => notify_id: {}", ty, id).as_str());
2021-10-05 11:46:56 +08:00
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
}