feat: Upgrade to 2.7.0

This commit is contained in:
anonymous 2024-07-26 10:14:29 +08:00
parent 211dccc9da
commit 9289b5c890
5 changed files with 153 additions and 94 deletions

View File

@ -1,3 +1,9 @@
# 2.7.0
## Breaking Changes
* Upgraded Low-Level Native Chat SDK to 8.0.
# 2.6.0
## Breaking Changes

View File

@ -1241,33 +1241,33 @@ packages:
dependency: transitive
description:
name: tencent_cloud_chat_sdk
sha256: "358e79b51aba5457418d3bb87e0bbd0f088a1eaf4c4463d09bdda93d1d655aa3"
sha256: ec9d338fe3aa82b71cd9c46b0ebe54267ae6a79f03d1b4b4c506b121fe64bd5b
url: "https://pub.dev"
source: hosted
version: "7.9.5672"
version: "8.0.5897"
tencent_cloud_chat_uikit:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.6.0+1"
version: "2.7.0"
tencent_cloud_uikit_core:
dependency: transitive
description:
name: tencent_cloud_uikit_core
sha256: "61a5400b3fe75c00252272469f332e7ec07f6d1932ee636a3f2b919cf9805cb8"
sha256: "987e266dec10801510ada00411ddb063de8129bf550d2d25ba32d88afa272a67"
url: "https://pub.dev"
source: hosted
version: "1.6.0"
version: "1.7.0"
tencent_im_base:
dependency: transitive
description:
name: tencent_im_base
sha256: daee1faac70fdf5fa4a53576db4fb7268ba5d897cc036353d3114a31abb76fb1
sha256: "08790ad86bc780f071975d62aadf1d9b853a7a84d5e2dfb37fceb6977856fbdc"
url: "https://pub.dev"
source: hosted
version: "3.3.775297"
version: "8.0.0"
tencent_im_sdk_plugin_desktop:
dependency: "direct main"
description:
@ -1328,10 +1328,10 @@ packages:
dependency: transitive
description:
name: tim_ui_kit_sticker_plugin
sha256: "1c4164afbe0bd6479faeee70fad328e82666f8b75c8d54382e97fed250452611"
sha256: "723152d3c67636c25b3d14eaca2f81a5e2b75b85603a62ddbe0480db0a9d6488"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.0"
transparent_image:
dependency: transitive
description:

View File

@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';
// ignore: unnecessary_import
import 'dart:typed_data';
@ -48,7 +47,15 @@ class DesktopControlBarItem {
final String? showName;
final double? size;
DesktopControlBarItem({required this.item, this.icon, this.color, this.imgPath, this.svgPath, required this.onClick, this.showName, this.size})
DesktopControlBarItem(
{required this.item,
this.icon,
this.color,
this.imgPath,
this.svgPath,
required this.onClick,
this.showName,
this.size})
: assert(icon != null || TencentUtils.checkString(imgPath) != null || TencentUtils.checkString(svgPath) != null);
}
@ -261,8 +268,11 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
}
String getAbstractMessage(V2TimMessage message) {
final String? customAbstractMessage = widget.model.abstractMessageBuilder != null ? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!) : null;
return customAbstractMessage ?? MessageUtils.getAbstractMessageAsync(widget.model.repliedMessage!, widget.model.groupMemberList ?? []);
final String? customAbstractMessage = widget.model.abstractMessageBuilder != null
? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!)
: null;
return customAbstractMessage ??
MessageUtils.getAbstractMessageAsync(widget.model.repliedMessage!, widget.model.groupMemberList ?? []);
}
_buildRepliedMessage(V2TimMessage? repliedMessage) {
@ -328,8 +338,9 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
entry = null;
}
},
initOffset:
offset != null ? Offset(offset.dx, max(offset.dy, 16)) : Offset(MediaQuery.of(context).size.height * 0.5 + 20, MediaQuery.of(context).size.height * 0.5 - 100),
initOffset: offset != null
? Offset(offset.dx, max(offset.dy, 16))
: Offset(MediaQuery.of(context).size.height * 0.5 + 20, MediaQuery.of(context).size.height * 0.5 - 100),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(8)),
@ -462,13 +473,16 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
inputElem = html.document.getElementById("__file_picker_web-file-input")?.querySelector("input");
fileName = result.files.single.name;
MessageUtils.handleMessageError(model.sendFileMessage(inputElement: inputElem, fileName: fileName, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendFileMessage(inputElement: inputElem, fileName: fileName, convID: convID, convType: convType),
context);
} else {
File file = File(result.files.single.path!);
final int size = file.lengthSync();
final String savePath = file.path;
MessageUtils.handleMessageError(model.sendFileMessage(filePath: savePath, size: size, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendFileMessage(filePath: savePath, size: size, convID: convID, convType: convType), context);
}
} else {
throw TypeError();
@ -490,7 +504,9 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
final alignBox = key.currentContext?.findRenderObject() as RenderBox?;
var offset = alignBox?.localToGlobal(Offset.zero);
final double? dx = (offset?.dx != null) ? offset!.dx : null;
final double? dy = (offset?.dy != null && alignBox?.size.height != null) ? offset!.dy - (widget.chatConfig.desktopStickerPanelHeight + 20) : null;
final double? dy = (offset?.dy != null && alignBox?.size.height != null)
? offset!.dy - (widget.chatConfig.desktopStickerPanelHeight + 20)
: null;
e.onClick((dx != null && dy != null) ? Offset(dx, dy) : null);
},
child: Tooltip(
@ -545,7 +561,10 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
final convID = widget.conversationID;
final convType = widget.conversationType;
MessageUtils.handleMessageError(model.sendImageMessage(inputElement: inputElem, imagePath: tempFile?.path, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendImageMessage(
inputElement: inputElem, imagePath: tempFile?.path, convID: convID, convType: convType),
context);
} catch (e) {
// ignore: avoid_print
outputLogger.i("_sendFileErr: ${e.toString()}");
@ -561,7 +580,8 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
fileContent = videoContent;
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), infoCode: 6660412));
onTIMCallback(
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), infoCode: 6660412));
return;
}
@ -569,7 +589,10 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
final convID = widget.conversationID;
final convType = widget.conversationType;
MessageUtils.handleMessageError(model.sendVideoMessage(inputElement: inputElem, videoPath: tempFile?.path, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendVideoMessage(
inputElement: inputElem, videoPath: tempFile?.path, convID: convID, convType: convType),
context);
} catch (e) {
// ignore: avoid_print
outputLogger.i("_sendFileErr: ${e.toString()}");
@ -582,7 +605,8 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
final originFile = await asset.originFile;
final size = await originFile!.length();
if (size >= 104857600) {
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("发送失败,视频不能大于100MB"), infoCode: 6660405));
onTIMCallback(
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("发送失败,视频不能大于100MB"), infoCode: 6660405));
return;
}
@ -602,7 +626,10 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
quality: 100,
height: 128,
);
MessageUtils.handleMessageError(model.sendVideoMessage(videoPath: filePath, duration: duration, snapshotPath: tempPath, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendVideoMessage(
videoPath: filePath, duration: duration, snapshotPath: tempPath, convID: convID, convType: convType),
context);
} catch (e) {
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频文件异常"), infoCode: 6660415));
}
@ -623,7 +650,8 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
final type = asset.type;
if (filePath != null) {
if (type == AssetType.image) {
MessageUtils.handleMessageError(model.sendImageMessage(imagePath: filePath, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendImageMessage(imagePath: filePath, convID: convID, convType: convType), context);
}
if (type == AssetType.video) {
@ -640,10 +668,13 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
if (result != null && result.files.isNotEmpty) {
File file = File(result.files.single.path!);
final String savePath = file.path;
final String type = TencentUtils.getFileType((savePath.split(".")[savePath.split(".").length - 1]).toLowerCase()).split("/")[0];
final String type =
TencentUtils.getFileType((savePath.split(".")[savePath.split(".").length - 1]).toLowerCase())
.split("/")[0];
if (type == "image") {
MessageUtils.handleMessageError(model.sendImageMessage(imagePath: savePath, convID: convID, convType: convType), context);
MessageUtils.handleMessageError(
model.sendImageMessage(imagePath: savePath, convID: convID, convType: convType), context);
} else if (type == "video") {
String tempPath = (await getTemporaryDirectory()).path + p.basename(savePath) + ".jpeg";
await plugin.getVideoThumbnail(
@ -655,7 +686,9 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
quality: 100,
height: 128,
);
MessageUtils.handleMessageError(model.sendVideoMessage(videoPath: savePath, convID: convID, convType: convType, snapshotPath: tempPath), context);
MessageUtils.handleMessageError(
model.sendVideoMessage(videoPath: savePath, convID: convID, convType: convType, snapshotPath: tempPath),
context);
}
} else {
throw TypeError();
@ -669,7 +702,8 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
}
_sendImageWithConfirmation({String? fileName, Size? fileSize, required String filePath}) async {
final option1 = widget.currentConversation.showName ?? (widget.conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方"));
final option1 =
widget.currentConversation.showName ?? (widget.conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方"));
final size = fileSize ?? await ScreenshotHelper.getImageSize(filePath);
TUIKitWidePopup.showPopupWindow(
@ -716,7 +750,12 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
ElevatedButton(
onPressed: () {
MessageUtils.handleMessageError(
widget.model.sendImageMessage(imagePath: filePath, imageName: fileName, convID: widget.conversationID, convType: widget.conversationType), context);
widget.model.sendImageMessage(
imagePath: filePath,
imageName: fileName,
convID: widget.conversationID,
convType: widget.conversationType),
context);
closeFunc();
},
child: Text(TIM_t("发送")))
@ -724,7 +763,8 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
)
],
),
));
),
);
}
_sendScreenShot() async {
@ -798,7 +838,10 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
child: (onClose) => TIMUIKitSearchMsgDetail(
currentConversation: widget.currentConversation,
keyword: '',
initMessageList: widget.model.getOriginMessageList().getRange(0, min(widget.model.getOriginMessageList().length, 100)).toList(),
initMessageList: widget.model
.getOriginMessageList()
.getRange(0, min(widget.model.getOriginMessageList().length, 100))
.toList(),
onTapConversation: (V2TimConversation conversation, V2TimMessage? message) {},
),
theme: widget.theme);
@ -809,7 +852,10 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
}
List<Widget> generateControlBar(TUIChatSeparateViewModel model, TUITheme theme) {
final List<DesktopControlBarItem> itemsList = [...defaultControlBarItems, ...(widget.chatConfig.additionalDesktopControlBarItems ?? [])];
final List<DesktopControlBarItem> itemsList = [
...defaultControlBarItems,
...(widget.chatConfig.additionalDesktopControlBarItems ?? [])
];
return generateBarIcons(itemsList, theme);
}
@ -934,7 +980,9 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
hintStyle: const TextStyle(
color: Color(0xffAEA4A3),
),
fillColor: widget.backgroundColor ?? theme.desktopChatMessageInputBgColor ?? hexToColor("fafafa"),
fillColor: widget.backgroundColor ??
theme.desktopChatMessageInputBgColor ??
hexToColor("fafafa"),
filled: true,
isDense: true,
hintText: widget.hintText ?? '',
@ -943,8 +991,13 @@ class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldL
specialTextSpanBuilder: PlatformUtils().isWeb
? null
: DefaultSpecialTextSpanBuilder(
isUseQQPackage: (widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackage ?? true) || widget.isUseDefaultEmoji,
isUseTencentCloudChatPackage: widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackage ?? true,
isUseQQPackage: (widget.model.chatConfig.stickerPanelConfig
?.useTencentCloudChatStickerPackage ??
true) ||
widget.isUseDefaultEmoji,
isUseTencentCloudChatPackage:
widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
true,
customEmojiStickerList: widget.customEmojiStickerList,
showAtBackground: true,
)),

View File

@ -1316,26 +1316,26 @@ packages:
dependency: transitive
description:
name: tencent_cloud_chat_sdk
sha256: "358e79b51aba5457418d3bb87e0bbd0f088a1eaf4c4463d09bdda93d1d655aa3"
sha256: ec9d338fe3aa82b71cd9c46b0ebe54267ae6a79f03d1b4b4c506b121fe64bd5b
url: "https://pub.dev"
source: hosted
version: "7.9.5672"
version: "8.0.5897"
tencent_cloud_uikit_core:
dependency: "direct main"
description:
name: tencent_cloud_uikit_core
sha256: "61a5400b3fe75c00252272469f332e7ec07f6d1932ee636a3f2b919cf9805cb8"
sha256: "987e266dec10801510ada00411ddb063de8129bf550d2d25ba32d88afa272a67"
url: "https://pub.dev"
source: hosted
version: "1.6.0"
version: "1.7.0"
tencent_im_base:
dependency: "direct main"
description:
name: tencent_im_base
sha256: daee1faac70fdf5fa4a53576db4fb7268ba5d897cc036353d3114a31abb76fb1
sha256: "08790ad86bc780f071975d62aadf1d9b853a7a84d5e2dfb37fceb6977856fbdc"
url: "https://pub.dev"
source: hosted
version: "3.3.775297"
version: "8.0.0"
tencent_keyboard_visibility:
dependency: "direct main"
description:
@ -1372,10 +1372,10 @@ packages:
dependency: "direct main"
description:
name: tim_ui_kit_sticker_plugin
sha256: "1c4164afbe0bd6479faeee70fad328e82666f8b75c8d54382e97fed250452611"
sha256: "723152d3c67636c25b3d14eaca2f81a5e2b75b85603a62ddbe0480db0a9d6488"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.0"
timing:
dependency: transitive
description:

View File

@ -1,6 +1,6 @@
name: tencent_cloud_chat_uikit
description: A powerful chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences.
version: 2.6.0+2
version: 2.7.0
homepage: https://trtc.io/products/chat?utm_source=gfs&utm_medium=link&utm_campaign=%E6%B8%A0%E9%81%93&_channel_track_key=k6WgfCKn
repository: https://github.com/TencentCloud/chat-uikit-flutter
documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html
@ -61,8 +61,8 @@ dependencies:
uuid: ^3.0.6
open_file: ^3.3.2
tencent_keyboard_visibility: ^1.0.1
tim_ui_kit_sticker_plugin: ^3.1.0
tencent_im_base: ^3.3.775297
tim_ui_kit_sticker_plugin: ^3.2.0
tencent_im_base: ^8.0.0
fc_native_video_thumbnail: any
path: ^1.8.1
tencent_cloud_uikit_core: ^1.6.0