#![forbid(unsafe_code)]
#![warn(
clippy::pedantic,
clippy::nursery,
clippy::tests_outside_test_module,
unused_qualifications,
non_ascii_idents
)]
#![allow(
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::future_not_send
)]
use std::fmt::Debug;
use std::io::Read;
pub use error::FcmError;
pub use error::NetworkError;
pub use fcm::send_fcm_message;
pub use fcm::send_fcm_message_with_url;
pub use fcm::FcmNotification;
pub use token_manager::SharedTokenManager;
pub use token_manager::TokenManager;
use tracing::info;
use tracing::instrument;
mod error;
mod fcm;
mod token_manager;
#[instrument(level = "info", skip_all)]
pub fn create_shared_token_manager<T: Read + Debug>(
credentials: T,
) -> Result<SharedTokenManager, FcmError> {
info!("Creating shared token manager");
let manager = TokenManager::new(credentials)?;
Ok(std::sync::Arc::new(tokio::sync::Mutex::new(manager)))
}