Engage with shared bets through comments and reactions.
Use CentralHubCommentingProvider to add comments to shared bets and view existing comments with pagination support.
The provider tracks comment state including unread counts and supports marking comments as read.
class CommentingViewModel : ViewModel(), KoinComponent {
private val commentingProvider:
CentralHubCommentingProvider = get()
val commentingState = commentingProvider.state
suspend fun loadComments(betShare: BetShare) {
commentingProvider.loadData(betShare)
}
suspend fun addComment(
betShareId: String,
message: String
) {
commentingProvider.commentBetShare(
betShareId = betShareId,
messageReply = message,
onSuccess = { /* Comment posted */ },
onFailure = { error -> /* Handle error */ }
)
}
suspend fun markAsRead(betShareId: String) {
commentingProvider.markCommentsAsRead(betShareId)
}
}CentralHubReactionsManager enables users to react to bet shares and comments with emojis or custom reactions.
Toggle reactions on/off with a single method call - the SDK handles adding or removing reactions automatically.
The reactionEvents flow emits updates when reactions change, allowing UI to update in real-time.
class ReactionsViewModel : ViewModel(), KoinComponent {
private val reactionsManager:
CentralHubReactionsManager = get()
val reactionEvents = reactionsManager.reactionEvents
suspend fun toggleReaction(
betShare: BetShare,
reactionType: ReactionType
) {
reactionsManager.toggleReactionBetShare(
betShare = betShare,
reactionType = reactionType,
onSuccess = { /* Reaction toggled */ },
onFailure = { error -> /* Handle error */ }
)
}
suspend fun reactToComment(
reply: MessageReply,
reactionType: ReactionType
) {
reactionsManager.toggleReactionComment(
reply = reply,
reactionType = reactionType,
onSuccess = { /* Reaction toggled */ },
onFailure = { error -> /* Handle error */ }
)
}
}State for bet share comments:
data class CommentingState(
val betShare: BetShare?,
val loadingStatus: LoadingStatus,
val nextPageLoadingStatus: LoadingStatus,
val allDataLoaded: Boolean,
)