Skip to main content
Logo
Explore APIsContact Us
  • Home
  1. Resources
  2. Virtual Stadium
  3. Bet Sharing

Bet Sharing

Share your betslips with the Central Hub community and browse bets shared by others.


#Creating Bet Shares

Share your betslip with the community using CentralHubBetShareProvider. You can add an optional comment and control whether to display your stake amount.

The BetPayload contains all bet details including selections, odds, stake, and potential winnings.

kotlin
class CentralHubViewModel : ViewModel(), KoinComponent {
    
    private val betShareProvider: CentralHubBetShareProvider = get()
    
    suspend fun shareBet(
        betPayload: BetPayload,
        comment: String?,
        showStake: Boolean
    ) {
        betShareProvider.createBetShare(
            betPayload = betPayload,
            comment = comment,
            showStake = showStake,
            onSuccess = { /* Handle success */ },
            onFailure = { error -> /* Handle error */ }
        )
    }
}

#Browsing Shared Bets

Use CentralHubBetsProvider to browse shared bets from the community. The provider supports:

  • Filtering - View all bets, following only, or my bets
  • Sorting - Sort by latest, oldest, or most popular
  • Pagination - Load more bets as users scroll

The state flow automatically updates with new bet shares and supports incremental loading.

#Filter Options

BetShareFilterType.ALL

Display all shared bets from the entire community.

BetShareFilterType.FOLLOWERS_BETS

Show only bet shares from users you follow.

BetShareFilterType.MY_SHARED_BETS

Display only your own shared bets.

BetShareFilterType.MY_CONVERSATIONS

Show bet shares where you've participated in conversations.

BetShareFilterType.WINNING_BETS

Display only winning bet shares.

#Sort Options

BetShareSortType.CREATED

Sort by creation time (most recent first).

BetShareSortType.COMMENT_COUNT

Sort by number of comments (most commented first).

BetShareSortType.COPY_COUNT

Sort by number of times copied (most popular first).

kotlin
class BetsViewModel : ViewModel(), KoinComponent {
    
    private val betsProvider: CentralHubBetsProvider = get()
    
    val betsState = betsProvider.state
    
    fun loadBets(
        filterType: BetShareFilterType,
        sortType: BetShareSortType
    ) {
        betsProvider.loadBetShares(filterType, sortType)
    }
    
    fun loadMore(
        filterType: BetShareFilterType,
        sortType: BetShareSortType
    ) {
        betsProvider.loadMoreBetShares(filterType, sortType)
    }
}

Compose UI:

kotlin
@Composable
fun BetsFeed(viewModel: BetsViewModel = viewModel()) {
    val state by viewModel.betsState
        .collectAsStateWithLifecycle()
    
    LazyColumn {
        items(state.sharedBets) { betShare ->
            BetShareCard(betShare)
        }
        
        if (!state.allDataLoaded) {
            item {
                LoadMoreButton {
                    viewModel.loadMore(
                        BetShareFilterType.ALL,
                        BetShareSortType.CREATED
                    )
                }
            }
        }
    }
}

#Data Models

#BetShare

Represents a shared betslip with all associated data:

kotlin
data class BetShare(
    val id: String,
    val messageId: String?,
    val channelId: String?,
    val content: String,                    // Optional comment
    val numOfUnreadComments: Int,
    val numOfAllComments: Int,
    val userFollowersCount: Int?,
    val betPayload: BetPayload,             // Bet details
    val isMy: Boolean,                      // Is this my bet?
    val betShareCopyCount: Int,             // Times copied
    val user: User,                         // Bet author
    val createdAt: Long,
    val showStake: Boolean,
    val comments: List<MessageReply>,
    val reactions: List<Reaction>,
)

#CentralHubBetsState

State for browsing shared bets:

kotlin
data class CentralHubBetsState(
    val sharedBets: List<BetShare>,
    val loadingState: LoadingStatus,
    val previousPageLoadingStatus: LoadingStatus,
    val allDataLoaded: Boolean,
)

#Related Topics

  • Bet Copying - Copy shared bets to your bet slip
  • Comments & Reactions - Engage with shared bets
  • Notifications - Get notified about new bet shares
Last updated about 2 months ago
Is this site helpful?
Virtual Stadium, Moderation, Engagement Tools, BET
User ProfilesNotifications
On this page
  • Creating Bet Shares
  • Browsing Shared Bets
  • Filter Options
  • Sort Options
  • Data Models
  • BetShare
  • CentralHubBetsState
  • Related Topics