mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Updated conversations policy
This commit is contained in:
parent
a4181e3d42
commit
e02ab259b6
@ -19,38 +19,46 @@ class ServerConfigurationHelper {
|
|||||||
|
|
||||||
final passwordPolicy = response["password_policy"];
|
final passwordPolicy = response["password_policy"];
|
||||||
final dataConservationPolicy = response["data_conservation_policy"];
|
final dataConservationPolicy = response["data_conservation_policy"];
|
||||||
|
final conversationsPolicy = response["conversations_policy"];
|
||||||
|
|
||||||
_config = ServerConfig(
|
_config = ServerConfig(
|
||||||
minSupportedMobileVersion:
|
minSupportedMobileVersion:
|
||||||
Version.parse(response["min_supported_mobile_version"]),
|
Version.parse(response["min_supported_mobile_version"]),
|
||||||
termsURL: response["terms_url"],
|
termsURL: response["terms_url"],
|
||||||
playStoreURL: response["play_store_url"],
|
playStoreURL: response["play_store_url"],
|
||||||
androidDirectDownloadURL: response["android_direct_download_url"],
|
androidDirectDownloadURL: response["android_direct_download_url"],
|
||||||
passwordPolicy: PasswordPolicy(
|
passwordPolicy: PasswordPolicy(
|
||||||
allowMailInPassword: passwordPolicy["allow_email_in_password"],
|
allowMailInPassword: passwordPolicy["allow_email_in_password"],
|
||||||
allowNameInPassword: passwordPolicy["allow_name_in_password"],
|
allowNameInPassword: passwordPolicy["allow_name_in_password"],
|
||||||
minPasswordLength: passwordPolicy["min_password_length"],
|
minPasswordLength: passwordPolicy["min_password_length"],
|
||||||
minNumberUpperCaseLetters:
|
minNumberUpperCaseLetters:
|
||||||
passwordPolicy["min_number_upper_case_letters"],
|
passwordPolicy["min_number_upper_case_letters"],
|
||||||
minNumberLowerCaseLetters:
|
minNumberLowerCaseLetters:
|
||||||
passwordPolicy["min_number_lower_case_letters"],
|
passwordPolicy["min_number_lower_case_letters"],
|
||||||
minNumberDigits: passwordPolicy["min_number_digits"],
|
minNumberDigits: passwordPolicy["min_number_digits"],
|
||||||
minNumberSpecialCharacters:
|
minNumberSpecialCharacters:
|
||||||
passwordPolicy["min_number_special_characters"],
|
passwordPolicy["min_number_special_characters"],
|
||||||
minCategoriesPresence: passwordPolicy["min_categories_presence"],
|
minCategoriesPresence: passwordPolicy["min_categories_presence"],
|
||||||
),
|
),
|
||||||
dataConservationPolicy: ServerDataConservationPolicy(
|
dataConservationPolicy: ServerDataConservationPolicy(
|
||||||
minInactiveAccountLifetime:
|
minInactiveAccountLifetime:
|
||||||
dataConservationPolicy["min_inactive_account_lifetime"],
|
dataConservationPolicy["min_inactive_account_lifetime"],
|
||||||
minNotificationLifetime:
|
minNotificationLifetime:
|
||||||
dataConservationPolicy["min_notification_lifetime"],
|
dataConservationPolicy["min_notification_lifetime"],
|
||||||
minCommentsLifetime: dataConservationPolicy["min_comments_lifetime"],
|
minCommentsLifetime: dataConservationPolicy["min_comments_lifetime"],
|
||||||
minPostsLifetime: dataConservationPolicy["min_posts_lifetime"],
|
minPostsLifetime: dataConservationPolicy["min_posts_lifetime"],
|
||||||
minConversationMessagesLifetime:
|
minConversationMessagesLifetime:
|
||||||
dataConservationPolicy["min_conversation_messages_lifetime"],
|
dataConservationPolicy["min_conversation_messages_lifetime"],
|
||||||
minLikesLifetime: dataConservationPolicy["min_likes_lifetime"],
|
minLikesLifetime: dataConservationPolicy["min_likes_lifetime"],
|
||||||
),
|
),
|
||||||
);
|
conversationsPolicy: ConversationsPolicy(
|
||||||
|
minMessageLen: conversationsPolicy["min_message_len"],
|
||||||
|
maxMessageLen: conversationsPolicy["max_message_len"],
|
||||||
|
allowedFilesType: conversationsPolicy["allowed_files_type"].cast<String>(),
|
||||||
|
filesMaxSize: conversationsPolicy["files_max_size"],
|
||||||
|
writingEventInterval: conversationsPolicy["writing_event_interval"],
|
||||||
|
writingEventLifetime: conversationsPolicy["writing_event_lifetime"],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get current server configuration, throwing if it is not loaded yet
|
/// Get current server configuration, throwing if it is not loaded yet
|
||||||
|
@ -57,6 +57,29 @@ class ServerDataConservationPolicy {
|
|||||||
assert(minLikesLifetime != null);
|
assert(minLikesLifetime != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ConversationsPolicy {
|
||||||
|
final int minMessageLen;
|
||||||
|
final int maxMessageLen;
|
||||||
|
final List<String> allowedFilesType;
|
||||||
|
final int filesMaxSize;
|
||||||
|
final int writingEventInterval;
|
||||||
|
final int writingEventLifetime;
|
||||||
|
|
||||||
|
const ConversationsPolicy({
|
||||||
|
@required this.minMessageLen,
|
||||||
|
@required this.maxMessageLen,
|
||||||
|
@required this.allowedFilesType,
|
||||||
|
@required this.filesMaxSize,
|
||||||
|
@required this.writingEventInterval,
|
||||||
|
@required this.writingEventLifetime,
|
||||||
|
}) : assert(minMessageLen != null),
|
||||||
|
assert(maxMessageLen != null),
|
||||||
|
assert(allowedFilesType != null),
|
||||||
|
assert(filesMaxSize != null),
|
||||||
|
assert(writingEventInterval != null),
|
||||||
|
assert(writingEventLifetime != null);
|
||||||
|
}
|
||||||
|
|
||||||
class ServerConfig {
|
class ServerConfig {
|
||||||
final Version minSupportedMobileVersion;
|
final Version minSupportedMobileVersion;
|
||||||
final String termsURL;
|
final String termsURL;
|
||||||
@ -64,6 +87,7 @@ class ServerConfig {
|
|||||||
final String androidDirectDownloadURL;
|
final String androidDirectDownloadURL;
|
||||||
final PasswordPolicy passwordPolicy;
|
final PasswordPolicy passwordPolicy;
|
||||||
final ServerDataConservationPolicy dataConservationPolicy;
|
final ServerDataConservationPolicy dataConservationPolicy;
|
||||||
|
final ConversationsPolicy conversationsPolicy;
|
||||||
|
|
||||||
const ServerConfig({
|
const ServerConfig({
|
||||||
@required this.minSupportedMobileVersion,
|
@required this.minSupportedMobileVersion,
|
||||||
@ -72,10 +96,12 @@ class ServerConfig {
|
|||||||
@required this.androidDirectDownloadURL,
|
@required this.androidDirectDownloadURL,
|
||||||
@required this.passwordPolicy,
|
@required this.passwordPolicy,
|
||||||
@required this.dataConservationPolicy,
|
@required this.dataConservationPolicy,
|
||||||
|
@required this.conversationsPolicy,
|
||||||
}) : assert(minSupportedMobileVersion != null),
|
}) : assert(minSupportedMobileVersion != null),
|
||||||
assert(termsURL != null),
|
assert(termsURL != null),
|
||||||
assert(playStoreURL != null),
|
assert(playStoreURL != null),
|
||||||
assert(androidDirectDownloadURL != null),
|
assert(androidDirectDownloadURL != null),
|
||||||
assert(passwordPolicy != null),
|
assert(passwordPolicy != null),
|
||||||
assert(dataConservationPolicy != null);
|
assert(dataConservationPolicy != null),
|
||||||
|
assert(conversationsPolicy != null);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.1"
|
version: "0.1.1"
|
||||||
image:
|
image:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
Loading…
Reference in New Issue
Block a user