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,6 +19,7 @@ class ServerConfigurationHelper {
|
||||
|
||||
final passwordPolicy = response["password_policy"];
|
||||
final dataConservationPolicy = response["data_conservation_policy"];
|
||||
final conversationsPolicy = response["conversations_policy"];
|
||||
|
||||
_config = ServerConfig(
|
||||
minSupportedMobileVersion:
|
||||
@ -50,7 +51,14 @@ class ServerConfigurationHelper {
|
||||
dataConservationPolicy["min_conversation_messages_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
|
||||
|
@ -57,6 +57,29 @@ class ServerDataConservationPolicy {
|
||||
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 {
|
||||
final Version minSupportedMobileVersion;
|
||||
final String termsURL;
|
||||
@ -64,6 +87,7 @@ class ServerConfig {
|
||||
final String androidDirectDownloadURL;
|
||||
final PasswordPolicy passwordPolicy;
|
||||
final ServerDataConservationPolicy dataConservationPolicy;
|
||||
final ConversationsPolicy conversationsPolicy;
|
||||
|
||||
const ServerConfig({
|
||||
@required this.minSupportedMobileVersion,
|
||||
@ -72,10 +96,12 @@ class ServerConfig {
|
||||
@required this.androidDirectDownloadURL,
|
||||
@required this.passwordPolicy,
|
||||
@required this.dataConservationPolicy,
|
||||
@required this.conversationsPolicy,
|
||||
}) : assert(minSupportedMobileVersion != null),
|
||||
assert(termsURL != null),
|
||||
assert(playStoreURL != null),
|
||||
assert(androidDirectDownloadURL != null),
|
||||
assert(passwordPolicy != null),
|
||||
assert(dataConservationPolicy != null);
|
||||
assert(dataConservationPolicy != null),
|
||||
assert(conversationsPolicy != null);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
image:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
url: "https://pub.dartlang.org"
|
||||
|
Loading…
Reference in New Issue
Block a user