Настройки
This commit is contained in:
@@ -3,18 +3,55 @@ package core.domain.model
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ServerConfigModel(
|
||||
@SerializedName("features") val features: FeaturesConfig = FeaturesConfig(),
|
||||
@SerializedName("limits") val limits: LimitsConfig = LimitsConfig()
|
||||
@SerializedName("stories") val stories: StoriesConfig = StoriesConfig(),
|
||||
@SerializedName("messages") val messages: MessagesConfig = MessagesConfig(),
|
||||
@SerializedName("chats") val chats: ChatsConfig = ChatsConfig(),
|
||||
@SerializedName("webRtc") val webRtc: WebRtcConfig = WebRtcConfig()
|
||||
) {
|
||||
// Helper to keep the presentation layer simple
|
||||
val features: FeaturesConfig
|
||||
get() = FeaturesConfig(
|
||||
stories = stories.enabled,
|
||||
polls = messages.allowPolls,
|
||||
calls = webRtc.enabled && webRtc.enableVoiceCalls,
|
||||
groups = true // Static for now as chats config doesn't have a simple toggle
|
||||
)
|
||||
|
||||
val limits: LimitsConfig
|
||||
get() = LimitsConfig(
|
||||
maxFileSize = messages.maxFileSize,
|
||||
maxGroupMembers = chats.maxGroupParticipants
|
||||
)
|
||||
}
|
||||
|
||||
data class StoriesConfig(
|
||||
@SerializedName("enabled") val enabled: Boolean = true
|
||||
)
|
||||
|
||||
data class MessagesConfig(
|
||||
@SerializedName("maxFileSize") val maxFileSize: Long = 100 * 1024 * 1024,
|
||||
@SerializedName("allowPolls") val allowPolls: Boolean = true
|
||||
)
|
||||
|
||||
data class ChatsConfig(
|
||||
@SerializedName("maxGroupParticipants") val maxGroupParticipants: Int = 200
|
||||
)
|
||||
|
||||
data class WebRtcConfig(
|
||||
@SerializedName("enabled") val enabled: Boolean = true,
|
||||
@SerializedName("enableVoiceCalls") val enableVoiceCalls: Boolean = true,
|
||||
@SerializedName("enableVideoCalls") val enableVideoCalls: Boolean = true
|
||||
)
|
||||
|
||||
// DTOs to maintain compatibility with existing UI code if possible
|
||||
data class FeaturesConfig(
|
||||
@SerializedName("stories") val stories: Boolean = true,
|
||||
@SerializedName("polls") val polls: Boolean = true,
|
||||
@SerializedName("calls") val calls: Boolean = true,
|
||||
@SerializedName("groups") val groups: Boolean = true
|
||||
val stories: Boolean,
|
||||
val polls: Boolean,
|
||||
val calls: Boolean,
|
||||
val groups: Boolean
|
||||
)
|
||||
|
||||
data class LimitsConfig(
|
||||
@SerializedName("maxFileSize") val maxFileSize: Long = 100 * 1024 * 1024, // 100MB default
|
||||
@SerializedName("maxGroupMembers") val maxGroupMembers: Int = 200
|
||||
val maxFileSize: Long,
|
||||
val maxGroupMembers: Int
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user