Merge pull request #69 from onerain88/fix_rtm
Fix rtm
commit
31865b82bd
|
@ -477,6 +477,9 @@ namespace LeanCloud.Realtime {
|
||||||
if (conv.TryGetValue("objectId", out object idObj)) {
|
if (conv.TryGetValue("objectId", out object idObj)) {
|
||||||
Id = idObj as string;
|
Id = idObj as string;
|
||||||
}
|
}
|
||||||
|
if (conv.TryGetValue("name", out object nameObj)) {
|
||||||
|
Name = nameObj as string;
|
||||||
|
}
|
||||||
if (conv.TryGetValue("unique", out object uniqueObj)) {
|
if (conv.TryGetValue("unique", out object uniqueObj)) {
|
||||||
Unique = (bool)uniqueObj;
|
Unique = (bool)uniqueObj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,18 +43,21 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
if (members != null) {
|
if (members != null) {
|
||||||
conv.M.AddRange(members);
|
conv.M.AddRange(members);
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(name)) {
|
|
||||||
conv.N = name;
|
|
||||||
}
|
|
||||||
if (temporary) {
|
if (temporary) {
|
||||||
conv.TempConv = temporary;
|
conv.TempConv = temporary;
|
||||||
conv.TempConvTTL = temporaryTtl;
|
conv.TempConvTTL = temporaryTtl;
|
||||||
}
|
}
|
||||||
if (properties != null) {
|
Dictionary<string, object> attrs = new Dictionary<string, object>();
|
||||||
conv.Attr = new JsonObjectMessage {
|
if (!string.IsNullOrEmpty(name)) {
|
||||||
Data = JsonConvert.SerializeObject(LCEncoder.Encode(properties))
|
attrs["name"] = name;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
if (properties != null) {
|
||||||
|
attrs = properties.Union(attrs)
|
||||||
|
.ToDictionary(k => k.Key, v => v.Value);
|
||||||
|
}
|
||||||
|
conv.Attr = new JsonObjectMessage {
|
||||||
|
Data = JsonConvert.SerializeObject(LCEncoder.Encode(attrs))
|
||||||
|
};
|
||||||
if (Client.SignatureFactory != null) {
|
if (Client.SignatureFactory != null) {
|
||||||
LCIMSignature signature = await Client.SignatureFactory.CreateStartConversationSignature(Client.Id, members);
|
LCIMSignature signature = await Client.SignatureFactory.CreateStartConversationSignature(Client.Id, members);
|
||||||
conv.S = signature.Signature;
|
conv.S = signature.Signature;
|
||||||
|
@ -84,6 +87,8 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
conversation.CreatorId = Client.Id;
|
conversation.CreatorId = Client.Id;
|
||||||
conversation.ids = members != null ?
|
conversation.ids = members != null ?
|
||||||
new HashSet<string>(members) : new HashSet<string>();
|
new HashSet<string>(members) : new HashSet<string>();
|
||||||
|
// 将自己加入
|
||||||
|
conversation.ids.Add(Client.Id);
|
||||||
conversation.CreatedAt = DateTime.Parse(response.ConvMessage.Cdate);
|
conversation.CreatedAt = DateTime.Parse(response.ConvMessage.Cdate);
|
||||||
conversation.UpdatedAt = conversation.CreatedAt;
|
conversation.UpdatedAt = conversation.CreatedAt;
|
||||||
return conversation;
|
return conversation;
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
AckCommand ack = response.AckMessage;
|
AckCommand ack = response.AckMessage;
|
||||||
message.Id = ack.Uid;
|
message.Id = ack.Uid;
|
||||||
message.SentTimestamp = ack.T;
|
message.SentTimestamp = ack.T;
|
||||||
|
message.FromClientId = Client.Id;
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue