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.88 #232

Merged
merged 16 commits into from
Nov 21, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
pull_request:
branches: [main, develop]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
tests:
name: Run Automated Tests
Expand All @@ -17,6 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.9'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.88

- [DSApplicationJsonMessageBubble] Added support for interactive lists and buttons.

## 0.0.87

- [DSCircularProgress] Added widget to build circular progress indicator.
Expand Down
34 changes: 33 additions & 1 deletion lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export 'src/enums/ds_delivery_report_status.enum.dart'
show DSDeliveryReportStatus;
export 'src/enums/ds_input_container_shape.enum.dart'
show DSInputContainerShape;
export 'src/enums/ds_interactive_message_header_type.enum.dart'
show DSInteractiveMessageHeaderType;
export 'src/enums/ds_survey_scale.enum.dart' show DSSurveyScale;
export 'src/enums/ds_survey_type.enum.dart' show DSSurveyType;
export 'src/enums/ds_ticket_message_type.enum.dart' show DSTicketMessageType;
Expand All @@ -18,8 +20,32 @@ export 'src/models/ds_message_bubble_avatar_config.model.dart'
show DSMessageBubbleAvatarConfig;
export 'src/models/ds_message_bubble_style.model.dart'
show DSMessageBubbleStyle;
export 'src/models/ds_message_item.model.dart' show DSMessageItemModel;
export 'src/models/ds_message_item.model.dart' show DSMessageItem;
export 'src/models/ds_toast_props.model.dart' show DSToastProps;
export 'src/models/interactive_message/ds_interactive_message.model.dart'
show DSInteractiveMessage;
export 'src/models/interactive_message/ds_interactive_message_action.model.dart'
show DSInteractiveMessageAction;
export 'src/models/interactive_message/ds_interactive_message_body.model.dart'
show DSInteractiveMessageBody;
export 'src/models/interactive_message/ds_interactive_message_button.model.dart'
show DSInteractiveMessageButton;
export 'src/models/interactive_message/ds_interactive_message_document.model.dart'
show DSInteractiveMessageDocument;
export 'src/models/interactive_message/ds_interactive_message_footer.model.dart'
show DSInteractiveMessageFooter;
export 'src/models/interactive_message/ds_interactive_message_header.model.dart'
show DSInteractiveMessageHeader;
export 'src/models/interactive_message/ds_interactive_message_image.model.dart'
show DSInteractiveMessageImage;
export 'src/models/interactive_message/ds_interactive_message_media.model.dart'
show DSInteractiveMessageMedia;
export 'src/models/interactive_message/ds_interactive_message_row.model.dart'
show DSInteractiveMessageRow;
export 'src/models/interactive_message/ds_interactive_message_section.model.dart'
show DSInteractiveMessageSection;
export 'src/models/interactive_message/ds_interactive_message_video.model.dart'
show DSInteractiveMessageVideo;
export 'src/services/ds_auth.service.dart' show DSAuthService;
export 'src/services/ds_bottom_sheet.service.dart' show DSBottomSheetService;
export 'src/services/ds_dialog.service.dart' show DSDialogService;
Expand Down Expand Up @@ -89,6 +115,8 @@ export 'src/widgets/buttons/ds_tertiary_button.widget.dart'
export 'src/widgets/chat/audio/ds_audio_message_bubble.widget.dart'
show DSAudioMessageBubble;
export 'src/widgets/chat/audio/ds_audio_player.widget.dart' show DSAudioPlayer;
export 'src/widgets/chat/ds_application_json_message_bubble.widget.dart'
show DSApplicationJsonMessageBubble;
export 'src/widgets/chat/ds_carrousel.widget.dart' show DSCarrousel;
export 'src/widgets/chat/ds_contact_message_bubble.widget.dart'
show DSContactMessageBubble;
Expand All @@ -98,6 +126,10 @@ export 'src/widgets/chat/ds_file_message_bubble.widget.dart'
show DSFileMessageBubble;
export 'src/widgets/chat/ds_image_message_bubble.widget.dart'
show DSImageMessageBubble;
export 'src/widgets/chat/ds_interactive_button_message_bubble.widget.dart'
show DSInteractiveButtonMessageBubble;
export 'src/widgets/chat/ds_interactive_list_message_bubble.widget.dart'
show DSInteractiveListMessageBubble;
export 'src/widgets/chat/ds_location_message_bubble.widget.dart'
show DSLocationMessageBubble;
export 'src/widgets/chat/ds_message_bubble.widget.dart' show DSMessageBubble;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/enums/ds_interactive_message_header_type.enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum DSInteractiveMessageHeaderType {
text,
document,
image,
video,
}
10 changes: 5 additions & 5 deletions lib/src/models/ds_message_item.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../enums/ds_align.enum.dart';
import '../enums/ds_delivery_report_status.enum.dart';

/// A Design System message model used with [DSGroupCard] to display grouped bubble
class DSMessageItemModel {
class DSMessageItem {
/// Identifier of message
String? id;

Expand Down Expand Up @@ -30,8 +30,8 @@ class DSMessageItemModel {
/// Used to define if a message detail (typicament a messages date and time) should be displayed or not
bool? hideMessageDetail;

/// Creates a new Design System's [DSMessageItemModel] model
DSMessageItemModel({
/// Creates a new Design System's [DSMessageItem] model
DSMessageItem({
this.id,
required this.date,
required this.displayDate,
Expand All @@ -43,8 +43,8 @@ class DSMessageItemModel {
this.hideMessageDetail,
});

factory DSMessageItemModel.fromJson(Map<String, dynamic> json) {
final messageItem = DSMessageItemModel(
factory DSMessageItem.fromJson(Map<String, dynamic> json) {
final messageItem = DSMessageItem(
id: json['id'],
date: json['date'],
displayDate: json['displayDate'],
Expand Down
8 changes: 4 additions & 4 deletions lib/src/models/ds_select_option.model.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/// A Design System select options model used with [DSSelectMenu], [DSQuickReply] to display a options menu
class DSSelectOptionModel {
class DSSelectOption {
String text;
int? order;
String? type;
dynamic value;

DSSelectOptionModel({
DSSelectOption({
required this.text,
this.order,
this.type,
this.value,
});

factory DSSelectOptionModel.fromJson(Map<String, dynamic> json) {
final option = DSSelectOptionModel(
factory DSSelectOption.fromJson(Map<String, dynamic> json) {
final option = DSSelectOption(
text: json['text'],
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'ds_interactive_message_action.model.dart';
import 'ds_interactive_message_body.model.dart';
import 'ds_interactive_message_footer.model.dart';
import 'ds_interactive_message_header.model.dart';

class DSInteractiveMessage {
final DSInteractiveMessageHeader? header;
final DSInteractiveMessageBody? body;
final DSInteractiveMessageAction? action;
final DSInteractiveMessageFooter? footer;

DSInteractiveMessage({
this.header,
this.body,
this.action,
this.footer,
});

DSInteractiveMessage.fromJson(Map<String, dynamic> json)
: header = json['header'] != null
? DSInteractiveMessageHeader.fromJson(json['header'])
: null,
body = json['body'] != null
? DSInteractiveMessageBody.fromJson(json['body'])
: null,
action = json['action'] != null
? DSInteractiveMessageAction.fromJson(json['action'])
: null,
footer = json['footer'] != null
? DSInteractiveMessageFooter.fromJson(json['footer'])
: null;

Map<String, dynamic> toJson() => {
'header': header?.toJson(),
'body': body?.toJson(),
'action': action?.toJson(),
'footer': footer?.toJson(),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'ds_interactive_message_button.model.dart';
import 'ds_interactive_message_section.model.dart';

class DSInteractiveMessageAction {
final String? button;
final List<DSInteractiveMessageButton>? buttons;
final List<DSInteractiveMessageSection>? sections;

DSInteractiveMessageAction({
this.button,
this.buttons,
this.sections,
});

DSInteractiveMessageAction.fromJson(Map<String, dynamic> json)
: button = json['button'],
buttons = json['buttons'] != null
? List.from(json['buttons'])
.map(
(e) => DSInteractiveMessageButton.fromJson(e),
)
.toList()
: null,
sections = json['sections'] != null
? List.from(json['sections'])
.map(
(e) => DSInteractiveMessageSection.fromJson(e),
)
.toList()
: null;

Map<String, dynamic> toJson() => {
'button': button,
'buttons': buttons
?.map(
(e) => e.toJson(),
)
.toList(),
'sections': sections
?.map(
(e) => e.toJson(),
)
.toList(),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class DSInteractiveMessageBody {
final String? text;

DSInteractiveMessageBody({
this.text,
});

DSInteractiveMessageBody.fromJson(Map<String, dynamic> json)
: text = json['text'];

Map<String, dynamic> toJson() => {
'text': text,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class DSInteractiveMessageButton {
final String? title;

DSInteractiveMessageButton({
this.title,
});

DSInteractiveMessageButton.fromJson(Map<String, dynamic> json)
: title = json['reply']?['title'];

Map<String, dynamic> toJson() => {
'title': title,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'ds_interactive_message_media.model.dart';

class DSInteractiveMessageDocument extends DSInteractiveMessageMedia {
final String? filename;

DSInteractiveMessageDocument({
super.link,
this.filename,
});

DSInteractiveMessageDocument.fromJson(Map<String, dynamic> json)
: filename = json['filename'],
super.fromJson(json);

@override
Map<String, dynamic> toJson() => {
'link': super.link,
'filename': filename,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class DSInteractiveMessageFooter {
final String? text;

DSInteractiveMessageFooter({
this.text,
});

DSInteractiveMessageFooter.fromJson(Map<String, dynamic> json)
: text = json['text'];

Map<String, dynamic> toJson() => {
'text': text,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:get/get.dart';

import '../../enums/ds_interactive_message_header_type.enum.dart';
import 'ds_interactive_message_document.model.dart';
import 'ds_interactive_message_image.model.dart';
import 'ds_interactive_message_video.model.dart';

class DSInteractiveMessageHeader {
final DSInteractiveMessageHeaderType? type;
final String? text;
final DSInteractiveMessageDocument? document;
final DSInteractiveMessageImage? image;
final DSInteractiveMessageVideo? video;

DSInteractiveMessageHeader({
this.type,
this.text,
this.document,
this.image,
this.video,
});

DSInteractiveMessageHeader.fromJson(Map<String, dynamic> json)
: type = DSInteractiveMessageHeaderType.values.firstWhereOrNull(
(e) => e.name == json['type'],
),
text = json['text'],
document = json['document'] != null
? DSInteractiveMessageDocument.fromJson(json['document'])
: null,
image = json['image'] != null
? DSInteractiveMessageImage.fromJson(json['image'])
: null,
video = json['video'] != null
? DSInteractiveMessageVideo.fromJson(json['video'])
: null;

Map<String, dynamic> toJson() => {
'type': type?.name,
'text': text,
'document': document?.toJson(),
'image': image?.toJson(),
'video': video?.toJson(),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'ds_interactive_message_media.model.dart';

class DSInteractiveMessageImage extends DSInteractiveMessageMedia {
DSInteractiveMessageImage.fromJson(Map<String, dynamic> json)
: super.fromJson(json);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
abstract class DSInteractiveMessageMedia {
final String? link;

DSInteractiveMessageMedia({
this.link,
});

DSInteractiveMessageMedia.fromJson(Map<String, dynamic> json)
: link = json['link'];

Map<String, dynamic> toJson() => {
'link': link,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class DSInteractiveMessageRow {
final String? title;

DSInteractiveMessageRow({
this.title,
});

DSInteractiveMessageRow.fromJson(Map<String, dynamic> json)
: title = json['title'];

Map<String, dynamic> toJson() => {
'title': title,
};
}
Loading