Revision ce32510a ChatSecure/Classes/Model/Yap Storage/OTRMediaItem.m
| ChatSecure/Classes/Model/Yap Storage/OTRMediaItem.m | ||
|---|---|---|
| 329 | 329 |
|
| 330 | 330 |
- (id)yapDatabaseRelationshipEdgeDeleted:(YapDatabaseRelationshipEdge *)edge withReason:(YDB_NotifyReason)reason |
| 331 | 331 |
{
|
| 332 |
//TODO:Delete File because the parent OTRMessage was deleted |
|
| 332 |
//#865 Delete File because the parent OTRMessage was deleted |
|
| 333 |
__block id<OTRThreadOwner> thread = nil; |
|
| 334 |
__block id<OTRMessageProtocol> message = nil; |
|
| 335 |
[OTRDatabaseManager.shared.readOnlyDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
| 336 |
message = [self parentMessageWithTransaction:transaction]; |
|
| 337 |
thread = [message threadOwnerWithTransaction:transaction]; |
|
| 338 |
}]; |
|
| 339 |
if (!message || !thread) {
|
|
| 340 |
DDLogError(@"Missing parent message or thread for media message!"); |
|
| 341 |
return nil; |
|
| 342 |
} |
|
| 343 |
|
|
| 344 |
NSString *buddyUniqueId = [thread threadIdentifier]; |
|
| 345 |
if (!buddyUniqueId) {
|
|
| 346 |
return nil; |
|
| 347 |
} |
|
| 348 |
|
|
| 349 |
[[OTRMediaFileManager sharedInstance] deleteDataForItem:self buddyUniqueId:buddyUniqueId completion:^(BOOL success, NSError *error) {
|
|
| 350 |
if (error) {
|
|
| 351 |
DDLogError(@"ERROR in deleting data for media item"); |
|
| 352 |
} |
|
| 353 |
} completionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)]; |
|
| 354 |
|
|
| 333 | 355 |
return nil; |
| 334 | 356 |
} |
| 335 | 357 |
|
Also available in: Unified diff