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

V2 #54

Open
wants to merge 6 commits into
base: v2
Choose a base branch
from
Open

V2 #54

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
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
23 changes: 22 additions & 1 deletion tencent_cloud_chat/lib/utils/tencent_cloud_chat_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ 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;
Expand Down Expand Up @@ -194,7 +196,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:
Expand Down Expand Up @@ -659,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}]";
}
Expand Down
3 changes: 3 additions & 0 deletions tencent_cloud_chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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://jarvis:[email protected]:8081/ios/wb_flutter_tool.git

dev_dependencies:
flutter_test:
Expand Down
4 changes: 2 additions & 2 deletions tencent_cloud_chat_common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tencent_cloud_chat_contact/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions tencent_cloud_chat_conversation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ 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
wb_flutter_tool:
git:
url: http://jarvis:[email protected]:8081/ios/wb_flutter_tool.git

dependency_overrides:
tencent_cloud_chat_intl:
Expand Down
4 changes: 2 additions & 2 deletions tencent_cloud_chat_group_profile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -708,6 +713,7 @@ class TencentCloudChatMessageSeparateDataProvider extends ChangeNotifier {
if (imagePath.isEmpty) {
return null;
}

final messageInfo = await TencentCloudChatMessageSDK().createImageMessage(
imagePath: imagePath,
imageName: Pertypath().basename(imagePath),
Expand All @@ -721,24 +727,29 @@ 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,
snapshotPath: snapshotPath,
type: fileExtension,
duration: 150,
duration: 1,
);

return _sendMessage(messageInfoResult: messageInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
Loading