OrphanDataCleaner shouldn't delete active thumbnails

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent ae8dbeb8dd
commit a0bd2c2324

@ -26,7 +26,7 @@ public struct MediaGalleryItem: Equatable {
} }
var thumbnailImage: UIImage { var thumbnailImage: UIImage {
guard let image = attachmentStream.thumbnailImage else { guard let image = attachmentStream.thumbnailImage() else {
owsFail("\(logTag) in \(#function) unexpectedly unable to build attachment thumbnail") owsFail("\(logTag) in \(#function) unexpectedly unable to build attachment thumbnail")
return UIImage() return UIImage()
} }

@ -268,8 +268,8 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
// MARK: Lazy Loading // MARK: Lazy Loading
// This should be substantially larger than one screen size so we don't have to call it // This should be substantially larger than one screen size so we don't have to call it
// multiple times in a rapid succession. // multiple times in a rapid succession, but not so large that loading more get's chopping
let kMediaTileViewLoadBatchSize: UInt = 200 let kMediaTileViewLoadBatchSize: UInt = 80
var oldestLoadedItem: MediaGalleryItem? { var oldestLoadedItem: MediaGalleryItem? {
guard let oldestDate = galleryDates.first else { guard let oldestDate = galleryDates.first else {
return nil return nil

@ -29,11 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
// messages received from other clients // messages received from other clients
@property (nullable, nonatomic) NSData *digest; @property (nullable, nonatomic) NSData *digest;
// A serialized image which lives in the db, accessible without additional disk access.
// This is useful for the gallery view which allows us to fetch potentially many
// attachments in a single read.
@property (nullable, readonly) UIImage *thumbnailImage;
// This only applies for attachments being uploaded. // This only applies for attachments being uploaded.
@property (atomic) BOOL isUploaded; @property (atomic) BOOL isUploaded;
@ -51,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSURL *)mediaURL; - (nullable NSURL *)mediaURL;
- (nullable NSString *)filePath; - (nullable NSString *)filePath;
- (nullable NSString *)thumbnailPath;
- (nullable NSData *)readDataFromFileWithError:(NSError **)error; - (nullable NSData *)readDataFromFileWithError:(NSError **)error;
- (BOOL)writeData:(NSData *)data error:(NSError **)error; - (BOOL)writeData:(NSData *)data error:(NSError **)error;

@ -73,6 +73,11 @@ NS_ASSUME_NONNULL_BEGIN
NSString *_Nullable filePath = [attachmentStream filePath]; NSString *_Nullable filePath = [attachmentStream filePath];
OWSAssert(filePath); OWSAssert(filePath);
[attachmentFilePaths addObject:filePath]; [attachmentFilePaths addObject:filePath];
NSString *_Nullable thumbnailPath = [attachmentStream thumbnailPath];
if (thumbnailPath.length > 0) {
[attachmentFilePaths addObject:thumbnailPath];
}
}]; }];
}]; }];

Loading…
Cancel
Save