mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-17 20:58:05 +00:00
Add new configuration
This commit is contained in:
@ -6,6 +6,13 @@ 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;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct NotificationsConfig {
|
||||
has_firebase: bool,
|
||||
has_independent: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct PasswordPolicy {
|
||||
@ -53,13 +60,15 @@ pub struct ServerConfig {
|
||||
privacy_policy_url: &'static str,
|
||||
play_store_url: &'static str,
|
||||
android_direct_download_url: String,
|
||||
|
||||
notifications: NotificationsConfig,
|
||||
password_policy: PasswordPolicy,
|
||||
data_conservation_policy: DataConservationPolicy,
|
||||
conversations_policy: ConversationsPolicy,
|
||||
}
|
||||
|
||||
impl ServerConfig {
|
||||
pub fn new() -> Self {
|
||||
pub fn new(c: &APIClient) -> Self {
|
||||
ServerConfig {
|
||||
min_supported_mobile_version: MIN_SUPPORTED_MOBILE_VERSION,
|
||||
terms_url: &conf().terms_url,
|
||||
@ -67,6 +76,11 @@ impl ServerConfig {
|
||||
play_store_url: &conf().play_store_url,
|
||||
android_direct_download_url: conf().android_direct_download_url.clone(),
|
||||
|
||||
notifications: NotificationsConfig {
|
||||
has_firebase: c.firebase_token.is_some(),
|
||||
has_independent: conf().independent_push_service.is_some(),
|
||||
},
|
||||
|
||||
password_policy: PasswordPolicy {
|
||||
allow_email_in_password: password_policy::ALLOW_EMAIL_IN_PASSWORD,
|
||||
allow_name_in_password: password_policy::ALLOW_NAME_IN_PASSWORD,
|
||||
|
Reference in New Issue
Block a user