2021-07-21 15:43:05 +08:00
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
2023-01-26 15:40:23 +08:00
|
|
|
use flowy_notification::NotificationBuilder;
|
2021-11-27 19:19:41 +08:00
|
|
|
const OBSERVABLE_CATEGORY: &str = "Workspace";
|
2021-07-21 15:43:05 +08:00
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
2022-01-27 20:39:54 +08:00
|
|
|
pub(crate) enum FolderNotification {
|
2022-01-23 12:14:00 +08:00
|
|
|
Unknown = 0,
|
2023-02-08 10:40:40 +08:00
|
|
|
/// Trigger after creating a workspace
|
|
|
|
DidCreateWorkspace = 1,
|
|
|
|
/// Trigger after deleting a workspace
|
|
|
|
DidDeleteWorkspace = 2,
|
|
|
|
/// Trigger after updating a workspace
|
|
|
|
DidUpdateWorkspace = 3,
|
|
|
|
/// Trigger when the number of apps of the workspace is changed
|
|
|
|
DidUpdateWorkspaceApps = 4,
|
|
|
|
/// Trigger when the settings of the workspace are changed. The changes including the latest visiting view, etc
|
|
|
|
DidUpdateWorkspaceSetting = 5,
|
|
|
|
/// Trigger when the properties including rename,update description of the app are changed
|
|
|
|
DidUpdateApp = 20,
|
|
|
|
/// Trigger when the properties including rename,update description of the view are changed
|
|
|
|
DidUpdateView = 30,
|
|
|
|
/// Trigger after deleting the view
|
|
|
|
DidDeleteView = 31,
|
|
|
|
/// Trigger when restore the view from trash
|
|
|
|
DidRestoreView = 32,
|
|
|
|
/// Trigger after moving the view to trash
|
|
|
|
DidMoveViewToTrash = 33,
|
|
|
|
/// Trigger when the number of trash is changed
|
|
|
|
DidUpdateTrash = 34,
|
2021-07-21 15:43:05 +08:00
|
|
|
}
|
|
|
|
|
2022-01-27 20:39:54 +08:00
|
|
|
impl std::default::Default for FolderNotification {
|
2022-01-23 12:14:00 +08:00
|
|
|
fn default() -> Self {
|
2022-01-27 20:39:54 +08:00
|
|
|
FolderNotification::Unknown
|
2022-01-23 12:14:00 +08:00
|
|
|
}
|
2021-07-21 15:43:05 +08:00
|
|
|
}
|
|
|
|
|
2022-01-27 20:39:54 +08:00
|
|
|
impl std::convert::From<FolderNotification> for i32 {
|
|
|
|
fn from(notification: FolderNotification) -> Self {
|
2022-01-23 12:14:00 +08:00
|
|
|
notification as i32
|
|
|
|
}
|
2021-07-21 15:43:05 +08:00
|
|
|
}
|
|
|
|
|
2022-01-23 22:33:47 +08:00
|
|
|
#[tracing::instrument(level = "trace")]
|
2023-01-27 17:17:51 +08:00
|
|
|
pub(crate) fn send_notification(id: &str, ty: FolderNotification) -> NotificationBuilder {
|
2023-01-26 15:40:23 +08:00
|
|
|
NotificationBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
2021-10-01 19:39:08 +08:00
|
|
|
}
|
2021-10-14 14:34:22 +08:00
|
|
|
|
2022-01-23 22:33:47 +08:00
|
|
|
#[tracing::instrument(level = "trace")]
|
2023-01-27 17:17:51 +08:00
|
|
|
pub(crate) fn send_anonymous_notification(ty: FolderNotification) -> NotificationBuilder {
|
2023-01-26 15:40:23 +08:00
|
|
|
NotificationBuilder::new("", ty, OBSERVABLE_CATEGORY)
|
2021-10-14 14:34:22 +08:00
|
|
|
}
|