Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FGTranslator.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Pod::Spec.new do |s|
s.requires_arc = true

s.dependency 'AFNetworking', '~> 2.0'
s.dependency 'TMCache', '~> 2.0'
s.dependency 'PINCache', '~> 2.1'

end
10 changes: 5 additions & 5 deletions FGTranslator/FGTranslator.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import "FGTranslateRequest.h"
#import "NSString+FGTranslator.h"
#import <AFNetworking.h>
#import <TMCache.h>
#import <PINCache.h>

typedef NSInteger FGTranslatorState;

Expand Down Expand Up @@ -73,7 +73,7 @@ - (id)initGeneric
self.translatorState = FGTranslatorStateInitial;

// limit translation cache to 5 MB
TMCache *cache = [TMCache sharedCache];
PINCache *cache = [PINCache sharedCache];
cache.diskCache.byteLimit = 5000000;
}

Expand All @@ -87,7 +87,7 @@ + (void)flushCredentials

+ (void)flushCache
{
[[TMCache sharedCache] removeAllObjects];
[[PINCache sharedCache] removeAllObjects];
}

- (NSString *)cacheKeyForText:(NSString *)text target:(NSString *)target
Expand All @@ -107,7 +107,7 @@ - (void)cacheText:(NSString *)text translated:(NSString *)translated source:(NSS
if (source)
[cached setObject:source forKey:@"src"];

[[TMCache sharedCache] setObject:cached forKey:[self cacheKeyForText:text target:target]];
[[PINCache sharedCache] setObject:cached forKey:[self cacheKeyForText:text target:target]];
}

- (void)translateText:(NSString *)text
Expand Down Expand Up @@ -150,7 +150,7 @@ - (void)translateText:(NSString *)text
}

// check cache for existing translation
NSDictionary *cached = [[TMCache sharedCache] objectForKey:[self cacheKeyForText:text target:target]];
NSDictionary *cached = [[PINCache sharedCache] objectForKey:[self cacheKeyForText:text target:target]];
if (cached)
{
NSString *cachedSource = [cached objectForKey:@"src"];
Expand Down
2 changes: 1 addition & 1 deletion FGTranslatorDemo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ platform :ios, '7.0'
inhibit_all_warnings!

pod 'AFNetworking', '~> 2.0'
pod 'TMCache', '~> 2.0'
pod 'PINCache', '~> 2.1'
pod 'SVProgressHUD', :head