NumberPredictionViewModel
class NumberPredictionViewModel(val widgetInfos: WidgetInfos, analyticsService: AnalyticsService, configurationOnce: Once<SdkConfiguration>, var onDismiss: () -> Unit?, currentProfileOnce: Once<LiveLikeProfile>, programRepository: ProgramRepository? = null, widgetMessagingClient: (RealTimeClientMessage) -> Unit? = null, val widgetInteractionRepository: WidgetInteractionRepository?, networkApiClient: NetworkApiClient, rewardItemMapCache: Map<String, RewardItem>, userProfileRewardDelegate: UserProfileDelegate?, dataStoreDelegate: DataStoreDelegate, viewModelDispatcher: CoroutineDispatcher, uiDispatcher: CoroutineDispatcher) : BaseViewModel, NumberPredictionWidgetModel, NumberPredictionFollowUpWidgetModel
Constructors
Link copied to clipboard
constructor(widgetInfos: WidgetInfos, analyticsService: AnalyticsService, configurationOnce: Once<SdkConfiguration>, onDismiss: () -> Unit?, currentProfileOnce: Once<LiveLikeProfile>, programRepository: ProgramRepository? = null, widgetMessagingClient: (RealTimeClientMessage) -> Unit? = null, widgetInteractionRepository: WidgetInteractionRepository?, 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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
widget data holder
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Functions
Link copied to clipboard
Attempts to claim rewards for this Number Prediction Follow Up
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun getGamificationReward(rewardUrl: String, analyticsService: AnalyticsService, userAccessToken: String): ProgramGamificationProfile?
Link copied to clipboard
Returns the votes submitted
Link copied to clipboard
Returns the last interaction
Link copied to clipboard
Link copied to clipboard
checks if widgets expired interactive_until
Link copied to clipboard
fun isUserCorrect(selectedPredictionVotes: List<NumberPredictionVotes>?, correctVotes: List<Option?>?): Boolean
Link copied to clipboard
open override fun loadInteractionHistory(liveLikeCallback: LiveLikeCallback<List<NumberPredictionWidgetUserInteraction>>)
Call this to load the user's interaction history for this Widget
Link copied to clipboard
Link copied to clipboard
open override fun lockInVote(options: List<NumberPredictionVotes>, liveLikeCallback: LiveLikeCallback<VoteResponse>? = null)
submission of prediction votes (prediction for all options is mandatory)
Link copied to clipboard
This will capture the analytics event Widget Became Interactive It should be called when the widget is opened first time for user interaction
Link copied to clipboard
open override fun registerImpression(url: String, liveLikeCallback: LiveLikeCallback<WidgetImpressions>)
call this to register widget Impressions
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 startDismissTimeout(timeout: String, isFollowup: Boolean, selectedUserVotes: List<NumberPredictionVotes>?)
Link copied to clipboard
Link copied to clipboard
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
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