Remove contact share avatars upon message deletion
// FREEBIE
This commit is contained in:
parent
efa3c81f68
commit
ed2945126a
|
@ -117,6 +117,8 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value);
|
|||
|
||||
@property (nonatomic, readonly, nullable) NSString *avatarAttachmentId;
|
||||
- (nullable TSAttachment *)avatarAttachmentWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
||||
- (void)removeAvatarAttachmentWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
- (void)saveAvatarImage:(UIImage *)image transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
// "Profile" avatars should _not_ be saved to device contacts.
|
||||
@property (nonatomic, readonly) BOOL isProfileAvatar;
|
||||
|
|
|
@ -499,6 +499,13 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
|
|||
self.avatarAttachmentId = attachmentStream.uniqueId;
|
||||
}
|
||||
|
||||
- (void)removeAvatarAttachmentWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
TSAttachmentStream *_Nullable attachment =
|
||||
[TSAttachmentStream fetchObjectWithUniqueID:self.avatarAttachmentId transaction:transaction];
|
||||
[attachment removeWithTransaction:transaction];
|
||||
}
|
||||
|
||||
#pragma mark - Phone Numbers and Recipient IDs
|
||||
|
||||
- (NSArray<NSString *> *)systemContactsWithSignalAccountPhoneNumbers:(id<ContactsManagerProtocol>)contactsManager
|
||||
|
|
|
@ -289,6 +289,10 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
|
|||
[attachment removeWithTransaction:transaction];
|
||||
};
|
||||
|
||||
if (self.contactShare.avatarAttachmentId) {
|
||||
[self.contactShare removeAvatarAttachmentWithTransaction:transaction];
|
||||
}
|
||||
|
||||
// Updates inbox thread preview
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue