Merge pull request 'add lastSeenMessageId got contact' (#85) from lastSeenMid into trunk
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #85 Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
commit
d8ed0bf57c
|
@ -14,6 +14,7 @@ type Contact struct {
|
|||
SaveHistory string `json:"saveConversationHistory"`
|
||||
Messages int `json:"numMessages"`
|
||||
Unread int `json:"numUnread"`
|
||||
LastSeenMessageId int `json:"lastSeenMessageId"`
|
||||
LastMessage string `json:"lastMsgTime"`
|
||||
IsGroup bool `json:"isGroup"`
|
||||
GroupServer string `json:"groupServer"`
|
||||
|
|
|
@ -202,6 +202,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
}
|
||||
|
||||
unread := 0
|
||||
lastSeenMessageId := -1
|
||||
lastSeenTimeStr, set := conversationInfo.GetAttribute(attr.LocalScope, attr.ProfileZone, constants2.LastSeenTime)
|
||||
if set {
|
||||
lastSeenTime, err := time.Parse(constants2.DartIso8601, lastSeenTimeStr)
|
||||
|
@ -215,6 +216,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
if msgTime.UTC().After(lastSeenTime.UTC()) {
|
||||
unread++
|
||||
} else {
|
||||
lastSeenMessageId = message.ID
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +267,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
SaveHistory: saveHistory,
|
||||
Messages: count,
|
||||
Unread: unread,
|
||||
LastSeenMessageId: lastSeenMessageId,
|
||||
LastMessage: strconv.Itoa(getLastMessageTime(lastMessage)),
|
||||
IsGroup: conversationInfo.IsGroup(),
|
||||
GroupServer: groupServer,
|
||||
|
|
Reference in New Issue