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

Feature/999999 blue messenger #288

Merged
merged 21 commits into from
Jan 2, 2025
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 .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutter": "stable",
"flavors": {}
}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.9'
flutter-version: '3.27.1'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
Expand All @@ -96,7 +96,7 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.9'
flutter-version: '3.27.1'
channel: 'stable'
- name: Check Publish Warnings
run: dart pub publish --dry-run
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.13.9"
flutter-version: "3.27.1"
channel: "stable"
- name: Install dependencies
run: flutter pub get
Expand Down
6 changes: 6 additions & 0 deletions assets/svg/avatar-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion lib/blip_ds.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
library blip_ds;
library;

export 'package:scroll_to_index/scroll_to_index.dart' show AutoScrollController;

export 'src/enums/ds_align.enum.dart' show DSAlign;
export 'src/enums/ds_border_radius.enum.dart' show DSBorderRadius;
Expand Down Expand Up @@ -58,6 +60,7 @@ 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_context.service.dart' show DSContextService;
export 'src/services/ds_dialog.service.dart' show DSDialogService;
export 'src/services/ds_file.service.dart' show DSFileService;
export 'src/services/ds_localization.service.dart' show DSLocalizationService;
Expand All @@ -67,6 +70,7 @@ export 'src/services/ds_toast.service.dart' show DSToastService;
export 'src/themes/colors/ds_colors.theme.dart' show DSColors;
export 'src/themes/colors/ds_dark_colors.theme.dart' show DSDarkColors;
export 'src/themes/colors/ds_linear_gradient.theme.dart' show DSLinearGradient;
export 'src/themes/enums/ds_theme_type.enum.dart' show DSThemeType;
export 'src/themes/icons/ds_icons.dart' show DSIcons;
export 'src/themes/system_overlay/ds_system_overlay.style.dart'
show DSSystemOverlayStyle;
Expand All @@ -89,6 +93,7 @@ export 'src/themes/texts/styles/ds_headline_large_text_style.theme.dart'
show DSHeadlineLargeTextStyle;
export 'src/themes/texts/styles/ds_headline_small_text_style.theme.dart'
show DSHeadlineSmallTextStyle;
export 'src/themes/texts/styles/ds_text_style.theme.dart' show DSTextStyle;
export 'src/themes/texts/utils/ds_font_families.theme.dart' show DSFontFamilies;
export 'src/themes/texts/utils/ds_font_weights.theme.dart' show DSFontWeights;
export 'src/utils/ds_animate.util.dart' show DSAnimate;
Expand Down Expand Up @@ -133,6 +138,8 @@ export 'src/widgets/chat/audio/ds_audio_message_bubble.widget.dart'
export 'src/widgets/chat/audio/ds_audio_player.widget.dart' show DSAudioPlayer;
export 'src/widgets/chat/calls/ds_end_calls_message_bubble.widget.dart'
show DSEndCallsMessageBubble;
export 'src/widgets/chat/ds_active_campaign_message_bubble.widget.dart'
show DSActiveCampaignMessageBubble;
export 'src/widgets/chat/ds_application_json_message_bubble.widget.dart'
show DSApplicationJsonMessageBubble;
export 'src/widgets/chat/ds_carrousel.widget.dart' show DSCarrousel;
Expand Down Expand Up @@ -217,3 +224,5 @@ export 'src/widgets/utils/ds_group_card.widget.dart' show DSGroupCard;
export 'src/widgets/utils/ds_header.widget.dart' show DSHeader;
export 'src/widgets/utils/ds_progress_bar.widget.dart' show DSProgressBar;
export 'src/widgets/utils/ds_user_avatar.widget.dart' show DSUserAvatar;
export 'src/widgets/utils/reply_content/ds_reply_preview.widget.dart'
show DSReplyPreview;
3 changes: 2 additions & 1 deletion lib/src/controllers/ds_video_player.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:video_player/video_player.dart';

import '../services/ds_auth.service.dart';
import '../services/ds_navigation.service.dart';
import '../themes/colors/ds_colors.theme.dart';
import '../widgets/chat/video/ds_video_error.dialog.dart';

Expand Down Expand Up @@ -66,7 +67,7 @@ class DSVideoPlayerController extends GetxController {
}

Future<void> _showErrorDialog() async {
Get.back();
NavigationService.pop();
Get.delete<DSVideoPlayerController>();

await DSVideoErrorDialog.show(
Expand Down
1 change: 1 addition & 0 deletions lib/src/enums/ds_delivery_report_status.enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ enum DSDeliveryReportStatus {
consumed,
failed,
sending,
dispatched,
unknown,
}
33 changes: 33 additions & 0 deletions lib/src/models/ds_active_message.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'ds_active_message_template.model.dart';
import 'ds_active_message_template_content.model.dart';

class DSActiveMessage {
DSActiveMessage({
required this.type,
this.template,
this.templateContent,
});

final String type;
final DSActiveMessageTemplate? template;
final DSActiveMessageTemplateContent? templateContent;

factory DSActiveMessage.fromJson(Map<String, dynamic> json) {
return DSActiveMessage(
type: json['type'],
template: json['template'] != null
? DSActiveMessageTemplate.fromJson(json['template'])
: null,
templateContent:
DSActiveMessageTemplateContent.fromJson(json['templateContent']),
);
}

Map<String, dynamic> toJson() {
return {
'type': type,
'template': template,
'templateContent': templateContent,
};
}
}
31 changes: 31 additions & 0 deletions lib/src/models/ds_active_message_template.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class DSActiveMessageTemplate {
const DSActiveMessageTemplate({
this.name,
this.language,
this.components,
});

final String? name;
final Map<String, dynamic>? language;
final List<Map<String, dynamic>>? components;

factory DSActiveMessageTemplate.fromJson(Map<String, dynamic> json) {
return DSActiveMessageTemplate(
name: json['name'],
language: (json['language'] as Map<String, dynamic>?)?.map(
(key, value) => MapEntry(key, value),
),
components: (json['components'] as List<dynamic>?)
?.map((e) => e as Map<String, dynamic>)
.toList(),
);
}

Map<String, dynamic> toJson() {
return {
'name': name,
'language': language,
'components': components,
};
}
}
29 changes: 29 additions & 0 deletions lib/src/models/ds_active_message_template_content.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class DSActiveMessageTemplateContent {
const DSActiveMessageTemplateContent({
this.name,
this.language,
this.components,
});

final String? name;
final String? language;
final List<Map<String, dynamic>>? components;

factory DSActiveMessageTemplateContent.fromJson(Map<String, dynamic> json) {
return DSActiveMessageTemplateContent(
name: json['name'],
language: json['language'],
components: (json['components'] as List<dynamic>?)
?.map((e) => e as Map<String, dynamic>)
.toList(),
);
}

Map<String, dynamic> toJson() {
return {
'name': name,
'language': language,
'components': components,
};
}
}
31 changes: 31 additions & 0 deletions lib/src/models/ds_location.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import '../extensions/ds_localization.extension.dart';

class DSLocation {
DSLocation({
required this.text,
this.latitude,
this.longitude,
});

final double? latitude;
final double? longitude;
final String text;

factory DSLocation.fromJson(Map<String, dynamic> json) {
return DSLocation(
latitude: double.tryParse(json['latitude']?.toString() ?? ''),
longitude: double.tryParse(json['longitude']?.toString() ?? ''),
text: (json['text']?.isNotEmpty ?? false)
? json['text']
: 'location.text'.translate(),
);
}

Map<String, dynamic> toJson() {
return {
'latitude': latitude,
'longitude': longitude,
'text': text,
};
}
}
5 changes: 4 additions & 1 deletion lib/src/models/ds_media_link.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class DSMediaLink {
String? aspectRatio;
int? size;
String? authorizationRealm;
String? previewUri;

DSMediaLink({
required this.uri,
Expand All @@ -15,6 +16,7 @@ class DSMediaLink {
this.aspectRatio,
this.size,
this.authorizationRealm,
this.previewUri,
});

DSMediaLink.fromJson(Map<String, dynamic> json)
Expand All @@ -24,5 +26,6 @@ class DSMediaLink {
text = json['text'],
aspectRatio = json['aspectRatio'],
size = json['size'],
authorizationRealm = json['authorizationRealm'];
authorizationRealm = json['authorizationRealm'],
previewUri = json['previewUri'];
}
19 changes: 19 additions & 0 deletions lib/src/models/ds_media_reply_content_props.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/widgets.dart';

class DSMediaReplyContentProps {
String mediaTextTranslateKey;
IconData mediaIcon;
Widget trailing;
double size;
String title;
Widget? subtitle;

DSMediaReplyContentProps({
required this.mediaTextTranslateKey,
required this.mediaIcon,
this.title = '',
this.trailing = const SizedBox.shrink(),
this.size = 0.0,
this.subtitle,
});
}
8 changes: 8 additions & 0 deletions lib/src/models/ds_message_item.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class DSMessageItem {
/// if the media message is uploading
bool isUploading;

/// Message metadata
Map<String, dynamic>? metadata;

/// Creates a new Design System's [DSMessageItemModel] model
DSMessageItem({
this.id,
Expand All @@ -45,6 +48,7 @@ class DSMessageItem {
this.customer,
this.hideMessageDetail,
this.isUploading = false,
this.metadata,
});

factory DSMessageItem.fromJson(Map<String, dynamic> json) {
Expand All @@ -68,6 +72,10 @@ class DSMessageItem {
messageItem.hideMessageDetail = json['hideMessageDetail'];
}

if (json.containsKey('metadata')) {
messageItem.metadata = json['metadata'];
}

return messageItem;
}
}
7 changes: 7 additions & 0 deletions lib/src/models/ds_reply_content.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ class DSReplyContent {
inReplyTo = DSReplyContentInReplyTo.fromJson(
json['inReplyTo'],
);

Map<String, dynamic> toJson() {
return {
'replied': replied.toJson(),
'inReplyTo': inReplyTo.toJson(),
};
}
}
28 changes: 25 additions & 3 deletions lib/src/models/ds_reply_content_in_reply_to.model.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class DSReplyContentInReplyTo {
String id;
String type;
String? id;
String? type;
dynamic value;
String direction;
String? direction;

DSReplyContentInReplyTo({
required this.id,
Expand All @@ -16,4 +16,26 @@ class DSReplyContentInReplyTo {
type = json['type'] ?? '',
value = json['value'] ?? '',
direction = json['direction'] ?? '';

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

if (id != null) {
data['id'] = id;
}

if (type != null) {
data['type'] = type;
}

if (value != null) {
data['value'] = value;
}

if (direction != null) {
data['direction'] = direction;
}

return data;
}
}
14 changes: 14 additions & 0 deletions lib/src/models/ds_reply_content_replied.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,18 @@ class DSReplyContentReplied {
DSReplyContentReplied.fromJson(Map<String, dynamic> json)
: type = json['type'],
value = json['value'];

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};

if (type.isNotEmpty) {
data['type'] = type;
}

if (value != null) {
data['value'] = value;
}

return data;
}
}
4 changes: 2 additions & 2 deletions lib/src/services/ds_bottom_sheet.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class DSBottomSheetService {
backgroundColor: Colors.transparent,
isScrollControlled: true,
context: context,
builder: (_) => WillPopScope(
onWillPop: () async => false,
builder: (_) => PopScope(
canPop: false,
child: _buildBottomSheet(
hideGrabber: true,
),
Expand Down
Loading