This guide covers chat configuration and odds formatting in the Virtual Stadium Data SDK.
The SettingsProvider delivers default settings from the moderation backend. These settings control chat behavior and available features.
messageLength
Maximum number of characters allowed in a single message.
supportedReactions
Available reaction types for messages:
allowedCharRanges
Character ranges permitted in messages for content filtering and sanitization.
flashBetTimers
Configuration for flash betting functionality with timing settings.
clientSettings
Client-specific configuration options.
betStopTimeoutSeconds
Timeout duration for bet-related operations.
ChatSettings Data Structure:
data class ChatSettings(
val messageLength: Long,
val supportedReactions: List<ReactionType>,
val allowedCharRanges: List<AllowedChatRange>,
val flashBetTimers: FlashBetTimers?,
val clientSettings: ClientSettings?,
val betStopTimeoutSeconds: Int,
)Access chat settings through the SettingsProvider by injecting it via dependency injection.
The settings flow exposes the current configuration and updates automatically when settings change.
Use settings in your UI to enforce message length limits, display available reactions, and configure betting features.
import ag.sportradar.virtualstadium.datasdk.services.SettingsProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
class SettingsViewModel :
ViewModel(),
KoinComponent {
val settingsProvider: SettingsProvider
get() = get()
val settingsState = settingsProvider.settings
}Compose UI:
@Composable
fun Chat(settingsViewModel: SettingsViewModel = viewModel()) {
val settingsState by settingsViewModel.settingsState
.collectAsStateWithLifecycle()
// Use settings in UI
}import VirtualStadiumDataSDK
class ExampleSettingsViewModel: ObservableObject {
private var settingsProvider = KoinHelper().getSettingsProvider()
@Published var chatSettings: ChatSettings?
init() {
subscribeToSettingsProvider()
}
private func subscribeToSettingsProvider() {
settingsProvider.settings.subscribe { [weak self] chatSettings in
self?.chatSettings = chatSettings
}
}
}The OddsFormatProvider handles different odds formatting types for betslips.
OddsType.US
American odds format (e.g., +150, -200). Fully supported locally.
OddsType.EU
European/Decimal odds format (e.g., 2.50, 1.50). Fully supported locally.
OddsType.UK
UK/Fractional odds format (e.g., 3/2, 1/2). Requires backend request for formatting.
For OddsType.UK, request data as soon as possible or before requesting messages to ensure correct formatting. The SDK handles everything else automatically.
Access the OddsFormatProvider via dependency injection alongside the SettingsProvider.
Call getUKOddsFormats() when switching to UK odds format to fetch the necessary conversion data from the backend.
US and EU formats work immediately without additional requests.
import ag.sportradar.virtualstadium.datasdk.services.OddsFormatProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
class SettingsViewModel :
ViewModel(),
KoinComponent {
val oddsFormatProvider: OddsFormatProvider
get() = get()
private fun changeOddsType(oddsType: OddsType) {
if (oddsType == OddsType.UK) {
oddsFormatProvider.getUKOddsFormats()
}
}
}