1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 21:39:21 +00:00

Rename fields

This commit is contained in:
Pierre HUBERT 2021-04-12 17:59:00 +02:00
parent d6e5cb6fed
commit b28d102e24
5 changed files with 8 additions and 8 deletions

View File

@ -5,8 +5,8 @@ use serde::Serialize;
use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy};
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, CONVERSATION_WRITING_EVENT_INTERVAL, CONVERSATION_WRITING_EVENT_LIFETIME, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_LOGO_HEIGHT, MAX_CONV_LOGO_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MAX_CONVERSATION_NAME_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::data::config::conf;
use crate::data::api_client::APIClient;
use crate::data::config::conf;
#[derive(Serialize)]
struct NotificationsConfig {
@ -61,7 +61,7 @@ pub struct ServerConfig {
play_store_url: &'static str,
android_direct_download_url: String,
notifications: NotificationsConfig,
push_notifications: NotificationsConfig,
password_policy: PasswordPolicy,
data_conservation_policy: DataConservationPolicy,
conversations_policy: ConversationsPolicy,
@ -76,7 +76,7 @@ impl ServerConfig {
play_store_url: &conf().play_store_url,
android_direct_download_url: conf().android_direct_download_url.clone(),
notifications: NotificationsConfig {
push_notifications: NotificationsConfig {
has_firebase: c.is_firebase_available(),
has_independent: conf().is_independent_push_notifications_service_enabled(),
},

View File

@ -7,7 +7,7 @@ use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::config::conf;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::user_token::PushNotificationToken;
use crate::helpers::{account_helper, independent_push_notification_service_helper};
use crate::helpers::{account_helper, independent_push_notifications_service_helper};
use crate::routes::RequestResult;
/// Get current push notifications status for a connection
@ -37,7 +37,7 @@ pub fn configure(r: &mut HttpRequestHandler) -> RequestResult {
return r.bad_request("Independent service is unavailable!".to_string());
}
let token = independent_push_notification_service_helper::create_token()?;
let token = independent_push_notifications_service_helper::create_token()?;
PushNotificationToken::INDEPENDENT(token)
}

View File

@ -19,4 +19,4 @@ pub mod requests_limit_helper;
pub mod events_helper;
pub mod calls_helper;
pub mod push_notifications_helper;
pub mod independent_push_notification_service_helper;
pub mod independent_push_notifications_service_helper;

View File

@ -4,14 +4,14 @@
use crate::data::user_token::{UserAccessToken, PushNotificationToken};
use crate::data::error::Res;
use crate::helpers::independent_push_notification_service_helper;
use crate::helpers::independent_push_notifications_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) {
if let Err(e) = independent_push_notifications_service_helper::remove_token(old_token) {
eprintln!("Failed to un-register from independent push notifications service! {}", e);
}
}