Skip to main content
Logo
Explore APIsContact Us
  • Home
  1. Resources
  2. Virtual Stadium
  3. Comments & Reactions

Comments & Reactions

Engage with shared bets through comments and reactions.


#Commenting on Bet Shares

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.

kotlin
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)
    }
}

#Adding Reactions

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.

kotlin
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 */ }
        )
    }
}

#Data Models

#CommentingState

State for bet share comments:

kotlin
data class CommentingState(
    val betShare: BetShare?,
    val loadingStatus: LoadingStatus,
    val nextPageLoadingStatus: LoadingStatus,
    val allDataLoaded: Boolean,
)

#Related Topics

  • Bet Sharing - View and create shared bets
  • Notifications - Get notified about new comments and reactions
Last updated about 2 months ago
Is this site helpful?
Virtual Stadium, Moderation, Engagement Tools, BET
NotificationsCopying Bets
On this page
  • Commenting on Bet Shares
  • Adding Reactions
  • Data Models
  • CommentingState
  • Related Topics