Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.0.99 #256

Merged
merged 6 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading