26 lines
714 B
Rust
Raw Normal View History

2021-12-05 09:29:42 +08:00
use flowy_derive::ProtoBuf_Enum;
use flowy_notification::NotificationBuilder;
2021-11-27 19:19:41 +08:00
const OBSERVABLE_CATEGORY: &str = "User";
2021-09-07 23:30:43 +08:00
#[derive(ProtoBuf_Enum, Debug, Default)]
2021-10-14 14:34:22 +08:00
pub(crate) enum UserNotification {
#[default]
Unknown = 0,
DidUserSignIn = 1,
DidUpdateUserProfile = 2,
2021-09-07 23:30:43 +08:00
}
2021-11-27 19:19:41 +08:00
impl std::convert::From<UserNotification> for i32 {
fn from(notification: UserNotification) -> Self {
notification as i32
}
2021-09-07 23:30:43 +08:00
}
pub(crate) fn send_notification(id: &str, ty: UserNotification) -> NotificationBuilder {
NotificationBuilder::new(id, ty, OBSERVABLE_CATEGORY)
2021-10-05 11:46:56 +08:00
}
pub(crate) fn send_sign_in_notification() -> NotificationBuilder {
NotificationBuilder::new("", UserNotification::DidUserSignIn, OBSERVABLE_CATEGORY)
}