feat(channel): add getChannelHistoryMessages binding

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
gem
2026-05-07 11:19:10 +08:00
parent 6bcf3de467
commit 39fb9b5cb3
3 changed files with 556 additions and 522 deletions

View File

@@ -100,4 +100,14 @@ public class ChannelManager extends BaseManager {
jsonValue(methodCall, "userIDs")
);
}
public void getChannelHistoryMessages(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getChannelHistoryMessages(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "channelID"),
value(methodCall, "count"),
int2long(methodCall, "sinceSeq")
);
}
}

View File

@@ -17,6 +17,7 @@ public class ChannelManager: BaseServiceManager {
self["getUsersInChannel"] = getUsersInChannel
self["getChannelHistoryMessages"] = getChannelHistoryMessages
self["isJoinChannel"] = isJoinChannel
self["joinChannel"] = joinChannel
self["quitChannel"] = quitChannel
@@ -50,6 +51,10 @@ public class ChannelManager: BaseServiceManager {
methodCall[jsonString: "userIDs"])
}
func getChannelHistoryMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetChannelHistoryMessages(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[int: "count"], methodCall[int64: "sinceSeq"])
}
func isJoinChannel(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkIsJoinChannel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"])
}

View File

@@ -309,6 +309,25 @@ class ChannelManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// Get channel short-term history messages
/// [channelID] Channel ID
/// [count] Number of messages to retrieve
/// [sinceSeq] Internal sequence cursor for pagination (0 for first page)
Future<dynamic> getChannelHistoryMessages({
required String channelID,
int count = 20,
int sinceSeq = 0,
String? operationID,
}) =>
_channel.invokeMethod(
'getChannelHistoryMessages',
_buildParam({
'channelID': channelID,
'count': count,
'sinceSeq': sinceSeq,
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "channelManager";
param = Utils.cleanMap(param);