Merge branch 'charlesmchen/avatarSeed'

This commit is contained in:
Matthew Chen 2018-05-14 14:00:30 -04:00
commit ba95034ce7

View file

@ -47,9 +47,17 @@ public class ContactShareViewModel: NSObject {
return avatarImage
}
// TODO: What's the best colorSeed value to use?
var colorSeed = name.displayName
let recipientIds = systemContactsWithSignalAccountPhoneNumbers(contactsManager)
if let firstRecipientId = recipientIds.first {
// Try to use the first signal id as the default
// avatar's color seed, so that it is as consistent
// as possible with the user's avatar in other views.
colorSeed = firstRecipientId
}
let avatarBuilder = OWSContactAvatarBuilder(nonSignalName: displayName,
colorSeed: displayName,
colorSeed: colorSeed,
diameter: UInt(diameter),
contactsManager: contactsManager)
return avatarBuilder.build()