|
|
|
@ -15,6 +15,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
|
|
|
|
|
val contactDatabase = DatabaseFactory.getSessionContactDatabase(context)
|
|
|
|
|
var contact = contactDatabase.getContactWithSessionID(sessionID)
|
|
|
|
|
if (contact == null) contact = Contact(sessionID)
|
|
|
|
|
contact.threadID = DatabaseFactory.getStorage(context).getThreadIdFor(recipient.address)
|
|
|
|
|
if (contact.nickname != displayName) {
|
|
|
|
|
contact.nickname = displayName
|
|
|
|
|
contactDatabase.setContact(contact)
|
|
|
|
@ -34,6 +35,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
|
|
|
|
|
val contactDatabase = DatabaseFactory.getSessionContactDatabase(context)
|
|
|
|
|
var contact = contactDatabase.getContactWithSessionID(sessionID)
|
|
|
|
|
if (contact == null) contact = Contact(sessionID)
|
|
|
|
|
contact.threadID = DatabaseFactory.getStorage(context).getThreadIdFor(recipient.address)
|
|
|
|
|
if (contact.name != profileName) {
|
|
|
|
|
contact.name = profileName
|
|
|
|
|
contactDatabase.setContact(contact)
|
|
|
|
@ -47,6 +49,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
|
|
|
|
|
val contactDatabase = DatabaseFactory.getSessionContactDatabase(context)
|
|
|
|
|
var contact = contactDatabase.getContactWithSessionID(sessionID)
|
|
|
|
|
if (contact == null) contact = Contact(sessionID)
|
|
|
|
|
contact.threadID = DatabaseFactory.getStorage(context).getThreadIdFor(recipient.address)
|
|
|
|
|
if (contact.profilePictureURL != profilePictureURL) {
|
|
|
|
|
contact.profilePictureURL = profilePictureURL
|
|
|
|
|
contactDatabase.setContact(contact)
|
|
|
|
@ -61,6 +64,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
|
|
|
|
|
val contactDatabase = DatabaseFactory.getSessionContactDatabase(context)
|
|
|
|
|
var contact = contactDatabase.getContactWithSessionID(sessionID)
|
|
|
|
|
if (contact == null) contact = Contact(sessionID)
|
|
|
|
|
contact.threadID = DatabaseFactory.getStorage(context).getThreadIdFor(recipient.address)
|
|
|
|
|
if (!contact.profilePictureEncryptionKey.contentEquals(profileKey)) {
|
|
|
|
|
contact.profilePictureEncryptionKey = profileKey
|
|
|
|
|
contactDatabase.setContact(contact)
|
|
|
|
@ -82,6 +86,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
|
|
|
|
|
var contact = contactDatabase.getContactWithSessionID(sessionID)
|
|
|
|
|
if (contact == null) {
|
|
|
|
|
contact = Contact(sessionID)
|
|
|
|
|
contact.threadID = DatabaseFactory.getStorage(context).getThreadIdFor(recipient.address)
|
|
|
|
|
contact.name = DatabaseFactory.getLokiUserDatabase(context).getDisplayName(sessionID) ?: recipient.profileName ?: recipient.name
|
|
|
|
|
contactDatabase.setContact(contact)
|
|
|
|
|
}
|
|
|
|
|