sort and update contact list
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
91b3d19cf0
commit
0224372a66
|
@ -9,4 +9,5 @@ type Contact struct {
|
||||||
SaveHistory string `json:"saveConversationHistory"`
|
SaveHistory string `json:"saveConversationHistory"`
|
||||||
Messages int `json:"numMessages"`
|
Messages int `json:"numMessages"`
|
||||||
Unread int `json:"numUnread"`
|
Unread int `json:"numUnread"`
|
||||||
|
LastMessage string `json:"lastMsgTime"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/constants"
|
"git.openprivacy.ca/flutter/libcwtch-go/constants"
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/features/groups"
|
"git.openprivacy.ca/flutter/libcwtch-go/features/groups"
|
||||||
"git.openprivacy.ca/openprivacy/log"
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
import "cwtch.im/cwtch/event"
|
import "cwtch.im/cwtch/event"
|
||||||
|
|
||||||
|
@ -122,7 +123,17 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
if !set {
|
if !set {
|
||||||
saveHistory = event.DeleteHistoryDefault
|
saveHistory = event.DeleteHistoryDefault
|
||||||
}
|
}
|
||||||
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory, Messages: contactInfo.Timeline.Len(), Unread: 0})
|
contacts = append(contacts, Contact{
|
||||||
|
Name: name,
|
||||||
|
Onion: contactInfo.Onion,
|
||||||
|
Status: contactInfo.State,
|
||||||
|
Picture: cpicPath,
|
||||||
|
Authorization: string(contactInfo.Authorization),
|
||||||
|
SaveHistory: saveHistory,
|
||||||
|
Messages: contactInfo.Timeline.Len(),
|
||||||
|
Unread: 0,
|
||||||
|
LastMessage: strconv.Itoa(getLastMessageTime(&contactInfo.Timeline)),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, _ := json.Marshal(contacts)
|
bytes, _ := json.Marshal(contacts)
|
||||||
|
|
Loading…
Reference in New Issue