1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 08:25:16 +00:00

Build first notifications

This commit is contained in:
2021-04-15 11:08:11 +02:00
parent b28d102e24
commit 28c0494fe9
7 changed files with 166 additions and 5 deletions

View File

@ -38,4 +38,5 @@ pub mod new_custom_emoji;
pub mod user_ws_message;
pub mod user_ws_connection;
pub mod call_signal;
pub mod new_notifications_settings;
pub mod new_notifications_settings;
pub mod push_notification;

View File

@ -0,0 +1,14 @@
//! # Push notification
//!
//! Notification pushed to registered devices
//!
//! @author Pierre Hubert
#[derive(Debug)]
pub struct PushNotification {
pub id: String,
pub title: String,
pub body: String,
pub image: Option<String>,
pub timeout: Option<u64>,
}

View File

@ -36,6 +36,11 @@ impl UserID {
false => None,
}
}
/// Create an owned instance of this user ID object
pub fn as_owned(&self) -> Self {
Self(self.0)
}
}
impl Hash for UserID {
@ -136,6 +141,10 @@ pub struct User {
}
impl User {
pub fn full_name(&self) -> String {
format!("{} {}", self.first_name, self.last_name)
}
/// Check if user's page is public
pub fn is_page_public(&self) -> bool {
!matches!(self.status, UserPageStatus::PRIVATE)