1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-02-21 16:23:44 +00:00
comunicapiv3/src/helpers/push_notifications_helper.rs

20 lines
731 B
Rust
Raw Normal View History

//! # Push notifications helper
//!
//! @author Pierre Hubert
use crate::data::user_token::{UserAccessToken, PushNotificationToken};
use crate::data::error::Res;
use crate::helpers::independent_push_notification_service_helper;
/// Un-register for previous push notifications service
pub fn un_register_from_previous_service(client: &UserAccessToken) -> Res {
// This method must not fail in case of error
if let PushNotificationToken::INDEPENDENT(old_token) = &client.push_notifications_token {
if let Err(e) = independent_push_notification_service_helper::remove_token(old_token) {
eprintln!("Failed to un-register from independent push notifications service! {}", e);
}
}
Ok(())
}