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) go PeerHandler(onion, gcd.GetUiManager(p.GetOnion()), incSubscribed)
<-incSubscribed <-incSubscribed
// TODO: wait till ACN is 100 and online
if e.Data[event.Status] != "running" { if e.Data[event.Status] != "running" {
p.Listen() p.Listen()
p.StartPeersConnections() p.StartPeersConnections()

View File

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

View File

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

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

View File

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