mirror of https://github.com/oxen-io/session-ios
Make things compile again
parent
b218a16b05
commit
d7c71a8c06
@ -0,0 +1,18 @@
|
|||||||
|
#import <SessionMessagingKit/TSAttachment.h>
|
||||||
|
#import "TSMessage.h"
|
||||||
|
|
||||||
|
#ifndef TSAttachment_Albums_h
|
||||||
|
#define TSAttachment_Albums_h
|
||||||
|
|
||||||
|
@interface TSAttachment (Albums)
|
||||||
|
|
||||||
|
- (nullable TSMessage *)fetchAlbumMessageWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
||||||
|
|
||||||
|
// `migrateAlbumMessageId` is only used in the migration to the new multi-attachment message scheme,
|
||||||
|
// and shouldn't be used as a general purpose setter. Instead, `albumMessageId` should be passed as
|
||||||
|
// an initializer param.
|
||||||
|
- (void)migrateAlbumMessageId:(NSString *)albumMesssageId;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,18 @@
|
|||||||
|
#import "TSAttachment+Albums.h"
|
||||||
|
|
||||||
|
@implementation TSAttachment (Albums)
|
||||||
|
|
||||||
|
- (nullable TSMessage *)fetchAlbumMessageWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
|
{
|
||||||
|
if (self.albumMessageId == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
return [TSMessage fetchObjectWithUniqueID:self.albumMessageId transaction:transaction];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)migrateAlbumMessageId:(NSString *)albumMesssageId
|
||||||
|
{
|
||||||
|
self.albumMessageId = albumMesssageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -0,0 +1,19 @@
|
|||||||
|
#import <YapDatabase/YapDatabase.h>
|
||||||
|
#import <SessionMessagingKit/TSAttachmentPointer.h>
|
||||||
|
#import "OWSBackupFragment.h"
|
||||||
|
|
||||||
|
#ifndef TSAttachmentPointer_Backups_h
|
||||||
|
#define TSAttachmentPointer_Backups_h
|
||||||
|
|
||||||
|
@interface TSAttachmentPointer (Backups)
|
||||||
|
|
||||||
|
// Non-nil for attachments which need "lazy backup restore."
|
||||||
|
- (nullable OWSBackupFragment *)lazyRestoreFragment;
|
||||||
|
|
||||||
|
// Marks attachment as needing "lazy backup restore."
|
||||||
|
- (void)markForLazyRestoreWithFragment:(OWSBackupFragment *)lazyRestoreFragment
|
||||||
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,34 @@
|
|||||||
|
#import "TSAttachmentPointer+Backups.h"
|
||||||
|
|
||||||
|
@implementation TSAttachmentPointer (Backups)
|
||||||
|
|
||||||
|
- (nullable OWSBackupFragment *)lazyRestoreFragment
|
||||||
|
{
|
||||||
|
if (!self.lazyRestoreFragmentId) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
OWSBackupFragment *_Nullable backupFragment =
|
||||||
|
[OWSBackupFragment fetchObjectWithUniqueID:self.lazyRestoreFragmentId];
|
||||||
|
OWSAssertDebug(backupFragment);
|
||||||
|
return backupFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)markForLazyRestoreWithFragment:(OWSBackupFragment *)lazyRestoreFragment
|
||||||
|
transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||||
|
{
|
||||||
|
OWSAssertDebug(lazyRestoreFragment);
|
||||||
|
OWSAssertDebug(transaction);
|
||||||
|
|
||||||
|
if (!lazyRestoreFragment.uniqueId) {
|
||||||
|
// If metadata hasn't been saved yet, save now.
|
||||||
|
[lazyRestoreFragment saveWithTransaction:transaction];
|
||||||
|
|
||||||
|
OWSAssertDebug(lazyRestoreFragment.uniqueId);
|
||||||
|
}
|
||||||
|
[self applyChangeToSelfAndLatestCopy:transaction
|
||||||
|
changeBlock:^(TSAttachmentPointer *attachment) {
|
||||||
|
[attachment setLazyRestoreFragmentId:lazyRestoreFragment.uniqueId];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
Loading…
Reference in New Issue