From ac014bfb60d9da704c1803ebf3cbfc52bd57431d Mon Sep 17 00:00:00 2001 From: Andre Rossi Date: Fri, 29 Nov 2024 17:48:44 -0300 Subject: [PATCH 1/2] feat: fix filename when channel is instagram --- .../chat/ds_image_message_bubble.controller.dart | 3 ++- .../chat/ds_video_message_bubble.controller.dart | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/src/controllers/chat/ds_image_message_bubble.controller.dart b/lib/src/controllers/chat/ds_image_message_bubble.controller.dart index e2a7ad91..1e744939 100644 --- a/lib/src/controllers/chat/ds_image_message_bubble.controller.dart +++ b/lib/src/controllers/chat/ds_image_message_bubble.controller.dart @@ -37,10 +37,11 @@ class DSImageMessageBubbleController extends GetxController { } final uri = Uri.parse(url); + final identifier = uri.queryParameters['asset_id'] ?? uri.path; final cachePath = await DSDirectoryFormatter.getCachePath( type: mediaType!, - filename: md5.convert(utf8.encode(uri.path)).toString(), + filename: md5.convert(utf8.encode(identifier)).toString(), ); if (File(cachePath).existsSync()) { diff --git a/lib/src/controllers/chat/ds_video_message_bubble.controller.dart b/lib/src/controllers/chat/ds_video_message_bubble.controller.dart index 67226437..d4306514 100644 --- a/lib/src/controllers/chat/ds_video_message_bubble.controller.dart +++ b/lib/src/controllers/chat/ds_video_message_bubble.controller.dart @@ -46,7 +46,7 @@ class DSVideoMessageBubbleController { Future getStoredVideo() async { try { isLoadingThumbnail.value = true; - final fileName = md5.convert(utf8.encode(Uri.parse(url).path)).toString(); + final fileName = _getFileName(url); final fullPath = await DSDirectoryFormatter.getCachePath( type: type, @@ -72,7 +72,7 @@ class DSVideoMessageBubbleController { } Future getFullThumbnailPath() async { - final fileName = md5.convert(utf8.encode(Uri.parse(url).path)).toString(); + final fileName = _getFileName(url); return DSDirectoryFormatter.getCachePath( type: 'image/png', @@ -86,7 +86,7 @@ class DSVideoMessageBubbleController { try { final cachePath = await DSDirectoryFormatter.getCachePath( type: 'video/mp4', - filename: md5.convert(utf8.encode(Uri.parse(url).path)).toString(), + filename: _getFileName(url), ); final outputFile = File(cachePath); @@ -143,4 +143,11 @@ class DSVideoMessageBubbleController { return '${getSize(downloadProgress.value)} / ${getSize(maximumProgress.value)}'; } + + String _getFileName(String url) { + final uri = Uri.parse(url); + final identifier = uri.queryParameters['asset_id'] ?? uri.path; + + return md5.convert(utf8.encode(identifier)).toString(); + } } From c66cde72292dae06ae9abbedd2c8a7ec8fad2ce3 Mon Sep 17 00:00:00 2001 From: Andre Rossi Date: Fri, 29 Nov 2024 18:10:17 -0300 Subject: [PATCH 2/2] chore: upgrade version --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 252c9b69..ee6c9b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.5 + +- [DSImageMessageBubble] Fix when channel is instagram. + ## 0.2.4 - [DSSecurityService] Add service to manage security features. diff --git a/pubspec.yaml b/pubspec.yaml index 99293b85..dc10b2fa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.2.4 +version: 0.2.5 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter