|
|
@ -14,9 +14,16 @@ extension Storage {
|
|
|
|
|
|
|
|
|
|
|
|
@objc(setContact:usingTransaction:)
|
|
|
|
@objc(setContact:usingTransaction:)
|
|
|
|
public func setContact(_ contact: Contact, using transaction: Any) {
|
|
|
|
public func setContact(_ contact: Contact, using transaction: Any) {
|
|
|
|
(transaction as! YapDatabaseReadWriteTransaction).setObject(contact, forKey: contact.sessionID, inCollection: Storage.contactCollection)
|
|
|
|
let transaction = transaction as! YapDatabaseReadWriteTransaction
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
transaction.setObject(contact, forKey: contact.sessionID, inCollection: Storage.contactCollection)
|
|
|
|
NotificationCenter.default.post(name: .contactUpdated, object: contact.sessionID)
|
|
|
|
transaction.addCompletionQueue(DispatchQueue.main) {
|
|
|
|
|
|
|
|
let notificationCenter = NotificationCenter.default
|
|
|
|
|
|
|
|
notificationCenter.post(name: .contactUpdated, object: contact.sessionID)
|
|
|
|
|
|
|
|
if contact.sessionID == getUserHexEncodedPublicKey() {
|
|
|
|
|
|
|
|
notificationCenter.post(name: Notification.Name(kNSNotificationName_LocalProfileDidChange), object: nil)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
notificationCenter.post(name: Notification.Name(kNSNotificationName_OtherUsersProfileDidChange), object: nil)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|