32 lines
913 B
Rust
Raw Normal View History

2021-07-21 15:43:05 +08:00
use flowy_derive::ProtoBuf_Enum;
2021-09-11 14:26:30 +08:00
use flowy_observable::NotifyBuilder;
2021-07-21 15:43:05 +08:00
const OBSERVABLE_CATEGORY: &'static str = "Workspace";
#[derive(ProtoBuf_Enum, Debug)]
2021-07-21 22:41:44 +08:00
pub(crate) enum WorkspaceObservable {
2021-09-06 16:18:34 +08: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 15:43:05 +08:00
}
2021-07-21 22:41:44 +08:00
impl std::default::Default for WorkspaceObservable {
fn default() -> Self { WorkspaceObservable::Unknown }
2021-07-21 15:43:05 +08:00
}
2021-09-07 23:30:43 +08:00
impl std::convert::Into<i32> for WorkspaceObservable {
fn into(self) -> i32 { self as i32 }
2021-07-21 15:43:05 +08:00
}
pub(crate) fn notify(id: &str, ty: WorkspaceObservable) -> NotifyBuilder {
NotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
}