The VirtualStadiumSDK streamlines data access through a suite of integrated services. Leveraging the Koin dependency injection framework (already included as a dependency within the SDK). This approach simplifies the process of retrieving and utilizing data within your application.
Services available in the project are:
LoginManager is used to handle login to the SDK with JWT. Without it usage of SDK is basically impossible. (check Login Manager section)UserProvider provides current state of the user (check User Status section)SettingsProvider provides settings for the channel e.g. message limitation, list of available reactions (check Settings section)OddsFormatProvider offers the possibility to get UK formats for the odds in the betslips (check Odds provider section)ChatManager serves as a central management point for chat channels within the Virtual Stadium Data SDK. It is designed to handle the lifecycle and organization of chat channels (check Chat Manager section)Like already mentioned above, to use all the providers KoinComponent should be used.
import ag.sportradar.virtualstadium.datasdk.services.ChatManager
import ag.sportradar.virtualstadium.datasdk.services.LoginManager
import ag.sportradar.virtualstadium.datasdk.services.OddsFormatProvider
import ag.sportradar.virtualstadium.datasdk.services.SettingsProvider
import ag.sportradar.virtualstadium.datasdk.services.UserProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
class ExampleViewModel :
ViewModel(),
KoinComponent {
private val loginManager: LoginManager
get() = get()
private val userProvider: UserProvider
get() = get()
private val settingsProvider: SettingsProvider
get() = get()
private val oddsFormatProvider: OddsFormatProvider
get() = get()
private val chatManager: ChatManager
get() = get()
...
}
To use all mentioned providers in iOS, you must get them via KoinHelper getters.
import VirtualStadiumDataSDK
class ExampleViewModel {
private let loginManager = KoinHelper().getLoginManager()
private let userProvider = KoinHelper().getUserProvider()
private let settingsProvider = KoinHelper().getSettingsProvider()
private let oddsFormatProvider = KoinHelper().getOddsFormatProvider()
private let chatManager = KoinHelper().getChatManager()
...
}