PredictionViewModel

class PredictionViewModel(widgetInfos: WidgetInfos, analyticsService: AnalyticsService, configurationUserPairFlow: Flow<Pair<LiveLikeUser, SdkConfiguration>>, onDismiss: () -> Unit, currentUserFlow: StateFlow<LiveLikeUser?>, programRepository: ProgramRepository?, widgetMessagingClient: WidgetManager?, widgetInteractionRepository: WidgetInteractionRepository?, networkApiClient: NetworkApiClient, rewardItemMapCache: Map<String, RewardItem>, userProfileRewardDelegate: UserProfileDelegate?, dataStoreDelegate: DataStoreDelegate, lottieAnimationPath: (String) -> String?, viewModelDispatcher: CoroutineDispatcher, uiDispatcher: CoroutineDispatcher) : BaseViewModel, PredictionWidgetViewModel, FollowUpWidgetViewModel

Functions

claimRewards
Link copied to clipboard
open override fun claimRewards()
claim earned rewards if any for the chosen prediction
dismissWidget
Link copied to clipboard
fun dismissWidget(action: DismissAction)
finish
Link copied to clipboard
open override fun finish()
call this to cleanup the viewModel and its association
followupState
Link copied to clipboard
fun followupState(selectedPredictionId: String, correctOptionId: String?, widgetWinAnimation: String, widgetLoseAnimation: String)
getGamificationReward
Link copied to clipboard
suspend fun getGamificationReward(rewardUrl: String, analyticsService: AnalyticsService, userAccessToken: String): ProgramGamificationProfile?
getPredictionVoteId
Link copied to clipboard
open override fun getPredictionVoteId(): String?
return the prediction option Id which it was voted previously
getUserInteraction
Link copied to clipboard
open override fun getUserInteraction(): PredictionWidgetUserInteraction?
it returns the latest user interaction for the widget
isInteractivityExpired
Link copied to clipboard
fun isInteractivityExpired(interactiveUntil: String?): Boolean
checks if widgets expired interactive_until
loadInteractionHistory
Link copied to clipboard
open override fun loadInteractionHistory(liveLikeCallback: LiveLikeCallback<List<PredictionWidgetUserInteraction>>)
returns widget interactions from remote source
lockInVote
Link copied to clipboard
open override fun lockInVote(optionID: String)
lock the answer for prediction
markAsInteractive
Link copied to clipboard
open override fun markAsInteractive()
This will capture the analytics event Widget Became Interactive It should be called when the widget is opened first time for user interaction
onClear
Link copied to clipboard
open override fun onClear()
all models should override this to cleanup their resources
onOptionClicked
Link copied to clipboard
fun onOptionClicked()
startDismissTimout
Link copied to clipboard
fun startDismissTimout(timeout: String, isFollowup: Boolean)
subscribeWidgetResults
Link copied to clipboard
inline fun <T : Any> subscribeWidgetResults(channelName: String, sdkConfiguration: SdkConfiguration, user: LiveLikeUser, widgetId: String, flow: MutableStateFlow<T?>)
trackWidgetEngagedAnalytics
Link copied to clipboard
fun trackWidgetEngagedAnalytics(currentWidgetType: WidgetType?, currentWidgetId: String, programId: String)
unsubscribeWidgetResults
Link copied to clipboard
fun unsubscribeWidgetResults()
voteApi
Link copied to clipboard
fun voteApi(url: String, id: String, currentUserFlow: StateFlow<LiveLikeUser?>, patchVoteUrl: String? = null)

Properties

analyticsService
Link copied to clipboard
val analyticsService: AnalyticsService
animationEggTimerProgress
Link copied to clipboard
var animationEggTimerProgress: Float = 0f
animationPath
Link copied to clipboard
var animationPath: String
animationProgress
Link copied to clipboard
var animationProgress: Float = 0f
correctOptionIdFlow
Link copied to clipboard
val correctOptionIdFlow: <ERROR CLASS>
dataFlow
Link copied to clipboard
val dataFlow: <ERROR CLASS>
dataStoreDelegate
Link copied to clipboard
val dataStoreDelegate: DataStoreDelegate
enableDefaultWidgetTransition
Link copied to clipboard
var enableDefaultWidgetTransition: Boolean = true
followUp
Link copied to clipboard
var followUp: Boolean = false
gamificationProfile
Link copied to clipboard
val gamificationProfile: StateFlow<ProgramGamificationProfile?>
onDismiss
Link copied to clipboard
val onDismiss: () -> Unit
points
Link copied to clipboard
var points: Int? = null
resultsFlow
Link copied to clipboard
val resultsFlow: <ERROR CLASS>
rewardsType
Link copied to clipboard
val rewardsType: RewardsType
rewardType
Link copied to clipboard
var rewardType: String
selectedOptionId
Link copied to clipboard
var selectedOptionId: String?
selectedPositionFlow
Link copied to clipboard
val selectedPositionFlow: <ERROR CLASS>
selectionLockedFlow
Link copied to clipboard
val selectionLockedFlow: <ERROR CLASS>
showDismissButton
Link copied to clipboard
var showDismissButton: Boolean = true
showTimer
Link copied to clipboard
var showTimer: Boolean = true
subscribedWidgetChannelName
Link copied to clipboard
var subscribedWidgetChannelName: String? = null
subscribeResultJobs
Link copied to clipboard
var subscribeResultJobs: <ERROR CLASS>
timeoutStarted
Link copied to clipboard
var timeoutStarted: Boolean = false
timerStartTime
Link copied to clipboard
var timerStartTime: Long? = null
uiScope
Link copied to clipboard
val uiScope: <ERROR CLASS>
This is the main scope for all coroutines launched by MainViewModel.
userSelectedOptionIdFlow
Link copied to clipboard
val userSelectedOptionIdFlow: <ERROR CLASS>
viewModelScope
Link copied to clipboard
val viewModelScope: <ERROR CLASS>
voteResults
Link copied to clipboard
open override val voteResults: Stream<LiveLikeWidgetResult>
live stream for vote results
widgetData
Link copied to clipboard
open override val widgetData: LiveLikeWidget
widget data holder
widgetInfos
Link copied to clipboard
val widgetInfos: WidgetInfos
widgetInteractionRepository
Link copied to clipboard
widgetStateFlow
Link copied to clipboard
val widgetStateFlow: <ERROR CLASS>