Skip to content

Commit cf64a6b

Browse files
authored
Merge pull request #540 from easemob/dev_4.0.0+1
fix: ios image or video message to dart message error.
2 parents c451ec8 + 08af4f9 commit cf64a6b

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
## NEXT
22

3-
## 4.0.0 Easemob IM Flutter 端发版说明
3+
## 4.0.0+1
4+
5+
#### 修复
6+
7+
- 修复图片消息和视频消息转换失败的问题。
8+
9+
## 4.0.0
410

511
#### 新增特性
612

ios/Classes/EMChatManagerWrapper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ - (void)fetchGroupReadAck:(NSDictionary *)param
637637
break;
638638
}
639639
e = nil;
640-
} while (false);
640+
} while (NO);
641641
if (e != nil) {
642642
[weakSelf wrapperCallBack:result
643643
channelName:aChannelName

ios/Classes/EMChatMessage+Helper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ - (NSDictionary *)toJson {
507507
ret[@"secret"] = self.secretKey;
508508
ret[@"displayName"] = self.displayName;
509509
ret[@"localPath"] = self.localPath;
510-
ret[@"sendOriginalImage"] = self.compressionRatio == 1.0 ? @(true) : @(false);
510+
ret[@"sendOriginalImage"] = self.compressionRatio == 1.0 ? @(YES) : @(NO);
511511
return ret;
512512
}
513513
@end

ios/Classes/EMGroup+Helper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (BOOL)isMemberOnly {
4444
if (self.settings.style == EMGroupStylePrivateOnlyOwnerInvite ||
4545
self.settings.style == EMGroupStylePrivateMemberCanInvite ||
4646
self.settings.style == EMGroupStylePublicJoinNeedApproval) {
47-
return true;
47+
return YES;
4848
}
4949

5050
return NO;

lib/src/models/em_message.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ class EMLocationMessageBody extends EMMessageBody {
710710
/// @nodoc
711711
EMLocationMessageBody.fromJson({required Map map})
712712
: super.fromJson(map: map, type: MessageType.LOCATION) {
713-
this.latitude = map["latitude"] ?? 0.0;
714-
this.longitude = map["longitude"] ?? 0.0;
713+
this.latitude = (map["latitude"] ?? 0).toDouble();
714+
this.longitude = (map["longitude"] ?? 0).toDouble();
715715
this._address = map["address"];
716716
this._buildingName = map["buildingName"];
717717
}
@@ -865,8 +865,8 @@ class EMImageMessageBody extends EMFileMessageBody {
865865
this.thumbnailRemotePath = map["thumbnailRemotePath"];
866866
this.thumbnailSecret = map["thumbnailSecret"];
867867
this.sendOriginalImage = map["sendOriginalImage"] ?? false;
868-
this.height = map["height"];
869-
this.width = map["width"];
868+
this.height = (map["height"] ?? 0).toDouble();
869+
this.width = (map["width"] ?? 0).toDouble();
870870
this.thumbnailStatus =
871871
EMFileMessageBody.downloadStatusFromInt(map["thumbnailStatus"]);
872872
}
@@ -879,8 +879,8 @@ class EMImageMessageBody extends EMFileMessageBody {
879879
data.add("thumbnailRemotePath", thumbnailRemotePath);
880880
data.add("thumbnailSecret", thumbnailSecret);
881881
data.add("sendOriginalImage", sendOriginalImage);
882-
data.add("height", height);
883-
data.add("width", width);
882+
data.add("height", height ?? 0.0);
883+
data.add("width", width ?? 0.0);
884884
data.add("thumbnailStatus", downloadStatusToInt(this.thumbnailStatus));
885885
return data;
886886
}
@@ -1008,8 +1008,8 @@ class EMVideoMessageBody extends EMFileMessageBody {
10081008
this.thumbnailLocalPath = map["thumbnailLocalPath"];
10091009
this.thumbnailRemotePath = map["thumbnailRemotePath"];
10101010
this.thumbnailSecret = map["thumbnailSecret"];
1011-
this.height = map["height"];
1012-
this.width = map["width"];
1011+
this.height = (map["height"] ?? 0).toDouble();
1012+
this.width = (map["width"] ?? 0).toDouble();
10131013
this.thumbnailStatus =
10141014
EMFileMessageBody.downloadStatusFromInt(map["thumbnailStatus"]);
10151015
}
@@ -1022,8 +1022,8 @@ class EMVideoMessageBody extends EMFileMessageBody {
10221022
data.add("thumbnailLocalPath", thumbnailLocalPath);
10231023
data.add("thumbnailRemotePath", thumbnailRemotePath);
10241024
data.add("thumbnailSecret", thumbnailSecret);
1025-
data.add("height", height);
1026-
data.add("width", width);
1025+
data.add("height", height ?? 0.0);
1026+
data.add("width", width ?? 0.0);
10271027
data.add("thumbnailStatus", downloadStatusToInt(this.thumbnailStatus));
10281028

10291029
return data;

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: 4.0.0
3+
version: 4.0.0+1
44
homepage: https://www.easemob.com/product/im
55

66
environment:

0 commit comments

Comments
 (0)