2021-11-19 07:00:51 +00:00
|
|
|
use dart_notify::DartNotifyBuilder;
|
2021-07-21 07:43:05 +00:00
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
2021-11-27 11:19:41 +00:00
|
|
|
const OBSERVABLE_CATEGORY: &str = "Workspace";
|
2021-07-21 07:43:05 +00:00
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
2022-01-27 12:39:54 +00:00
|
|
|
pub(crate) enum FolderNotification {
|
2022-01-23 04:14:00 +00:00
|
|
|
Unknown = 0,
|
|
|
|
UserCreateWorkspace = 10,
|
|
|
|
UserDeleteWorkspace = 11,
|
|
|
|
WorkspaceUpdated = 12,
|
2021-10-30 09:19:50 +00:00
|
|
|
WorkspaceListUpdated = 13,
|
|
|
|
WorkspaceAppsChanged = 14,
|
2022-05-05 02:45:53 +00:00
|
|
|
WorkspaceSetting = 15,
|
2022-01-23 04:14:00 +00:00
|
|
|
AppUpdated = 21,
|
|
|
|
AppViewsChanged = 24,
|
|
|
|
ViewUpdated = 31,
|
|
|
|
ViewDeleted = 32,
|
|
|
|
ViewRestored = 33,
|
2022-09-22 05:08:48 +00:00
|
|
|
ViewMoveToTrash = 34,
|
2022-01-23 04:14:00 +00:00
|
|
|
UserUnauthorized = 100,
|
|
|
|
TrashUpdated = 1000,
|
2021-07-21 07:43:05 +00:00
|
|
|
}
|
|
|
|
|
2022-01-27 12:39:54 +00:00
|
|
|
impl std::default::Default for FolderNotification {
|
2022-01-23 04:14:00 +00:00
|
|
|
fn default() -> Self {
|
2022-01-27 12:39:54 +00:00
|
|
|
FolderNotification::Unknown
|
2022-01-23 04:14:00 +00:00
|
|
|
}
|
2021-07-21 07:43:05 +00:00
|
|
|
}
|
|
|
|
|
2022-01-27 12:39:54 +00:00
|
|
|
impl std::convert::From<FolderNotification> for i32 {
|
|
|
|
fn from(notification: FolderNotification) -> Self {
|
2022-01-23 04:14:00 +00:00
|
|
|
notification as i32
|
|
|
|
}
|
2021-07-21 07:43:05 +00:00
|
|
|
}
|
|
|
|
|
2022-01-23 14:33:47 +00:00
|
|
|
#[tracing::instrument(level = "trace")]
|
2022-01-27 12:39:54 +00:00
|
|
|
pub(crate) fn send_dart_notification(id: &str, ty: FolderNotification) -> DartNotifyBuilder {
|
2021-10-05 03:46:56 +00:00
|
|
|
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
2021-10-01 11:39:08 +00:00
|
|
|
}
|
2021-10-14 06:34:22 +00:00
|
|
|
|
2022-01-23 14:33:47 +00:00
|
|
|
#[tracing::instrument(level = "trace")]
|
2022-01-27 12:39:54 +00:00
|
|
|
pub(crate) fn send_anonymous_dart_notification(ty: FolderNotification) -> DartNotifyBuilder {
|
2021-10-14 06:34:22 +00:00
|
|
|
DartNotifyBuilder::new("", ty, OBSERVABLE_CATEGORY)
|
|
|
|
}
|