GiftStore

abstract class GiftStore

Gift-related interface, managing gift sending, gift state synchronization, and gift event listening in live rooms/voice chat rooms.

Overview

GiftStore Gift management class for handling gift-related business logic in live rooms/voice chat rooms. GiftStore provides a complete set of gift management APIs, including sending gifts, refreshing gift lists, setting language, and listening to gift events. Through this class, gift interaction features can be implemented in live rooms.

Core Features

  • Gift Sending: Support sending specified gifts to the current room

  • Gift List: Get and refresh the available gift list in the current room

  • Language Setting: Set the display language for gift information

  • Event Listening: Listen to gift receiving events

Important: Use the GiftStore.create factory method to create a GiftStore instance, passing a valid live room ID. Gift state updates are delivered through the giftState publisher. Subscribe to it to receive real-time updates of gift data in the room.

Gift Operations Overview

FeatureMethodDescription
Create InstanceGiftStore.createCreate a gift management instance for the specified room
Send GiftsendGiftSend a specified gift to the current room
Refresh ListrefreshUsableGiftsManually refresh the available gift list in the current room
Language SettingsetLanguageSet the display language for gift information
Event ListeningaddGiftListener/removeGiftListenerAdd/remove gift event listeners

Topics

Creating Instance

Observing State and Events

Gift Operations

See Also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val giftState: GiftState

Gift state subscription for the current room, containing information such as available gift list. By subscribing to this state, real-time updates of gift data in the room can be obtained.

Functions

Link copied to clipboard
abstract fun addGiftListener(listener: GiftListener?)

Gift event publisher. Through this publisher, you can subscribe to/remove gift events in live rooms/voice chat rooms. After subscribing, you will receive corresponding notifications when viewers send gifts.

Link copied to clipboard
abstract fun refreshUsableGifts(completion: CompletionHandler?)

Manually refresh the available gift list in the current room.

Link copied to clipboard
abstract fun removeGiftListener(listener: GiftListener?)
Link copied to clipboard
abstract fun sendGift(giftID: String, count: Int, completion: CompletionHandler?)

Send a specified gift to the current room

Link copied to clipboard
abstract fun setLanguage(language: String)

Set the display language for gift information.