From cafff98e464b70d916b91867dd996c0d02f7c387 Mon Sep 17 00:00:00 2001 From: jj19 Date: Mon, 8 Apr 2024 15:23:55 +0800 Subject: [PATCH 1/6] =?UTF-8?q?git=20=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4501ffa0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,139 @@ +# Do not remove or rename entries in this file, only add new ones +# See https://github.com/flutter/flutter/issues/128635 for more context. + +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.classpath +.project +.settings/ +.vscode/* + +# Flutter repo-specific +/bin/cache/ +/bin/internal/bootstrap.bat +/bin/internal/bootstrap.sh +/bin/mingit/ +/dev/benchmarks/mega_gallery/ +/dev/bots/.recipe_deps +/dev/bots/android_tools/ +/dev/devicelab/ABresults*.json +/dev/docs/doc/ +/dev/docs/api_docs.zip +/dev/docs/flutter.docs.zip +/dev/docs/lib/ +/dev/docs/pubspec.yaml +/dev/integration_tests/**/xcuserdata +/dev/integration_tests/**/Pods +/packages/flutter/coverage/ +version +analysis_benchmark.json + +# packages file containing multi-root paths +.packages.generated + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart +.packages +.pub-preload-cache/ +.pub-cache/ +.pub/ +build/ +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds + +# Android related +**/android/**/gradle-wrapper.jar +.gradle/ +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/ephemeral +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# macOS +**/Flutter/ephemeral/ +**/Pods/ +**/macos/Flutter/GeneratedPluginRegistrant.swift +**/macos/Flutter/ephemeral +**/xcuserdata/ + +# Windows +**/windows/flutter/generated_plugin_registrant.cc +**/windows/flutter/generated_plugin_registrant.h +**/windows/flutter/generated_plugins.cmake + +# Linux +**/linux/flutter/generated_plugin_registrant.cc +**/linux/flutter/generated_plugin_registrant.h +**/linux/flutter/generated_plugins.cmake + +# Coverage +coverage/ + +# Symbols +app.*.symbols + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +!/dev/ci/**/Gemfile.lock +!.vscode/settings.json +.fvm/flutter_sdk \ No newline at end of file From ab26f1e9176f81c27552dfcaca8f57e418094014 Mon Sep 17 00:00:00 2001 From: jj19 Date: Tue, 9 Apr 2024 20:46:52 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E8=AF=95=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencent_cloud_chat_common/pubspec.yaml | 4 ++-- tencent_cloud_chat_contact/pubspec.yaml | 4 ++-- tencent_cloud_chat_conversation/pubspec.yaml | 4 ++-- tencent_cloud_chat_group_profile/pubspec.yaml | 4 ++-- tencent_cloud_chat_message/pubspec.yaml | 4 ++-- tencent_cloud_chat_search/pubspec.yaml | 11 +++++++++-- tencent_cloud_chat_user_profile/pubspec.yaml | 4 ++-- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tencent_cloud_chat_common/pubspec.yaml b/tencent_cloud_chat_common/pubspec.yaml index 54ad97b2..d442450c 100644 --- a/tencent_cloud_chat_common/pubspec.yaml +++ b/tencent_cloud_chat_common/pubspec.yaml @@ -12,8 +12,8 @@ dependencies: flutter: sdk: flutter cached_network_image: ^3.2.3 - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_intl: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_intl: ^1.2.1 pull_to_refresh_flutter3: ^2.0.2 shimmer: ^3.0.0 extended_image: ^8.1.1 diff --git a/tencent_cloud_chat_contact/pubspec.yaml b/tencent_cloud_chat_contact/pubspec.yaml index 9ee1e01b..5a75830c 100644 --- a/tencent_cloud_chat_contact/pubspec.yaml +++ b/tencent_cloud_chat_contact/pubspec.yaml @@ -11,8 +11,8 @@ environment: dependencies: flutter: sdk: flutter - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_common: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_common: ^1.2.1 azlistview_all_platforms: ^2.1.2 fluttertoast: ^8.2.2 diff --git a/tencent_cloud_chat_conversation/pubspec.yaml b/tencent_cloud_chat_conversation/pubspec.yaml index 49448898..fc7e47c0 100644 --- a/tencent_cloud_chat_conversation/pubspec.yaml +++ b/tencent_cloud_chat_conversation/pubspec.yaml @@ -13,8 +13,8 @@ dependencies: flutter: sdk: flutter flutter_swipe_action_cell: ^3.1.2 - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_common: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_common: ^1.2.1 dependency_overrides: tencent_cloud_chat_intl: diff --git a/tencent_cloud_chat_group_profile/pubspec.yaml b/tencent_cloud_chat_group_profile/pubspec.yaml index c8147507..62cecde5 100644 --- a/tencent_cloud_chat_group_profile/pubspec.yaml +++ b/tencent_cloud_chat_group_profile/pubspec.yaml @@ -11,8 +11,8 @@ environment: dependencies: flutter: sdk: flutter - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_common: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_common: ^1.2.1 azlistview_all_platforms: ^2.1.2 dependency_overrides: diff --git a/tencent_cloud_chat_message/pubspec.yaml b/tencent_cloud_chat_message/pubspec.yaml index 9d8e1623..af6bc70e 100644 --- a/tencent_cloud_chat_message/pubspec.yaml +++ b/tencent_cloud_chat_message/pubspec.yaml @@ -17,8 +17,8 @@ dependencies: file_picker: ^6.1.1 pull_to_refresh: ^2.0.0 flutter_list_view: ^1.1.18 - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_common: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_common: ^1.2.1 http: ^1.1.0 card_swiper: ^3.0.1 photo_view: ^0.14.0 diff --git a/tencent_cloud_chat_search/pubspec.yaml b/tencent_cloud_chat_search/pubspec.yaml index 70401065..262b2b19 100644 --- a/tencent_cloud_chat_search/pubspec.yaml +++ b/tencent_cloud_chat_search/pubspec.yaml @@ -12,14 +12,21 @@ environment: dependencies: flutter: sdk: flutter - tencent_cloud_chat: ^1.2.0 - tencent_cloud_chat_common: ^1.2.0 +# tencent_cloud_chat: ^1.2.0 +# tencent_cloud_chat_common: ^1.2.0 + +dependency_overrides: + tencent_cloud_chat: + path: ../tencent_cloud_chat + tencent_cloud_chat_common: + path: ../tencent_cloud_chat_common dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/tencent_cloud_chat_user_profile/pubspec.yaml b/tencent_cloud_chat_user_profile/pubspec.yaml index b60b217e..52f68752 100644 --- a/tencent_cloud_chat_user_profile/pubspec.yaml +++ b/tencent_cloud_chat_user_profile/pubspec.yaml @@ -11,8 +11,8 @@ environment: dependencies: flutter: sdk: flutter - tencent_cloud_chat: ^1.2.1 - tencent_cloud_chat_common: ^1.2.1 +# tencent_cloud_chat: ^1.2.1 +# tencent_cloud_chat_common: ^1.2.1 dependency_overrides: tencent_cloud_chat_intl: From 188b09743de5f2234f7de2be3312908a1ae3f233 Mon Sep 17 00:00:00 2001 From: jj19 Date: Wed, 10 Apr 2024 13:49:42 +0800 Subject: [PATCH 3/6] =?UTF-8?q?1.=E6=96=87=E6=9C=AC=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=202.=E5=9B=BE=E7=89=87=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/utils/tencent_cloud_chat_utils.dart | 3 +- tencent_cloud_chat/pubspec.yaml | 3 + tencent_cloud_chat_conversation/pubspec.yaml | 3 + .../tencent_cloud_chat_message_file.dart | 60 +++++++++++++++++-- .../tencent_cloud_chat_message_text.dart | 3 +- .../wb_ext_file_path.dart | 48 +++++++++++++++ tencent_cloud_chat_message/pubspec.yaml | 4 ++ 7 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart diff --git a/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart b/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart index bf8c93fa..16ff3c23 100644 --- a/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart +++ b/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:path/path.dart' as p; import 'package:tencent_cloud_chat/tencent_cloud_chat.dart'; import 'package:tencent_cloud_chat/utils/tencent_cloud_chat_message_calling_message/tencent_cloud_chat_message_calling_message.dart'; +import 'package:wb_flutter_tool/wb_flutter_tool.dart'; class ImageExifInfo { final double width; @@ -194,7 +195,7 @@ class TencentCloudChatUtils { switch (message.elemType) { case MessageElemType.V2TIM_ELEM_TYPE_TEXT: if (message.textElem != null) { - text = message.textElem!.text ?? ""; + text = AESTools.getLanguageText(AESTools.decryptString(message.textElem!.text ?? "")); } break; case MessageElemType.V2TIM_ELEM_TYPE_CUSTOM: diff --git a/tencent_cloud_chat/pubspec.yaml b/tencent_cloud_chat/pubspec.yaml index 4a65da40..662522a2 100644 --- a/tencent_cloud_chat/pubspec.yaml +++ b/tencent_cloud_chat/pubspec.yaml @@ -23,6 +23,9 @@ dependencies: flutter_ringtone_player: ^3.2.0 hive_flutter: ^1.1.0 path: ^1.8.3 + wb_flutter_tool: + git: + url: http://192.168.4.209:8081/ios/wb_flutter_tool.git dev_dependencies: flutter_test: diff --git a/tencent_cloud_chat_conversation/pubspec.yaml b/tencent_cloud_chat_conversation/pubspec.yaml index fc7e47c0..47312d36 100644 --- a/tencent_cloud_chat_conversation/pubspec.yaml +++ b/tencent_cloud_chat_conversation/pubspec.yaml @@ -15,6 +15,9 @@ dependencies: flutter_swipe_action_cell: ^3.1.2 # tencent_cloud_chat: ^1.2.1 # tencent_cloud_chat_common: ^1.2.1 + wb_flutter_tool: + git: + url: http://192.168.4.209:8081/ios/wb_flutter_tool.git dependency_overrides: tencent_cloud_chat_intl: diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart index efd1921f..a682d139 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:math'; +import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:open_file/open_file.dart'; @@ -13,8 +14,11 @@ import 'package:tencent_cloud_chat/tencent_cloud_chat.dart'; import 'package:tencent_cloud_chat/utils/tencent_cloud_chat_utils.dart'; import 'package:tencent_cloud_chat_common/base/tencent_cloud_chat_theme_widget.dart'; import 'package:tencent_cloud_chat_common/widgets/file_icon/tencent_cloud_chat_file_icon.dart'; +import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart'; import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_widgets/tencent_cloud_chat_message_item.dart'; - +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:wb_flutter_tool/wb_flutter_tool.dart'; +import 'wb_ext_file_path.dart'; enum TimFileCurrentRenderType { online, local, @@ -69,6 +73,7 @@ class _TencentCloudChatMessageFileState extends TencentCloudChatMessageState decryptImgPath(String fileName) async { + String? fileFormat; + var hasFormat = false; + List imgFormats = [".jpg", ".png", ".gif", ".webp"]; + + for (String form in imgFormats) { + if (this.contains(form)) { + hasFormat = true; + } + } + if (hasFormat) { + fileFormat = this.split(".")[max(this + .split(".") + .length - 1, 0)]; + } else { + fileFormat = ".jpg"; + } + String lastdierName = this.split("/")[max(this + .split("/") + .length - 1, 0)]; + String saveDirec = this.replaceAll(lastdierName, ""); + + String saveNewName = lastdierName.replaceAll( + ".${fileFormat}", "_decrypt.${fileFormat}"); + if (!hasFormat) { + saveNewName = lastdierName + fileFormat!; + } + + if (!File("${saveDirec}/${saveNewName}").existsSync()) { + var aescode = Uint8List.fromList(aesKey.codeUnits); + var file = File(this).readAsBytesSync(); + var imgfile = file.sublist(aescode.length, file.length); + print("file path:${this},file name:${fileName}"); + await File("${saveDirec}/${saveNewName}") + ..createSync(recursive: true) + ..writeAsBytesSync(imgfile); + } + + return Future.value("${saveDirec}/${saveNewName}"); + } +} \ No newline at end of file diff --git a/tencent_cloud_chat_message/pubspec.yaml b/tencent_cloud_chat_message/pubspec.yaml index af6bc70e..436610ff 100644 --- a/tencent_cloud_chat_message/pubspec.yaml +++ b/tencent_cloud_chat_message/pubspec.yaml @@ -32,6 +32,10 @@ dependencies: desktop_drop: ^0.4.4 dotted_border: ^2.1.0 package_info_plus: ^5.0.1 + cached_network_image: ^3.3.1 + wb_flutter_tool: + git: + url: http://192.168.4.209:8081/ios/wb_flutter_tool.git dependency_overrides: tencent_cloud_chat_intl: From 0e15e7a7ca2b1916998fea15d2e7b17d1293b931 Mon Sep 17 00:00:00 2001 From: "DGG3\\kafuk" Date: Wed, 10 Apr 2024 18:22:03 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencent_cloud_chat/pubspec.yaml | 2 +- tencent_cloud_chat_conversation/pubspec.yaml | 2 +- .../message_type_builders/wb_ext_file_path.dart | 9 +++++++-- tencent_cloud_chat_message/pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tencent_cloud_chat/pubspec.yaml b/tencent_cloud_chat/pubspec.yaml index 662522a2..ff74aa75 100644 --- a/tencent_cloud_chat/pubspec.yaml +++ b/tencent_cloud_chat/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: path: ^1.8.3 wb_flutter_tool: git: - url: http://192.168.4.209:8081/ios/wb_flutter_tool.git + url: http://jarvis:apple123@192.168.4.209:8081/ios/wb_flutter_tool.git dev_dependencies: flutter_test: diff --git a/tencent_cloud_chat_conversation/pubspec.yaml b/tencent_cloud_chat_conversation/pubspec.yaml index 47312d36..69116e22 100644 --- a/tencent_cloud_chat_conversation/pubspec.yaml +++ b/tencent_cloud_chat_conversation/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: # tencent_cloud_chat_common: ^1.2.1 wb_flutter_tool: git: - url: http://192.168.4.209:8081/ios/wb_flutter_tool.git + url: http://jarvis:apple123@192.168.4.209:8081/ios/wb_flutter_tool.git dependency_overrides: tencent_cloud_chat_intl: diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart index 5ffd03a1..4c78221c 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart @@ -22,8 +22,13 @@ extension Wbfileext on String { } else { fileFormat = ".jpg"; } - String lastdierName = this.split("/")[max(this - .split("/") + var str = "/"; + if (PlatformUtils().isWindows) { + str = "\\"; + } + + String lastdierName = this.split(str)[max(this + .split(str) .length - 1, 0)]; String saveDirec = this.replaceAll(lastdierName, ""); diff --git a/tencent_cloud_chat_message/pubspec.yaml b/tencent_cloud_chat_message/pubspec.yaml index 436610ff..fc366aa9 100644 --- a/tencent_cloud_chat_message/pubspec.yaml +++ b/tencent_cloud_chat_message/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: cached_network_image: ^3.3.1 wb_flutter_tool: git: - url: http://192.168.4.209:8081/ios/wb_flutter_tool.git + url: http://jarvis:apple123@192.168.4.209:8081/ios/wb_flutter_tool.git dependency_overrides: tencent_cloud_chat_intl: From 1920c2e84246b86223a2c8a01f41c2f9b7dd5847 Mon Sep 17 00:00:00 2001 From: "DGG3\\kafuk" Date: Fri, 12 Apr 2024 22:12:27 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...cent_cloud_chat_message_separate_data.dart | 33 +++++--- ...nt_cloud_chat_message_input_container.dart | 42 +++++++++- ...encent_cloud_chat_message_videoplayer.dart | 16 ++-- .../tencent_cloud_chat_message_file.dart | 14 +++- .../tencent_cloud_chat_message_video.dart | 51 +++++++++--- .../wb_ext_file_path.dart | 83 ++++++++++++++++++- tencent_cloud_chat_message/pubspec.yaml | 2 + 7 files changed, 200 insertions(+), 41 deletions(-) diff --git a/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart b/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart index 52881a28..043554ed 100644 --- a/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart +++ b/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'package:fc_native_video_thumbnail/fc_native_video_thumbnail.dart'; import 'package:flutter/scheduler.dart'; +import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:scroll_to_index/scroll_to_index.dart'; import 'package:tencent_cloud_chat/chat_sdk/components/tencent_cloud_chat_conversation_sdk.dart'; @@ -20,6 +21,7 @@ import 'package:tencent_cloud_chat_message/data/tencent_cloud_chat_message_data_ import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_controller.dart'; import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_sticker/default_sticker_set.dart'; import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_sticker/tencent_cloud_chat_message_sticker_data.dart'; +import 'package:wb_flutter_tool/wb_flutter_tool.dart'; // import 'package:tencent_cloud_chat_sdk/tencent_im_sdk_plugin.dart'; class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier { @@ -695,9 +697,12 @@ class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier { if (text.isEmpty) { return null; } + var dic = "{\"original\":\"${text.trim()}\"}"; + final entext = AESTools.encryptString(dic); + print("encrypt str :${entext}"); final textMessageInfo = await TencentCloudChatMessageSDK().createTextMessage( - text: text, + text: entext, mentionedUsers: mentionedUsers, ); return _sendMessage(messageInfoResult: textMessageInfo); @@ -708,6 +713,7 @@ class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier { if (imagePath.isEmpty) { return null; } + final messageInfo = await TencentCloudChatMessageSDK().createImageMessage( imagePath: imagePath, imageName: Pertypath().basename(imagePath), @@ -721,18 +727,23 @@ class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier { if (videoPath.isEmpty) { return null; } - final plugin = FcNativeVideoThumbnail(); + // final plugin = FcNativeVideoThumbnail(); + String snapshotPath = "${(await getTemporaryDirectory()).path}${Pertypath().basename(videoPath)}.jpeg"; - await plugin.getVideoThumbnail( - srcFile: videoPath, - keepAspectRatio: true, - destFile: snapshotPath, - format: 'jpeg', - width: 128, - quality: 100, - height: 128, - ); + // await plugin.getVideoThumbnail( + // srcFile: videoPath, + // keepAspectRatio: true, + // destFile: snapshotPath, + // format: 'jpeg', + // width: 128, + // quality: 100, + // height: 128, + // ); + + ByteData imageBytes = await rootBundle.load("assets/video_noraml.png"); + Uint8List bytes = imageBytes.buffer.asUint8List(); + await File(snapshotPath).writeAsBytes(bytes); final String fileExtension = Pertypath().extension(videoPath).toLowerCase(); final messageInfo = await TencentCloudChatMessageSDK().createVideoMessage( videoFilePath: videoPath, diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_input/tencent_cloud_chat_message_input_container.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_input/tencent_cloud_chat_message_input_container.dart index f90ee4bf..49198fe1 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_input/tencent_cloud_chat_message_input_container.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_input/tencent_cloud_chat_message_input_container.dart @@ -17,7 +17,7 @@ import 'package:tencent_cloud_chat_common/widgets/modal/bottom_modal.dart'; import 'package:tencent_cloud_chat_message/data/tencent_cloud_chat_message_separate_data.dart'; import 'package:tencent_cloud_chat_message/data/tencent_cloud_chat_message_separate_data_notifier.dart'; import 'package:tencent_cloud_chat_message/tencent_cloud_chat_message_builders.dart'; - +import '../tencent_cloud_chat_message_widgets/message_type_builders/wb_ext_file_path.dart'; class TencentCloudChatMessageInputContainer extends StatefulWidget { final String? userID; final String? groupID; @@ -59,9 +59,9 @@ class _TencentCloudChatMessageInputContainerState extends TencentCloudChatState< final config = dataProvider.config; if (!TencentCloudChatPlatformAdapter().isMobile) { final defaultOptions = [ - TencentCloudChatMessageGeneralOptionItem(icon: Icons.insert_drive_file_outlined, label: tL10n.file, onTap: _sendFileFromExplorer), - TencentCloudChatMessageGeneralOptionItem(icon: Icons.image_outlined, label: tL10n.image, onTap: _sendImage), - TencentCloudChatMessageGeneralOptionItem(icon: Icons.perm_media_outlined, label: tL10n.media, onTap: _sendMediaFromGallery), + // TencentCloudChatMessageGeneralOptionItem(icon: Icons.insert_drive_file_outlined, label: tL10n.file, onTap: _sendFileFromExplorer), + TencentCloudChatMessageGeneralOptionItem(icon: Icons.image_outlined, label: tL10n.image, onTap: _sendSingleImage), + TencentCloudChatMessageGeneralOptionItem(icon: Icons.video_collection, label: tL10n.video, onTap: _sendSingleVideo), ]; final additionalAttachmentOptionsForDesktop = config.additionalInputControlBarOptionsForDesktop( userID: dataProvider.userID, @@ -126,6 +126,40 @@ class _TencentCloudChatMessageInputContainerState extends TencentCloudChatState< } } } + void _sendSingleImage({Offset? offset}) async { + final ImagePicker picker = ImagePicker(); + XFile? file = await picker.pickImage(source: ImageSource.gallery); + if (file != null) { + final String fileExtension = file.path.split('.').last.toLowerCase(); + if (['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp'].contains(fileExtension)) { + var compressStr = await Wbfileext.compressImage(file.path!, 0.6); + if (compressStr == null || compressStr == "") { + return; + } + var sendPath = await compressStr.encrypyPath(fileExtension); + _sendFileMessage(filePath: sendPath); + } else if (['mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'mpeg', 'webm', '3gp'].contains(fileExtension)) { + _sendVideoMessage(videoPath: file.path); + } else { + // Unsupported file type + debugPrint('Unsupported file type: $fileExtension'); + } + } + + } + void _sendSingleVideo({Offset? offset}) async { + FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.video); + if (result != null && result.files.isNotEmpty) { + File file = File(result.files.single.path!); + + if (['mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'mpeg', 'webm', '3gp',"MP4"].contains(result.files.single.extension)) { + var encPath = await file.path.encryptVideo(result.files.single.name); + _sendVideoMessage(videoPath: encPath); + }else { + debugPrint('Unsupported video type: ${result.files.single.name}'); + } + } + } void _sendImage({Offset? offset}) async { final ImagePicker picker = ImagePicker(); diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_viewer/tencent_cloud_chat_message_videoplayer.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_viewer/tencent_cloud_chat_message_videoplayer.dart index cfd5dc42..142a8b01 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_viewer/tencent_cloud_chat_message_videoplayer.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_viewer/tencent_cloud_chat_message_videoplayer.dart @@ -113,14 +113,14 @@ class TencentCloudChatMessageVideoPlayerState @override Widget build(BuildContext context) { - if (widget.message.hasRiskContent == true) { - return const Center( - child: Text( - "视频存在风险", - style: TextStyle(color: Colors.white), - ), - ); - } + // if (widget.message.hasRiskContent == true) { + // return const Center( + // child: Text( + // "视频存在风险", + // style: TextStyle(color: Colors.white), + // ), + // ); + // } return FutureBuilder( future: getMessageInfo(), builder: diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart index a682d139..ec449741 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_file.dart @@ -74,6 +74,7 @@ class _TencentCloudChatMessageFileState extends TencentCloudChatMessageState decryptImgPath(String fileName) async { + Future decryptPath({ String fileName = "", bool isImg = true}) async { String? fileFormat; var hasFormat = false; - List imgFormats = [".jpg", ".png", ".gif", ".webp"]; - + List imgFormats = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp']; + if (!isImg) { + imgFormats = ['mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'mpeg', 'webm', '3gp',"MP4"]; + } for (String form in imgFormats) { if (this.contains(form)) { hasFormat = true; @@ -20,7 +25,7 @@ extension Wbfileext on String { .split(".") .length - 1, 0)]; } else { - fileFormat = ".jpg"; + fileFormat = isImg ? ".jpg":".mp4"; } var str = "/"; if (PlatformUtils().isWindows) { @@ -50,4 +55,74 @@ extension Wbfileext on String { return Future.value("${saveDirec}/${saveNewName}"); } + + + + static Future compressImage(String imagePath, double scale) { + // 替换为你的图像文件路径 + final File imageFile = File(imagePath); + + final img.Image? originalImage = img.decodeImage(imageFile.readAsBytesSync()); + if (originalImage == null) { + print('无法解码图像文件'); + return Future(() => null); + } + + final img.Image compressedImage = img.copyResize(originalImage, width: originalImage!.width, + height: originalImage!.height + ); // 调整图像尺寸 + final String compressedImagePath = path.join(path.dirname(imagePath), + '${path.basenameWithoutExtension(imagePath)}_compressed_image.jpg'); + if (!File(compressedImagePath).existsSync()) { + File(compressedImagePath).writeAsBytesSync(img.encodeJpg(compressedImage, quality: 60)); // 压缩质量(0-100) + } + // 压缩后的图像文件 + print('压缩后的图像文件路径:$compressedImagePath'); + return Future(() => compressedImagePath); + } + Future encryptVideo(String fileFormat) async { + File file = File(this!); + final int size = file.lengthSync(); + final String savePath = file.path; + var fileFormat = savePath.split(".")[max(savePath.split(".").length - 1, 0)]; + var encryptPath = savePath.replaceAll(".${fileFormat}", "_encrypt.${fileFormat}"); + var aescode = Uint8List.fromList( aesKey.codeUnits); + if (!File(encryptPath).existsSync()) { + var filedata = file.readAsBytesSync(); + var imgFile = Uint8List.fromList(aescode + filedata); + print("video file data: ${imgFile}"); + + int fileSize = imgFile.lengthInBytes; + File(encryptPath)..createSync(recursive: true)..writeAsBytesSync(imgFile); + } + print("video file path:${encryptPath},file name:${this}"); + + + + return Future.value(encryptPath); + } + Future encrypyPath(String fileFormat) async{ + var path = await compressImage(this, 0.6); + if (path == null) { + print("压缩失败"); + return Future.value(""); + } + File file = File(path!); + final int size = file.lengthSync(); + final String savePath = file.path; + var aescode = Uint8List.fromList( aesKey.codeUnits); + var filedata = file.readAsBytesSync(); + var imgFile = Uint8List.fromList(aescode + filedata); + print("file data: ${imgFile}"); + var fileFormat = savePath.split(".")[max(savePath.split(".").length - 1, 0)]; + var encryptPath = savePath.replaceAll(".${fileFormat}", "_encrypt.${fileFormat}"); + print("file path:${encryptPath},file name:${this}"); + int fileSize = imgFile.lengthInBytes; + if (!File(encryptPath).existsSync()) { + File(encryptPath)..createSync(recursive: true)..writeAsBytesSync(imgFile); + } + return Future.value(encryptPath); + + + } } \ No newline at end of file diff --git a/tencent_cloud_chat_message/pubspec.yaml b/tencent_cloud_chat_message/pubspec.yaml index fc366aa9..d877f783 100644 --- a/tencent_cloud_chat_message/pubspec.yaml +++ b/tencent_cloud_chat_message/pubspec.yaml @@ -33,6 +33,8 @@ dependencies: dotted_border: ^2.1.0 package_info_plus: ^5.0.1 cached_network_image: ^3.3.1 + image: ^4.1.7 + path: ^1.8.1 wb_flutter_tool: git: url: http://jarvis:apple123@192.168.4.209:8081/ios/wb_flutter_tool.git From 631b6dbd10bcda950ad41a3901d687896d638c15 Mon Sep 17 00:00:00 2001 From: "DGG3\\kafuk" Date: Sun, 14 Apr 2024 15:57:36 +0800 Subject: [PATCH 6/6] =?UTF-8?q?1.=E8=A7=86=E9=A2=91=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=9B=9E=E8=B0=83=202.=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=B6=88=E6=81=AF=E5=9C=A8conv=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/utils/tencent_cloud_chat_utils.dart | 20 +++++++++++++++++++ ...cent_cloud_chat_message_separate_data.dart | 2 +- .../tencent_cloud_chat_message_video.dart | 3 +++ .../wb_ext_file_path.dart | 4 +++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart b/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart index 16ff3c23..e7c577eb 100644 --- a/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart +++ b/tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart @@ -12,6 +12,7 @@ import 'package:tencent_cloud_chat/tencent_cloud_chat.dart'; import 'package:tencent_cloud_chat/utils/tencent_cloud_chat_message_calling_message/tencent_cloud_chat_message_calling_message.dart'; import 'package:wb_flutter_tool/wb_flutter_tool.dart'; + class ImageExifInfo { final double width; final double height; @@ -660,10 +661,29 @@ class TencentCloudChatUtils { String lineOne = "[${tL10n.custom}]"; String? lineTwo; IconData? icon; + final customMessage = jsonDecode(customElem!.data!.splitAllExJson()); + String businessID = customMessage["businessID"]; if (customElem?.data == "group_create") { lineOne = "Group chat created successfully!"; } + if (businessID == "dgg_group_businessId") { + lineOne = "[群名片]"; + } else if (businessID == "dgg_businessId") { + lineOne = "[名片]"; + } else if (businessID == "red_packet_tips") { + //红包领取 + lineOne = "[红包变动]"; + } else if (businessID == "red_packet") { + //红包 + lineOne = "[红包]"; + } else if (businessID == "dgg_clearGroupMsg") { + //FIXME:清屏 + + } else if (businessID == "transfer_c2c") { + //转账 + lineOne = "[转账]"; + } if (isVoteMessage(message)) { lineOne = "[${tL10n.poll}]"; } diff --git a/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart b/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart index 043554ed..8e2cf7cc 100644 --- a/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart +++ b/tencent_cloud_chat_message/lib/data/tencent_cloud_chat_message_separate_data.dart @@ -749,7 +749,7 @@ class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier { videoFilePath: videoPath, snapshotPath: snapshotPath, type: fileExtension, - duration: 150, + duration: 1, ); return _sendMessage(messageInfoResult: messageInfo); diff --git a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_video.dart b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_video.dart index b4eef336..55652ade 100644 --- a/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_video.dart +++ b/tencent_cloud_chat_message/lib/tencent_cloud_chat_message_widgets/message_type_builders/tencent_cloud_chat_message_video.dart @@ -794,6 +794,9 @@ class _TencentCloudChatMessageVideoState extends TencentCloudChatMessageState compressImage(String imagePath, double scale) { // 替换为你的图像文件路径