diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bfa5b0..93e865c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 4.0.6 +* Solve the updateSelfInfo exception problem. +* The success of calling the initSDK interface is determined by the code of the return value. Avoid inaccurate judgment when calling the interface multiple times. + # 4.0.5 * Upgrade tencent_cloud_chat_sdk to the minimum version 8.5.6864+6. * Changed the SDK interface call from getConversationListByConversaionIds to getConversationListByConversationIds. @@ -19,12 +23,11 @@ # 4.0.1 * Upgraded the plugin tim_ui_kit_sticker_plugin to 4.0.1. -* Use the 'useTencentCloudChatStickerPackageOldKeys' parameter in StickerPanelConfig to control whether the emoticon is compatible with version 3.x. +* Add the 'useTencentCloudChatStickerPackageOldKeys' parameter in StickerPanelConfig to control whether the emoticon is compatible with version 3.x. # 4.0.0 ## Breaking changes * Upgraded the plugin tim_ui_kit_sticker_plugin to 4.0.0. -* Delete the useQQStickerPackage and unicodeEmojiList parameters in StickerPanelConfig. * Delete the isUseDefaultEmoji parameter in TIMUIKitChatConfig. * Delete the isUseDefaultEmoji parameter in each widget. diff --git a/lib/business_logic/separate_models/tui_profile_view_model.dart b/lib/business_logic/separate_models/tui_profile_view_model.dart index 106f3a6..46ed330 100644 --- a/lib/business_logic/separate_models/tui_profile_view_model.dart +++ b/lib/business_logic/separate_models/tui_profile_view_model.dart @@ -220,50 +220,41 @@ class TUIProfileViewModel extends ChangeNotifier { return res; } - updateUserInfo(String key, dynamic value) { - if (key == "nickName") { - _userProfile?.friendInfo!.userProfile?.nickName = value; + updateUserInfo(V2TimUserFullInfo userFullInfo) { + if (userFullInfo.nickName != null) { + _userProfile?.friendInfo!.userProfile?.nickName = userFullInfo.nickName; } - if (key == "faceUrl") { - _userProfile?.friendInfo!.userProfile?.faceUrl = value; + if (userFullInfo.faceUrl != null) { + _userProfile?.friendInfo!.userProfile?.faceUrl = userFullInfo.faceUrl; } - if (key == "nickName") { - _userProfile?.friendInfo!.userProfile?.nickName = value; + if (userFullInfo.selfSignature != null) { + _userProfile?.friendInfo!.userProfile?.selfSignature = userFullInfo.selfSignature; } - if (key == "selfSignature") { - _userProfile?.friendInfo!.userProfile?.selfSignature = value; + if (userFullInfo.gender != null) { + _userProfile?.friendInfo!.userProfile?.gender = userFullInfo.gender; } - if (key == "gender") { - _userProfile?.friendInfo!.userProfile?.gender = value; + if (userFullInfo.allowType != null) { + _userProfile?.friendInfo!.userProfile?.allowType = userFullInfo.allowType; } - if (key == "allowType") { - _userProfile?.friendInfo!.userProfile?.allowType = value; + if (userFullInfo.customInfo != null) { + _userProfile?.friendInfo!.userProfile?.customInfo = userFullInfo.customInfo; } - if (key == "customInfo") { - _userProfile?.friendInfo!.userProfile?.customInfo = value; + if (userFullInfo.role != null) { + _userProfile?.friendInfo!.userProfile?.role = userFullInfo.role; } - if (key == "role") { - _userProfile?.friendInfo!.userProfile?.role = value; + if (userFullInfo.level != null) { + _userProfile?.friendInfo!.userProfile?.level = userFullInfo.level; } - if (key == "level") { - _userProfile?.friendInfo!.userProfile?.level = value; - } - if (key == "birthday") { - _userProfile?.friendInfo!.userProfile?.birthday = value; + if (userFullInfo.birthday != null) { + _userProfile?.friendInfo!.userProfile?.birthday = userFullInfo.birthday; } } - Future updateSelfInfo(Map newSelfInfo) async { - final res = await _coreServices.setSelfInfo( - userFullInfo: V2TimUserFullInfo.fromJson( - newSelfInfo, - ), - ); + Future updateSelfInfo(V2TimUserFullInfo userFullInfo) async { + final res = await _coreServices.setSelfInfo(userFullInfo: userFullInfo); if (res.code == 0) { - newSelfInfo.forEach((key, value) { - updateUserInfo(key, value); - }); + updateUserInfo(userFullInfo); notifyListeners(); } diff --git a/lib/data_services/core/core_services_implements.dart b/lib/data_services/core/core_services_implements.dart index 15f6a51..0adff1e 100644 --- a/lib/data_services/core/core_services_implements.dart +++ b/lib/data_services/core/core_services_implements.dart @@ -148,7 +148,11 @@ class CoreServicesImpl implements CoreServices { _loginInfo = info; }, onUserSigExpired: listener.onUserSigExpired)); - return result.data; + if (result.code == 0) { + return true; + } else { + return false; + } } /// This method is used for init the TUIKit after you initialized the IM SDK from Native SDK. diff --git a/lib/ui/controller/tim_uikit_profile_controller.dart b/lib/ui/controller/tim_uikit_profile_controller.dart index ae3b0fb..e313d9b 100644 --- a/lib/ui/controller/tim_uikit_profile_controller.dart +++ b/lib/ui/controller/tim_uikit_profile_controller.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:tencent_cloud_chat_sdk/models/v2_tim_callback.dart'; import 'package:tencent_cloud_chat_sdk/models/v2_tim_friend_operation_result.dart'; +import 'package:tencent_cloud_chat_sdk/models/v2_tim_user_full_info.dart'; import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_profile_view_model.dart'; import 'package:tencent_cloud_chat_uikit/ui/widgets/text_input_bottom_sheet.dart'; @@ -84,28 +85,33 @@ class TIMUIKitProfileController { } Future updateSelfSignature(String selfSignature) { - Map infoMap = {"selfSignature": selfSignature}; - return model.updateSelfInfo(infoMap); + V2TimUserFullInfo userFullInfo = V2TimUserFullInfo(); + userFullInfo.selfSignature = selfSignature; + return model.updateSelfInfo(userFullInfo); } Future updateNickName(String nickName) { - Map infoMap = {"nickName": nickName}; - return model.updateSelfInfo(infoMap); + V2TimUserFullInfo userFullInfo = V2TimUserFullInfo(); + userFullInfo.nickName = nickName; + return model.updateSelfInfo(userFullInfo); } /// 1:男 2:女 Future updateGender(int gender) { - Map infoMap = {"gender": gender}; - return model.updateSelfInfo(infoMap); + V2TimUserFullInfo userFullInfo = V2TimUserFullInfo(); + userFullInfo.gender = gender; + return model.updateSelfInfo(userFullInfo); } Future updateBirthday(int birthday) { - Map infoMap = {"birthday": birthday}; - return model.updateSelfInfo(infoMap); + V2TimUserFullInfo userFullInfo = V2TimUserFullInfo(); + userFullInfo.birthday = birthday; + return model.updateSelfInfo(userFullInfo); } Future updateAvatar(String url) { - Map infoMap = {"faceUrl" : url}; - return model.updateSelfInfo(infoMap); + V2TimUserFullInfo userFullInfo = V2TimUserFullInfo(); + userFullInfo.faceUrl = url; + return model.updateSelfInfo(userFullInfo); } } diff --git a/pubspec.yaml b/pubspec.yaml index 9f2de2d..201fc8a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: 4.0.5 +version: 4.0.6 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 @@ -28,7 +28,7 @@ dependencies: get_it: ^7.2.0 dotted_border: ^2.0.0+2 flutter_svg: ^2.0.6 - image_picker: ^0.8.5+3 + image_picker: ^0.8.9 file_picker: ^5.3.0 tencent_super_tooltip: ^0.0.1 better_player_plus: '>=1.0.4 <=1.0.5' @@ -45,7 +45,6 @@ dependencies: shared_preferences: ^2.0.13 scroll_to_index: ^2.1.1 wechat_assets_picker: ^9.3.3 - wechat_camera_picker: ^4.3.4 flutter_easyrefresh: ^2.2.1 extended_image: ^9.0.0 extended_text_field: ^16.0.0