compareScreenStates

Compares the current screenStates list with the prevScreenStates list and triggers actions if there are differences.

This is useful for detecting changes in screen states and responding accordingly in a real-time application. The function performs the following steps:

  1. If the restart flag is true, it skips the comparison and exits early

  2. Iterates through each pair of screenStates and prevScreenStates, comparing key-value pairs

  3. If any differences are detected between a current and previous screen state, it triggers an action

  4. The trigger action is based on the recordingDisplayType and recordingVideoOptimized flags

Parameters

options

The options containing restart flag and parameters

Example:

val options = CompareScreenStatesOptions(
restart = false,
parameters = object : CompareScreenStatesParameters {
override val recordingDisplayType = "video"
override val recordingVideoOptimized = true
override val screenStates = listOf(
ScreenState(mainScreenPerson = "Alice", mainScreenFilled = true),
ScreenState(mainScreenPerson = "Bob", mainScreenFilled = false)
)
override val prevScreenStates = listOf(
ScreenState(mainScreenPerson = "Alice", mainScreenFilled = false),
ScreenState(mainScreenPerson = "Bob", mainScreenFilled = false)
)
override val activeNames = listOf("Alice", "Bob")
override val trigger = { opts ->
}
override fun getUpdatedAllParams() = this
// ... other required implementations
}
)

compareScreenStates(options)