2021-09-07 15:30:43 +00:00
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
2021-09-08 05:50:20 +00:00
|
|
|
|
2021-11-19 07:00:51 +00:00
|
|
|
use dart_notify::DartNotifyBuilder;
|
2021-09-07 15:30:43 +00:00
|
|
|
|
|
|
|
const OBSERVABLE_CATEGORY: &'static str = "User";
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
2021-10-14 06:34:22 +00:00
|
|
|
pub(crate) enum UserNotification {
|
2021-09-07 15:30:43 +00:00
|
|
|
Unknown = 0,
|
|
|
|
UserAuthChanged = 1,
|
|
|
|
UserProfileUpdated = 2,
|
2021-09-08 05:50:20 +00:00
|
|
|
UserUnauthorized = 3,
|
2021-09-07 15:30:43 +00:00
|
|
|
}
|
|
|
|
|
2021-10-14 06:34:22 +00:00
|
|
|
impl std::default::Default for UserNotification {
|
|
|
|
fn default() -> Self { UserNotification::Unknown }
|
2021-09-07 15:30:43 +00:00
|
|
|
}
|
|
|
|
|
2021-10-14 06:34:22 +00:00
|
|
|
impl std::convert::Into<i32> for UserNotification {
|
2021-09-07 15:30:43 +00:00
|
|
|
fn into(self) -> i32 { self as i32 }
|
|
|
|
}
|
|
|
|
|
2021-10-14 06:34:22 +00:00
|
|
|
pub(crate) fn dart_notify(id: &str, ty: UserNotification) -> DartNotifyBuilder {
|
2021-10-05 03:46:56 +00:00
|
|
|
DartNotifyBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
|
|
|
}
|