Skip to content

Commit

Permalink
Project settings updated. ThumbnailService API now is more open
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgarbarev committed Jan 28, 2016
1 parent 1735d39 commit e6bf698
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ThumbnailService.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ThumbnailService'
spec.version = '1.0.4'
spec.version = '1.0.5'
spec.license = 'MIT'

spec.summary = 'Generate thumbnail/preview from any resource (Video, PDF, ALAsset, Huge Picture, WebPage, custom) with efficient and cached way.'
Expand Down
8 changes: 5 additions & 3 deletions ThumbnailService/ThumbnailService.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
FA2677371807AF7F00F5B02B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Aleksey Garbarev";
};
buildConfigurationList = FA26773A1807AF7F00F5B02B /* Build configuration list for PBXProject "ThumbnailService" */;
Expand Down Expand Up @@ -499,6 +499,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -566,7 +567,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "include/$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "armv7 armv7s";
WARNING_CFLAGS = (
"-pedantic",
"-Werror",
Expand All @@ -587,11 +587,11 @@
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "include/$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "armv7 armv7s";
WARNING_CFLAGS = (
"-pedantic",
"-Werror",
Expand All @@ -615,6 +615,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "ThumbnailServiceTests/ThumbnailServiceTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.trasd.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = xctest;
};
Expand All @@ -630,6 +631,7 @@
);
GCC_PRECOMPILE_PREFIX_HEADER = NO;
INFOPLIST_FILE = "ThumbnailServiceTests/ThumbnailServiceTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.trasd.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = xctest;
};
Expand Down
4 changes: 4 additions & 0 deletions ThumbnailService/ThumbnailService/Cache/TSCacheManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Foundation/Foundation.h>
#import "TSFileCache.h"

typedef enum {
TSCacheManagerModeNone = 0,
Expand All @@ -19,6 +20,9 @@ static const TSCacheManagerMode TSCacheManagerModeFileAndMemory = TSCacheManager
@interface TSCacheManager : NSObject

@property (nonatomic) NSUInteger memoryLimitInBytes;
@property (nonatomic) BOOL shouldWriteAsynchronically;
@property (nonatomic) TSFileCacheImageWriteMode imageWriteMode; /* Default: PNG */
@property (nonatomic) CGFloat imageWriteCompressionQuality; /* Default: 0.6. Used only in TSFileCacheImageWriteModeJPG */

- (void)setName:(NSString *)name;
- (NSString *)name;
Expand Down
30 changes: 30 additions & 0 deletions ThumbnailService/ThumbnailService/Cache/TSCacheManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ - (id)init
return self;
}

- (void)setShouldWriteAsynchronically:(BOOL)shouldWriteAsynchronically
{
fileCache.shouldWriteAsynchronically = shouldWriteAsynchronically;
}

- (BOOL)shouldWriteAsynchronically
{
return fileCache.shouldWriteAsynchronically;
}

- (void)setImageWriteMode:(TSFileCacheImageWriteMode)imageWriteMode
{
fileCache.imageWriteMode = imageWriteMode;
}

- (TSFileCacheImageWriteMode)imageWriteMode
{
return fileCache.imageWriteMode;
}

- (void)setImageWriteCompressionQuality:(CGFloat)imageWriteCompressionQuality
{
fileCache.imageWriteCompressionQuality = imageWriteCompressionQuality;
}

- (CGFloat)imageWriteCompressionQuality
{
return fileCache.imageWriteCompressionQuality;
}

- (void)setMemoryLimitInBytes:(NSUInteger)memoryLimitInBytes
{
memoryCache.totalCostLimit = memoryLimitInBytes;
Expand Down
8 changes: 8 additions & 0 deletions ThumbnailService/ThumbnailService/ThumbnailService.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Foundation/Foundation.h>
#import "TSCacheManager.h"
#import "TSRequest.h"
#import "TSRequestGroupSequence.h"

Expand Down Expand Up @@ -35,3 +36,10 @@
- (void)clearFileCache;

@end

@interface ThumbnailService (ExtendedApi)

@property (nonatomic, readonly) TSCacheManager *placeholderCache;
@property (nonatomic, readonly) TSCacheManager *thumbnailsCache;

@end
15 changes: 15 additions & 0 deletions ThumbnailService/ThumbnailService/ThumbnailService.m
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,18 @@ - (void)handleWarning:(NSString *)warningString
}

@end


@implementation ThumbnailService (ExtendedApi)

- (TSCacheManager *)placeholderCache
{
return placeholderCache;
}

- (TSCacheManager *)thumbnailsCache
{
return thumbnailsCache;
}

@end
4 changes: 2 additions & 2 deletions ThumbnailService/ThumbnailServiceTests/RequestGroupTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ - (void) testGroupCancel
[source fire];
});

WaitAndCallInBackground(0.6, ^{
WaitAndCallInBackground(0.8, ^{
[source fire];
});

WaitAndCallInBackground(0.41, ^{
WaitAndCallInBackground(0.6, ^{
[group cancel];
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.trasd.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
FA2675F71806F75E00F5B02B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Aleksey Garbarev";
};
buildConfigurationList = FA2675FA1806F75E00F5B02B /* Build configuration list for PBXProject "ThumbnailServiceDemo" */;
Expand Down Expand Up @@ -403,7 +403,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -418,6 +417,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -442,7 +442,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -474,7 +473,6 @@
FA2676321806F75E00F5B02B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -490,16 +488,15 @@
"-ObjC",
"-all_load",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.trasd.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
FA2676331806F75E00F5B02B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -515,8 +512,8 @@
"-ObjC",
"-all_load",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.trasd.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -48,17 +48,21 @@
ReferencedContainer = "container:ThumbnailServiceDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA2675FE1806F75E00F5B02B"
Expand All @@ -71,12 +75,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA2675FE1806F75E00F5B02B"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.trasd.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down

0 comments on commit e6bf698

Please sign in to comment.