mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* feat: support collab selection * feat: collab cusro/selection * chore: add metadata field * feat: support displaying user name above cursor * fix: emit error * feat: support displaying collaborators * feat: sync collaborator * fix: collab doc issues * chore: update deps * feat: refactor device id * chore: enable share button * chore: update collab a816214 * fix: clippy lint * chore: use extension type instead class function * feat: add clear recent views button in debug mode * chore: support clear recent views * feat: support saving the last opened workspace * chore: update collab
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use flowy_derive::ProtoBuf_Enum;
|
|
use flowy_notification::NotificationBuilder;
|
|
|
|
const DOCUMENT_OBSERVABLE_SOURCE: &str = "Document";
|
|
|
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
|
pub enum DocumentNotification {
|
|
#[default]
|
|
Unknown = 0,
|
|
|
|
DidReceiveUpdate = 1,
|
|
DidUpdateDocumentSnapshotState = 2,
|
|
DidUpdateDocumentSyncState = 3,
|
|
DidUpdateDocumentAwarenessState = 4,
|
|
}
|
|
|
|
impl std::convert::From<DocumentNotification> for i32 {
|
|
fn from(notification: DocumentNotification) -> Self {
|
|
notification as i32
|
|
}
|
|
}
|
|
impl std::convert::From<i32> for DocumentNotification {
|
|
fn from(notification: i32) -> Self {
|
|
match notification {
|
|
1 => DocumentNotification::DidReceiveUpdate,
|
|
2 => DocumentNotification::DidUpdateDocumentSnapshotState,
|
|
3 => DocumentNotification::DidUpdateDocumentSyncState,
|
|
4 => DocumentNotification::DidUpdateDocumentAwarenessState,
|
|
_ => DocumentNotification::Unknown,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
pub(crate) fn send_notification(id: &str, ty: DocumentNotification) -> NotificationBuilder {
|
|
NotificationBuilder::new(id, ty, DOCUMENT_OBSERVABLE_SOURCE)
|
|
}
|