Merge pull request #27 from hrxiang/android

upgrade sdk,new add quote message
main
hrxiang 4 years ago committed by GitHub
commit 38cbf47e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      android/build.gradle
  2. 1
      lib/src/enum/message_type.dart
  3. 2
      lib/src/manager/im_message_manager.dart
  4. 34
      lib/src/models/message.dart

@ -52,5 +52,5 @@ android {
}
dependencies {
// implementation 'io.openim:client:0.0.13@aar'
implementation 'io.openim:client-sdk:0.0.8@aar'
implementation 'io.openim:client-sdk:0.0.9@aar'
}

@ -13,6 +13,7 @@ class MessageType {
static const revoke = 111;
static const has_read_receipt = 112;
static const typing = 113;
static const quote = 114;
///
static const accept_friend = 201;

@ -42,7 +42,7 @@ class MessageManager {
required Message message,
String? userID,
String? groupID,
required bool onlineUserOnly,
bool onlineUserOnly = false,
}) {
return _channel.invokeMethod(
'sendMessage',

@ -28,6 +28,7 @@ class Message {
AtElem? atElem;
LocationElem? locationElem;
CustomElem? customElem;
QuoteElem? quoteElem;
Message({
this.clientMsgID,
@ -57,6 +58,7 @@ class Message {
this.atElem,
this.locationElem,
this.customElem,
this.quoteElem,
});
Message.fromJson(Map<String, dynamic> json)
@ -102,6 +104,9 @@ class Message {
customElem = json['customElem'] != null
? CustomElem.fromJson(json['customElem'])
: null;
quoteElem = json['quoteElem'] != null
? QuoteElem.fromJson(json['quoteElem'])
: null;
}
Map<String, dynamic> toJson() {
@ -133,24 +138,22 @@ class Message {
data['atElem'] = this.atElem?.toJson();
data['locationElem'] = this.locationElem?.toJson();
data['customElem'] = this.customElem?.toJson();
data['quoteElem'] = this.quoteElem?.toJson();
return data;
}
@override
bool operator ==(Object other) {
// TODO: implement ==
if (other is Message) {
return other._id == _id;
}
return super == other;
return false;
}
@override
// TODO: implement hashCode
int get hashCode => super.hashCode;
String? get _id =>
clientMsgID == null || clientMsgID!.isEmpty ? serverMsgID : clientMsgID;
String? get _id => clientMsgID;
}
class PictureElem {
@ -426,6 +429,27 @@ class CustomElem {
}
}
class QuoteElem {
String? text;
Message? quoteMessage;
QuoteElem({this.text, this.quoteMessage});
QuoteElem.fromJson(Map<String, dynamic> json) {
text = json['text'];
if (json['quoteMessage'] is Map) {
quoteMessage = Message.fromJson(json['quoteMessage']);
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['text'] = this.text;
data['quoteMessage'] = this.quoteMessage?.toJson();
return data;
}
}
class HaveReadInfo {
String? uid;
List<String>? msgIDList;

Loading…
Cancel
Save