AppFlowy/rust-lib/flowy-workspace/src/observable/observable.rs

30 lines
909 B
Rust
Raw Normal View History

2021-07-21 07:43:05 +00:00
use flowy_derive::ProtoBuf_Enum;
2021-09-11 06:26:30 +00:00
use flowy_observable::NotifyBuilder;
2021-07-21 07:43:05 +00:00
const OBSERVABLE_CATEGORY: &'static str = "Workspace";
#[derive(ProtoBuf_Enum, Debug)]
2021-07-21 14:41:44 +00:00
pub(crate) enum WorkspaceObservable {
2021-09-06 08:18:34 +00:00
Unknown = 0,
UserCreateWorkspace = 10,
UserDeleteWorkspace = 11,
WorkspaceUpdated = 12,
WorkspaceCreateApp = 13,
WorkspaceDeleteApp = 14,
WorkspaceListUpdated = 15,
AppUpdated = 21,
AppCreateView = 23,
AppDeleteView = 24,
ViewUpdated = 31,
UserUnauthorized = 100,
2021-07-21 07:43:05 +00:00
}
2021-07-21 14:41:44 +00:00
impl std::default::Default for WorkspaceObservable {
fn default() -> Self { WorkspaceObservable::Unknown }
2021-07-21 07:43:05 +00:00
}
2021-09-07 15:30:43 +00:00
impl std::convert::Into<i32> for WorkspaceObservable {
fn into(self) -> i32 { self as i32 }
2021-07-21 07:43:05 +00:00
}
2021-09-11 06:26:30 +00:00
pub(crate) fn notify(id: &str, ty: WorkspaceObservable) -> NotifyBuilder { NotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY) }