Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## NEXT

## 3.9.7+2

修复:
1. 修复 StartCallback() 不会回调的问题;
2. 修复 iOS 根据时间获取消息失败的问题;

## 3.9.7+1

修复:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public class EMChatManagerWrapper extends EMWrapper implements MethodCallHandler
}




@Override
public void onMethodCall(MethodCall call, Result result) {
JSONObject param = (JSONObject) call.arguments;
Expand Down Expand Up @@ -239,6 +237,7 @@ private void ackGroupMessageRead(JSONObject param, String channelName, Result re
asyncRunnable(()->{
try {
EMClient.getInstance().chatManager().ackGroupMessageRead(to, msgId, finalContent);
onSuccess(result, channelName, true);
} catch (HyphenateException e) {
onError(result, e);
}
Expand Down Expand Up @@ -436,6 +435,10 @@ public void onError(int code, String desc) {
}

private void loadAllConversations(JSONObject param, String channelName, Result result) throws JSONException {
if (EMClient.getInstance().getCurrentUser() == null || EMClient.getInstance().getCurrentUser().length() == 0) {
onSuccess(result, channelName, new ArrayList<>());
return;
}
List<EMConversation> list = new ArrayList<>(EMClient.getInstance().chatManager().getAllConversations().values());
asyncRunnable(() -> {
boolean retry = false;
Expand Down Expand Up @@ -536,12 +539,12 @@ private void fetchHistoryMessages(JSONObject param, String channelName, Result r

private void searchChatMsgFromDB(JSONObject param, String channelName, Result result) throws JSONException {
String keywords = param.getString("keywords");
long timeStamp = param.getLong("timeStamp");
long timestamp = param.getLong("timestamp");
int count = param.getInt("maxCount");
String from = param.getString("from");
EMSearchDirection direction = searchDirectionFromString(param.getString("direction"));
asyncRunnable(() -> {
List<EMMessage> msgList = EMClient.getInstance().chatManager().searchMsgFromDB(keywords, timeStamp, count,
List<EMMessage> msgList = EMClient.getInstance().chatManager().searchMsgFromDB(keywords, timestamp, count,
from, direction);
List<Map> messages = new ArrayList<>();
for (EMMessage msg : msgList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ else if (EMSDKMethod.isConnected.equals(call.method)) {
else if (EMSDKMethod.renewToken.equals(call.method)){
renewToken(param, call.method, result);
} else if (EMSDKMethod.startCallback.equals(call.method)) {
startCallback();
startCallback(param, call.method, result);
}
else {
super.onMethodCall(call, result);
Expand Down Expand Up @@ -311,8 +311,9 @@ private void getLoggedInDevicesFromServer(JSONObject param, String channelName,
});
}

private void startCallback() {
private void startCallback(JSONObject param, String channelName, Result result) {
EMListenerHandle.getInstance().startCallback();
onSuccess(result, channelName, null);
}

private void bindingManagers() {
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/EMChatManagerWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,12 @@ - (void)searchChatMsgFromDB:(NSDictionary *)param
result:(FlutterResult)result {
__weak typeof(self) weakSelf = self;
NSString *keywords = param[@"keywords"];
long long timeStamp = [param[@"timeStamp"] longLongValue];
long long timestamp = [param[@"timestamp"] longLongValue];
int maxCount = [param[@"maxCount"] intValue];
NSString *from = param[@"from"];
EMMessageSearchDirection direction = [self searchDirectionFromString:param[@"direction"]];
[EMClient.sharedClient.chatManager loadMessagesWithKeyword:keywords
timestamp:timeStamp
timestamp:timestamp
count:maxCount
fromUser:from
searchDirection:direction
Expand Down
11 changes: 9 additions & 2 deletions ios/Classes/EMClientWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
channelName:call.method
result:result];
}else if ([ChatStartCallback isEqualToString:call.method]){
[self startCallBack];
[self startCallBack:call.arguments
channelName:call.method
result:result];
}
else {
[super handleMethodCall:call result:result];
Expand Down Expand Up @@ -439,8 +441,13 @@ - (void)getLoggedInDevicesFromServer:(NSDictionary *)param channelName:(NSString
}];
}

- (void)startCallBack {
- (void)startCallBack:(NSDictionary *)param channelName:(NSString *)aChannelName result:(FlutterResult)result{
__weak typeof(self)weakSelf = self;
[EMListenerHandle.sharedInstance startCallback];
[weakSelf wrapperCallBack:result
channelName:aChannelName
error:nil
object:nil];
}

#pragma - mark EMClientDelegate
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/EMConversationWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ - (void)loadMsgWithMsgType:(NSDictionary *)param channelName:(NSString *)aChanne
__weak typeof(self) weakSelf = self;

EMMessageBodyType type = [EMMessageBody typeFromString:param[@"msgType"]];
long long timeStamp = [param[@"timeStamp"] longLongValue];
long long timestamp = [param[@"timestamp"] longLongValue];
int count = [param[@"count"] intValue];
NSString *sender = param[@"sender"];
EMMessageSearchDirection direction = [self searchDirectionFromString:param[@"direction"]];
Expand All @@ -355,7 +355,7 @@ - (void)loadMsgWithMsgType:(NSDictionary *)param channelName:(NSString *)aChanne
{

[conversation loadMessagesWithType:type
timestamp:timeStamp
timestamp:timestamp
count:count
fromUser:sender
searchDirection:direction
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/EMOptions+Helper.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ + (EMOptions *)fromJson:(NSDictionary *)aJson {
options.restServer = aJson[@"restServer"];
options.dnsURL = aJson[@"dnsURL"];
options.area = [aJson[@"areaCode"] intValue];

return options;
}
@end
6 changes: 3 additions & 3 deletions lib/src/em_chat_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ class EMChatManager {
///
/// Param [keywords] The keywords in message.
///
/// Param [timeStamp] The Unix timestamp for search, in milliseconds.
/// Param [timestamp] The Unix timestamp for search, in milliseconds.
///
/// Param [maxCount] The maximum number of messages to retrieve each time.
///
Expand All @@ -597,14 +597,14 @@ class EMChatManager {
///
Future<List<EMMessage>> searchMsgFromDB(
String keywords, {
int timeStamp = -1,
int timestamp = -1,
int maxCount = 20,
String from = '',
EMSearchDirection direction = EMSearchDirection.Up,
}) async {
Map req = Map();
req['keywords'] = keywords;
req['timeStamp'] = timeStamp;
req['timestamp'] = timestamp;
req['maxCount'] = maxCount;
req['from'] = from;
req['direction'] = direction == EMSearchDirection.Up ? "up" : "down";
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: im_flutter_sdk
description: Integrate the Chat SDK to enjoy the global IM services with high reliability, ultra-low latency, and high concurrency.
version: 3.9.7+1
version: 3.9.7+2
homepage: https://www.easemob.com/product/im

environment:
Expand Down