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