Brett
2025-06-04 16:10:48 +08:00
parent 7b65537e14
commit b96401de8a
15 changed files with 269 additions and 46 deletions

View File

@@ -4,8 +4,6 @@ import 'dart:developer';
import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import '../models/update_req.dart';
class ConversationManager {
MethodChannel _channel;
late OnConversationListener listener;

View File

@@ -3,8 +3,6 @@ import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import '../models/update_req.dart';
class FriendshipManager {
MethodChannel _channel;
late OnFriendshipListener listener;
@@ -51,22 +49,36 @@ class FriendshipManager {
}));
/// Get Friend Requests Sent to Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient({String? operationID}) => _channel
.invokeMethod(
'getFriendApplicationListAsRecipient',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient(
{GetFriendApplicationListAsRecipientReq? req, String? operationID}) {
if (req != null && req.offset > 0) {
assert(req.count > 0, 'count must be greater than 0');
}
return _channel
.invokeMethod(
'getFriendApplicationListAsRecipient',
_buildParam({
'req': req?.toJson() ?? {},
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
}
/// Get Friend Requests Sent by Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant({String? operationID}) => _channel
.invokeMethod(
'getFriendApplicationListAsApplicant',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant(
{GetFriendApplicationListAsApplicantReq? req, String? operationID}) {
if (req != null && req.offset > 0) {
assert(req.count > 0, 'count must be greater than 0');
}
return _channel
.invokeMethod(
'getFriendApplicationListAsApplicant',
_buildParam({
'req': req?.toJson() ?? {},
"operationID": Utils.checkOperationID(operationID),
}))
.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({

View File

@@ -2,7 +2,6 @@ import 'dart:developer';
import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import 'package:flutter_openim_sdk/src/models/set_group_member_info.dart';
class GroupManager {
MethodChannel _channel;
@@ -257,22 +256,41 @@ class GroupManager {
}));
/// Handle group membership applications received as a group owner or administrator
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient({
GetGroupApplicationListAsRecipientReq? req,
String? operationID,
}) {
if (req != null && req.offset > 0) {
assert(req.count > 0, 'count must be greater than 0');
}
return _channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'req': req?.toJson() ?? {},
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
}
/// Get the list of group membership applications sent by the user
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant({
GetGroupApplicationListAsApplicantReq? req,
String? operationID,
}) {
if (req != null && req.offset > 0) {
assert(req.count > 0, 'count must be greater than 0');
}
return _channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'req': req?.toJson() ?? {},
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
}
/// Accept a group membership application as an administrator or group owner
/// Note: Membership applications require approval from administrators or the group.

View File

@@ -422,3 +422,90 @@ class GroupInviteResult {
return data;
}
}
class GetGroupApplicationListAsRecipientReq {
final List<String> groupIDs;
final List<int> handleResults;
final int offset;
final int count;
GetGroupApplicationListAsRecipientReq({
this.groupIDs = const [],
this.handleResults = const [],
required this.offset,
required this.count,
});
GetGroupApplicationListAsRecipientReq.fromJson(Map<String, dynamic> json)
: groupIDs = json['groupIDs'] == null ? [] : List<String>.from(json['groupIDs'].map((x) => x)),
handleResults = json['handleResults'] == null ? [] : List<int>.from(json['handleResults'].map((x) => x)),
offset = json['offset'],
count = json['count'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['groupIDs'] = groupIDs;
data['handleResults'] = handleResults;
data['offset'] = offset;
data['count'] = count;
return data;
}
@override
String toString() {
return 'GetGroupApplicationListAsRecipientReq{groupIDs: $groupIDs, handleResults: $handleResults, offset: $offset, count: $count}';
}
}
class GetGroupApplicationListAsApplicantReq {
final List<String> groupIDs;
final List<int> handleResults;
final int offset;
final int count;
GetGroupApplicationListAsApplicantReq({
this.groupIDs = const [],
this.handleResults = const [],
required this.offset,
required this.count,
});
GetGroupApplicationListAsApplicantReq.fromJson(Map<String, dynamic> json)
: groupIDs = json['groupIDs'] == null ? [] : List<String>.from(json['groupIDs'].map((x) => x)),
handleResults = json['handleResults'] == null ? [] : List<int>.from(json['handleResults'].map((x) => x)),
offset = json['offset'],
count = json['count'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['groupIDs'] = groupIDs;
data['handleResults'] = handleResults;
data['offset'] = offset;
data['count'] = count;
return data;
}
@override
String toString() {
return 'GetGroupApplicationListAsApplicantReq{groupIDs: $groupIDs, handleResults: $handleResults, offset: $offset, count: $count}';
}
}
class GetGroupApplicationUnhandledCountReq {
final int time;
GetGroupApplicationUnhandledCountReq({this.time = 0});
GetGroupApplicationUnhandledCountReq.fromJson(Map<String, dynamic> json) : time = json['time'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['time'] = time;
return data;
}
@override
String toString() {
return 'GetGroupApplicationUnhandledCountReq{time: $time}';
}
}

View File

@@ -124,6 +124,6 @@ class SearchFriendsInfo extends FriendInfo {
Map<String, dynamic> toJson() {
final data = super.toJson();
data['relationship'] = this.relationship;
return data ?? {};
return data;
}
}

View File

@@ -423,3 +423,78 @@ class UserStatusInfo {
return data;
}
}
class GetFriendApplicationListAsRecipientReq {
final List<int> handleResults;
final int offset;
final int count;
GetFriendApplicationListAsRecipientReq({
this.handleResults = const [],
required this.offset,
required this.count,
});
GetFriendApplicationListAsRecipientReq.fromJson(Map<String, dynamic> json)
: handleResults = json['handleResults'] == null ? [] : List<int>.from(json['handleResults'].map((x) => x)),
offset = json['offset'],
count = json['count'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['handleResults'] = handleResults;
data['offset'] = offset;
data['count'] = count;
return data;
}
@override
String toString() {
return 'GetFriendApplicationListAsRecipientReq{handleResults: $handleResults, offset: $offset, count: $count}';
}
}
class GetFriendApplicationListAsApplicantReq {
final int offset;
final int count;
GetFriendApplicationListAsApplicantReq({
required this.offset,
required this.count,
});
GetFriendApplicationListAsApplicantReq.fromJson(Map<String, dynamic> json)
: offset = json['offset'],
count = json['count'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['offset'] = offset;
data['count'] = count;
return data;
}
@override
String toString() {
return 'GetFriendApplicationListAsApplicantReq{offset: $offset, count: $count}';
}
}
class GetFriendApplicationUnhandledCountReq {
final int time;
GetFriendApplicationUnhandledCountReq({this.time = 0});
GetFriendApplicationUnhandledCountReq.fromJson(Map<String, dynamic> json) : time = json['time'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['time'] = time;
return data;
}
@override
String toString() {
return 'GetSelfUnhandledApplyCountReq{time: $time}';
}
}

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.8.3+hotfix.3.1';
static const version = '3.8.3+hotfix.7';
static const _channel = MethodChannel('flutter_openim_sdk');