From 3278a9824f50e915ef20c5385110ae5b83188f2b Mon Sep 17 00:00:00 2001 From: adrianoct42 Date: Thu, 28 Mar 2024 12:45:32 -0300 Subject: [PATCH 1/3] feat: add ds_string extension on BlipDS, which was previously on BlipDeskApp --- lib/blip_ds.dart | 1 + lib/src/extensions/ds_string.extension.dart | 21 ++ pubspec.yaml | 1 + sample/pubspec.lock | 202 ++++++++++---------- 4 files changed, 120 insertions(+), 105 deletions(-) create mode 100644 lib/src/extensions/ds_string.extension.dart diff --git a/lib/blip_ds.dart b/lib/blip_ds.dart index 51f6e21c..fcf63b92 100644 --- a/lib/blip_ds.dart +++ b/lib/blip_ds.dart @@ -16,6 +16,7 @@ export 'src/extensions/ds_border_radius.extension.dart' show DSBorderRadiusExtension, DSBorderRadiusListExtension; export 'src/extensions/ds_delivery_report_status.extension.dart' show DSDeliveryReportStatusExtension; +export 'src/extensions/ds_string.extension.dart' show DSStringExtension; export 'src/models/ds_message_bubble_avatar_config.model.dart' show DSMessageBubbleAvatarConfig; export 'src/models/ds_message_bubble_style.model.dart' diff --git a/lib/src/extensions/ds_string.extension.dart b/lib/src/extensions/ds_string.extension.dart new file mode 100644 index 00000000..ed5a6545 --- /dev/null +++ b/lib/src/extensions/ds_string.extension.dart @@ -0,0 +1,21 @@ +import 'dart:core'; + +import 'package:phone_number/phone_number.dart'; + +extension DSStringExtension on String { + Future asPhoneNumber() async { + try { + final plugin = PhoneNumberUtil(); + + final phone = startsWith('+') ? this : '+$this'; + final regionCode = (await plugin.parse(phone)).regionCode; + + return plugin.format( + phone, + regionCode, + ); + } catch (_) { + return this; + } + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 7b27d7f9..24526714 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,6 +40,7 @@ dependencies: crypto: ^3.0.3 video_compress: ^3.1.2 flutter_image_compress: ^2.1.0 + phone_number: ^2.0.1 dev_dependencies: flutter_test: diff --git a/sample/pubspec.lock b/sample/pubspec.lock index 8028fe28..7784a0fb 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -31,7 +31,7 @@ packages: path: ".." relative: true source: path - version: "0.0.97" + version: "0.0.98" boolean_selector: dependency: transitive description: @@ -100,18 +100,18 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" cross_file: dependency: transitive description: name: cross_file - sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" + sha256: "2f9d2cbccb76127ba28528cb3ae2c2326a122446a83de5a056aaa3880d3882c5" url: "https://pub.dev" source: hosted - version: "0.3.4+1" + version: "0.3.3+7" crypto: dependency: transitive description: @@ -156,10 +156,10 @@ packages: dependency: transitive description: name: dio - sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8" + sha256: "50fec96118958b97c727d0d8f67255d3683f16cc1f90d9bc917b5d4fe3abeca9" url: "https://pub.dev" source: hosted - version: "5.4.1" + version: "5.4.2" dotted_border: dependency: transitive description: @@ -180,18 +180,18 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.0" ffmpeg_kit_flutter_full_gpl: dependency: transitive description: name: ffmpeg_kit_flutter_full_gpl - sha256: "523bd84eed67e157d8988889ceb21e7e3f58539af428bfe0b277a90c5793f61c" + sha256: "4f269bcb636bfcb544e5b4d65c706a3d311839970cb42638e72406410c1b5b7b" url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "6.0.3" ffmpeg_kit_flutter_platform_interface: dependency: transitive description: @@ -216,14 +216,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.6" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" - source: hosted - version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -339,10 +331,10 @@ packages: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.1.0" http_parser: dependency: transitive description: @@ -383,30 +375,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.9" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - 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" linkify: dependency: transitive description: @@ -427,10 +395,10 @@ packages: dependency: transitive description: name: map_launcher - sha256: "4db9f2878dd0764f476f613eda671b969084960b6ae81bf578699cfe03e58ce0" + sha256: b9c11a1d32740ef8393559148716cc0fec38a569fdcf3fb569375114cf30988a url: "https://pub.dev" source: hosted - version: "2.5.0+1" + version: "3.2.0" mask_text_input_formatter: dependency: transitive description: @@ -443,42 +411,42 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.11.0" - metadata_fetch: + version: "1.9.1" + metadata_fetch_plus: dependency: transitive description: - name: metadata_fetch - sha256: "2c79e69e71cbb051041da6a8a9dd3df0617db84482ab3f36b4952ff779b7580e" + name: metadata_fetch_plus + sha256: f4a833f0dc00f50203fa97a780d10025fb3703c4f7b1fbbe9c635b48dc7a41fe url: "https://pub.dev" source: hosted - version: "0.4.1" + version: "1.0.0" mime: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.4" nested: dependency: transitive description: @@ -523,10 +491,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" path_drawing: dependency: transitive description: @@ -595,18 +563,26 @@ packages: dependency: transitive description: name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "6.0.2" + version: "5.4.0" + phone_number: + dependency: transitive + description: + name: phone_number + sha256: c66d3e2f2c69ce95f10bb923957049b1e5b8c6efea02d7366353fa3b80d4338a + url: "https://pub.dev" + source: hosted + version: "2.1.0" pinch_zoom: dependency: transitive description: name: pinch_zoom - sha256: ad12872281742726afaf03438d99a4572c584a612630768953beb6dfd6f9389a + sha256: "8e430a215db198099a708f334620e223cbea3fdc477b717d6535ab852994985e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" platform: dependency: transitive description: @@ -627,10 +603,34 @@ packages: dependency: transitive description: name: pointer_interceptor - sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + sha256: bd18321519718678d5fa98ad3a3359cbc7a31f018554eab80b73d08a7f0c165a + url: "https://pub.dev" + source: hosted + version: "0.10.1" + pointer_interceptor_ios: + dependency: transitive + description: + name: pointer_interceptor_ios + sha256: "2e73c39452830adc4695757130676a39412a3b7f3c34e3f752791b5384770877" url: "https://pub.dev" source: hosted - version: "0.9.3+7" + version: "0.10.0+2" + pointer_interceptor_platform_interface: + dependency: transitive + description: + name: pointer_interceptor_platform_interface + sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506" + url: "https://pub.dev" + source: hosted + version: "0.10.0+1" + pointer_interceptor_web: + dependency: transitive + description: + name: pointer_interceptor_web + sha256: "2a8a069206f7b234a895d30ccab8b18ea267eeb79a832e5e3d1b6464d659eb6a" + url: "https://pub.dev" + source: hosted + version: "0.10.0" provider: dependency: transitive description: @@ -659,10 +659,10 @@ packages: dependency: transitive description: name: simple_link_preview - sha256: "3c822908dc747e92e3c65ace0008dc465c98f16e795d622c9593f2cb3565fabc" + sha256: "04c40b3f0e8414207719935c3469621c4cae0a9916b26da712204847cfb02520" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "2.0.0" simple_observable: dependency: transitive description: @@ -712,10 +712,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" sticky_headers: dependency: transitive description: @@ -728,10 +728,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: @@ -744,10 +744,10 @@ packages: dependency: transitive description: name: string_validator - sha256: "50dd8ecf91db6a732f4a851eeae81ee12406eedc62d0da72f2d91a04a2d10dd8" + sha256: "54d4f42cd6878ae72793a58a529d9a18ebfdfbfebd9793bbe55c9b28935e8543" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "1.0.2" synchronized: dependency: transitive description: @@ -768,10 +768,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" typed_data: dependency: transitive description: @@ -800,10 +800,10 @@ packages: dependency: transitive description: name: url_launcher - sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" + sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.2.4" url_launcher_android: dependency: transitive description: @@ -816,10 +816,10 @@ packages: dependency: transitive description: name: url_launcher_ios - sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5" + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.2.4" url_launcher_linux: dependency: transitive description: @@ -848,10 +848,10 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d" + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.2.0" url_launcher_windows: dependency: transitive description: @@ -864,10 +864,10 @@ packages: dependency: transitive description: name: uuid - sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f" url: "https://pub.dev" source: hosted - version: "4.3.3" + version: "4.2.2" vector_graphics: dependency: transitive description: @@ -928,10 +928,10 @@ packages: dependency: transitive description: name: video_player_avfoundation - sha256: "309e3962795e761be010869bae65c0b0e45b5230c5cee1bec72197ca7db040ed" + sha256: bc923884640d6dc403050586eb40713cdb8d1d84e6886d8aca50ab04c59124c2 url: "https://pub.dev" source: hosted - version: "2.5.6" + version: "2.5.2" video_player_platform_interface: dependency: transitive description: @@ -944,18 +944,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "8e9cb7fe94e49490e67bbc15149691792b58a0ade31b32e3f3688d104a0e057b" + sha256: "34beb3a07d4331a24f7e7b2f75b8e2b103289038e07e65529699a671b6a6e2cb" url: "https://pub.dev" source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.dev" - source: hosted - version: "13.0.0" + version: "2.1.3" wakelock_plus: dependency: transitive description: @@ -976,18 +968,18 @@ packages: dependency: transitive description: name: web - sha256: "1d9158c616048c38f712a6646e317a3426da10e884447626167240d45209cbad" + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.1.4-beta" win32: dependency: transitive description: name: win32 - sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.1.1" xdg_directories: dependency: transitive description: @@ -1000,10 +992,10 @@ packages: dependency: transitive description: name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.5.0" + version: "6.3.0" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.19.0" + dart: ">=3.1.0 <4.0.0" + flutter: ">=3.13.0" From 90ae88e5fa135fefbbfb2f3e6bdc622abfbdbbda Mon Sep 17 00:00:00 2001 From: Andre Rossi Date: Thu, 4 Apr 2024 12:58:59 -0300 Subject: [PATCH 2/3] fix: check the status in ticket card --- .../ds_ticket_message.widget.dart | 63 +++++++++---------- lib/src/widgets/utils/ds_card.widget.dart | 1 + 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/lib/src/widgets/ticket_message/ds_ticket_message.widget.dart b/lib/src/widgets/ticket_message/ds_ticket_message.widget.dart index 3bfb84a0..9d07b859 100644 --- a/lib/src/widgets/ticket_message/ds_ticket_message.widget.dart +++ b/lib/src/widgets/ticket_message/ds_ticket_message.widget.dart @@ -23,6 +23,8 @@ class DSTicketMessage extends StatelessWidget { /// [DSTicketMessageType.closedAttendant] or [DSTicketMessageType.closedCustomer] final DSTicketMessageType messageType; + final String contentStatus; + final _message = [ 'Chatbot {chatbotIdentity} encaminhou a conversa para atendimento', 'Atendente {agentIdentity} encerrou o atendimento', @@ -35,43 +37,38 @@ class DSTicketMessage extends StatelessWidget { this.agentIdentity, this.chatbotIdentity, required this.messageType, - }) : assert((messageType == DSTicketMessageType.forwardedTicket) - ? (ticketId != null && - chatbotIdentity != null && - ticketId.trim().isNotEmpty && - chatbotIdentity.trim().isNotEmpty) - : true), - assert((messageType == DSTicketMessageType.closedAttendant) - ? (agentIdentity != null && agentIdentity.trim().isNotEmpty) - : true); + required this.contentStatus, + }); @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 16.0, bottom: 16.0), - child: Column( - children: [ - DSBodyText( - _prepareMessage(messageType), - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - fontWeight: FontWeight.w400, - isSelectable: true, - ), - if (messageType == DSTicketMessageType.forwardedTicket) - Padding( - padding: const EdgeInsets.only(top: 5.0), - child: DSBodyText( - 'Ticket $ticketId', - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - fontWeight: FontWeight.w700, - isSelectable: true, - ), + return (contentStatus.toLowerCase() == 'waiting') + ? Padding( + padding: const EdgeInsets.only(top: 16.0, bottom: 16.0), + child: Column( + children: [ + DSBodyText( + _prepareMessage(messageType), + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + fontWeight: FontWeight.w400, + isSelectable: true, + ), + if (messageType == DSTicketMessageType.forwardedTicket) + Padding( + padding: const EdgeInsets.only(top: 5.0), + child: DSBodyText( + 'Ticket $ticketId', + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + fontWeight: FontWeight.w700, + isSelectable: true, + ), + ), + ], ), - ], - ), - ); + ) + : const SizedBox.shrink(); } /// Prepare messages with parameters to be displayed diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index f69a4608..203265d8 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -151,6 +151,7 @@ class DSCard extends StatelessWidget { messageType: DSTicketMessageType.forwardedTicket, ticketId: content['formattedTicketId'], chatbotIdentity: content['ownerIdentity'], + contentStatus: content['status'], ); case DSMessageContentType.input: From e4f2d90e7b5646578f3d03f3d07577e8ccd21300 Mon Sep 17 00:00:00 2001 From: Andre Rossi Date: Fri, 5 Apr 2024 08:18:01 -0300 Subject: [PATCH 3/3] chore: upgrade version --- CHANGELOG.md | 5 +++++ pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea29c603..60022564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.0.99 + +- [DSTicketMessage] Added ```contentStatus``` property. +- [DSStringExtension] Added a new string extension ```DSStringExtension``` . + ## 0.0.98 - [DSGroupCard] Added ```key``` property to DSCard. diff --git a/pubspec.yaml b/pubspec.yaml index 24526714..830f591f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.0.98 +version: 0.0.99 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter