Compare commits

...

5 Commits

Author SHA1 Message Date
Brett
92dd3adad5 Correct homepage and other information. 2023-11-17 17:01:22 +08:00
Brett
ebae12f11d fix: 'Fix return value type of 'getFriendsInfo'. 2023-11-17 16:45:22 +08:00
Brett
0dec034a55 Adjust some fields and APIs. 2023-11-17 15:05:27 +08:00
Brett
2b3f062e5c chore: Adjust the default values of some properties. 2023-11-16 18:28:39 +08:00
Brett
a4b52f5895 fix: Fixed some parameter errors. 2023-11-16 16:20:54 +08:00
9 changed files with 42 additions and 40 deletions

View File

@@ -1,3 +1,7 @@
## 3.4.0+1
- Adjust some fields and APIs.
## 3.4.0
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.4.0)

View File

@@ -15,7 +15,7 @@ class FriendshipManager {
/// Query Friend Information
/// [userIDList] List of user IDs
Future<List<FriendInfo>> getFriendsInfo({
Future<List<FullUserInfo>> getFriendsInfo({
required List<String> userIDList,
String? operationID,
}) =>
@@ -26,7 +26,7 @@ class FriendshipManager {
"userIDList": userIDList,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendInfo.fromJson(v)));
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
/// Send a Friend Request, the other party needs to accept the request to become friends.
/// [userID] User ID to be invited
@@ -63,13 +63,13 @@ class FriendshipManager {
.then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// Get Friend List, including friends who have been put into the blacklist
Future<List<FriendInfo>> getFriendList({String? operationID}) => _channel
Future<List<FullUserInfo>> getFriendList({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendInfo.fromJson(v)));
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel

View File

@@ -566,8 +566,6 @@ class GroupManager {
/// Modify the GroupMemberInfo ex field
Future<dynamic> setGroupMemberInfo({
required String groupID,
required String userID,
required GroupMembersInfo groupMembersInfo,
String? operationID,
}) =>

View File

@@ -15,7 +15,7 @@ class UserManager {
/// Get user information
/// [userIDList] List of user IDs
Future<List<UserInfo>> getUsersInfo({
Future<List<FullUserInfo>> getUsersInfo({
required List<String> userIDList,
String? operationID,
}) =>
@@ -26,7 +26,7 @@ class UserManager {
'userIDList': userIDList,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
/// Get information of the currently logged-in user
Future<UserInfo> getSelfUserInfo({
@@ -115,7 +115,7 @@ class UserManager {
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserInfo>> getUsersInfoWithCache(
Future<List<FullUserInfo>> getUsersInfoWithCache(
List<String> userIDs, {
String? groupID,
String? operationID,
@@ -128,7 +128,7 @@ class UserManager {
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => FullUserInfo.fromJson(map)));
}
static Map _buildParam(Map param) {

View File

@@ -25,7 +25,7 @@ class ConversationInfo {
int? recvMsgOpt;
// Number of unread messages in the conversation
int? unreadCount;
int unreadCount = 0;
// Latest message in the conversation
Message? latestMsg;
@@ -72,7 +72,7 @@ class ConversationInfo {
this.showName,
this.faceURL,
this.recvMsgOpt,
this.unreadCount,
this.unreadCount = 0,
this.latestMsg,
this.latestMsgSendTime,
this.draftText,
@@ -87,8 +87,7 @@ class ConversationInfo {
this.msgDestructTime,
});
ConversationInfo.fromJson(Map<String, dynamic> json)
: conversationID = json['conversationID'] {
ConversationInfo.fromJson(Map<String, dynamic> json) : conversationID = json['conversationID'] {
conversationType = json['conversationType'];
userID = json['userID'];
groupID = json['groupID'];
@@ -146,19 +145,14 @@ class ConversationInfo {
bool get isSingleChat => conversationType == ConversationType.single;
// Check if it's a group chat
bool get isGroupChat =>
conversationType == ConversationType.group ||
conversationType == ConversationType.superGroup;
bool get isGroupChat => conversationType == ConversationType.group || conversationType == ConversationType.superGroup;
// Check if it's a valid conversation (not in a group if isNotInGroup is true)
bool get isValid => isSingleChat || (isGroupChat && !isNotInGroup!);
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ConversationInfo &&
runtimeType == other.runtimeType &&
conversationID == other.conversationID;
identical(this, other) || other is ConversationInfo && runtimeType == other.runtimeType && conversationID == other.conversationID;
@override
int get hashCode => conversationID.hashCode;

View File

@@ -920,37 +920,27 @@ class MessageEntity {
/// Group message read information
class GroupHasReadInfo {
/// List of user IDs that have read the message
List<String>? hasReadUserIDList;
/// Total number of messages read
/// Total number of reads
int? hasReadCount;
/// Number of group members when this message was sent
int? groupMemberCount;
int? unreadCount;
GroupHasReadInfo.fromJson(Map<String, dynamic> json) {
if (json['hasReadUserIDList'] == null) {
hasReadUserIDList = <String>[];
} else {
hasReadUserIDList = (json['hasReadUserIDList'] as List).cast<String>();
}
hasReadCount = json['hasReadCount'] ?? 0;
groupMemberCount = json['groupMemberCount'] ?? 0;
unreadCount = json['unreadCount'] ?? 0;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['hasReadUserIDList'] = this.hasReadUserIDList;
data['hasReadCount'] = this.hasReadCount;
data['groupMemberCount'] = this.groupMemberCount;
data['unreadCount'] = this.unreadCount;
return data;
}
}
/// Message read receipt information
class ReadReceiptInfo {
/// Sender's ID
/// Sender ID
String? userID;
/// Group ID

View File

@@ -98,6 +98,22 @@ class FullUserInfo {
return data;
}
String get userID {
return publicInfo?.userID ?? friendInfo?.userID ?? blackInfo?.userID ?? '';
}
String get nickname {
return publicInfo?.nickname ?? friendInfo?.nickname ?? blackInfo?.nickname ?? '';
}
String get faceURL {
return publicInfo?.faceURL ?? friendInfo?.faceURL ?? blackInfo?.faceURL ?? '';
}
String get showName {
return friendInfo?.nickname ?? nickname;
}
}
class PublicUserInfo {

View File

@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class OpenIM {
static const version = '3.4.0';
static const version = '3.4.0+2';
static const _channel = const MethodChannel('flutter_openim_sdk');

View File

@@ -1,8 +1,8 @@
name: flutter_openim_sdk
description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source.
version: 3.4.0
homepage: https://www.rentsoft.cn
repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter
version: 3.4.0+2
homepage: https://www.openim.io
repository: https://github.com/openimsdk/open-im-sdk-flutter
environment:
sdk: ">=2.12.0 <3.0.0"