mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'mkirk/cleanup-share-avatars'
This commit is contained in:
commit
e520451996
|
@ -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 a new issue