Merge pull request 'fix p2p get name sync issue; overlay offline contact portraits' (#358) from dan/ui:nameSync into master
the build was successful Details

Reviewed-on: #358
This commit is contained in:
erinn 2020-11-04 13:53:27 -08:00
commit fd45f72a09
5 changed files with 16 additions and 9 deletions

View File

@ -91,6 +91,7 @@ func App(gcd *ui.GrandCentralDispatcher, subscribed chan bool, reloadingAccounts
go PeerHandler(onion, gcd.GetUiManager(p.GetOnion()), incSubscribed)
<-incSubscribed
// TODO: wait till ACN is 100 and online
if e.Data[event.Status] != "running" {
p.Listen()
p.StartPeersConnections()

View File

@ -109,10 +109,10 @@ func PeerHandler(onion string, uiManager ui.Manager, subscribed chan bool) {
if exists && scope == attr.PublicScope {
switch path {
case constants.Name:
peer.SetContactAttribute(onion, attr.GetPublicScope(constants.Name), val)
peer.SetContactAttribute(onion, attr.GetPeerScope(constants.Name), val)
uiManager.UpdateContactDisplayName(onion)
case constants.Picture:
peer.SetContactAttribute(onion, attr.GetPublicScope(constants.Picture), val)
peer.SetContactAttribute(onion, attr.GetPeerScope(constants.Picture), val)
uiManager.UpdateContactPicture(onion)
}
}

View File

@ -66,19 +66,19 @@ func getWithSetDefault(id string, key string, defaultVal string) string {
func GetNick(id string) string {
if isGroup(id) {
nick, exists := the.Peer.GetGroupAttribute(id, attr.GetLocalScope(constants.Name))
if !exists || nick == "" {
if !exists || nick == "" || nick == id {
nick, exists = the.Peer.GetGroupAttribute(id, attr.GetPeerScope(constants.Name))
if !exists {
nick = id
nick = "[" + id + "]"
}
}
return nick
} else {
nick, exists := the.Peer.GetContactAttribute(id, attr.GetLocalScope(constants.Name))
if !exists || nick == "" {
if !exists || nick == "" || nick == id {
nick, exists = the.Peer.GetContactAttribute(id, attr.GetPeerScope(constants.Name))
if !exists {
nick = id
nick = "[" + id + "]"
}
}
return nick
@ -230,7 +230,7 @@ func NewManager(profile string, gcd *GrandCentralDispatcher) Manager {
// Acknowledge acknowledges the given message id in the UI
func (this *manager) Acknowledge(handle, mID string) {
this.gcd.DoIfProfile(this.profile, func() {
this.gcd.DoIfConversation(handle, func(){
this.gcd.DoIfConversation(handle, func() {
this.gcd.PeerAckAlert(mID)
})
})
@ -318,7 +318,7 @@ func (this *manager) AddMessage(handle string, from string, message string, from
updateLastReadTime(handle)
// If the message is not from the user then add it, otherwise, just acknowledge.
if !fromMe || !Acknowledged {
this.gcd.TimelineInterface.AddMessage(this.gcd.TimelineInterface.num()-1)
this.gcd.TimelineInterface.AddMessage(this.gcd.TimelineInterface.num() - 1)
this.gcd.TimelineInterface.RequestEIR()
} else {
this.gcd.Acknowledged(messageID)

@ -1 +1 @@
Subproject commit 925796d468b208787e232c06d18f77c219686a45
Subproject commit 15e3f5ab84473070d16238f36fa04584d46f0bcb

View File

@ -21,6 +21,8 @@ Opaque.PortraitRow {
property bool blocked
portraitOverlayColor: Theme.portraitOverlayOfflineColor
badgeColor: Theme.portraitOnlineBadgeColor
badgeVisible: (Utils.isGroup(handle) && status == Const.state_synced) || (Utils.isPeer(handle) && status == Const.state_authenticated)
@ -115,21 +117,25 @@ Opaque.PortraitRow {
portraitColor = Theme.portraitBlockedBackgroundColor
nameColor = Theme.portraitBlockedTextColor
onionColor = Theme.portraitBlockedTextColor
portraitPerformTransform = true
} else if (status == Const.state_synced || status == Const.state_authenticated) {
portraitBorderColor = Theme.portraitOnlineBorderColor
portraitColor = Theme.portraitOnlineBackgroundColor
nameColor = Theme.portraitOnlineTextColor
onionColor = Theme.portraitOnlineTextColor
portraitPerformTransform = false
} else if (status == Const.state_connected || status == Const.state_connecting) {
portraitBorderColor = Theme.portraitConnectingBorderColor
portraitColor = Theme.portraitConnectingBackgroundColor
nameColor = Theme.portraitConnectingTextColor
onionColor = Theme.portraitConnectingTextColor
portraitPerformTransform = true
} else {
portraitBorderColor = Theme.portraitOfflineBorderColor
portraitColor = Theme.portraitOfflineBackgroundColor
nameColor = Theme.portraitOfflineTextColor
onionColor = Theme.portraitOfflineTextColor
portraitPerformTransform = true
}
}