compare Screen States
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:
If the
restartflag is true, it skips the comparison and exits earlyIterates through each pair of
screenStatesandprevScreenStates, comparing key-value pairsIf any differences are detected between a current and previous screen state, it triggers an action
The trigger action is based on the
recordingDisplayTypeandrecordingVideoOptimizedflags
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)Content copied to clipboard