From 526b3296b017b8a06691494a1c10ec7d9cb3bd47 Mon Sep 17 00:00:00 2001 From: "leonardo.gabriel" Date: Fri, 20 Dec 2024 17:11:44 -0300 Subject: [PATCH] feat: add support to latest flutter version --- .github/workflows/release.yml | 8 +- .github/workflows/tests.yml | 2 +- CHANGELOG.md | 4 + lib/blip_sdk.dart | 3 +- lib/src/client.dart | 35 ++--- lib/src/extensions/media/media.extension.dart | 44 +++++-- pubspec.lock | 122 ++++++++++++------ pubspec.yaml | 9 +- 8 files changed, 141 insertions(+), 86 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0dadd08..d5fc557 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,7 @@ jobs: future_release: ${{ needs.auto-gen-tag.outputs.tag }} since_tag: ${{ steps.get_latest_release.outputs.release }} - name: Upload changelog - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: changelog path: CHANGELOG.md @@ -57,7 +57,7 @@ jobs: steps: - run: echo ${{needs.auto-gen-tag.outputs.tag}} - name: Download changelog - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: changelog - name: Draft release with changelog @@ -80,7 +80,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Install dependencies run: flutter pub get - name: Run tests @@ -95,7 +95,7 @@ jobs: - name: Install Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Check Publish Warnings run: dart pub publish --dry-run - name: Publish diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4b991d..e876bae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Install dependencies run: flutter pub get - name: Run tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dfea7f..4656fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.27 + +- Upgraded Lime version from 0.0.25 to 0.0.26 and add support to latest flutter stable version. + ## 0.0.26 - Upgraded Lime version from 0.0.24 to 0.0.25. diff --git a/lib/blip_sdk.dart b/lib/blip_sdk.dart index b880e97..1b8ab0e 100644 --- a/lib/blip_sdk.dart +++ b/lib/blip_sdk.dart @@ -1,6 +1,7 @@ -library blip_sdk; +library; export 'package:lime/lime.dart'; + export 'src/application.dart' show Application; export 'src/client.dart' show Client; export 'src/client_builder.dart' show ClientBuilder; diff --git a/lib/src/client.dart b/lib/src/client.dart index 69208fd..36444f4 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -29,7 +29,7 @@ class Client { final _extensions = {}; late StreamController onConnectionDone; - var onListeningChanged = StreamController(); + var onListeningChanged = StreamController.broadcast(); bool _listening = false; bool _closing = false; @@ -91,7 +91,7 @@ class Client { ); final session = await _clientChannel.establishSession( - application.identifier + '@' + application.domain, + '${application.identifier}@${application.domain}', application.instance, application.authentication, ); @@ -103,7 +103,7 @@ class Client { ], ); - _listening = true; + listening = true; _connectionTryCount = 0; return session; @@ -113,7 +113,7 @@ class Client { void _initializeClientChannel() { // Allows Take an action when the connection to the server is closed transport.onClose.stream.listen((event) async { - _listening = false; + listening = false; if (!_closing) { // Use an exponential backoff for the timeout num timeout = 100 * pow(2, _connectionTryCount); @@ -283,19 +283,11 @@ class Client { Future close() async { Session? result; _closing = true; - if (_clientChannel.state == SessionState.established && transport.socket?.closeCode == null) { result = await _clientChannel.sendFinishingSession(); } - onListeningChanged.close(); - onListeningChanged = StreamController(); - - _clientChannel.onConnectionDone.close(); - _clientChannel.onConnectionDone = StreamController(); - onConnectionDone = _clientChannel.onConnectionDone; - await transport.close(); return result; @@ -475,17 +467,17 @@ class Client { /// Allows to get a extension T _getExtension(ExtensionType type, String to) { - var _extension = _extensions[type]; - if (_extension == null) { + var extension = _extensions[type]; + if (extension == null) { switch (type) { case ExtensionType.media: - _extension = MediaExtension(this, to); + extension = MediaExtension(this, to); break; } - _extensions[type] = _extension; + _extensions[type] = extension; } - return _extension as T; + return extension as T; } /// Returns a media extension @@ -493,15 +485,6 @@ class Client { _getExtension(ExtensionType.media, application.domain); Future _onConnect() async { - transport.onEnvelope?.close(); - transport.onEnvelope = StreamController>(); - - transport.onConnectionDone?.close(); - transport.onConnectionDone = StreamController(); - - transport.onClose.close(); - transport.onClose = StreamController(); - _clientChannel = ClientChannel(transport); _initializeClientChannel(); diff --git a/lib/src/extensions/media/media.extension.dart b/lib/src/extensions/media/media.extension.dart index 03e4521..4d055fd 100644 --- a/lib/src/extensions/media/media.extension.dart +++ b/lib/src/extensions/media/media.extension.dart @@ -1,6 +1,5 @@ import 'package:lime/lime.dart'; -import '../../client.dart'; import '../base.extension.dart'; import 'uri_templates.dart'; @@ -8,18 +7,47 @@ const postmasterName = 'postmaster'; const postmasterDomain = 'media'; class MediaExtension extends BaseExtension { - MediaExtension(final Client client, final String domain) - : super(client, - to: Node( - name: postmasterName, domain: '$postmasterDomain.$domain')); + MediaExtension(super.client, final String domain) + : super( + to: Node( + name: postmasterName, + domain: '$postmasterDomain.$domain', + ), + ); Future getUploadToken({bool secure = false}) { - return processCommand(createGetCommand( - buildResourceQuery(UriTemplates.mediaUpload, {'secure': secure}))); + return processCommand( + buildUploadTokenComand( + secure: secure, + ), + ); + } + + Command buildUploadTokenComand({bool secure = false}) { + return createGetCommand( + buildResourceQuery( + UriTemplates.mediaUpload, + { + 'secure': secure, + }, + ), + ); } Future refreshMedia(id) { return processCommand( - createGetCommand(buildUri(UriTemplates.refreshMedia, [id]))); + buildRefreshMediaCommand(id), + ); + } + + Command buildRefreshMediaCommand(id) { + return createGetCommand( + buildUri( + UriTemplates.refreshMedia, + [ + id, + ], + ), + ); } } diff --git a/pubspec.lock b/pubspec.lock index c7a1f52..fad9242 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,18 +37,18 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.19.0" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.6" fake_async: dependency: transitive description: @@ -57,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -66,71 +74,95 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lime: dependency: "direct main" description: name: lime - sha256: "98cdcb8c3b56ce0b498fd0c533153b55507f4135d9c2e14edd4d18ff6c716f79" + sha256: "75b9a50311249b5ec7bdb55c7d35c065e545b4d53202d43c3aa455ac6e21dfb7" url: "https://pub.dev" source: hosted - version: "0.0.25" + version: "0.0.26" lints: dependency: transitive description: name: lints - sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "5.1.1" logging: dependency: transitive description: name: logging - sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.3.0" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" pretty_json: dependency: transitive description: @@ -143,15 +175,15 @@ packages: dependency: transitive description: name: simple_logger - sha256: "0b0006199015a81c30041390b91e4c9561079d631541ffc317f76fd1181c9cc7" + sha256: "1de79f22bf31e5c33b91e9e302394dac02d8269d474848d33153c3a15c08e970" url: "https://pub.dev" source: hosted - version: "1.9.0+2" + version: "1.10.0" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -160,30 +192,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -196,26 +236,26 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.3" typed_data: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" uuid: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.5.1" vector_math: dependency: transitive description: @@ -224,14 +264,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "14.3.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=1.17.0" + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index aee7b03..5f1edfc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,23 +1,22 @@ name: blip_sdk description: A simple SDK built for BLiP using Flutter/Dart -version: 0.0.26 +version: 0.0.27 homepage: https://github.com/takenet/blip-sdk-dart#readme repository: https://github.com/takenet/blip-sdk-dart environment: - sdk: '>=2.12.0 <4.0.0' - flutter: '>=1.17.0' + sdk: ^3.5.1 dependencies: flutter: sdk: flutter - lime: ^0.0.25 + lime: ^0.0.26 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^1.0.0 + flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec