Skip to content

Commit

Permalink
Merge branch 'develop' into release/0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Amaro committed Aug 26, 2024
2 parents 68bbba4 + 3fc312e commit 4bea3de
Show file tree
Hide file tree
Showing 28 changed files with 634 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.9'
channel: 'stable'
flutter-version: "3.13.9"
channel: "stable"
- name: Install dependencies
run: flutter pub get
- name: Run tests
Expand Down
5 changes: 5 additions & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export 'src/extensions/ds_border_radius.extension.dart'
export 'src/extensions/ds_delivery_report_status.extension.dart'
show DSDeliveryReportStatusExtension;
export 'src/extensions/ds_string.extension.dart' show DSStringExtension;
export 'src/models/ds_calls_media_message.model.dart' show DSCallsMediaMessage;
export 'src/models/ds_message_bubble_avatar_config.model.dart'
show DSMessageBubbleAvatarConfig;
export 'src/models/ds_message_bubble_style.model.dart'
Expand Down Expand Up @@ -58,6 +59,7 @@ 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;
export 'src/services/ds_file.service.dart' show DSFileService;
export 'src/services/ds_localization.service.dart' show DSLocalizationService;
export 'src/services/ds_media_format.service.dart' show DSMediaFormatService;
export 'src/services/ds_toast.service.dart' show DSToastService;
export 'src/themes/colors/ds_colors.theme.dart' show DSColors;
Expand Down Expand Up @@ -112,6 +114,7 @@ export 'src/widgets/buttons/ds_attachment_button.widget.dart'
export 'src/widgets/buttons/ds_button.widget.dart' show DSButton;
export 'src/widgets/buttons/ds_custom_replies_icon_button.widget.dart'
show DSCustomRepliesIconButton;
export 'src/widgets/buttons/ds_ghost_button.widget.dart' show DSGhostButton;
export 'src/widgets/buttons/ds_icon_button.widget.dart' show DSIconButton;
export 'src/widgets/buttons/ds_pause_button.widget.dart' show DSPauseButton;
export 'src/widgets/buttons/ds_play_button.widget.dart' show DSPlayButton;
Expand All @@ -126,6 +129,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/calls/ds_end_calls_message_bubble.widget.dart'
show DSEndCallsMessageBubble;
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
5 changes: 5 additions & 0 deletions lib/src/enums/ds_call_direction.enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum DSCallDirection {
outbound,
inbound,
unknown,
}
5 changes: 5 additions & 0 deletions lib/src/enums/ds_call_provider.enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum DSCallProvider {
mobcall,
whatsApp,
unknown,
}
6 changes: 6 additions & 0 deletions lib/src/enums/ds_call_status.enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum DSCallStatus {
completed,
answer,
noAnswer,
unknown,
}
5 changes: 5 additions & 0 deletions lib/src/enums/ds_call_type.enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum DSCallType {
voice,
video,
unknown,
}
12 changes: 12 additions & 0 deletions lib/src/extensions/ds_enum.extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extension EnumByNameOrNull<T extends Enum> on Iterable<T> {
T? byNameOrNull(String? name) {
for (var value in this) {
if (value.name.toString().toLowerCase() ==
name?.toString().toLowerCase()) {
return value;
}
}

return null;
}
}
10 changes: 10 additions & 0 deletions lib/src/extensions/ds_localization.extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import '../services/ds_localization.service.dart';

extension DSLocalizationExtension on String {
translate() {
final locale = DSLocalizationService.locale ?? 'pt_BR';
final translations =
DSLocalizationService.translations?[locale.toString()] ?? {};
return translations[this] ?? this;
}
}
37 changes: 37 additions & 0 deletions lib/src/models/ds_calls_media_message.model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import '../enums/ds_call_direction.enum.dart';
import '../enums/ds_call_provider.enum.dart';
import '../enums/ds_call_status.enum.dart';
import '../enums/ds_call_type.enum.dart';
import '../extensions/ds_enum.extension.dart';

class DSCallsMediaMessage {
final String? sessionId;
final DSCallType? type;
final DSCallProvider? provider;
final DSCallDirection? direction;
final DSCallStatus? status;
final String? ticketId;
final String? identification;
final int? callDuration;

DSCallsMediaMessage({
required this.sessionId,
required this.type,
required this.provider,
required this.direction,
required this.status,
required this.ticketId,
required this.identification,
this.callDuration,
});

DSCallsMediaMessage.fromJson(Map<String, dynamic> json)
: sessionId = json['sessionId'],
type = DSCallType.values.byNameOrNull(json['type']),
provider = DSCallProvider.values.byNameOrNull(json['provider']),
direction = DSCallDirection.values.byNameOrNull(json['direction']),
status = DSCallStatus.values.byNameOrNull(json['status']),
ticketId = json['ticketId'],
identification = json['identification'],
callDuration = json['callDuration'] ?? 0;
}
13 changes: 13 additions & 0 deletions lib/src/services/ds_localization.service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';

abstract class DSLocalizationService {
static Locale? _locale;
static final Map<String, dynamic> _translations = {};

static setLocale(final Locale locale) => _locale = locale;
static setTranslations(final Map<String, dynamic> translations) =>
_translations.addAll(translations);

static Locale? get locale => _locale;
static Map<String, dynamic>? get translations => _translations;
}
2 changes: 1 addition & 1 deletion lib/src/themes/colors/ds_colors.theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ abstract class DSColors {
static const Color disabledText = Color(0xFF637798);
static const Color disabledBg = Color(0xFFE8F2FF);
static const Color contentDisable = Color(0xFF636363);
static const Color border1 = Color(0xFF616161);
static const Color border1 = Color(0xFFC9C9C9);

static Gradient gradientOcean = DSLinearGradient(
colors: const [
Expand Down
11 changes: 6 additions & 5 deletions lib/src/themes/colors/ds_dark_colors.theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import 'package:flutter/material.dart';

/// All Dark [Color] constants that are used by this Design System.
abstract class DSDarkColors {
static const Color surfacePositive = Color(0xFF01562F);
static const Color surface0 = Color(0xFF424242);
static const Color surface1 = Color(0xFF292929);
static const Color surface1 = Color(0xFF393939);
static const Color surface3 = Color(0xFF141414);
static const Color contentDefault = Color(0xFFF6F6F6);
static const Color contentDefault = Color(0xFFFFFFFF);
static const Color success = Color(0xFF355E4B);
static const Color positive = Color(0xFF6BFFBC);
static const Color error = Color(0xFF7B3D3D);

static const Color extendBlue = Color(0xFF1968F0);
static const Color extendGreen = Color(0xFF35DE90);
static const Color success = Color(0xFF355E4B);
static const Color positive = Color(0xFF01562F);
static const Color error = Color(0xFF7B3D3D);
}
1 change: 1 addition & 0 deletions lib/src/utils/ds_message_content_type.util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ abstract class DSMessageContentType {
static const String location = 'application/vnd.lime.location+json';
static const String applicationJson = 'application/json';
static const String reply = 'application/vnd.lime.reply+json';
static const String callsMedia = 'application/vnd.iris.calls.media+json';
}
23 changes: 23 additions & 0 deletions lib/src/widgets/buttons/ds_ghost_button.widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';

import '../../../blip_ds.dart';

/// A Design System's [ButtonStyleButton] primarily used by call to action.
class DSGhostButton extends DSSecondaryButton {
/// Creates a Design System's [ButtonStyleButton] with ghost style.
DSGhostButton({
required super.onPressed,
super.key,
super.leadingIcon,
super.label,
super.trailingIcon,
super.isEnabled,
super.isLoading,
super.autoSize,
super.contentAlignment,
super.foregroundColor,
super.borderColor,
}) : super(
backgroundColor: Colors.transparent,
);
}
11 changes: 8 additions & 3 deletions lib/src/widgets/buttons/ds_primary_button.widget.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:ui';

import '../../themes/colors/ds_colors.theme.dart';
import 'ds_button.widget.dart';

Expand All @@ -17,11 +19,14 @@ class DSPrimaryButton extends DSButton {
super.isLoading,
super.autoSize,
super.contentAlignment,
Color? backgroundColor,
Color? foregroundColor,
}) : super(
backgroundColor:
isEnabled ? DSColors.primaryNight : DSColors.disabledBg,
backgroundColor: isEnabled
? backgroundColor ?? DSColors.primaryNight
: DSColors.disabledBg,
foregroundColor: isEnabled
? DSColors.neutralLightSnow
? foregroundColor ?? DSColors.neutralLightSnow
: DSColors.neutralMediumElephant,
);
}
21 changes: 14 additions & 7 deletions lib/src/widgets/buttons/ds_secondary_button.widget.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:flutter/material.dart';

import '../../themes/colors/ds_colors.theme.dart';
import 'ds_button.widget.dart';

Expand All @@ -17,13 +19,18 @@ class DSSecondaryButton extends DSButton {
super.isLoading,
super.autoSize,
super.contentAlignment,
super.backgroundColor = DSColors.neutralLightSnow,
Color? backgroundColor,
Color? foregroundColor,
Color? borderColor,
}) : super(
foregroundColor: isEnabled
? DSColors.primaryNight
: DSColors.neutralMediumElephant,
borderColor: isEnabled
? DSColors.primaryNight
: DSColors.neutralMediumElephant,
backgroundColor: backgroundColor ?? DSColors.neutralLightSnow,
foregroundColor: foregroundColor ??
(isEnabled
? DSColors.primaryNight
: DSColors.neutralMediumElephant),
borderColor: borderColor ??
(isEnabled
? DSColors.primaryNight
: DSColors.neutralMediumElephant),
);
}
Loading

0 comments on commit 4bea3de

Please sign in to comment.