From 8d8604abfc66e58c2f93b0f400c8a975f2ffe7f4 Mon Sep 17 00:00:00 2001 From: Gaurav Bansal Date: Wed, 18 Jan 2017 12:44:12 +0530 Subject: [PATCH 1/2] Adding protection mode while writing content to the file --- .../FastImageCache/FICImageFormat.h | 4 +++- .../FastImageCache/FICImageFormat.m | 16 ++++++++++++++++ .../FastImageCache/FICImageTable.m | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.h b/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.h index 31304ef..cc90a31 100644 --- a/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.h +++ b/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.h @@ -147,6 +147,8 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, assign, readonly) NSString *protectionModeString; +@property (nonatomic, assign, readonly) NSDataWritingOptions protectionModeOption; + /** The dictionary representation of this image format. @@ -181,4 +183,4 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)formatWithName:(NSString *)name family:(NSString *)family imageSize:(CGSize)imageSize style:(FICImageFormatStyle)style maximumCount:(NSInteger)maximumCount devices:(FICImageFormatDevices)devices protectionMode:(FICImageFormatProtectionMode)protectionMode; @end -NS_ASSUME_NONNULL_END \ No newline at end of file +NS_ASSUME_NONNULL_END diff --git a/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.m b/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.m index da6eeca..8d7c4ce 100644 --- a/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.m +++ b/FastImageCache/FastImageCache/FastImageCache/FICImageFormat.m @@ -143,6 +143,22 @@ - (NSString *)protectionModeString { return protectionModeString; } +- (NSDataWritingOptions)protectionModeOption { + NSDataWritingOptions protectionModeOption = NSDataWritingFileProtectionNone; + switch (_protectionMode) { + case FICImageFormatProtectionModeNone: + protectionModeOption = NSDataWritingFileProtectionNone; + break; + case FICImageFormatProtectionModeComplete: + protectionModeOption = NSDataWritingFileProtectionComplete; + break; + case FICImageFormatProtectionModeCompleteUntilFirstUserAuthentication: + protectionModeOption = NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication; + break; + } + return protectionModeOption; +} + #pragma mark - Object Lifecycle + (instancetype)formatWithName:(NSString *)name family:(NSString *)family imageSize:(CGSize)imageSize style:(FICImageFormatStyle)style maximumCount:(NSInteger)maximumCount devices:(FICImageFormatDevices)devices protectionMode:(FICImageFormatProtectionMode)protectionMode { diff --git a/FastImageCache/FastImageCache/FastImageCache/FICImageTable.m b/FastImageCache/FastImageCache/FastImageCache/FICImageTable.m index 2925c02..234ecf1 100644 --- a/FastImageCache/FastImageCache/FastImageCache/FICImageTable.m +++ b/FastImageCache/FastImageCache/FastImageCache/FICImageTable.m @@ -714,7 +714,7 @@ - (void)saveMetadata { return; } - BOOL fileWriteResult = [data writeToFile:[self metadataFilePath] atomically:NO]; + BOOL fileWriteResult = [data writeToFile:[self metadataFilePath] options:[_imageFormat protectionModeOption] error:nil]; if (fileWriteResult == NO) { NSString *message = [NSString stringWithFormat:@"*** FIC Error: %s couldn't write metadata for format %@", __PRETTY_FUNCTION__, [_imageFormat name]]; [self.imageCache _logMessage:message]; From e4f0b81e7678eb466aa313d62b1d7e64614bfc4d Mon Sep 17 00:00:00 2001 From: Gaurav Bansal Date: Mon, 30 Jan 2017 18:30:53 +0530 Subject: [PATCH 2/2] Adding podspec file --- FastImageCache.podspec | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 FastImageCache.podspec diff --git a/FastImageCache.podspec b/FastImageCache.podspec new file mode 100644 index 0000000..0ec597b --- /dev/null +++ b/FastImageCache.podspec @@ -0,0 +1,24 @@ + +Pod::Spec.new do |s| + + s.name = "FastImageCache" + s.version = "1.5.1" + s.summary = "iOS library for quickly displaying images while scrolling" + + s.description = <<-DESC +Fast Image Cache is an efficient, persistent, and—above all—fast way to store and retrieve images in your iOS application. Part of any good iOS application's user experience is fast, smooth scrolling, and Fast Image Cache helps make this easier. +A significant burden on performance for graphics-rich applications like Path is image loading. The traditional method of loading individual images from disk is just too slow, especially while scrolling. Fast Image Cache was created specifically to solve this problem. + DESC + + s.homepage = "https://github.com/gauravmnit07/FastImageCache" + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.authors = { "Mallory Paine" => "mallory@path.com", "Michael Potter" => "michael@path.com" } + + s.platform = :ios + s.platform = :ios, '6.0' + s.source = { :git => "https://github.com/gauravmnit07/FastImageCache.git" } + + s.source_files = "FastImageCache/FastImageCache/**/*.{h,m}" + s.requires_arc = true + +end