Debug
This commit is contained in:
parent
9d605c03f0
commit
6bf25e28f7
|
@ -32,11 +32,6 @@ extension Storage {
|
||||||
OWSFileSystem.deleteFileIfExists(path)
|
OWSFileSystem.deleteFileIfExists(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Download new profile picture if needed
|
|
||||||
if contact.profilePictureURL != nil && contact.profilePictureURL != oldContact?.profilePictureURL {
|
|
||||||
let profileManager = SSKEnvironment.shared.profileManager
|
|
||||||
profileManager.downloadAvatar(forUserProfile: contact)
|
|
||||||
}
|
|
||||||
// Post notification
|
// Post notification
|
||||||
let notificationCenter = NotificationCenter.default
|
let notificationCenter = NotificationCenter.default
|
||||||
notificationCenter.post(name: .contactUpdated, object: contact.sessionID)
|
notificationCenter.post(name: .contactUpdated, object: contact.sessionID)
|
||||||
|
|
|
@ -183,10 +183,6 @@ extension MessageReceiver {
|
||||||
// Profile
|
// Profile
|
||||||
updateProfileIfNeeded(publicKey: userPublicKey, name: message.displayName, profilePictureURL: message.profilePictureURL,
|
updateProfileIfNeeded(publicKey: userPublicKey, name: message.displayName, profilePictureURL: message.profilePictureURL,
|
||||||
profileKey: given(message.profileKey) { OWSAES256Key(data: $0)! }, sentTimestamp: message.sentTimestamp!, transaction: transaction)
|
profileKey: given(message.profileKey) { OWSAES256Key(data: $0)! }, sentTimestamp: message.sentTimestamp!, transaction: transaction)
|
||||||
transaction.addCompletionQueue(DispatchQueue.main) {
|
|
||||||
let userProfile = storage.getUser() ?? Contact(sessionID: userPublicKey)
|
|
||||||
SSKEnvironment.shared.profileManager.downloadAvatar(forUserProfile: userProfile)
|
|
||||||
}
|
|
||||||
// Initial configuration sync
|
// Initial configuration sync
|
||||||
if !UserDefaults.standard[.hasSyncedInitialConfiguration] {
|
if !UserDefaults.standard[.hasSyncedInitialConfiguration] {
|
||||||
UserDefaults.standard[.hasSyncedInitialConfiguration] = true
|
UserDefaults.standard[.hasSyncedInitialConfiguration] = true
|
||||||
|
@ -320,8 +316,8 @@ extension MessageReceiver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Profile picture & profile key
|
// Profile picture & profile key
|
||||||
if let profileKey = profileKey, let profilePictureURL = profilePictureURL, profileKey.keyData.count == kAES256_KeyByteLength,
|
if let profileKey = profileKey, let profilePictureURL = profilePictureURL,
|
||||||
profileKey != contact.profileEncryptionKey {
|
profileKey.keyData.count == kAES256_KeyByteLength, profileKey != contact.profileEncryptionKey {
|
||||||
let shouldUpdate: Bool
|
let shouldUpdate: Bool
|
||||||
if isCurrentUser {
|
if isCurrentUser {
|
||||||
shouldUpdate = given(userDefaults[.lastProfilePictureUpdate]) { sentTimestamp > UInt64($0.timeIntervalSince1970 * 1000) } ?? true
|
shouldUpdate = given(userDefaults[.lastProfilePictureUpdate]) { sentTimestamp > UInt64($0.timeIntervalSince1970 * 1000) } ?? true
|
||||||
|
@ -338,6 +334,10 @@ extension MessageReceiver {
|
||||||
}
|
}
|
||||||
// Persist changes
|
// Persist changes
|
||||||
Storage.shared.setContact(contact, using: transaction)
|
Storage.shared.setContact(contact, using: transaction)
|
||||||
|
// Download the profile picture if needed
|
||||||
|
transaction.addCompletionQueue(DispatchQueue.main) {
|
||||||
|
SSKEnvironment.shared.profileManager.downloadAvatar(forUserProfile: contact)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue