Skip to content

Commit 7485091

Browse files
authored
Merge pull request #534 from dujiepeng/dev_3.9.7.2
Dev 3.9.7.2
2 parents d931d80 + dc5213c commit 7485091

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## NEXT
22

3+
## 3.9.7+2
4+
5+
修复:
6+
1. 修复 StartCallback() 不会回调的问题;
7+
2. 修复 iOS 根据时间获取消息失败的问题;
8+
39
## 3.9.7+1
410

511
修复:

android/src/main/java/com/easemob/im_flutter_sdk/EMChatManagerWrapper.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public class EMChatManagerWrapper extends EMWrapper implements MethodCallHandler
4646
}
4747

4848

49-
50-
5149
@Override
5250
public void onMethodCall(MethodCall call, Result result) {
5351
JSONObject param = (JSONObject) call.arguments;
@@ -239,6 +237,7 @@ private void ackGroupMessageRead(JSONObject param, String channelName, Result re
239237
asyncRunnable(()->{
240238
try {
241239
EMClient.getInstance().chatManager().ackGroupMessageRead(to, msgId, finalContent);
240+
onSuccess(result, channelName, true);
242241
} catch (HyphenateException e) {
243242
onError(result, e);
244243
}
@@ -436,6 +435,10 @@ public void onError(int code, String desc) {
436435
}
437436

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

537540
private void searchChatMsgFromDB(JSONObject param, String channelName, Result result) throws JSONException {
538541
String keywords = param.getString("keywords");
539-
long timeStamp = param.getLong("timeStamp");
542+
long timestamp = param.getLong("timestamp");
540543
int count = param.getInt("maxCount");
541544
String from = param.getString("from");
542545
EMSearchDirection direction = searchDirectionFromString(param.getString("direction"));
543546
asyncRunnable(() -> {
544-
List<EMMessage> msgList = EMClient.getInstance().chatManager().searchMsgFromDB(keywords, timeStamp, count,
547+
List<EMMessage> msgList = EMClient.getInstance().chatManager().searchMsgFromDB(keywords, timestamp, count,
545548
from, direction);
546549
List<Map> messages = new ArrayList<>();
547550
for (EMMessage msg : msgList) {

android/src/main/java/com/easemob/im_flutter_sdk/EMClientWrapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ else if (EMSDKMethod.isConnected.equals(call.method)) {
129129
else if (EMSDKMethod.renewToken.equals(call.method)){
130130
renewToken(param, call.method, result);
131131
} else if (EMSDKMethod.startCallback.equals(call.method)) {
132-
startCallback();
132+
startCallback(param, call.method, result);
133133
}
134134
else {
135135
super.onMethodCall(call, result);
@@ -311,8 +311,9 @@ private void getLoggedInDevicesFromServer(JSONObject param, String channelName,
311311
});
312312
}
313313

314-
private void startCallback() {
314+
private void startCallback(JSONObject param, String channelName, Result result) {
315315
EMListenerHandle.getInstance().startCallback();
316+
onSuccess(result, channelName, null);
316317
}
317318

318319
private void bindingManagers() {

ios/Classes/EMChatManagerWrapper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,12 +648,12 @@ - (void)searchChatMsgFromDB:(NSDictionary *)param
648648
result:(FlutterResult)result {
649649
__weak typeof(self) weakSelf = self;
650650
NSString *keywords = param[@"keywords"];
651-
long long timeStamp = [param[@"timeStamp"] longLongValue];
651+
long long timestamp = [param[@"timestamp"] longLongValue];
652652
int maxCount = [param[@"maxCount"] intValue];
653653
NSString *from = param[@"from"];
654654
EMMessageSearchDirection direction = [self searchDirectionFromString:param[@"direction"]];
655655
[EMClient.sharedClient.chatManager loadMessagesWithKeyword:keywords
656-
timestamp:timeStamp
656+
timestamp:timestamp
657657
count:maxCount
658658
fromUser:from
659659
searchDirection:direction

ios/Classes/EMClientWrapper.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
170170
channelName:call.method
171171
result:result];
172172
}else if ([ChatStartCallback isEqualToString:call.method]){
173-
[self startCallBack];
173+
[self startCallBack:call.arguments
174+
channelName:call.method
175+
result:result];
174176
}
175177
else {
176178
[super handleMethodCall:call result:result];
@@ -439,8 +441,13 @@ - (void)getLoggedInDevicesFromServer:(NSDictionary *)param channelName:(NSString
439441
}];
440442
}
441443

442-
- (void)startCallBack {
444+
- (void)startCallBack:(NSDictionary *)param channelName:(NSString *)aChannelName result:(FlutterResult)result{
445+
__weak typeof(self)weakSelf = self;
443446
[EMListenerHandle.sharedInstance startCallback];
447+
[weakSelf wrapperCallBack:result
448+
channelName:aChannelName
449+
error:nil
450+
object:nil];
444451
}
445452

446453
#pragma - mark EMClientDelegate

ios/Classes/EMConversationWrapper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ - (void)loadMsgWithMsgType:(NSDictionary *)param channelName:(NSString *)aChanne
345345
__weak typeof(self) weakSelf = self;
346346

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

357357
[conversation loadMessagesWithType:type
358-
timestamp:timeStamp
358+
timestamp:timestamp
359359
count:count
360360
fromUser:sender
361361
searchDirection:direction

ios/Classes/EMOptions+Helper.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ + (EMOptions *)fromJson:(NSDictionary *)aJson {
5757
options.restServer = aJson[@"restServer"];
5858
options.dnsURL = aJson[@"dnsURL"];
5959
options.area = [aJson[@"areaCode"] intValue];
60+
6061
return options;
6162
}
6263
@end

lib/src/em_chat_manager.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ class EMChatManager {
585585
///
586586
/// Param [keywords] The keywords in message.
587587
///
588-
/// Param [timeStamp] The Unix timestamp for search, in milliseconds.
588+
/// Param [timestamp] The Unix timestamp for search, in milliseconds.
589589
///
590590
/// Param [maxCount] The maximum number of messages to retrieve each time.
591591
///
@@ -597,14 +597,14 @@ class EMChatManager {
597597
///
598598
Future<List<EMMessage>> searchMsgFromDB(
599599
String keywords, {
600-
int timeStamp = -1,
600+
int timestamp = -1,
601601
int maxCount = 20,
602602
String from = '',
603603
EMSearchDirection direction = EMSearchDirection.Up,
604604
}) async {
605605
Map req = Map();
606606
req['keywords'] = keywords;
607-
req['timeStamp'] = timeStamp;
607+
req['timestamp'] = timestamp;
608608
req['maxCount'] = maxCount;
609609
req['from'] = from;
610610
req['direction'] = direction == EMSearchDirection.Up ? "up" : "down";

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: im_flutter_sdk
22
description: Integrate the Chat SDK to enjoy the global IM services with high reliability, ultra-low latency, and high concurrency.
3-
version: 3.9.7+1
3+
version: 3.9.7+2
44
homepage: https://www.easemob.com/product/im
55

66
environment:

0 commit comments

Comments
 (0)