DivKit 30.0.0 release
DivKitHello everyone!
This Monday, we published the major release 30.0.0! It brought many changes and new features: we changed the naming rules for variables, raised the minimum supported iOS version, and added SVG support on Android. And that's far from all.
The post turned out to be very extensive, so for convenient navigation, we have collected for you:
Key changes
Across all platforms
- Variable names with consecutive dots and dots at the end are now prohibited.
For example, variables like very.dotted..variable
(two consecutive dots) and persuasive.var.
(dot at the end) are considered invalid and generate a parsing error.
A variable named still.good.var
is valid.
Android
- All
is_enabled
conditions inactions
are evaluated before theactions
begin execution, not during the process.
So, if action_2
had is_enabled == false
, and action_1
changed the condition during its execution such that is_enabled
for action_2
became true
, action_2
will not be executed.
At the next run, all is_enabled
conditions will be recalculated, and action_2
will be executed.
iOS
- The minimum iOS version has been raised to 13.
- String literals in double quotes are no longer supported.
The expression @{\"abcd\"}
is no longer valid. Instead, use single quotes: @{'abcd'}
Breaking Changes. Migration
Android
- Breaking Change:
ExpressionResolver
is now required inDivActionHandler
,Div2Logger
,DivExtensionHandler
, and custom classes. The method signatures of these classes now include a new argument forExpressionResolver
, which should be used for evaluating expressions within them:com.yandex.div.core.Div2Logger
-expressionResolver: ExpressionResolver
has been added as the second argument. com.yandex.div.core.DivActionHandler
-expressionResolver: ExpressionResolver
has been added as the third argument.com.yandex.div.core.extension.DivExtensionHandler
-expressionResolver: ExpressionResolver
has been added as the second argument.com.yandex.div.core.DivCustomContainerViewAdapter
-expressionResolver: ExpressionResolver
has been added as the fourth argument.- Breaking Change:
com.yandex.div2.DivAction.logId: String
now supports expressionslogId: Expression<String>
. To fix, changedivAction.logId
todivAction.logId.evaluate(expressionResolver)
. For example, you can useDiv2View#getExpressionResolver()
- Breaking Change: Variable names with consecutive dots and dots at the end are now prohibited. Check if you have any, and simply rename them if necessary.
- Breaking Change: The
StandardExoDivPlayerView
andZoomExoDivPlayerView
classes have been replaced byExoDivPlayerView
. - Breaking Change: The following classes have been removed from the public API:
ExoDivMediaSourceAbstractFactory
,ExoDivPlayer
(available through theDivPlayer
interface) andExoDivPlayerView
(available through theDivPlayerView
interface). - Breaking Change: The method
DivPlayerView#isCompatibleWithNewParams(scale: DivVideoScale)
has been removed. - Breaking Change: The method
DivPlayerView#makePlayerView(context: Context, additional: Map<String, Any>)
has been removed. Player view creation occurs incom.yandex.div.core.player.DivPlayerFactory
.
iOS
- Breaking Change: Method signature in
ExpressionResolver
changed fromresolveString(_ expression: String) -> String
toresolveString(_ expression: String) -> String?
. - Breaking Change: The
DivStateInterceptor
protocol and its implementationDivStateInterceptorImpl
have been removed. Please useDivExtensionHandler
. - Breaking Change: The public API for
DivActionURLHandler.updateReason
has been changed. - Breaking Change:
DefaultDivActionLogger
has been removed and replaced withEmptyDivActionLogger
. - Breaking Change:
DefaultShimmerViewFactory
has been removed. - Breaking Change:
DivVariablesStorage.ChangeEvent.oldValues
has been removed due to performance issues. - Breaking Change: The
urlOpener
argument has been removed from theDivKitComponents
initializer. UseurlHandler
instead. - Breaking Change:
UserInterfaceAction.Payload.composite
has been removed. - Breaking Change:
UserInterfaceAction.Payload.json
has been removed. - Breaking Change: The signatures of the
setSource
functions have changed: they are now marked as asynchronous to reduce the number of main thread locks. - Breaking Change: Variable names with consecutive dots and dots at the end are now prohibited. Check if you have any, and simply rename them if necessary.
Web
- Breaking Change: Actions from
variable_triggers
will now call theonStat
callback with a newtype = trigger
. - Breaking Change: Variable names with consecutive dots and dots at the end are now prohibited. Check if you have any, and simply rename them if necessary.
Non-breaking changes (relative to version 29.15)
Android
- The
toString()
method is supported in evaluated expressions, example usage:@{123.toString()}
. Previously, only functions could be used:@{toString(123)}
. The list of available methods will grow. - Implemented the
gesture
extension, which allows performingactions
when a swipe is detected on the specified view. - Implemented the
item_builder
property for thecontainer
component. - Supported SVG image loading for all
DivImageLoaders
implementations. Read more in a separate post. - Added the ability to force release all video players using the
Div2View#releaseMedia()
method. - Supported the use of Div2View in Jetpack Compose.
- Fixed an issue where old
visibility_actions
continued to be logged after re-creatingDiv2View
. - New
border
orbackground
are not set if there are no actual changes. TextureView
is now the default view forDivVideo
.- Fixed the calculation of
height
fortext
whenline_height
is specified. - Fixed the calculation of the
is_enabled
flag inactions
. Allis_enabled
conditions are evaluated before the execution of the entire action list, not during the process. - Fixed the algorithm for complex rebind.
iOS
DivActionLogger
is deprecated. UseDivReporter
for tracking actions.- Raised the minimum supported iOS version to 13.
- String literals in double quotes are no longer supported.
The expression @{\"abcd\"}
is no longer valid. Instead, use single quotes: @{'abcd'}
- Fixed animation in
gallery
. - Fixed the number to string cast in evaluated expressions.
- Fixed the position of
gallery
elements after scrolling via an action. - Fixed parsing of the unary
minus
operator. - Fixed validation in evaluated expressions.
- Fixed view reuse in
ShimmerImagePreviewExtension
.