Skip to content

Commit

Permalink
Merge pull request #274 from takenet/develop
Browse files Browse the repository at this point in the history
[Release] 0.1.8
  • Loading branch information
mpamaro authored Aug 29, 2024
2 parents edb51ae + 615879e commit 3e06a46
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 52 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.8

- Added translation to all hard coded texts.

## 0.1.7

- Upgraded dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:crypto/crypto.dart';
import 'package:file_sizes/file_sizes.dart';
import 'package:get/get.dart';

import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_toast_props.model.dart';
import '../../services/ds_file.service.dart';
import '../../services/ds_media_format.service.dart';
Expand Down Expand Up @@ -39,8 +40,7 @@ class DSVideoMessageBubbleController {
mediaSize,
precision: PrecisionValue.One,
)
// TODO: translate
: 'Download';
: 'video.download'.translate();
}

Future<void> getStoredVideo() async {
Expand Down Expand Up @@ -113,11 +113,10 @@ class DSVideoMessageBubbleController {
} catch (_) {
hasError.value = true;

// TODO: translate
DSToastService.error(
DSToastProps(
title: 'Erro ao baixar vídeo',
message: 'Ops! Houve um erro ao baixar o vídeo para reprodução.',
title: 'video.download-title-error'.translate(),
message: 'video.download-message-error'.translate(),
),
);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/services/ds_file.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class DSFileService {
return;
}

final result = await OpenFilex.open(filePath);
final result = await OpenFilex.open(filePath!);

switch (result.type) {
case ResultType.done:
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/chat/ds_delivery_report_icon.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

import '../../enums/ds_delivery_report_status.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/icons/ds_icons.dart';
import '../../utils/ds_utils.util.dart';
Expand Down Expand Up @@ -34,7 +35,7 @@ class DSDeliveryReportIcon extends StatelessWidget {

case DSDeliveryReportStatus.failed:
return DSCaptionSmallText(
'Falha ao enviar mensagem.',
'delivery.send-fail'.translate(),
color: DSColors.actionColorNegative,
);

Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/chat/ds_location_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:map_launcher/map_launcher.dart';

import '../../enums/ds_align.enum.dart';
import '../../enums/ds_border_radius.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../models/ds_reply_content.model.dart';
import '../../services/ds_auth.service.dart';
Expand Down Expand Up @@ -155,7 +156,7 @@ class _DSLocationMessageBubbleState extends State<DSLocationMessageBubble> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DSHeadlineLargeText(
'Selecione uma ação',
'location.select-action'.translate(),
),
DSIconButton(
onPressed: () {
Expand Down Expand Up @@ -197,7 +198,7 @@ class _DSLocationMessageBubbleState extends State<DSLocationMessageBubble> {
Get.back();
},
title: DSBodyText(
'Abrir com ${map.mapName}',
"location.open-with".translate() + " ${map.mapName}",
),
);
},
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/chat/ds_reply_container.widget.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';

import '../../enums/ds_align.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../models/ds_reply_content.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
Expand Down Expand Up @@ -52,7 +53,7 @@ class DSReplyContainer extends StatelessWidget {
),
const SizedBox(width: 8.0),
DSCaptionText(
'Reply',
'reply.text'.translate(),
fontStyle: FontStyle.italic,
color: style.isLightBubbleBackground(align)
? DSColors.neutralDarkCity
Expand Down Expand Up @@ -152,7 +153,7 @@ class DSReplyContainer extends StatelessWidget {
const SizedBox(width: 8.0),
Flexible(
child: DSBodyText(
'Failed to load message',
'reply.load-fail'.translate(),
overflow: TextOverflow.visible,
color: _foregroundColor,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/chat/ds_request_location_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import '../../enums/ds_align.enum.dart';
import '../../enums/ds_border_radius.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../models/ds_reply_content.model.dart';
import '../../utils/ds_bubble.util.dart';
Expand Down Expand Up @@ -56,7 +57,7 @@ class DSRequestLocationBubble extends StatelessWidget {
),
if (showRequestLocationButton)
DSRequestLocationButton(
label: 'Send Location', // TODO: translate
label: 'location.send'.translate(),
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/chat/ds_show_more_text.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/state_manager.dart';

import '../../enums/ds_align.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/texts/styles/ds_body_text_style.theme.dart';
Expand Down Expand Up @@ -71,8 +72,7 @@ class DSShowMoreText extends StatelessWidget {
child: GestureDetector(
onTap: () => shouldShowFullText.value = true,
child: DSBodyText(
// TODO: Need localized translate.
'Mostrar mais',
'show-more.text'.translate(),
color: isLightBubbleBackground
? isDefaultBubbleColors
? DSColors.primaryNight
Expand Down
15 changes: 8 additions & 7 deletions lib/src/widgets/chat/ds_survey_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../../enums/ds_align.enum.dart';
import '../../enums/ds_border_radius.enum.dart';
import '../../enums/ds_survey_scale.enum.dart';
import '../../enums/ds_survey_type.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/icons/ds_icons.dart';
Expand Down Expand Up @@ -109,19 +110,19 @@ class DSSurveyMessageBubble extends StatelessWidget {
_getTitlePreview() {
switch (type) {
case DSSurveyType.recommendation:
return 'Would you recommend our Chatbot?';
return "survey.recommendation".translate();
case DSSurveyType.solution:
return 'How did you feel about the service on this channel?';
return 'survey.solution'.translate();
case DSSurveyType.chatbot:
return 'How did you feel about the chatbot assistance?';
return 'survey.chatbot'.translate();
}
}

_getDescriptionPreview(bool positiveLabel) => positiveLabel
? type == DSSurveyType.recommendation
? 'Recommend'
: 'Positive'
? 'survey.recommendation-answered-positive'.translate()
: 'survey.positive'.translate()
: type == DSSurveyType.recommendation
? "Don't Recommend"
: 'Negative';
? "survey.recommendation-answered-negative".translate()
: 'survey.negative'.translate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import '../../enums/ds_align.enum.dart';
import '../../enums/ds_border_radius.enum.dart';
import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../models/ds_reply_content.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
Expand All @@ -27,7 +28,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget {
this.overflow = TextOverflow.ellipsis,
this.borderRadius = const [DSBorderRadius.all],
DSMessageBubbleStyle? style,
}) : style = style ?? DSMessageBubbleStyle();
}) : style = style ?? DSMessageBubbleStyle();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -55,8 +56,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: DSBodyText(
text ??
'Unsupported content', // TODO: Need localized translate.
text ?? 'unsupported-content.text'.translate(),
color: color,
overflow: overflow,
),
Expand Down
37 changes: 18 additions & 19 deletions lib/src/widgets/chat/video/ds_video_error.dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'package:get/get.dart';

import '../../../extensions/ds_localization.extension.dart';
import '../../../services/ds_dialog.service.dart';
import '../../../services/ds_file.service.dart';
import '../../../utils/ds_directory_formatter.util.dart';
Expand All @@ -14,31 +15,29 @@ abstract class DSVideoErrorDialog {
required final String url,
final Map<String, String?>? httpHeaders,
}) async {
// TODO: translate
await DSDialogService(
title: 'Erro ao reproduzir o vídeo',
text:
'Encontramos um erro ao reproduzir o vídeo. Você deseja tentar abrir o vídeo externamente?',
title: 'video-error.reproduction-title'.translate(),
text: 'video-error.reproduction-message'.translate(),
primaryButton: DSPrimaryButton(
onPressed: () async {
Get.back();
onPressed: () async {
Get.back();

final cachePath = await DSDirectoryFormatter.getCachePath(
type: 'video/mp4',
filename: md5.convert(utf8.encode(Uri.parse(url).path)).toString(),
);
final cachePath = await DSDirectoryFormatter.getCachePath(
type: 'video/mp4',
filename:
md5.convert(utf8.encode(Uri.parse(url).path)).toString(),
);

await DSFileService.open(
url: url,
path: cachePath,
httpHeaders: httpHeaders,
);
},
label: 'Sim',
),
await DSFileService.open(
url: url,
path: cachePath,
httpHeaders: httpHeaders,
);
},
label: 'message.yes'.translate()),
secondaryButton: DSSecondaryButton(
onPressed: () => Get.back(),
label: 'Não',
label: 'message.no'.translate(),
),
context: Get.context!,
).showError();
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/fields/ds_phone_input.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';

import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_country.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/icons/ds_icons.dart';
Expand Down Expand Up @@ -209,7 +210,7 @@ class _DSPhoneInputState extends State<DSPhoneInput> {
border: InputBorder.none,
hintText: widget.hintText ??
widget.labelText ??
'Número de telefone',
'phone.number'.translate(),
hintStyle: const DSBodyTextStyle(
color: DSColors.neutralMediumWave,
),
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';

import '../../extensions/ds_localization.extension.dart';
import '../../models/ds_country.model.dart';
import '../../services/ds_bottom_sheet.service.dart';
import '../../themes/colors/ds_colors.theme.dart';
Expand Down Expand Up @@ -40,7 +41,7 @@ abstract class DSBottomSheetCountries {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DSHeadlineLargeText(
'País',
'country.name'.translate(),
),
DSIconButton(
onPressed: () {
Expand All @@ -64,7 +65,7 @@ abstract class DSBottomSheetCountries {
child: Obx(
() => DSSearchInput(
iconBackgroundColor: Colors.transparent,
hintText: 'Buscar por nome do país ou código',
hintText: 'country.search'.translate(),
onSearch: _onSearch,
onClear: _onClear,
showSuffixIcon: showClearButton.value,
Expand Down
4 changes: 2 additions & 2 deletions 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.1.7
version: 0.1.8
homepage: https://github.com/takenet/blip-ds-flutter#readme
repository: https://github.com/takenet/blip-ds-flutter

Expand All @@ -16,7 +16,7 @@ dependencies:
rxdart: ^0.27.4
flutter_spinkit: ^5.1.0
get: ^4.6.5
open_filex: ^4.3.2
open_filex: ^4.5.0
path_provider: ^2.1.1
dio: ^5.2.1+1
url_launcher: ^6.1.5
Expand Down
6 changes: 3 additions & 3 deletions sample/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.6"
version: "0.1.8"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -467,10 +467,10 @@ packages:
dependency: transitive
description:
name: open_filex
sha256: "854aefd72dfd74219dc8c8d1767c34ec1eae64b8399a5be317bddb1ec2108915"
sha256: ba425ea49affd0a98a234aa9344b9ea5d4c4f7625a1377961eae9fe194c3d523
url: "https://pub.dev"
source: hosted
version: "4.3.2"
version: "4.5.0"
package_info_plus:
dependency: transitive
description:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion test/widgets/chat/ds_chat_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blip_ds/blip_ds.dart';
import 'package:blip_ds/src/extensions/ds_localization.extension.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';

Expand Down Expand Up @@ -33,7 +34,7 @@ void main() {
await tester.pumpWidgetBuilder(messages);

final Finder findMessage = find.text(
'Falha ao enviar mensagem.', // TODO: translate
'delivery.send-fail'.translate(),
findRichText: true,
);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3e06a46

Please sign in to comment.