CollectBadgeWidgetViewModel

class CollectBadgeWidgetViewModel(val badge: Badge, configurationOnce: Once<SdkConfiguration>, currentProfileOnce: Once<LiveLikeProfile>, onDismiss: () -> Unit?, analyticsService: AnalyticsService, animationEventsFlow: MutableStateFlow<ViewAnimationEvents?>, networkApiClient: NetworkApiClient, rewardItemMapCache: Map<String, RewardItem>, userProfileRewardDelegate: UserProfileDelegate?, dataStoreDelegate: DataStoreDelegate, viewModelDispatcher: CoroutineDispatcher, uiDispatcher: CoroutineDispatcher) : WidgetViewModel<Resource>

Constructors

Link copied to clipboard
constructor(badge: Badge, configurationOnce: Once<SdkConfiguration>, currentProfileOnce: Once<LiveLikeProfile>, onDismiss: () -> Unit?, analyticsService: AnalyticsService, animationEventsFlow: MutableStateFlow<ViewAnimationEvents?>, networkApiClient: NetworkApiClient, rewardItemMapCache: Map<String, RewardItem>, userProfileRewardDelegate: UserProfileDelegate?, dataStoreDelegate: DataStoreDelegate, viewModelDispatcher: CoroutineDispatcher, uiDispatcher: CoroutineDispatcher)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val currentVoteFlow: MutableStateFlow<String?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val dataFlow: MutableStateFlow<T?>
Link copied to clipboard
Link copied to clipboard
val disableInteractionFlow: MutableStateFlow<Boolean?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected var onDismiss: () -> Unit?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resultsFlow: MutableStateFlow<T?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val selectedPositionFlow: MutableStateFlow<Int>
Link copied to clipboard
val selectionLockedFlow: MutableStateFlow<Boolean>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val stateFlow: MutableStateFlow<WidgetState?>
Link copied to clipboard
Link copied to clipboard
var timeOutJob: Job?
Link copied to clipboard
Link copied to clipboard
val uiScope: CoroutineScope

This is the main scope for all coroutines launched by MainViewModel. Since we pass viewModelJob, you can cancel all coroutines launched by uiScope by calling viewModelJob.cancel()

Link copied to clipboard
val userSelectedOptionIdFlow: MutableStateFlow<String?>
Link copied to clipboard
val viewModelScope: CoroutineScope
Link copied to clipboard
lateinit var widgetInfos: WidgetInfos
Link copied to clipboard
val widgetStateFlow: MutableStateFlow<WidgetStates?>

Functions

Link copied to clipboard
Link copied to clipboard
open override fun dismissWidget(action: DismissAction)
Link copied to clipboard
suspend fun getGamificationReward(rewardUrl: String, analyticsService: AnalyticsService, userAccessToken: String): ProgramGamificationProfile?
Link copied to clipboard
fun isInteractivityExpired(interactiveUntil: String?): Boolean

checks if widgets expired interactive_until

Link copied to clipboard
open override fun onClear()

all models should override this to cleanup their resources

Link copied to clipboard
fun onInteractionCompletion(function: () -> Unit?)

will be called after timer completion or can be called manually after interaction finished

Link copied to clipboard
Link copied to clipboard
protected fun <T : Any> safeCallBack(liveLikeCallBack: LiveLikeCallback<T>? = null, call: suspend (Pair<LiveLikeProfile, SdkConfiguration>) -> T?)
Link copied to clipboard
fun startInteractionTimeout(timeout: Long, function: () -> Unit? = null)
Link copied to clipboard
Link copied to clipboard
protected inline fun <T : Any> subscribeWidgetResults(channelName: String, widgetId: String, flow: MutableStateFlow<T?>)
Link copied to clipboard
protected fun trackWidgetBecameInteractive(widgetType: WidgetType?, widgetId: String, programId: String)
Link copied to clipboard
fun trackWidgetEngagedAnalytics(currentWidgetType: WidgetType?, currentWidgetId: String, programId: String, widgetPrompt: String)
Link copied to clipboard
Link copied to clipboard
open override fun vote(value: String)
Link copied to clipboard
protected suspend fun voteAsync(widgetVotingUrl: String, voteId: String? = null, body: Map<String, Any>? = null, type: RequestType? = null, useVoteUrl: Boolean = true, currentProfileOnce: Once<LiveLikeProfile>, widgetId: String? = null, patchVoteUrl: String? = null, rewardItemMapCache: Map<String, RewardItem>, userProfileRewardDelegate: UserProfileDelegate?): VoteResponse