Skip to content

Commit

Permalink
Merge pull request #256 from takenet/release/0.0.99
Browse files Browse the repository at this point in the history
Release/0.0.99
  • Loading branch information
githubdoandre authored Apr 5, 2024
2 parents 6c50aca + e4f2d90 commit 7ba7f5c
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 139 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
21 changes: 21 additions & 0 deletions lib/src/extensions/ds_string.extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:core';

import 'package:phone_number/phone_number.dart';

extension DSStringExtension on String {
Future<String> 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;
}
}
}
63 changes: 30 additions & 33 deletions lib/src/widgets/ticket_message/ds_ticket_message.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class DSTicketMessage extends StatelessWidget {
/// [DSTicketMessageType.closedAttendant] or [DSTicketMessageType.closedCustomer]
final DSTicketMessageType messageType;

final String contentStatus;

final _message = <String>[
'Chatbot {chatbotIdentity} encaminhou a conversa para atendimento',
'Atendente {agentIdentity} encerrou o atendimento',
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/utils/ds_card.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class DSCard extends StatelessWidget {
messageType: DSTicketMessageType.forwardedTicket,
ticketId: content['formattedTicketId'],
chatbotIdentity: content['ownerIdentity'],
contentStatus: content['status'],
);

case DSMessageContentType.input:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 7ba7f5c

Please sign in to comment.