mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* refactor: using tokio-postgres * chore: update * chore: update env * chore: update * chore: upgrade supabase and add logout button * refactor: update * chore: update * refactor: using message queue to handle the pg connection * refactor: move test * refactor: update sql * chore: create pg database when user login * chore: update scheme * chore: generic user service * chore: update * chore: create statistics * chore: create snapshot * chore: add test * chore: add database cloud service * chore: add document cloud service * chore: update interface * test: add document test * refactor: document interface * chore: fix test * chore: update * chore: update test * test: add test * test: add test * test: add test * chore: update collab rev * fix: flutter analyzer * chore: update * chore: update * chore: update * fix: tests * chore: update * chore: update collab rev * ci: rust fmt --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
35 lines
993 B
Rust
35 lines
993 B
Rust
use flowy_derive::ProtoBuf_Enum;
|
|
use flowy_notification::NotificationBuilder;
|
|
|
|
const DOCUMENT_OBSERVABLE_SOURCE: &str = "Document";
|
|
|
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
|
pub(crate) enum DocumentNotification {
|
|
#[default]
|
|
Unknown = 0,
|
|
|
|
DidReceiveUpdate = 1,
|
|
DidUpdateDocumentSnapshotState = 2,
|
|
DidUpdateDocumentSyncState = 3,
|
|
}
|
|
|
|
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,
|
|
_ => DocumentNotification::Unknown,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub(crate) fn send_notification(id: &str, ty: DocumentNotification) -> NotificationBuilder {
|
|
NotificationBuilder::new(id, ty, DOCUMENT_OBSERVABLE_SOURCE)
|
|
}
|