diff --git a/client/flutter/divkit/CHANGELOG.md b/client/flutter/divkit/CHANGELOG.md index 416b3fea1..cbd312760 100644 --- a/client/flutter/divkit/CHANGELOG.md +++ b/client/flutter/divkit/CHANGELOG.md @@ -1,15 +1,21 @@ -## 0.3.0-pre +## 0.3.0-pre+1 * Fix object parsing in DTO * Add ranges in div-text +* Open access to the classes DivAction, DivTimer, DivVariable, DivPatch, DivDownloadCallbacks and + converters in the public api -## Migration 0.2 → 0.3 +## Migration 0.2 → 0.3.0-pre+1 * Now we have fixed the error and extract the value of dict type values when parsing. This change affected the following structures: dict_value, dict_variable, div_action, div_custom, div_disappear_action, div_extension, div_video, div_visibility_action. `-action.payload['payload']` `+action.payload` +* The naming of the classes of the public api was changed so as not to conflict with the dto + classes: + `-DivAction, DivTimer, DivVariable, DivPatch, DivDownloadCallbacks` + `+DivActionModel, DivTimerModel, DivVariableModel, DivPatchModel, DivDownloadCallbacksModel` ## 0.2.0 @@ -26,7 +32,8 @@ ## Migration 0.1 → 0.2 -* Now DivContext specified in div-customs protocol, you need to change signature of function if it was used. +* Now DivContext specified in div-customs protocol, you need to change signature of function if it + was used. `-Widget createCustom(DivCustom div);` `+Widget createCustom(DivCustom div, DivContext context)` diff --git a/client/flutter/divkit/example/lib/src/configuration/playground_action_handler.dart b/client/flutter/divkit/example/lib/src/configuration/playground_action_handler.dart index ef110e343..26ef78c94 100644 --- a/client/flutter/divkit/example/lib/src/configuration/playground_action_handler.dart +++ b/client/flutter/divkit/example/lib/src/configuration/playground_action_handler.dart @@ -27,7 +27,7 @@ class PlaygroundActionHandler implements DivActionHandler { }) : _navigator = navigator; @override - bool canHandle(DivContext context, DivAction action) { + bool canHandle(DivContext context, DivActionModel action) { final uri = action.url; if (uri != null) { if (uri.scheme == _schemeDivAction && @@ -47,7 +47,7 @@ class PlaygroundActionHandler implements DivActionHandler { @override FutureOr handleAction( DivContext context, - DivAction action, + DivActionModel action, ) async { final uri = action.url; if (uri == null) { diff --git a/client/flutter/divkit/example/lib/src/configuration/playground_custom_handler.dart b/client/flutter/divkit/example/lib/src/configuration/playground_custom_handler.dart index cc6e0eb99..81d39c6ad 100644 --- a/client/flutter/divkit/example/lib/src/configuration/playground_custom_handler.dart +++ b/client/flutter/divkit/example/lib/src/configuration/playground_custom_handler.dart @@ -76,28 +76,23 @@ class PlaygroundAppCustomHandler implements DivCustomHandler { /// An example of using variables and actions inside a custom Widget _createRefreshIndicator(DivCustom div, DivContext context) { - final props = div.customProps?['custom_props']; - - final valueName = props['var'] as String; - final value = context.variableManager.context.current[valueName] as bool; - - final actions = props['actions'] as List; - final actionList = actions - .map( - (action) => DivAction( - enabled: true, - url: Uri.parse( - action['url'].toString() + (!value).toString(), - ), - ), - ) - .toList(); + final props = div.customProps; + final actions = props?['actions'] as List; + final actionList = >[]; + for (var action in actions) { + final actionModel = DivAction.fromJson(action)?.resolve( + context: context.variableManager.context, + ); + if (actionModel != null) { + actionList.add(actionModel); + } + } return RefreshIndicator( onRefresh: () async { for (final action in actionList) { context.actionHandler.handleAction( context, - action, + await action, ); } }, diff --git a/client/flutter/divkit/example/lib/src/configuration/playground_root_action_handler.dart b/client/flutter/divkit/example/lib/src/configuration/playground_root_action_handler.dart index 1d543d400..d48635c10 100644 --- a/client/flutter/divkit/example/lib/src/configuration/playground_root_action_handler.dart +++ b/client/flutter/divkit/example/lib/src/configuration/playground_root_action_handler.dart @@ -27,7 +27,7 @@ class PlaygroundAppRootActionHandler implements DivActionHandler { }) : _navigator = navigator; @override - bool canHandle(DivContext context, DivAction action) { + bool canHandle(DivContext context, DivActionModel action) { if (_typedHandler.canHandle(context, action)) { return true; } @@ -52,7 +52,7 @@ class PlaygroundAppRootActionHandler implements DivActionHandler { @override FutureOr handleAction( DivContext context, - DivAction action, + DivActionModel action, ) async { if (_typedHandler.canHandle(context, action)) { return _typedHandler.handleAction(context, action); diff --git a/client/flutter/divkit/example/lib/src/pages/playground.dart b/client/flutter/divkit/example/lib/src/pages/playground.dart index e7fbb6db5..96ac9d0d7 100644 --- a/client/flutter/divkit/example/lib/src/pages/playground.dart +++ b/client/flutter/divkit/example/lib/src/pages/playground.dart @@ -22,7 +22,7 @@ class _PlaygroundPage extends State { @override void initState() { super.initState(); - variableStorage.put(DivVariable(name: demoInputVariable, value: '')); + variableStorage.put(DivVariableModel(name: demoInputVariable, value: '')); } Future> loadJson() async { @@ -57,7 +57,7 @@ class _PlaygroundPage extends State { icon: const Icon(Icons.clear), onPressed: () { variableStorage - .update(DivVariable(name: demoInputVariable, value: '')); + .update(DivVariableModel(name: demoInputVariable, value: '')); }, ), ], diff --git a/client/flutter/divkit/example/pubspec.lock b/client/flutter/divkit/example/pubspec.lock index 7563c1f1a..5a39d335c 100644 --- a/client/flutter/divkit/example/pubspec.lock +++ b/client/flutter/divkit/example/pubspec.lock @@ -1,22 +1,30 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + sha256: "80e5141fafcb3361653ce308776cfd7d45e6e9fbb429e14eec571382c0c5fecb" + url: "https://pub.dev" + source: hosted + version: "3.3.2" args: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.4.2" async: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.10.0" boolean_selector: dependency: transitive description: @@ -29,34 +37,34 @@ packages: dependency: transitive description: name: cached_network_image - sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f" + sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.2.3" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f" + sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7" + sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.0.2" characters: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" clock: dependency: transitive description: @@ -69,26 +77,26 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.0" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.8" + version: "1.0.6" div_expressions_resolver: dependency: "direct overridden" description: @@ -102,7 +110,7 @@ packages: path: ".." relative: true source: path - version: "0.3.0-pre" + version: "0.3.0-pre+1" equatable: dependency: "direct main" description: @@ -123,39 +131,39 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.0.2" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" - source: hosted - version: "1.1.0" + version: "6.1.4" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6" + url: "https://pub.dev" + source: hosted + version: "0.7.0" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - sha256: "395d6b7831f21f3b989ebedbb785545932adb9afe2622c1ffacf7f4b53a7e544" + sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" url: "https://pub.dev" source: hosted - version: "3.3.2" + version: "3.3.1" flutter_driver: dependency: transitive description: flutter @@ -173,18 +181,18 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d" + sha256: b6cb0041c6c11cefb2dcb97ef436eba43c6d41287ac6d8ca93e02a497f53a4f3 url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.3.7" flutter_svg: dependency: transitive description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.0.5" flutter_test: dependency: "direct dev" description: flutter @@ -199,10 +207,10 @@ packages: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "0.13.6" http_parser: dependency: transitive description: @@ -216,38 +224,22 @@ packages: description: flutter source: sdk version: "0.0.0" - leak_tracker: + js: dependency: transitive description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" url: "https://pub.dev" source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.dev" - source: hosted - version: "2.0.1" + version: "0.6.5" lints: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.0.1" logging: dependency: transitive description: @@ -260,42 +252,42 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.2.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.8.0" octo_image: dependency: transitive description: name: octo_image - sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d" + sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.2" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.2" path_parsing: dependency: transitive description: @@ -308,26 +300,26 @@ packages: dependency: transitive description: name: path_provider - sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.1" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.2.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.1" path_provider_linux: dependency: transitive description: @@ -340,10 +332,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" path_provider_windows: dependency: transitive description: @@ -356,42 +348,42 @@ packages: dependency: transitive description: name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" url: "https://pub.dev" source: hosted - version: "6.0.2" + version: "5.1.0" platform: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.1.6" process: dependency: transitive description: name: process - sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "4.2.4" riverpod: dependency: transitive description: name: riverpod - sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d + sha256: b0657b5b30c81a3184bdaab353045f0a403ebd60bb381591a8b7ad77dcade793 url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.3.7" rxdart: dependency: transitive description: @@ -409,10 +401,10 @@ packages: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" sprintf: dependency: transitive description: @@ -425,26 +417,26 @@ packages: dependency: transitive description: name: sqflite - sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d + sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9 url: "https://pub.dev" source: hosted - version: "2.3.3+1" + version: "2.2.8+4" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" + sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.4.5+1" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" state_notifier: dependency: transitive description: @@ -457,10 +449,10 @@ packages: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -481,10 +473,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" url: "https://pub.dev" source: hosted - version: "3.1.0+1" + version: "3.1.0" term_glyph: dependency: transitive description: @@ -497,50 +489,50 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.4.16" typed_data: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.1" uuid: dependency: transitive description: name: uuid - sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" + sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7 url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.1.0" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: ea8d3fc7b2e0f35de38a7465063ecfcf03d8217f7962aa2a6717132cb5d43a79 url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + sha256: a5eaa5d19e123ad4f61c3718ca1ed921c4e6254238d9145f82aa214955d9aced url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: "15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_math: dependency: transitive description: @@ -553,50 +545,42 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 url: "https://pub.dev" source: hosted - version: "13.0.0" - web: - dependency: transitive - description: - name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" - url: "https://pub.dev" - source: hosted - version: "0.5.1" + version: "9.4.0" webdriver: dependency: transitive description: name: webdriver - sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" + sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.1" win32: dependency: transitive description: name: win32 - sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "4.1.4" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.3" xml: dependency: transitive description: name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" url: "https://pub.dev" source: hosted - version: "6.5.0" + version: "6.2.2" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.16.6" + dart: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" diff --git a/client/flutter/divkit/lib/divkit.dart b/client/flutter/divkit/lib/divkit.dart index 77db11a88..46a54f5b2 100644 --- a/client/flutter/divkit/lib/divkit.dart +++ b/client/flutter/divkit/lib/divkit.dart @@ -4,6 +4,12 @@ export 'src/core/data/data.dart'; export 'src/core/timer/timer.dart'; export 'src/core/patch/patch.dart'; export 'src/core/action/action.dart'; +export 'src/core/action/action_converter.dart'; +export 'src/core/patch/patch_converter.dart'; +export 'src/core/timer/timer_converter.dart'; +export 'src/core/trigger/trigger_converter.dart'; +export 'src/utils/converters.dart'; +export 'src/utils/size_converters.dart'; export 'src/core/action/handler/default_div_action_handler.dart'; export 'src/core/action/handler/div_action_handler_typed.dart'; export 'src/core/action/handler/div_action_handler_url.dart'; @@ -15,5 +21,4 @@ export 'src/core/template/templates_resolver.dart'; export 'src/core/variable/variable.dart'; export 'src/core/variable/variable_storage.dart'; export 'src/core/widgets/widgets.dart'; -export 'src/generated_sources/generated_sources.dart' - hide DivAction, DivTimer, DivVariable, DivPatch, DivDownloadCallbacks; +export 'src/generated_sources/generated_sources.dart'; diff --git a/client/flutter/divkit/lib/src/core/action/action.dart b/client/flutter/divkit/lib/src/core/action/action.dart index ec90d9e84..a2a0ca482 100644 --- a/client/flutter/divkit/lib/src/core/action/action.dart +++ b/client/flutter/divkit/lib/src/core/action/action.dart @@ -2,14 +2,14 @@ import 'package:divkit/src/core/protocol/div_context.dart'; import 'package:divkit/src/generated_sources/div_action_typed.dart'; import 'package:equatable/equatable.dart'; -class DivAction with EquatableMixin { +class DivActionModel with EquatableMixin { final Uri? url; final bool enabled; final DivActionTyped? typedAction; final Map? payload; - final DivDownloadCallbacks? downloadCallbacks; + final DivDownloadCallbacksModel? downloadCallbacks; - const DivAction({ + const DivActionModel({ required this.enabled, this.url, this.typedAction, @@ -38,15 +38,15 @@ class DivAction with EquatableMixin { } } -class DivDownloadCallbacks with EquatableMixin { - const DivDownloadCallbacks({ +class DivDownloadCallbacksModel with EquatableMixin { + const DivDownloadCallbacksModel({ this.onFailActions, this.onSuccessActions, }); - final List? onFailActions; + final List? onFailActions; - final List? onSuccessActions; + final List? onSuccessActions; @override List get props => [ diff --git a/client/flutter/divkit/lib/src/core/action/action_converter.dart b/client/flutter/divkit/lib/src/core/action/action_converter.dart index 0b25bfd25..3614671dd 100644 --- a/client/flutter/divkit/lib/src/core/action/action_converter.dart +++ b/client/flutter/divkit/lib/src/core/action/action_converter.dart @@ -1,12 +1,12 @@ import 'package:divkit/src/core/action/action.dart'; import 'package:divkit/src/core/protocol/div_variable.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; -extension PassDivAction on dto.DivAction { - Future resolve({ +extension PassDivAction on DivAction { + Future resolve({ required DivVariableContext context, }) async => - DivAction( + DivActionModel( url: await url?.resolveValue(context: context), enabled: await isEnabled.resolveValue(context: context), typedAction: typed, @@ -15,11 +15,11 @@ extension PassDivAction on dto.DivAction { ); } -extension PassDivDownloadCallbacks on dto.DivDownloadCallbacks { - Future resolve({ +extension PassDivDownloadCallbacks on DivDownloadCallbacks { + Future resolve({ required DivVariableContext context, }) async { - List? success; + List? success; if (onSuccessActions != null) { success = []; for (final a in onSuccessActions!) { @@ -27,7 +27,7 @@ extension PassDivDownloadCallbacks on dto.DivDownloadCallbacks { } } - List? fail; + List? fail; if (onFailActions != null) { fail = []; for (final a in onFailActions!) { @@ -35,7 +35,7 @@ extension PassDivDownloadCallbacks on dto.DivDownloadCallbacks { } } - return DivDownloadCallbacks( + return DivDownloadCallbacksModel( onSuccessActions: success, onFailActions: fail, ); diff --git a/client/flutter/divkit/lib/src/core/action/handler/default_div_action_handler.dart b/client/flutter/divkit/lib/src/core/action/handler/default_div_action_handler.dart index 44477d883..57f2b1c6a 100644 --- a/client/flutter/divkit/lib/src/core/action/handler/default_div_action_handler.dart +++ b/client/flutter/divkit/lib/src/core/action/handler/default_div_action_handler.dart @@ -12,7 +12,7 @@ class DefaultDivActionHandler implements DivActionHandler { final urlHandler = DefaultDivActionHandlerUrl(); @override - bool canHandle(DivContext context, DivAction action) { + bool canHandle(DivContext context, DivActionModel action) { try { if (typedHandler.canHandle(context, action)) { return true; @@ -29,7 +29,7 @@ class DefaultDivActionHandler implements DivActionHandler { } @override - FutureOr handleAction(DivContext context, DivAction action) async { + FutureOr handleAction(DivContext context, DivActionModel action) async { try { if (typedHandler.canHandle(context, action)) { return typedHandler.handleAction(context, action); diff --git a/client/flutter/divkit/lib/src/core/action/handler/div_action_handler_typed.dart b/client/flutter/divkit/lib/src/core/action/handler/div_action_handler_typed.dart index 934ab495e..847400ca2 100644 --- a/client/flutter/divkit/lib/src/core/action/handler/div_action_handler_typed.dart +++ b/client/flutter/divkit/lib/src/core/action/handler/div_action_handler_typed.dart @@ -12,11 +12,11 @@ class DefaultDivActionHandlerTyped implements DivActionHandler { final setVariableHandler = DivSetVariableHandlerTyped(); @override - bool canHandle(DivContext context, DivAction action) => + bool canHandle(DivContext context, DivActionModel action) => action.typedAction != null; @override - FutureOr handleAction(DivContext context, DivAction action) { + FutureOr handleAction(DivContext context, DivActionModel action) { final typedAction = action.typedAction; if (typedAction != null) { return typedAction.maybeMap( diff --git a/client/flutter/divkit/lib/src/core/patch/patch.dart b/client/flutter/divkit/lib/src/core/patch/patch.dart index 099ceb6c5..0d286948a 100644 --- a/client/flutter/divkit/lib/src/core/patch/patch.dart +++ b/client/flutter/divkit/lib/src/core/patch/patch.dart @@ -1,8 +1,8 @@ import 'package:divkit/src/generated_sources/div_patch.dart'; import 'package:equatable/equatable.dart'; -class DivPatch with EquatableMixin { - const DivPatch({ +class DivPatchModel with EquatableMixin { + const DivPatchModel({ required this.changes, this.mode = DivPatchMode.partial, }); diff --git a/client/flutter/divkit/lib/src/core/patch/patch_converter.dart b/client/flutter/divkit/lib/src/core/patch/patch_converter.dart index 4677355ef..885bfcff1 100644 --- a/client/flutter/divkit/lib/src/core/patch/patch_converter.dart +++ b/client/flutter/divkit/lib/src/core/patch/patch_converter.dart @@ -1,12 +1,12 @@ import 'package:divkit/src/core/patch/patch.dart'; import 'package:divkit/src/core/protocol/div_variable.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; -extension PassDivPatch on dto.DivPatch { - Future resolve({ +extension PassDivPatch on DivPatch { + Future resolve({ required DivVariableContext context, }) async => - DivPatch( + DivPatchModel( changes: changes, mode: await mode.resolveValue(context: context), ); diff --git a/client/flutter/divkit/lib/src/core/patch/patch_manager.dart b/client/flutter/divkit/lib/src/core/patch/patch_manager.dart index 91bc48d9c..6960d7742 100644 --- a/client/flutter/divkit/lib/src/core/patch/patch_manager.dart +++ b/client/flutter/divkit/lib/src/core/patch/patch_manager.dart @@ -13,7 +13,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { const DefaultDivPatchManager(this.dataProvider); @override - Future applyPatch(DivPatch patch) async { + Future applyPatch(DivPatchModel patch) async { final current = dataProvider.value; final states = []; for (final state in current.states) { @@ -33,7 +33,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { /// Apply [patch] changes to single [div], throws Exception if try change to multiple items. /// [root] - If true, not support deletion via null. - Div? _updateSingle(Div div, DivPatch patch, [bool root = false]) { + Div? _updateSingle(Div div, DivPatchModel patch, [bool root = false]) { for (var change in patch.changes) { if (div.value.id == change.id) { if (!root && change.items == null) { @@ -57,7 +57,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { static List? _toList(T? obj) => obj == null ? null : [obj]; /// Replace [div] to items form [patch] changes in parent witch support multiple items. - List
? _updateMultiple(Div div, DivPatch patch) { + List
? _updateMultiple(Div div, DivPatchModel patch) { for (var change in patch.changes) { if (div.value.id == change.id) { return change.items; @@ -67,7 +67,8 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { } /// Distribution of updates strategy depending on the type of div. - Div? _update(Div div, DivPatch patch, [bool root = false]) => _updateSingle( + Div? _update(Div div, DivPatchModel patch, [bool root = false]) => + _updateSingle( div.maybeMap( divContainer: (v) => Div.divContainer(_updateContainer(v, patch)), divGallery: (v) => Div.divGallery(_updateGallery(v, patch)), @@ -81,7 +82,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { root, ); - DivContainer _updateContainer(DivContainer div, DivPatch patch) => + DivContainer _updateContainer(DivContainer div, DivPatchModel patch) => div.copyWith( items: () => div.items @@ -92,7 +93,8 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { [], ); - DivGallery _updateGallery(DivGallery div, DivPatch patch) => div.copyWith( + DivGallery _updateGallery(DivGallery div, DivPatchModel patch) => + div.copyWith( items: () => div.items ?.map((e) => _updateMultiple(e, patch)) @@ -102,7 +104,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { [], ); - DivGrid _updateGrid(DivGrid div, DivPatch patch) => div.copyWith( + DivGrid _updateGrid(DivGrid div, DivPatchModel patch) => div.copyWith( items: () => div.items ?.map((e) => _updateMultiple(e, patch)) @@ -112,7 +114,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { [], ); - DivPager _updatePager(DivPager div, DivPatch patch) => div.copyWith( + DivPager _updatePager(DivPager div, DivPatchModel patch) => div.copyWith( items: () => div.items ?.map((e) => _updateMultiple(e, patch)) @@ -122,7 +124,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { [], ); - DivState _updateState(DivState div, DivPatch patch) => div.copyWith( + DivState _updateState(DivState div, DivPatchModel patch) => div.copyWith( states: div.states .map( (e) => e.div != null @@ -132,7 +134,7 @@ class DefaultDivPatchManager with EquatableMixin implements DivPatchManager { .toList(), ); - DivTabs _updateTabs(DivTabs div, DivPatch patch) => div.copyWith( + DivTabs _updateTabs(DivTabs div, DivPatchModel patch) => div.copyWith( items: div.items .map((e) => e.copyWith(div: _update(e.div, patch))) .toList(), diff --git a/client/flutter/divkit/lib/src/core/protocol/div_action.dart b/client/flutter/divkit/lib/src/core/protocol/div_action.dart index d3e36d733..5fc8e6253 100644 --- a/client/flutter/divkit/lib/src/core/protocol/div_action.dart +++ b/client/flutter/divkit/lib/src/core/protocol/div_action.dart @@ -10,10 +10,10 @@ abstract class DivActionHandler { /// Returns TRUE if action can be handled. /// [action] — Action to handle. Maybe typed or contain a non-null url /// [context] — DivContext to use variables and access stateManager - bool canHandle(DivContext context, DivAction action); + bool canHandle(DivContext context, DivActionModel action); /// Returns TRUE if action was handled. /// [action] — Action to handle. Maybe typed or contain a non-null url /// [context] — DivContext to use variables and access stateManager - FutureOr handleAction(DivContext context, DivAction action); + FutureOr handleAction(DivContext context, DivActionModel action); } diff --git a/client/flutter/divkit/lib/src/core/protocol/div_patch.dart b/client/flutter/divkit/lib/src/core/protocol/div_patch.dart index 8e7859455..043d16956 100644 --- a/client/flutter/divkit/lib/src/core/protocol/div_patch.dart +++ b/client/flutter/divkit/lib/src/core/protocol/div_patch.dart @@ -8,5 +8,5 @@ abstract class DivPatchManager { /// Applies changes in the patch format to the [DivData]. /// /// Replaces the [div]s of the root structure with new ones by id. - Future applyPatch(DivPatch patch); + Future applyPatch(DivPatchModel patch); } diff --git a/client/flutter/divkit/lib/src/core/protocol/div_variable.dart b/client/flutter/divkit/lib/src/core/protocol/div_variable.dart index 3d0b7e48d..f362aab26 100644 --- a/client/flutter/divkit/lib/src/core/protocol/div_variable.dart +++ b/client/flutter/divkit/lib/src/core/protocol/div_variable.dart @@ -110,16 +110,16 @@ abstract class DivVariableStorage { /// Update an existing variable. /// If successful, it will return true - bool update(DivVariable variable); + bool update(DivVariableModel variable); /// Update if it exists and will create otherwise. - void put(DivVariable variable); + void put(DivVariableModel variable); /// The current snapshot of the raw representation of the storage. - Map get value; + Map get value; /// The raw data stream of storage changes. - Stream> get stream; + Stream> get stream; /// Safely destroy storage. Future dispose(); diff --git a/client/flutter/divkit/lib/src/core/timer/timer.dart b/client/flutter/divkit/lib/src/core/timer/timer.dart index a13e5eb69..fbf47e9f3 100644 --- a/client/flutter/divkit/lib/src/core/timer/timer.dart +++ b/client/flutter/divkit/lib/src/core/timer/timer.dart @@ -4,19 +4,19 @@ import 'package:divkit/src/core/action/action_converter.dart'; import 'package:divkit/src/core/protocol/div_context.dart'; import 'package:divkit/src/core/protocol/div_variable.dart'; import 'package:divkit/src/core/expression/expression.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; import 'package:divkit/src/utils/clockwork.dart'; import 'package:divkit/src/utils/duration_helper.dart'; import 'package:equatable/equatable.dart'; -class DivTimer with EquatableMixin { +class DivTimerModel with EquatableMixin { final String id; final Expression duration; final Expression? tickInterval; - final List? tickActions; - final List? endActions; + final List? tickActions; + final List? endActions; final String? valueVariable; @@ -25,7 +25,7 @@ class DivTimer with EquatableMixin { Clockwork get clockwork => _clockwork!; - DivTimer({ + DivTimerModel({ required this.id, required this.duration, this.endActions, diff --git a/client/flutter/divkit/lib/src/core/timer/timer_converter.dart b/client/flutter/divkit/lib/src/core/timer/timer_converter.dart index 2c0725a9c..fef12223d 100644 --- a/client/flutter/divkit/lib/src/core/timer/timer_converter.dart +++ b/client/flutter/divkit/lib/src/core/timer/timer_converter.dart @@ -1,8 +1,8 @@ import 'package:divkit/src/core/timer/timer.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; -extension PassDivTimer on dto.DivTimer { - DivTimer get pass => DivTimer( +extension PassDivTimer on DivTimer { + DivTimerModel get pass => DivTimerModel( id: id, duration: duration, tickInterval: tickInterval, diff --git a/client/flutter/divkit/lib/src/core/timer/timer_manager.dart b/client/flutter/divkit/lib/src/core/timer/timer_manager.dart index 85185fc04..c4a2c59f1 100644 --- a/client/flutter/divkit/lib/src/core/timer/timer_manager.dart +++ b/client/flutter/divkit/lib/src/core/timer/timer_manager.dart @@ -12,7 +12,7 @@ class DefaultDivTimerManager extends DivTimerManager { }); Future init({ - Iterable? timers, + Iterable? timers, void Function()? onEnd, }) async { if (timers != null) { diff --git a/client/flutter/divkit/lib/src/core/timer/timer_scheduler.dart b/client/flutter/divkit/lib/src/core/timer/timer_scheduler.dart index 10f2cf372..7dee878b2 100644 --- a/client/flutter/divkit/lib/src/core/timer/timer_scheduler.dart +++ b/client/flutter/divkit/lib/src/core/timer/timer_scheduler.dart @@ -2,15 +2,15 @@ import 'package:divkit/src/core/protocol/div_logger.dart'; import 'package:divkit/src/core/timer/timer.dart'; /// Empty storage, important for initialization. -final _empty = {}; +final _empty = {}; class DivTimerScheduler { - final Map _timers; + final Map _timers; - Iterable get timers => _timers.values; + Iterable get timers => _timers.values; DivTimerScheduler({ - required Iterable? timers, + required Iterable? timers, }) : _timers = timers != null ? Map.fromIterable(timers, key: (v) => v.id) : _empty; diff --git a/client/flutter/divkit/lib/src/core/trigger/trigger.dart b/client/flutter/divkit/lib/src/core/trigger/trigger.dart index 6dee02534..c7d63e3ec 100644 --- a/client/flutter/divkit/lib/src/core/trigger/trigger.dart +++ b/client/flutter/divkit/lib/src/core/trigger/trigger.dart @@ -1,17 +1,17 @@ import 'package:divkit/src/core/expression/expression.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; import 'package:equatable/equatable.dart'; -class DivTrigger with EquatableMixin { - final List actions; +class DivTriggerModel with EquatableMixin { + final List actions; final Expression condition; bool prevConditionResult = false; - final Expression mode; + final Expression mode; - DivTrigger({ + DivTriggerModel({ required this.actions, required this.condition, required this.mode, diff --git a/client/flutter/divkit/lib/src/core/trigger/trigger_converter.dart b/client/flutter/divkit/lib/src/core/trigger/trigger_converter.dart index 2385f2ef3..01b5d2cad 100644 --- a/client/flutter/divkit/lib/src/core/trigger/trigger_converter.dart +++ b/client/flutter/divkit/lib/src/core/trigger/trigger_converter.dart @@ -1,8 +1,8 @@ import 'package:divkit/src/core/trigger/trigger.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; -extension PassDivTrigger on dto.DivTrigger { - DivTrigger get pass => DivTrigger( +extension PassDivTrigger on DivTrigger { + DivTriggerModel get pass => DivTriggerModel( actions: actions, condition: condition, mode: mode, diff --git a/client/flutter/divkit/lib/src/core/trigger/trigger_manager.dart b/client/flutter/divkit/lib/src/core/trigger/trigger_manager.dart index 78c908d3c..d5942aa19 100644 --- a/client/flutter/divkit/lib/src/core/trigger/trigger_manager.dart +++ b/client/flutter/divkit/lib/src/core/trigger/trigger_manager.dart @@ -8,7 +8,7 @@ import 'package:divkit/src/core/protocol/div_variable.dart'; import 'package:divkit/src/core/trigger/trigger.dart'; class DefaultDivTriggerManager extends DivTriggerManager { - final List? triggers; + final List? triggers; DefaultDivTriggerManager({ required super.divContext, diff --git a/client/flutter/divkit/lib/src/core/variable/variable.dart b/client/flutter/divkit/lib/src/core/variable/variable.dart index f546ad88a..40d4f43c1 100644 --- a/client/flutter/divkit/lib/src/core/variable/variable.dart +++ b/client/flutter/divkit/lib/src/core/variable/variable.dart @@ -1,13 +1,13 @@ import 'package:equatable/equatable.dart'; -class DivVariable with EquatableMixin { +class DivVariableModel with EquatableMixin { final String name; T value; // An auxiliary function, since we do not have reliability by type. final T? Function(String raw)? safeParse; - DivVariable({ + DivVariableModel({ required this.name, required this.value, this.safeParse, diff --git a/client/flutter/divkit/lib/src/core/variable/variable_converter.dart b/client/flutter/divkit/lib/src/core/variable/variable_converter.dart index 7deb49ada..b07bbf8b5 100644 --- a/client/flutter/divkit/lib/src/core/variable/variable_converter.dart +++ b/client/flutter/divkit/lib/src/core/variable/variable_converter.dart @@ -1,46 +1,46 @@ import 'package:divkit/src/core/variable/variable.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; import 'package:divkit/src/utils/parsing_utils.dart'; -extension PassDivVariable on dto.DivVariable { +extension PassDivVariable on DivVariable { /// Creating a reactive variable from raw data. - DivVariable get pass => map( - booleanVariable: (data) => DivVariable( + DivVariableModel get pass => map( + booleanVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseBool, ), - colorVariable: (data) => DivVariable( + colorVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseColor, ), - integerVariable: (data) => DivVariable( + integerVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseInt, ), - numberVariable: (data) => DivVariable( + numberVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseDouble, ), - stringVariable: (data) => DivVariable( + stringVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseStr, ), - urlVariable: (data) => DivVariable( + urlVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseUri, ), - arrayVariable: (data) => DivVariable( + arrayVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseList, ), - dictVariable: (data) => DivVariable( + dictVariable: (data) => DivVariableModel( name: data.name, value: data.value, safeParse: safeParseMap, diff --git a/client/flutter/divkit/lib/src/core/variable/variable_storage.dart b/client/flutter/divkit/lib/src/core/variable/variable_storage.dart index d37ca1092..cd72b0343 100644 --- a/client/flutter/divkit/lib/src/core/variable/variable_storage.dart +++ b/client/flutter/divkit/lib/src/core/variable/variable_storage.dart @@ -6,7 +6,7 @@ import 'package:equatable/equatable.dart'; import 'package:rxdart/rxdart.dart'; class DefaultDivVariableStorage extends DivVariableStorage with EquatableMixin { - final _storage = BehaviorSubject>(); + final _storage = BehaviorSubject>(); /// Inherited storage of reactive variables. Not managed by local storage. @override @@ -17,13 +17,13 @@ class DefaultDivVariableStorage extends DivVariableStorage with EquatableMixin { DefaultDivVariableStorage({ this.inheritedStorage, - List? variables, + List? variables, }) { _storage.add(Map.fromIterable(variables ?? [], key: (v) => v.name)); } @override - bool update(DivVariable variable) { + bool update(DivVariableModel variable) { final isLocal = names.contains(variable.name); final isInherited = inheritedStorage?.names.contains(variable.name) ?? false; @@ -39,14 +39,14 @@ class DefaultDivVariableStorage extends DivVariableStorage with EquatableMixin { } @override - void put(DivVariable variable) { + void put(DivVariableModel variable) { if (!update(variable)) { _storage.add(Map.of(_storage.value)..addAll({variable.name: variable})); } } @override - Map get value => _storage.isClosed + Map get value => _storage.isClosed ? {} : { ...?inheritedStorage?.value, @@ -54,21 +54,22 @@ class DefaultDivVariableStorage extends DivVariableStorage with EquatableMixin { }; /// Caching the combined contextStream. - BehaviorSubject>? _contextStreamSubject; - StreamSubscription>? _contextStreamSubscription; + BehaviorSubject>? _contextStreamSubject; + StreamSubscription>? _contextStreamSubscription; @override - Stream> get stream { + Stream> get stream { if (_contextStreamSubject == null) { final inheritedStream = inheritedStorage?.stream; if (inheritedStream != null) { - _contextStreamSubject = BehaviorSubject>(); + _contextStreamSubject = + BehaviorSubject>(); _contextStreamSubscription ??= CombineLatestStream.combine2( inheritedStream, _storage.stream, ( - Map inherited, - Map local, + Map inherited, + Map local, ) => { ...inherited, diff --git a/client/flutter/divkit/lib/src/core/variable/variable_storage_manager.dart b/client/flutter/divkit/lib/src/core/variable/variable_storage_manager.dart index ff5a68eae..2dcdd237e 100644 --- a/client/flutter/divkit/lib/src/core/variable/variable_storage_manager.dart +++ b/client/flutter/divkit/lib/src/core/variable/variable_storage_manager.dart @@ -118,7 +118,7 @@ class DefaultDivVariableManager extends DivVariableManager with EquatableMixin { } else { // Create new variable storage.put( - DivVariable( + DivVariableModel( name: name, value: value, safeParse: safeParseTyped(value.runtimeType), diff --git a/client/flutter/divkit/lib/src/core/widgets/div_tap_action_emitter.dart b/client/flutter/divkit/lib/src/core/widgets/div_tap_action_emitter.dart index c279fe624..88313a15d 100644 --- a/client/flutter/divkit/lib/src/core/widgets/div_tap_action_emitter.dart +++ b/client/flutter/divkit/lib/src/core/widgets/div_tap_action_emitter.dart @@ -1,16 +1,15 @@ import 'package:divkit/src/core/action/action.dart'; import 'package:divkit/src/core/action/action_converter.dart'; import 'package:divkit/src/core/protocol/div_context.dart'; -import 'package:divkit/src/generated_sources/div_animation.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; import 'package:divkit/src/utils/provider.dart'; import 'package:divkit/src/utils/tap_builder.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/widgets.dart'; class DivTapActionModel with EquatableMixin { - final List actions; - final List longtapActions; + final List actions; + final List longtapActions; final bool enabled; final bool enabledAnimation; @@ -23,15 +22,15 @@ class DivTapActionModel with EquatableMixin { static Stream from( BuildContext context, - List actions, - List longtapActions, - dto.DivAnimation? divAnimation, + List actions, + List longtapActions, + DivAnimation? divAnimation, ) { final variables = DivKitProvider.watch(context)!.variableManager; return variables.watch((context) async { - List a = []; + List a = []; for (final action in actions) { final rAction = await action.resolve( context: context, @@ -41,7 +40,7 @@ class DivTapActionModel with EquatableMixin { } } - List la = []; + List la = []; for (final action in longtapActions) { final rAction = await action.resolve( context: context, @@ -73,8 +72,8 @@ class DivTapActionModel with EquatableMixin { /// A wrapper for sending actions. class DivTapActionEmitter extends StatefulWidget { - final List actions; - final List longtapActions; + final List actions; + final List longtapActions; final DivAnimation? actionAnimation; final Widget child; diff --git a/client/flutter/divkit/lib/src/core/widgets/input/div_input_model.dart b/client/flutter/divkit/lib/src/core/widgets/input/div_input_model.dart index ad56e279d..02d5e6e94 100644 --- a/client/flutter/divkit/lib/src/core/widgets/input/div_input_model.dart +++ b/client/flutter/divkit/lib/src/core/widgets/input/div_input_model.dart @@ -16,8 +16,8 @@ class DivInputModel with EquatableMixin { final int? maxLines; final bool obscureText; final void Function()? onForwardFocus; - final List onBlurActions; - final List onFocusActions; + final List onBlurActions; + final List onFocusActions; final TextAlign textAlign; final TextAlignVertical textAlignVertical; diff --git a/client/flutter/divkit/lib/src/core/widgets/text/div_text_widget.dart b/client/flutter/divkit/lib/src/core/widgets/text/div_text_widget.dart index 979f1e5ea..4fed9ddde 100644 --- a/client/flutter/divkit/lib/src/core/widgets/text/div_text_widget.dart +++ b/client/flutter/divkit/lib/src/core/widgets/text/div_text_widget.dart @@ -52,7 +52,7 @@ class _DivTextWidgetState extends State { ); if (divContext != null) { final actions = item.optionModel.actions; - for (DivAction action in actions) { + for (DivActionModel action in actions) { await action.execute(divContext); } } diff --git a/client/flutter/divkit/lib/src/core/widgets/text/utils/div_range_helper.dart b/client/flutter/divkit/lib/src/core/widgets/text/utils/div_range_helper.dart index c81c1eff4..e3cdf0be3 100644 --- a/client/flutter/divkit/lib/src/core/widgets/text/utils/div_range_helper.dart +++ b/client/flutter/divkit/lib/src/core/widgets/text/utils/div_range_helper.dart @@ -5,7 +5,7 @@ import 'package:divkit/src/generated_sources/div_text.dart'; import 'package:divkit/src/utils/converters.dart'; import 'package:divkit/src/generated_sources/div_line_style.dart'; import 'package:flutter/material.dart'; -import 'package:divkit/src/generated_sources/generated_sources.dart' as dto; +import 'package:divkit/src/generated_sources/generated_sources.dart'; import 'package:divkit/src/core/action/action_converter.dart'; import 'package:divkit/src/core/action/action.dart'; @@ -105,8 +105,8 @@ class DivRangeHelper { context: context, ); - List actions = []; - List? actionsDto = [...?divTextRange.actions]; + List actions = []; + List? actionsDto = [...?divTextRange.actions]; for (final action in actionsDto) { final resAction = await action.resolve( context: context, diff --git a/client/flutter/divkit/lib/src/core/widgets/text/utils/div_text_range_model.dart b/client/flutter/divkit/lib/src/core/widgets/text/utils/div_text_range_model.dart index 1ec6ec922..f29c5c88e 100644 --- a/client/flutter/divkit/lib/src/core/widgets/text/utils/div_text_range_model.dart +++ b/client/flutter/divkit/lib/src/core/widgets/text/utils/div_text_range_model.dart @@ -22,7 +22,7 @@ class DivTextRangeModel with EquatableMixin { class DivTextRangeOptionModel with EquatableMixin { final TextStyle? style; - final List actions; + final List actions; final int? topOffset; diff --git a/client/flutter/divkit/lib/src/utils/converters.dart b/client/flutter/divkit/lib/src/utils/converters.dart index 309c2643b..6e003e9a5 100644 --- a/client/flutter/divkit/lib/src/utils/converters.dart +++ b/client/flutter/divkit/lib/src/utils/converters.dart @@ -1,7 +1,7 @@ import 'dart:math' as math; import 'dart:ui'; -import 'package:divkit/src/core/action/action.dart' as resolved_action; +import 'package:divkit/src/core/action/action.dart'; import 'package:divkit/src/core/action/action_converter.dart'; import 'package:divkit/src/core/expression/expression.dart'; import 'package:divkit/src/core/expression/resolver.dart'; @@ -683,10 +683,10 @@ extension PassDivBlendMode on DivBlendMode { } extension PassActions on DivFocus { - Future> resolveOnBlurActions({ + Future> resolveOnBlurActions({ required DivVariableContext context, }) async { - List result = []; + List result = []; final blurAction = onBlur; if (blurAction != null) { for (final action in blurAction) { @@ -699,10 +699,10 @@ extension PassActions on DivFocus { return result; } - Future> resolveOnFocusActions({ + Future> resolveOnFocusActions({ required DivVariableContext context, }) async { - List result = []; + List result = []; final blurAction = onFocus; if (blurAction != null) { for (final action in blurAction) { diff --git a/client/flutter/divkit/pubspec.yaml b/client/flutter/divkit/pubspec.yaml index 52ba89acd..caa12c70c 100644 --- a/client/flutter/divkit/pubspec.yaml +++ b/client/flutter/divkit/pubspec.yaml @@ -3,7 +3,7 @@ description: Open source SDUI framework for server-driven app updates, rapid UI homepage: https://github.com/divkit/divkit repository: https://github.com/divkit/divkit publish_to: 'https://dart-unpub.taxi.yandex-team.ru/' -version: 0.3.0-pre +version: 0.3.0-pre+1 environment: sdk: '>=2.17.0 <4.0.0' diff --git a/client/flutter/divkit/test/unit/patch_test.dart b/client/flutter/divkit/test/unit/patch_test.dart index e79c8d18b..9ad3bf35f 100644 --- a/client/flutter/divkit/test/unit/patch_test.dart +++ b/client/flutter/divkit/test/unit/patch_test.dart @@ -12,7 +12,7 @@ void main() { [divWithId('some_div')], ), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -30,7 +30,7 @@ void main() { }); test('When replacing root div replaces div', () { final original = data(divWithId('div_to_replace')); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -48,7 +48,7 @@ void main() { }); test('When replacing div with different type replaces div', () { final original = data(divWithId('div_to_replace')); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -67,7 +67,7 @@ void main() { // Why don't we allow the structure to be patched from the base? test('When deleting root div does nothing', () { final original = data(divWithId('div_to_delete')); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_delete", @@ -85,7 +85,7 @@ void main() { }); test('When replacing root div with multiple divs does nothing', () { final original = data(divWithId('div_to_replace')); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -109,7 +109,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -139,7 +139,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -170,7 +170,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_delete", @@ -200,7 +200,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -235,7 +235,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -266,7 +266,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_delete", @@ -296,7 +296,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -332,7 +332,7 @@ void main() { separator, ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -365,7 +365,7 @@ void main() { divWithId('div_to_replace'), ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -391,7 +391,7 @@ void main() { divWithId('div_to_delete'), ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_delete", @@ -418,7 +418,7 @@ void main() { divWithId('div_to_replace'), ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -440,7 +440,7 @@ void main() { divWithId('div_to_replace'), ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_replace", @@ -466,7 +466,7 @@ void main() { divWithId('div_to_delete'), ]), ); - const patch = DivPatch( + const patch = DivPatchModel( changes: [ DivPatchChange( id: "div_to_delete", diff --git a/client/flutter/divkit/test/unit/timer_test.dart b/client/flutter/divkit/test/unit/timer_test.dart index a4da75227..632e2f4bd 100644 --- a/client/flutter/divkit/test/unit/timer_test.dart +++ b/client/flutter/divkit/test/unit/timer_test.dart @@ -14,7 +14,7 @@ void main() { ); test("clockwork can not sync init", () async { - final timer = DivTimer( + final timer = DivTimerModel( id: 'Test', duration: const ValueExpression(1000), endActions: [ @@ -37,7 +37,7 @@ void main() { }); test("clockwork has async init", () async { - final timer = DivTimer( + final timer = DivTimerModel( id: 'Test', duration: const ValueExpression(1000), endActions: [ diff --git a/client/flutter/divkit/test/unit/variable_storage_test.dart b/client/flutter/divkit/test/unit/variable_storage_test.dart index f13ee0af8..6c760dea4 100644 --- a/client/flutter/divkit/test/unit/variable_storage_test.dart +++ b/client/flutter/divkit/test/unit/variable_storage_test.dart @@ -28,41 +28,41 @@ Map afterUpdateOuter(Map? update) => { ...(update ?? {}), }; -List createNewVars() => [ - DivVariable( +List createNewVars() => [ + DivVariableModel( name: "string_var", value: "value", safeParse: safeParseStr, ), - DivVariable( + DivVariableModel( name: "int_var", value: 100, safeParse: safeParseInt, ), - DivVariable( + DivVariableModel( name: "number_var", value: 123.34, safeParse: safeParseDouble, ), - DivVariable( + DivVariableModel( name: "bool_var", value: true, safeParse: safeParseBool, ), - DivVariable( + DivVariableModel( name: "url_var", value: safeParseUri("https://test.url"), safeParse: safeParseUri, ), ]; -List createNewVarsOuter() => [ - DivVariable( +List createNewVarsOuter() => [ + DivVariableModel( name: "outer_string_var", value: "outer value", safeParse: safeParseStr, ), - DivVariable( + DivVariableModel( name: "outer_int_var", value: 200, safeParse: safeParseInt, @@ -225,7 +225,7 @@ void main() { () async { final outerStorage = DefaultDivVariableStorage( variables: [ - DivVariable( + DivVariableModel( name: "string_var", value: "outer value", safeParse: safeParseStr, @@ -318,7 +318,7 @@ void main() { final variables = DefaultDivVariableManager(storage: storage); - outerStorage.put(DivVariable(name: "global", value: 0)); + outerStorage.put(DivVariableModel(name: "global", value: 0)); expect(afterUpdateOuter({"global": 0}), variables.context.current); @@ -346,7 +346,8 @@ void main() { final first = await stream.first; expect(afterUpdateOuter(null), first); - outerStorage.update(DivVariable(name: "outer_int_var", value: 0)); + outerStorage + .update(DivVariableModel(name: "outer_int_var", value: 0)); final second = await stream.first; expect(afterUpdateOuter({"outer_int_var": 0}), second); @@ -404,7 +405,7 @@ void main() { final first = await stream.first; expect(afterUpdateOuter(null), first); - outerStorage.put(DivVariable(name: "new_int_var", value: 0)); + outerStorage.put(DivVariableModel(name: "new_int_var", value: 0)); final second = await stream.first; expect(afterUpdateOuter({"new_int_var": 0}), second);