mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
25 lines
614 B
Swift
25 lines
614 B
Swift
import Foundation
|
|
import LayoutKit
|
|
import VGSL
|
|
|
|
final class VideoActionHandler {
|
|
func handle(
|
|
_ action: DivActionVideo,
|
|
context: DivActionHandlingContext
|
|
) {
|
|
let expressionResolver = context.expressionResolver
|
|
guard let id = action.resolveId(expressionResolver),
|
|
let command = action.resolveAction(expressionResolver) else {
|
|
return
|
|
}
|
|
|
|
let cardId = context.cardId
|
|
context.blockStateStorage.setState(
|
|
id: id,
|
|
cardId: cardId,
|
|
state: VideoBlockViewState(state: command == .start ? .playing : .paused)
|
|
)
|
|
context.updateCard(.state(cardId))
|
|
}
|
|
}
|