├── .gitignore ├── FGTranslator.podspec ├── FGTranslator ├── FGAzureToken.h ├── FGAzureToken.m ├── FGTranslateRequest.h ├── FGTranslateRequest.m ├── FGTranslator.h ├── FGTranslator.m ├── NSString+FGTranslator.h ├── NSString+FGTranslator.m └── XMLDictionary │ ├── XMLDictionary.h │ └── XMLDictionary.m ├── FGTranslatorDemo ├── FGTranslatorDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── FGTranslatorDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── FGTranslatorDemo.xccheckout ├── FGTranslatorDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── Main.storyboard │ ├── FGTranslatorDemo-Info.plist │ ├── FGTranslatorDemo-Prefix.pch │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── Podfile ├── Podfile.lock └── Pods │ ├── AFNetworking │ ├── AFNetworking │ │ ├── AFHTTPRequestOperation.h │ │ ├── AFHTTPRequestOperation.m │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── AFHTTPRequestOperationManager.m │ │ ├── AFHTTPSessionManager.h │ │ ├── AFHTTPSessionManager.m │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFNetworkReachabilityManager.m │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFSecurityPolicy.m │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLConnectionOperation.m │ │ ├── AFURLRequestSerialization.h │ │ ├── AFURLRequestSerialization.m │ │ ├── AFURLResponseSerialization.h │ │ ├── AFURLResponseSerialization.m │ │ ├── AFURLSessionManager.h │ │ └── AFURLSessionManager.m │ ├── LICENSE │ ├── README.md │ └── UIKit+AFNetworking │ │ ├── AFNetworkActivityIndicatorManager.h │ │ ├── AFNetworkActivityIndicatorManager.m │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIAlertView+AFNetworking.m │ │ ├── UIButton+AFNetworking.h │ │ ├── UIButton+AFNetworking.m │ │ ├── UIImage+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.m │ │ ├── UIKit+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.m │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.m │ │ ├── UIWebView+AFNetworking.h │ │ └── UIWebView+AFNetworking.m │ ├── Headers │ ├── Private │ │ ├── AFNetworking │ │ │ ├── AFHTTPRequestOperation.h │ │ │ ├── AFHTTPRequestOperationManager.h │ │ │ ├── AFHTTPSessionManager.h │ │ │ ├── AFNetworkActivityIndicatorManager.h │ │ │ ├── AFNetworkReachabilityManager.h │ │ │ ├── AFNetworking.h │ │ │ ├── AFSecurityPolicy.h │ │ │ ├── AFURLConnectionOperation.h │ │ │ ├── AFURLRequestSerialization.h │ │ │ ├── AFURLResponseSerialization.h │ │ │ ├── AFURLSessionManager.h │ │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ │ ├── UIAlertView+AFNetworking.h │ │ │ ├── UIButton+AFNetworking.h │ │ │ ├── UIImage+AFNetworking.h │ │ │ ├── UIImageView+AFNetworking.h │ │ │ ├── UIKit+AFNetworking.h │ │ │ ├── UIProgressView+AFNetworking.h │ │ │ ├── UIRefreshControl+AFNetworking.h │ │ │ └── UIWebView+AFNetworking.h │ │ ├── PINCache │ │ │ ├── Nullability.h │ │ │ ├── PINCache.h │ │ │ ├── PINDiskCache.h │ │ │ └── PINMemoryCache.h │ │ └── SVProgressHUD │ │ │ ├── SVIndefiniteAnimatedView.h │ │ │ ├── SVProgressHUD.h │ │ │ └── SVRadialGradientLayer.h │ └── Public │ │ ├── AFNetworking │ │ ├── AFHTTPRequestOperation.h │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLRequestSerialization.h │ │ ├── AFURLResponseSerialization.h │ │ ├── AFURLSessionManager.h │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIImage+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── UIKit+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ └── UIWebView+AFNetworking.h │ │ ├── PINCache │ │ ├── Nullability.h │ │ ├── PINCache.h │ │ ├── PINDiskCache.h │ │ └── PINMemoryCache.h │ │ └── SVProgressHUD │ │ ├── SVIndefiniteAnimatedView.h │ │ ├── SVProgressHUD.h │ │ └── SVRadialGradientLayer.h │ ├── Manifest.lock │ ├── PINCache │ ├── LICENSE.txt │ ├── PINCache │ │ ├── Nullability.h │ │ ├── PINCache.h │ │ ├── PINCache.m │ │ ├── PINDiskCache.h │ │ ├── PINDiskCache.m │ │ ├── PINMemoryCache.h │ │ └── PINMemoryCache.m │ └── README.md │ ├── Pods.xcodeproj │ └── project.pbxproj │ ├── SVProgressHUD │ ├── LICENSE.txt │ ├── README.md │ └── SVProgressHUD │ │ ├── SVIndefiniteAnimatedView.h │ │ ├── SVIndefiniteAnimatedView.m │ │ ├── SVProgressHUD.bundle │ │ ├── angle-mask.png │ │ ├── angle-mask@2x.png │ │ ├── angle-mask@3x.png │ │ ├── error.png │ │ ├── error@2x.png │ │ ├── error@3x.png │ │ ├── info.png │ │ ├── info@2x.png │ │ ├── info@3x.png │ │ ├── success.png │ │ ├── success@2x.png │ │ └── success@3x.png │ │ ├── SVProgressHUD.h │ │ ├── SVProgressHUD.m │ │ ├── SVRadialGradientLayer.h │ │ └── SVRadialGradientLayer.m │ └── Target Support Files │ ├── AFNetworking │ ├── AFNetworking-dummy.m │ ├── AFNetworking-prefix.pch │ └── AFNetworking.xcconfig │ ├── PINCache │ ├── PINCache-dummy.m │ ├── PINCache-prefix.pch │ └── PINCache.xcconfig │ ├── Pods │ ├── Pods-acknowledgements.markdown │ ├── Pods-acknowledgements.plist │ ├── Pods-dummy.m │ ├── Pods-frameworks.sh │ ├── Pods-resources.sh │ ├── Pods.debug.xcconfig │ └── Pods.release.xcconfig │ └── SVProgressHUD │ ├── SVProgressHUD-dummy.m │ ├── SVProgressHUD-prefix.pch │ └── SVProgressHUD.xcconfig ├── LICENSE ├── README.md └── fgtranslator_logo.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Xcode 4 | 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | *.moved-aside 17 | DerivedData 18 | *.hmap 19 | *.ipa 20 | *.xcuserstate 21 | -------------------------------------------------------------------------------- /FGTranslator.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "FGTranslator" 4 | s.version = "1.1.2" 5 | s.summary = "iOS library for Google and Bing translation services" 6 | s.homepage = "https://github.com/gpolak/FGTranslator" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | 9 | s.author = { "George Polak" => "george.polak@gmail.com" } 10 | 11 | s.platform = :ios, "7.0" 12 | 13 | s.source = { :git => "https://github.com/gpolak/FGTranslator.git", :tag => "1.1.2" } 14 | 15 | s.source_files = 'FGTranslator', 'FGTranslator/XMLDictionary' 16 | s.requires_arc = true 17 | 18 | s.dependency 'AFNetworking', '~> 2.0' 19 | s.dependency 'PINCache', '~> 2.1' 20 | 21 | end 22 | -------------------------------------------------------------------------------- /FGTranslator/FGAzureToken.h: -------------------------------------------------------------------------------- 1 | // 2 | // FGAzureToken.h 3 | // Fargate 4 | // 5 | // Created by George Polak on 10/9/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface FGAzureToken : NSObject 12 | 13 | /** 14 | * The token itself. 15 | */ 16 | @property (nonatomic, readonly) NSString *token; 17 | /** 18 | * Token expiry 19 | */ 20 | @property (nonatomic, readonly) NSDate *expiry; 21 | 22 | 23 | /** 24 | Initializes an Azure token. 25 | 26 | @params 27 | token: token 28 | expire: token expiry 29 | 30 | @returns 31 | Token instance. 32 | */ 33 | - (id)initWithToken:(NSString *)token expiry:(NSDate *)expiry; 34 | 35 | /** 36 | Determines token validity based on expiration date. 37 | @returns 38 | TRUE if token is valid, FALSE otherwise. 39 | */ 40 | - (BOOL)isValid; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /FGTranslator/FGAzureToken.m: -------------------------------------------------------------------------------- 1 | // 2 | // FGAzureToken.m 3 | // Fargate 4 | // 5 | // Created by George Polak on 10/9/13. 6 | // 7 | // 8 | 9 | #import "FGAzureToken.h" 10 | 11 | @interface FGAzureToken () 12 | 13 | @property (nonatomic) NSString *token; 14 | @property (nonatomic) NSDate *expiry; 15 | 16 | @end 17 | 18 | 19 | @implementation FGAzureToken 20 | 21 | - (id)initWithToken:(NSString *)token expiry:(NSDate *)expiry 22 | { 23 | self = [super init]; 24 | if (self) 25 | { 26 | self.token = token; 27 | self.expiry = expiry; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | return [NSString stringWithFormat:@"token:%@ expiry:%@", self.token, self.expiry]; 36 | } 37 | 38 | - (BOOL)isValid 39 | { 40 | if (!self.token || !self.expiry) 41 | return NO; 42 | 43 | return [self.expiry timeIntervalSinceNow] > 0; 44 | } 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /FGTranslator/FGTranslateRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // FGTranslateRequest.h 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AFNetworking.h" 11 | 12 | extern NSString *const FG_TRANSLATOR_ERROR_DOMAIN; 13 | 14 | typedef NSInteger FGTranslationError; 15 | enum 16 | { 17 | FGTranslationErrorNoToken = 0, 18 | FGTranslationErrorBadRequest = 1, 19 | FGTranslationErrorOther = 2 20 | }; 21 | 22 | 23 | @interface FGTranslateRequest : NSObject 24 | 25 | #pragma mark - Google 26 | 27 | + (AFHTTPRequestOperation *)googleTranslateMessage:(NSString *)message 28 | withSource:(NSString *)source 29 | target:(NSString *)target 30 | key:(NSString *)key 31 | quotaUser:(NSString *)quotaUser 32 | completion:(void (^)(NSString *translatedMessage, NSString *detectedSource, NSError *error))completion; 33 | 34 | + (AFHTTPRequestOperation *)googleDetectLanguage:(NSString *)text 35 | key:(NSString *)key 36 | quotaUser:(NSString *)quotaUser 37 | completion:(void (^)(NSString *detectedSource, float confidence, NSError *error))completion; 38 | 39 | + (AFHTTPRequestOperation *)googleSupportedLanguagesWithKey:(NSString *)key 40 | quotaUser:(NSString *)quotaUser 41 | completion:(void (^)(NSArray *languageCodes, NSError *error))completion; 42 | 43 | 44 | #pragma mark - Bing 45 | 46 | + (AFHTTPRequestOperation *)bingTranslateMessage:(NSString *)message 47 | withSource:(NSString *)source 48 | target:(NSString *)target 49 | clientId:(NSString *)clientId 50 | clientSecret:(NSString *)clientSecret 51 | completion:(void (^)(NSString *translatedMessage, NSString *detectedSource, NSError *error))completion; 52 | 53 | 54 | + (AFHTTPRequestOperation *)bingDetectLanguage:(NSString *)message 55 | clientId:(NSString *)clientId 56 | clientSecret:(NSString *)clientSecret 57 | completion:(void (^)(NSString *detectedLanguage, float confidence, NSError *error))completion; 58 | 59 | + (AFHTTPRequestOperation *)bingSupportedLanguagesWithClienId:(NSString *)clientId 60 | clientSecret:(NSString *)clientSecret 61 | completion:(void (^)(NSArray *languageCodes, NSError *error))completion; 62 | 63 | #pragma mark - Misc 64 | 65 | + (void)flushCredentials; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /FGTranslator/FGTranslator.h: -------------------------------------------------------------------------------- 1 | // 2 | // FGTranslator.h 3 | // Fargate 4 | // 5 | // Created by George Polak on 1/14/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Error domain for FGTranslator errors. 13 | */ 14 | typedef NSInteger FGTranslatorError; 15 | 16 | /** 17 | * FGTranslator specific error 18 | */ 19 | enum FGTranslatorError 20 | { 21 | FGTranslatorErrorUnableToTranslate = 0, 22 | FGTranslatorErrorNetworkError = 1, 23 | FGTranslatorErrorSame = 2, 24 | FGTranslatorErrorTranslationInProgress = 3, 25 | FGTranslatorErrorAlreadyTranslated = 4, 26 | FGTranslatorErrorMissingCredentials = 5 27 | }; 28 | 29 | extern float const FGTranslatorUnknownConfidence; 30 | 31 | @interface FGTranslator : NSObject 32 | { 33 | } 34 | 35 | /** 36 | * Set to 'true' to enable source guessing, false to always respect the 'source' parameter in translate functions. Default true. 37 | */ 38 | @property (nonatomic) BOOL preferSourceGuess; 39 | 40 | /** 41 | * Google API key, if any. 42 | */ 43 | @property (nonatomic, readonly) NSString *googleAPIKey; 44 | /** 45 | * Bing Azure client ID, if any. 46 | */ 47 | @property (nonatomic, readonly) NSString *azureClientId; 48 | /** 49 | * Bing Azure client secret, if any. 50 | */ 51 | @property (nonatomic, readonly) NSString *azureClientSecret; 52 | 53 | /** 54 | * Optional quota throttle to use use with Google Translate. 55 | * https://developers.google.com/analytics/devguides/reporting/realtime/v3/parameters 56 | * 57 | * This option has no effect on Bing Translate. 58 | */ 59 | @property (nonatomic) NSString *quotaUser; 60 | 61 | typedef void (^FGTranslatorCompletionHandler)(NSError *error, NSString *translated, NSString *sourceLanguage); 62 | 63 | /** 64 | * Initialize translator with Google Translate. 65 | 66 | * @param key Google API key 67 | 68 | * @return FGTranslator instance. 69 | */ 70 | - (id)initWithGoogleAPIKey:(NSString *)key; 71 | 72 | /** 73 | * Initialize translator with Bing Translate. 74 | 75 | * @param clientId Azure client ID 76 | * @param clientSecret Azure client secret 77 | 78 | * @return FGTranslator instance. 79 | */ 80 | - (id)initWithBingAzureClientId:(NSString *)clientId secret:(NSString *)secret; 81 | 82 | /** 83 | * Translate text. 84 | 85 | * The translator will attempt to guess the source language, and user the current iPhone locale for the target language. 86 | 87 | * @param text Text to translate. 88 | * @param completion Completion handler. 89 | */ 90 | - (void)translateText:(NSString *)text 91 | completion:(FGTranslatorCompletionHandler)completion; 92 | /** 93 | * Translate text. 94 | 95 | * @param text Text to translate. 96 | * @param source ISO language code of the source text. Leave 'nil' to guess. 97 | * @param target ISO language code of the desired language output. Leave 'nil' to use iPhone's current locale. 98 | * @param completion Completion handler. 99 | 100 | * @discussion If the `preferSourceGuess` property is set to TRUE (default), the translator will ignore the passed-in `source` 101 | * parameter (if any) if it determines a reliable guess can be made. 102 | */ 103 | - (void)translateText:(NSString *)text 104 | withSource:(NSString *)source 105 | target:(NSString *)target 106 | completion:(FGTranslatorCompletionHandler)completion; 107 | 108 | /** 109 | * Detect text language. 110 | 111 | * @param text Text to analyze. 112 | * @param completion Completion handler. 113 | */ 114 | - (void)detectLanguage:(NSString *)text 115 | completion:(void (^)(NSError *error, NSString *detectedSource, float confidence))completion; 116 | 117 | /** 118 | * Return a list of languages supported by either the Google or Bing service. 119 | * @param completion completion handler 120 | */ 121 | - (void)supportedLanguages:(void (^)(NSError *error, NSArray *languageCodes))completion; 122 | 123 | /** 124 | * Cancels the current translation. 125 | */ 126 | - (void)cancel; 127 | 128 | /** 129 | * Flushes the translation cache. 130 | 131 | * Previous translation results are cached (on a per-target-language basis). Call this function to clear the cache. 132 | */ 133 | + (void)flushCache; 134 | 135 | /** 136 | Flush Azure credentials. 137 | 138 | This deletes the existing token, if any. 139 | */ 140 | + (void)flushCredentials; 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /FGTranslator/NSString+FGTranslator.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+FGTranslator.h 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (FGTranslator) 12 | 13 | /** 14 | * @return Number of words in the string. 15 | */ 16 | - (NSUInteger)wordCount; 17 | 18 | /** 19 | * @return Number of word-characters in the string. Ignoring whitespace, etc. 20 | */ 21 | - (NSUInteger)wordCharacterCount; 22 | 23 | /** 24 | * URL encodes string. Does away with some of the omissions from the default NSString encoding function. 25 | 26 | * @param original String to encode. 27 | 28 | * @return Encoded string. 29 | */ 30 | + (NSString *)urlEncodedStringFromString:(NSString *)original; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /FGTranslator/NSString+FGTranslator.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+FGTranslator.m 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import "NSString+FGTranslator.h" 10 | 11 | @implementation NSString (FGTranslator) 12 | 13 | - (NSUInteger)wordCount 14 | { 15 | NSCharacterSet *separators = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 16 | NSArray *words = [self componentsSeparatedByCharactersInSet:separators]; 17 | 18 | NSIndexSet *separatorIndexes = [words indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { 19 | return [obj isEqualToString:@""]; 20 | }]; 21 | 22 | return [words count] - [separatorIndexes count]; 23 | } 24 | 25 | - (NSUInteger)wordCharacterCount 26 | { 27 | NSCharacterSet *separators = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 28 | NSArray *words = [self componentsSeparatedByCharactersInSet:separators]; 29 | 30 | NSUInteger count = 0; 31 | for (NSString *word in words) 32 | count += word.length; 33 | 34 | return count; 35 | } 36 | 37 | + (NSString *)urlEncodedStringFromString:(NSString *)original 38 | { 39 | NSMutableString *escaped = [NSMutableString stringWithString:[original stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 40 | 41 | [escaped replaceOccurrencesOfString:@"$" withString:@"%24" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 42 | [escaped replaceOccurrencesOfString:@"&" withString:@"%26" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 43 | [escaped replaceOccurrencesOfString:@"+" withString:@"%2B" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 44 | [escaped replaceOccurrencesOfString:@"," withString:@"%2C" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 45 | [escaped replaceOccurrencesOfString:@"/" withString:@"%2F" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 46 | [escaped replaceOccurrencesOfString:@":" withString:@"%3A" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 47 | [escaped replaceOccurrencesOfString:@";" withString:@"%3B" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 48 | [escaped replaceOccurrencesOfString:@"=" withString:@"%3D" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 49 | [escaped replaceOccurrencesOfString:@"?" withString:@"%3F" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 50 | [escaped replaceOccurrencesOfString:@"@" withString:@"%40" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 51 | [escaped replaceOccurrencesOfString:@" " withString:@"%20" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 52 | [escaped replaceOccurrencesOfString:@"\t" withString:@"%09" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 53 | [escaped replaceOccurrencesOfString:@"#" withString:@"%23" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 54 | [escaped replaceOccurrencesOfString:@"<" withString:@"%3C" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 55 | [escaped replaceOccurrencesOfString:@">" withString:@"%3E" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 56 | [escaped replaceOccurrencesOfString:@"\"" withString:@"%22" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 57 | [escaped replaceOccurrencesOfString:@"\n" withString:@"%0A" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [escaped length])]; 58 | 59 | return escaped; 60 | } 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /FGTranslator/XMLDictionary/XMLDictionary.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDictionary.h 3 | // 4 | // Version 1.4 5 | // 6 | // Created by Nick Lockwood on 15/11/2010. 7 | // Copyright 2010 Charcoal Design. All rights reserved. 8 | // 9 | // Get the latest version of XMLDictionary from here: 10 | // 11 | // https://github.com/nicklockwood/XMLDictionary 12 | // 13 | // This software is provided 'as-is', without any express or implied 14 | // warranty. In no event will the authors be held liable for any damages 15 | // arising from the use of this software. 16 | // 17 | // Permission is granted to anyone to use this software for any purpose, 18 | // including commercial applications, and to alter it and redistribute it 19 | // freely, subject to the following restrictions: 20 | // 21 | // 1. The origin of this software must not be misrepresented; you must not 22 | // claim that you wrote the original software. If you use this software 23 | // in a product, an acknowledgment in the product documentation would be 24 | // appreciated but is not required. 25 | // 26 | // 2. Altered source versions must be plainly marked as such, and must not be 27 | // misrepresented as being the original software. 28 | // 29 | // 3. This notice may not be removed or altered from any source distribution. 30 | // 31 | 32 | #import 33 | #pragma GCC diagnostic push 34 | #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" 35 | 36 | 37 | typedef NS_ENUM(NSInteger, XMLDictionaryAttributesMode) 38 | { 39 | XMLDictionaryAttributesModePrefixed = 0, //default 40 | XMLDictionaryAttributesModeDictionary, 41 | XMLDictionaryAttributesModeUnprefixed, 42 | XMLDictionaryAttributesModeDiscard 43 | }; 44 | 45 | 46 | typedef NS_ENUM(NSInteger, XMLDictionaryNodeNameMode) 47 | { 48 | XMLDictionaryNodeNameModeRootOnly = 0, //default 49 | XMLDictionaryNodeNameModeAlways, 50 | XMLDictionaryNodeNameModeNever 51 | }; 52 | 53 | 54 | static NSString *const XMLDictionaryAttributesKey = @"__attributes"; 55 | static NSString *const XMLDictionaryCommentsKey = @"__comments"; 56 | static NSString *const XMLDictionaryTextKey = @"__text"; 57 | static NSString *const XMLDictionaryNodeNameKey = @"__name"; 58 | static NSString *const XMLDictionaryAttributePrefix = @"_"; 59 | 60 | 61 | @interface XMLDictionaryParser : NSObject 62 | 63 | + (XMLDictionaryParser *)sharedInstance; 64 | 65 | @property (nonatomic, assign) BOOL collapseTextNodes; // defaults to YES 66 | @property (nonatomic, assign) BOOL stripEmptyNodes; // defaults to YES 67 | @property (nonatomic, assign) BOOL trimWhiteSpace; // defaults to YES 68 | @property (nonatomic, assign) BOOL alwaysUseArrays; // defaults to NO 69 | @property (nonatomic, assign) BOOL preserveComments; // defaults to NO 70 | @property (nonatomic, assign) BOOL wrapRootNode; // defaults to NO 71 | 72 | @property (nonatomic, assign) XMLDictionaryAttributesMode attributesMode; 73 | @property (nonatomic, assign) XMLDictionaryNodeNameMode nodeNameMode; 74 | 75 | - (NSDictionary *)dictionaryWithParser:(NSXMLParser *)parser; 76 | - (NSDictionary *)dictionaryWithData:(NSData *)data; 77 | - (NSDictionary *)dictionaryWithString:(NSString *)string; 78 | - (NSDictionary *)dictionaryWithFile:(NSString *)path; 79 | 80 | @end 81 | 82 | 83 | @interface NSDictionary (XMLDictionary) 84 | 85 | + (NSDictionary *)dictionaryWithXMLParser:(NSXMLParser *)parser; 86 | + (NSDictionary *)dictionaryWithXMLData:(NSData *)data; 87 | + (NSDictionary *)dictionaryWithXMLString:(NSString *)string; 88 | + (NSDictionary *)dictionaryWithXMLFile:(NSString *)path; 89 | 90 | - (NSDictionary *)attributes; 91 | - (NSDictionary *)childNodes; 92 | - (NSArray *)comments; 93 | - (NSString *)nodeName; 94 | - (NSString *)innerText; 95 | - (NSString *)innerXML; 96 | - (NSString *)XMLString; 97 | 98 | - (NSArray *)arrayValueForKeyPath:(NSString *)keyPath; 99 | - (NSString *)stringValueForKeyPath:(NSString *)keyPath; 100 | - (NSDictionary *)dictionaryValueForKeyPath:(NSString *)keyPath; 101 | 102 | @end 103 | 104 | 105 | @interface NSString (XMLDictionary) 106 | 107 | - (NSString *)XMLEncodedString; 108 | 109 | @end 110 | 111 | 112 | #pragma GCC diagnostic pop 113 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo.xcworkspace/xcshareddata/FGTranslatorDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | CDF00E31-F0B6-4867-A563-B89FD708A880 9 | IDESourceControlProjectName 10 | FGTranslatorDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | CFFC5384449AEE3212E2994529168D0081744272 14 | ssh://github.com/gpolak/FGTranslator.git 15 | 16 | IDESourceControlProjectPath 17 | FGTranslatorDemo/FGTranslatorDemo.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | CFFC5384449AEE3212E2994529168D0081744272 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/gpolak/FGTranslator.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | CFFC5384449AEE3212E2994529168D0081744272 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | CFFC5384449AEE3212E2994529168D0081744272 36 | IDESourceControlWCCName 37 | FGTranslator 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 37 | 48 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/FGTranslatorDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/FGTranslatorDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "FGTranslator.h" 12 | #import "SVProgressHUD.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (nonatomic, weak) IBOutlet UITextView *textView; 17 | 18 | @end 19 | 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad 24 | { 25 | [super viewDidLoad]; 26 | 27 | // pre-load the text view 28 | self.textView.text = @"Bonjour!"; 29 | 30 | // not needed in production code, but making sure the demo is clean on each run 31 | [FGTranslator flushCache]; 32 | [FGTranslator flushCredentials]; 33 | } 34 | 35 | - (FGTranslator *)translator { 36 | /* 37 | * using Bing Translate 38 | * 39 | * Note: The client id and secret here is very limited and is included for demo purposes only. 40 | * You must use your own credentials for production apps. 41 | */ 42 | FGTranslator *translator = [[FGTranslator alloc] initWithBingAzureClientId:@"fgtranslator-demo" secret:@"GrsgBiUCKACMB+j2TVOJtRboyRT8Q9WQHBKJuMKIxsU="]; 43 | 44 | // or use Google Translate 45 | 46 | // using Google Translate 47 | // translator = [[FGTranslator alloc] initWithGoogleAPIKey:@"your_google_key"]; 48 | 49 | return translator; 50 | } 51 | 52 | - (NSLocale *)currentLocale { 53 | NSLocale *locale = [NSLocale currentLocale]; 54 | #if TARGET_IPHONE_SIMULATOR 55 | // handling Apple bug 56 | // http://stackoverflow.com/a/26769277/211692 57 | return [NSLocale localeWithLocaleIdentifier:[locale localeIdentifier]]; 58 | #else 59 | return locale; 60 | #endif 61 | } 62 | 63 | - (IBAction)translate:(UIButton *)sender 64 | { 65 | [SVProgressHUD show]; 66 | 67 | [self.textView resignFirstResponder]; 68 | 69 | [self.translator translateText:self.textView.text 70 | completion:^(NSError *error, NSString *translated, NSString *sourceLanguage) 71 | { 72 | if (error) 73 | { 74 | [self showErrorWithError:error]; 75 | 76 | [SVProgressHUD dismiss]; 77 | } 78 | else 79 | { 80 | NSString *fromLanguage = [[self currentLocale] displayNameForKey:NSLocaleIdentifier value:sourceLanguage]; 81 | 82 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:fromLanguage ? [NSString stringWithFormat:@"from %@", fromLanguage] : nil 83 | message:translated 84 | delegate:nil 85 | cancelButtonTitle:@"OK" 86 | otherButtonTitles:nil]; 87 | [alert show]; 88 | 89 | [SVProgressHUD dismiss]; 90 | } 91 | }]; 92 | } 93 | 94 | - (IBAction)detect:(UIButton *)sender 95 | { 96 | [SVProgressHUD show]; 97 | 98 | [self.textView resignFirstResponder]; 99 | 100 | 101 | [self.translator detectLanguage:self.textView.text completion:^(NSError *error, NSString *detectedSource, float confidence) 102 | { 103 | if (error) 104 | { 105 | [self showErrorWithError:error]; 106 | 107 | [SVProgressHUD dismiss]; 108 | } 109 | else 110 | { 111 | NSString *fromLanguage = [[self currentLocale] displayNameForKey:NSLocaleIdentifier value:detectedSource]; 112 | 113 | NSString *confidenceMessage = confidence == FGTranslatorUnknownConfidence 114 | ? @"unknown confidence" 115 | : [NSString stringWithFormat:@"%.1f%% sure", confidence * 100]; 116 | 117 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:fromLanguage 118 | message:confidenceMessage 119 | delegate:nil 120 | cancelButtonTitle:@"OK" 121 | otherButtonTitles:nil]; 122 | [alert show]; 123 | 124 | [SVProgressHUD dismiss]; 125 | } 126 | }]; 127 | } 128 | 129 | - (IBAction)supportedLanguages:(id)sender 130 | { 131 | [SVProgressHUD show]; 132 | 133 | [self.textView resignFirstResponder]; 134 | 135 | [self.translator supportedLanguages:^(NSError *error, NSArray *languageCodes) 136 | { 137 | if (error) 138 | { 139 | [self showErrorWithError:error]; 140 | 141 | [SVProgressHUD dismiss]; 142 | } 143 | else 144 | { 145 | NSMutableString *languageMessage = [NSMutableString new]; 146 | NSLocale *locale = [self currentLocale]; 147 | for (NSString *code in languageCodes) 148 | [languageMessage appendFormat:@"%@\n", [locale displayNameForKey:NSLocaleIdentifier value:code]]; 149 | 150 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%ld Supported Languages", (long)languageCodes.count] 151 | message:languageMessage 152 | delegate:nil 153 | cancelButtonTitle:@"OK" 154 | otherButtonTitles:nil]; 155 | [alert show]; 156 | 157 | [SVProgressHUD dismiss]; 158 | } 159 | }]; 160 | } 161 | 162 | - (void)showErrorWithError:(NSError *)error 163 | { 164 | NSLog(@"FGTranslator failed with error: %@", error); 165 | 166 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" 167 | message:error.localizedDescription 168 | delegate:nil 169 | cancelButtonTitle:@"OK" otherButtonTitles:nil]; 170 | [alert show]; 171 | } 172 | 173 | @end 174 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FGTranslatorDemo/FGTranslatorDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FGTranslatorDemo 4 | // 5 | // Created by George Polak on 8/12/14. 6 | // Copyright (c) 2014 George Polak. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | inhibit_all_warnings! 4 | 5 | pod 'AFNetworking', '~> 2.0' 6 | pod 'PINCache', '~> 2.1' 7 | pod 'SVProgressHUD', :head 8 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.6.3): 3 | - AFNetworking/NSURLConnection (= 2.6.3) 4 | - AFNetworking/NSURLSession (= 2.6.3) 5 | - AFNetworking/Reachability (= 2.6.3) 6 | - AFNetworking/Security (= 2.6.3) 7 | - AFNetworking/Serialization (= 2.6.3) 8 | - AFNetworking/UIKit (= 2.6.3) 9 | - AFNetworking/NSURLConnection (2.6.3): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.6.3): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.6.3) 18 | - AFNetworking/Security (2.6.3) 19 | - AFNetworking/Serialization (2.6.3) 20 | - AFNetworking/UIKit (2.6.3): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - PINCache (2.1.2) 24 | - SVProgressHUD (HEAD based on 2.0-beta) 25 | 26 | DEPENDENCIES: 27 | - AFNetworking (~> 2.0) 28 | - PINCache (~> 2.1) 29 | - SVProgressHUD (HEAD) 30 | 31 | SPEC CHECKSUMS: 32 | AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 33 | PINCache: 9e70271f1bdd60c0465b7208adcc4b6acc1fc376 34 | SVProgressHUD: c83337f10ed32d701c423d519059a249973c8662 35 | 36 | COCOAPODS: 0.39.0 37 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | // AFHTTPRequestOperation.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import "AFURLConnectionOperation.h" 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | /** 28 | `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. 29 | */ 30 | @interface AFHTTPRequestOperation : AFURLConnectionOperation 31 | 32 | ///------------------------------------------------ 33 | /// @name Getting HTTP URL Connection Information 34 | ///------------------------------------------------ 35 | 36 | /** 37 | The last HTTP response received by the operation's connection. 38 | */ 39 | @property (readonly, nonatomic, strong, nullable) NSHTTPURLResponse *response; 40 | 41 | /** 42 | Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an AFHTTPResponse serializer, which uses the raw data as its response object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed. 43 | 44 | @warning `responseSerializer` must not be `nil`. Setting a response serializer will clear out any cached value 45 | */ 46 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 47 | 48 | /** 49 | An object constructed by the `responseSerializer` from the response and response data. Returns `nil` unless the operation `isFinished`, has a `response`, and has `responseData` with non-zero content length. If an error occurs during serialization, `nil` will be returned, and the `error` property will be populated with the serialization error. 50 | */ 51 | @property (readonly, nonatomic, strong, nullable) id responseObject; 52 | 53 | ///----------------------------------------------------------- 54 | /// @name Setting Completion Block Success / Failure Callbacks 55 | ///----------------------------------------------------------- 56 | 57 | /** 58 | Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. 59 | 60 | This method should be overridden in subclasses in order to specify the response object passed into the success block. 61 | 62 | @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. 63 | @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. 64 | */ 65 | - (void)setCompletionBlockWithSuccess:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success 66 | failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; 67 | 68 | @end 69 | 70 | NS_ASSUME_NONNULL_END 71 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m: -------------------------------------------------------------------------------- 1 | // AFHTTPRequestOperation.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFHTTPRequestOperation.h" 23 | 24 | static dispatch_queue_t http_request_operation_processing_queue() { 25 | static dispatch_queue_t af_http_request_operation_processing_queue; 26 | static dispatch_once_t onceToken; 27 | dispatch_once(&onceToken, ^{ 28 | af_http_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.http-request.processing", DISPATCH_QUEUE_CONCURRENT); 29 | }); 30 | 31 | return af_http_request_operation_processing_queue; 32 | } 33 | 34 | static dispatch_group_t http_request_operation_completion_group() { 35 | static dispatch_group_t af_http_request_operation_completion_group; 36 | static dispatch_once_t onceToken; 37 | dispatch_once(&onceToken, ^{ 38 | af_http_request_operation_completion_group = dispatch_group_create(); 39 | }); 40 | 41 | return af_http_request_operation_completion_group; 42 | } 43 | 44 | #pragma mark - 45 | 46 | @interface AFURLConnectionOperation () 47 | @property (readwrite, nonatomic, strong) NSURLRequest *request; 48 | @property (readwrite, nonatomic, strong) NSURLResponse *response; 49 | @end 50 | 51 | @interface AFHTTPRequestOperation () 52 | @property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; 53 | @property (readwrite, nonatomic, strong) id responseObject; 54 | @property (readwrite, nonatomic, strong) NSError *responseSerializationError; 55 | @property (readwrite, nonatomic, strong) NSRecursiveLock *lock; 56 | @end 57 | 58 | @implementation AFHTTPRequestOperation 59 | @dynamic response; 60 | @dynamic lock; 61 | 62 | - (instancetype)initWithRequest:(NSURLRequest *)urlRequest { 63 | self = [super initWithRequest:urlRequest]; 64 | if (!self) { 65 | return nil; 66 | } 67 | 68 | self.responseSerializer = [AFHTTPResponseSerializer serializer]; 69 | 70 | return self; 71 | } 72 | 73 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 74 | NSParameterAssert(responseSerializer); 75 | 76 | [self.lock lock]; 77 | _responseSerializer = responseSerializer; 78 | self.responseObject = nil; 79 | self.responseSerializationError = nil; 80 | [self.lock unlock]; 81 | } 82 | 83 | - (id)responseObject { 84 | [self.lock lock]; 85 | if (!_responseObject && [self isFinished] && !self.error) { 86 | NSError *error = nil; 87 | self.responseObject = [self.responseSerializer responseObjectForResponse:self.response data:self.responseData error:&error]; 88 | if (error) { 89 | self.responseSerializationError = error; 90 | } 91 | } 92 | [self.lock unlock]; 93 | 94 | return _responseObject; 95 | } 96 | 97 | - (NSError *)error { 98 | if (_responseSerializationError) { 99 | return _responseSerializationError; 100 | } else { 101 | return [super error]; 102 | } 103 | } 104 | 105 | #pragma mark - AFHTTPRequestOperation 106 | 107 | - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 108 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure 109 | { 110 | // completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle. 111 | #pragma clang diagnostic push 112 | #pragma clang diagnostic ignored "-Warc-retain-cycles" 113 | #pragma clang diagnostic ignored "-Wgnu" 114 | self.completionBlock = ^{ 115 | if (self.completionGroup) { 116 | dispatch_group_enter(self.completionGroup); 117 | } 118 | 119 | dispatch_async(http_request_operation_processing_queue(), ^{ 120 | if (self.error) { 121 | if (failure) { 122 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 123 | failure(self, self.error); 124 | }); 125 | } 126 | } else { 127 | id responseObject = self.responseObject; 128 | if (self.error) { 129 | if (failure) { 130 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 131 | failure(self, self.error); 132 | }); 133 | } 134 | } else { 135 | if (success) { 136 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 137 | success(self, responseObject); 138 | }); 139 | } 140 | } 141 | } 142 | 143 | if (self.completionGroup) { 144 | dispatch_group_leave(self.completionGroup); 145 | } 146 | }); 147 | }; 148 | #pragma clang diagnostic pop 149 | } 150 | 151 | #pragma mark - AFURLRequestOperation 152 | 153 | - (void)pause { 154 | [super pause]; 155 | 156 | u_int64_t offset = 0; 157 | if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) { 158 | offset = [(NSNumber *)[self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey] unsignedLongLongValue]; 159 | } else { 160 | offset = [(NSData *)[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length]; 161 | } 162 | 163 | NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; 164 | if ([self.response respondsToSelector:@selector(allHeaderFields)] && [[self.response allHeaderFields] valueForKey:@"ETag"]) { 165 | [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; 166 | } 167 | [mutableURLRequest setValue:[NSString stringWithFormat:@"bytes=%llu-", offset] forHTTPHeaderField:@"Range"]; 168 | self.request = mutableURLRequest; 169 | } 170 | 171 | #pragma mark - NSSecureCoding 172 | 173 | + (BOOL)supportsSecureCoding { 174 | return YES; 175 | } 176 | 177 | - (id)initWithCoder:(NSCoder *)decoder { 178 | self = [super initWithCoder:decoder]; 179 | if (!self) { 180 | return nil; 181 | } 182 | 183 | self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))]; 184 | 185 | return self; 186 | } 187 | 188 | - (void)encodeWithCoder:(NSCoder *)coder { 189 | [super encodeWithCoder:coder]; 190 | 191 | [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))]; 192 | } 193 | 194 | #pragma mark - NSCopying 195 | 196 | - (id)copyWithZone:(NSZone *)zone { 197 | AFHTTPRequestOperation *operation = [super copyWithZone:zone]; 198 | 199 | operation.responseSerializer = [self.responseSerializer copyWithZone:zone]; 200 | operation.completionQueue = self.completionQueue; 201 | operation.completionGroup = self.completionGroup; 202 | 203 | return operation; 204 | } 205 | 206 | @end 207 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkReachabilityManager.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #if !TARGET_OS_WATCH 25 | #import 26 | 27 | #ifndef NS_DESIGNATED_INITIALIZER 28 | #if __has_attribute(objc_designated_initializer) 29 | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 30 | #else 31 | #define NS_DESIGNATED_INITIALIZER 32 | #endif 33 | #endif 34 | 35 | typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { 36 | AFNetworkReachabilityStatusUnknown = -1, 37 | AFNetworkReachabilityStatusNotReachable = 0, 38 | AFNetworkReachabilityStatusReachableViaWWAN = 1, 39 | AFNetworkReachabilityStatusReachableViaWiFi = 2, 40 | }; 41 | 42 | NS_ASSUME_NONNULL_BEGIN 43 | 44 | /** 45 | `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. 46 | 47 | Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. 48 | 49 | See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) 50 | 51 | @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. 52 | */ 53 | @interface AFNetworkReachabilityManager : NSObject 54 | 55 | /** 56 | The current network reachability status. 57 | */ 58 | @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; 59 | 60 | /** 61 | Whether or not the network is currently reachable. 62 | */ 63 | @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; 64 | 65 | /** 66 | Whether or not the network is currently reachable via WWAN. 67 | */ 68 | @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; 69 | 70 | /** 71 | Whether or not the network is currently reachable via WiFi. 72 | */ 73 | @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; 74 | 75 | ///--------------------- 76 | /// @name Initialization 77 | ///--------------------- 78 | 79 | /** 80 | Returns the shared network reachability manager. 81 | */ 82 | + (instancetype)sharedManager; 83 | 84 | /** 85 | Creates and returns a network reachability manager for the specified domain. 86 | 87 | @param domain The domain used to evaluate network reachability. 88 | 89 | @return An initialized network reachability manager, actively monitoring the specified domain. 90 | */ 91 | + (instancetype)managerForDomain:(NSString *)domain; 92 | 93 | /** 94 | Creates and returns a network reachability manager for the socket address. 95 | 96 | @param address The socket address (`sockaddr_in`) used to evaluate network reachability. 97 | 98 | @return An initialized network reachability manager, actively monitoring the specified socket address. 99 | */ 100 | + (instancetype)managerForAddress:(const void *)address; 101 | 102 | /** 103 | Initializes an instance of a network reachability manager from the specified reachability object. 104 | 105 | @param reachability The reachability object to monitor. 106 | 107 | @return An initialized network reachability manager, actively monitoring the specified reachability. 108 | */ 109 | - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; 110 | 111 | ///-------------------------------------------------- 112 | /// @name Starting & Stopping Reachability Monitoring 113 | ///-------------------------------------------------- 114 | 115 | /** 116 | Starts monitoring for changes in network reachability status. 117 | */ 118 | - (void)startMonitoring; 119 | 120 | /** 121 | Stops monitoring for changes in network reachability status. 122 | */ 123 | - (void)stopMonitoring; 124 | 125 | ///------------------------------------------------- 126 | /// @name Getting Localized Reachability Description 127 | ///------------------------------------------------- 128 | 129 | /** 130 | Returns a localized string representation of the current network reachability status. 131 | */ 132 | - (NSString *)localizedNetworkReachabilityStatusString; 133 | 134 | ///--------------------------------------------------- 135 | /// @name Setting Network Reachability Change Callback 136 | ///--------------------------------------------------- 137 | 138 | /** 139 | Sets a callback to be executed when the network availability of the `baseURL` host changes. 140 | 141 | @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. 142 | */ 143 | - (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block; 144 | 145 | @end 146 | 147 | ///---------------- 148 | /// @name Constants 149 | ///---------------- 150 | 151 | /** 152 | ## Network Reachability 153 | 154 | The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. 155 | 156 | enum { 157 | AFNetworkReachabilityStatusUnknown, 158 | AFNetworkReachabilityStatusNotReachable, 159 | AFNetworkReachabilityStatusReachableViaWWAN, 160 | AFNetworkReachabilityStatusReachableViaWiFi, 161 | } 162 | 163 | `AFNetworkReachabilityStatusUnknown` 164 | The `baseURL` host reachability is not known. 165 | 166 | `AFNetworkReachabilityStatusNotReachable` 167 | The `baseURL` host cannot be reached. 168 | 169 | `AFNetworkReachabilityStatusReachableViaWWAN` 170 | The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. 171 | 172 | `AFNetworkReachabilityStatusReachableViaWiFi` 173 | The `baseURL` host can be reached via a Wi-Fi connection. 174 | 175 | ### Keys for Notification UserInfo Dictionary 176 | 177 | Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. 178 | 179 | `AFNetworkingReachabilityNotificationStatusItem` 180 | A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. 181 | The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. 182 | */ 183 | 184 | ///-------------------- 185 | /// @name Notifications 186 | ///-------------------- 187 | 188 | /** 189 | Posted when network reachability changes. 190 | This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. 191 | 192 | @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). 193 | */ 194 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification; 195 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem; 196 | 197 | ///-------------------- 198 | /// @name Functions 199 | ///-------------------- 200 | 201 | /** 202 | Returns a localized string representation of an `AFNetworkReachabilityStatus` value. 203 | */ 204 | FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); 205 | 206 | NS_ASSUME_NONNULL_END 207 | #endif 208 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | #ifndef _AFNETWORKING_ 27 | #define _AFNETWORKING_ 28 | 29 | #import "AFURLRequestSerialization.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFSecurityPolicy.h" 32 | #if !TARGET_OS_WATCH 33 | #import "AFNetworkReachabilityManager.h" 34 | #import "AFURLConnectionOperation.h" 35 | #import "AFHTTPRequestOperation.h" 36 | #import "AFHTTPRequestOperationManager.h" 37 | #endif 38 | 39 | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ 40 | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) || \ 41 | TARGET_OS_WATCH ) 42 | #import "AFURLSessionManager.h" 43 | #import "AFHTTPSessionManager.h" 44 | #endif 45 | 46 | #endif /* _AFNETWORKING_ */ 47 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | // AFSecurityPolicy.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import 24 | 25 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { 26 | AFSSLPinningModeNone, 27 | AFSSLPinningModePublicKey, 28 | AFSSLPinningModeCertificate, 29 | }; 30 | 31 | /** 32 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. 33 | 34 | Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. 35 | */ 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | @interface AFSecurityPolicy : NSObject 40 | 41 | /** 42 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. 43 | */ 44 | @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; 45 | 46 | /** 47 | The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle. Note that if you create an array with duplicate certificates, the duplicate certificates will be removed. Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. 48 | */ 49 | @property (nonatomic, strong, nullable) NSArray *pinnedCertificates; 50 | 51 | /** 52 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. 53 | */ 54 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 55 | 56 | /** 57 | Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. 58 | */ 59 | @property (nonatomic, assign) BOOL validatesDomainName; 60 | 61 | ///----------------------------------------- 62 | /// @name Getting Specific Security Policies 63 | ///----------------------------------------- 64 | 65 | /** 66 | Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys. 67 | 68 | @return The default security policy. 69 | */ 70 | + (instancetype)defaultPolicy; 71 | 72 | ///--------------------- 73 | /// @name Initialization 74 | ///--------------------- 75 | 76 | /** 77 | Creates and returns a security policy with the specified pinning mode. 78 | 79 | @param pinningMode The SSL pinning mode. 80 | 81 | @return A new security policy. 82 | */ 83 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; 84 | 85 | ///------------------------------ 86 | /// @name Evaluating Server Trust 87 | ///------------------------------ 88 | 89 | /** 90 | Whether or not the specified server trust should be accepted, based on the security policy. 91 | 92 | This method should be used when responding to an authentication challenge from a server. 93 | 94 | @param serverTrust The X.509 certificate trust of the server. 95 | 96 | @return Whether or not to trust the server. 97 | 98 | @warning This method has been deprecated in favor of `-evaluateServerTrust:forDomain:`. 99 | */ 100 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust DEPRECATED_ATTRIBUTE; 101 | 102 | /** 103 | Whether or not the specified server trust should be accepted, based on the security policy. 104 | 105 | This method should be used when responding to an authentication challenge from a server. 106 | 107 | @param serverTrust The X.509 certificate trust of the server. 108 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated. 109 | 110 | @return Whether or not to trust the server. 111 | */ 112 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust 113 | forDomain:(nullable NSString *)domain; 114 | 115 | @end 116 | 117 | NS_ASSUME_NONNULL_END 118 | 119 | ///---------------- 120 | /// @name Constants 121 | ///---------------- 122 | 123 | /** 124 | ## SSL Pinning Modes 125 | 126 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. 127 | 128 | enum { 129 | AFSSLPinningModeNone, 130 | AFSSLPinningModePublicKey, 131 | AFSSLPinningModeCertificate, 132 | } 133 | 134 | `AFSSLPinningModeNone` 135 | Do not used pinned certificates to validate servers. 136 | 137 | `AFSSLPinningModePublicKey` 138 | Validate host certificates against public keys of pinned certificates. 139 | 140 | `AFSSLPinningModeCertificate` 141 | Validate host certificates against pinned certificates. 142 | */ 143 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | /** 33 | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. 34 | 35 | You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: 36 | 37 | [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; 38 | 39 | By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself. 40 | 41 | See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: 42 | http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 43 | */ 44 | NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.") 45 | @interface AFNetworkActivityIndicatorManager : NSObject 46 | 47 | /** 48 | A Boolean value indicating whether the manager is enabled. 49 | 50 | If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. 51 | */ 52 | @property (nonatomic, assign, getter = isEnabled) BOOL enabled; 53 | 54 | /** 55 | A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. 56 | */ 57 | @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; 58 | 59 | /** 60 | Returns the shared network activity indicator manager object for the system. 61 | 62 | @return The systemwide network activity indicator manager. 63 | */ 64 | + (instancetype)sharedManager; 65 | 66 | /** 67 | Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator. 68 | */ 69 | - (void)incrementActivityCount; 70 | 71 | /** 72 | Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator. 73 | */ 74 | - (void)decrementActivityCount; 75 | 76 | @end 77 | 78 | NS_ASSUME_NONNULL_END 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFNetworkActivityIndicatorManager.h" 23 | 24 | #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) 25 | 26 | #import "AFHTTPRequestOperation.h" 27 | 28 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 29 | #import "AFURLSessionManager.h" 30 | #endif 31 | 32 | static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17; 33 | 34 | static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { 35 | if ([[notification object] isKindOfClass:[AFURLConnectionOperation class]]) { 36 | return [(AFURLConnectionOperation *)[notification object] request]; 37 | } 38 | 39 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 40 | if ([[notification object] respondsToSelector:@selector(originalRequest)]) { 41 | return [(NSURLSessionTask *)[notification object] originalRequest]; 42 | } 43 | #endif 44 | 45 | return nil; 46 | } 47 | 48 | @interface AFNetworkActivityIndicatorManager () 49 | @property (readwrite, nonatomic, assign) NSInteger activityCount; 50 | @property (readwrite, nonatomic, strong) NSTimer *activityIndicatorVisibilityTimer; 51 | @property (readonly, nonatomic, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; 52 | 53 | - (void)updateNetworkActivityIndicatorVisibility; 54 | - (void)updateNetworkActivityIndicatorVisibilityDelayed; 55 | @end 56 | 57 | @implementation AFNetworkActivityIndicatorManager 58 | @dynamic networkActivityIndicatorVisible; 59 | 60 | + (instancetype)sharedManager { 61 | static AFNetworkActivityIndicatorManager *_sharedManager = nil; 62 | static dispatch_once_t oncePredicate; 63 | dispatch_once(&oncePredicate, ^{ 64 | _sharedManager = [[self alloc] init]; 65 | }); 66 | 67 | return _sharedManager; 68 | } 69 | 70 | + (NSSet *)keyPathsForValuesAffectingIsNetworkActivityIndicatorVisible { 71 | return [NSSet setWithObject:@"activityCount"]; 72 | } 73 | 74 | - (id)init { 75 | self = [super init]; 76 | if (!self) { 77 | return nil; 78 | } 79 | 80 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingOperationDidStartNotification object:nil]; 81 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingOperationDidFinishNotification object:nil]; 82 | 83 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 84 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil]; 85 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; 86 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil]; 87 | #endif 88 | 89 | return self; 90 | } 91 | 92 | - (void)dealloc { 93 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 94 | 95 | [_activityIndicatorVisibilityTimer invalidate]; 96 | } 97 | 98 | - (void)updateNetworkActivityIndicatorVisibilityDelayed { 99 | if (self.enabled) { 100 | // Delay hiding of activity indicator for a short interval, to avoid flickering 101 | if (![self isNetworkActivityIndicatorVisible]) { 102 | [self.activityIndicatorVisibilityTimer invalidate]; 103 | self.activityIndicatorVisibilityTimer = [NSTimer timerWithTimeInterval:kAFNetworkActivityIndicatorInvisibilityDelay target:self selector:@selector(updateNetworkActivityIndicatorVisibility) userInfo:nil repeats:NO]; 104 | [[NSRunLoop mainRunLoop] addTimer:self.activityIndicatorVisibilityTimer forMode:NSRunLoopCommonModes]; 105 | } else { 106 | [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:@[NSRunLoopCommonModes]]; 107 | } 108 | } 109 | } 110 | 111 | - (BOOL)isNetworkActivityIndicatorVisible { 112 | return self.activityCount > 0; 113 | } 114 | 115 | - (void)updateNetworkActivityIndicatorVisibility { 116 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self isNetworkActivityIndicatorVisible]]; 117 | } 118 | 119 | - (void)setActivityCount:(NSInteger)activityCount { 120 | @synchronized(self) { 121 | _activityCount = activityCount; 122 | } 123 | 124 | dispatch_async(dispatch_get_main_queue(), ^{ 125 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 126 | }); 127 | } 128 | 129 | - (void)incrementActivityCount { 130 | [self willChangeValueForKey:@"activityCount"]; 131 | @synchronized(self) { 132 | _activityCount++; 133 | } 134 | [self didChangeValueForKey:@"activityCount"]; 135 | 136 | dispatch_async(dispatch_get_main_queue(), ^{ 137 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 138 | }); 139 | } 140 | 141 | - (void)decrementActivityCount { 142 | [self willChangeValueForKey:@"activityCount"]; 143 | @synchronized(self) { 144 | #pragma clang diagnostic push 145 | #pragma clang diagnostic ignored "-Wgnu" 146 | _activityCount = MAX(_activityCount - 1, 0); 147 | #pragma clang diagnostic pop 148 | } 149 | [self didChangeValueForKey:@"activityCount"]; 150 | 151 | dispatch_async(dispatch_get_main_queue(), ^{ 152 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 153 | }); 154 | } 155 | 156 | - (void)networkRequestDidStart:(NSNotification *)notification { 157 | if ([AFNetworkRequestFromNotification(notification) URL]) { 158 | [self incrementActivityCount]; 159 | } 160 | } 161 | 162 | - (void)networkRequestDidFinish:(NSNotification *)notification { 163 | if ([AFNetworkRequestFromNotification(notification) URL]) { 164 | [self decrementActivityCount]; 165 | } 166 | } 167 | 168 | @end 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | @class AFURLConnectionOperation; 31 | 32 | /** 33 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task. 34 | */ 35 | @interface UIActivityIndicatorView (AFNetworking) 36 | 37 | ///---------------------------------- 38 | /// @name Animating for Session Tasks 39 | ///---------------------------------- 40 | 41 | /** 42 | Binds the animating state to the state of the specified task. 43 | 44 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 45 | */ 46 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 47 | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; 48 | #endif 49 | 50 | ///--------------------------------------- 51 | /// @name Animating for Request Operations 52 | ///--------------------------------------- 53 | 54 | /** 55 | Binds the animating state to the execution state of the specified operation. 56 | 57 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 58 | */ 59 | - (void)setAnimatingWithStateOfOperation:(nullable AFURLConnectionOperation *)operation; 60 | 61 | @end 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIActivityIndicatorView+AFNetworking.h" 23 | #import 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | @interface AFActivityIndicatorViewNotificationObserver : NSObject 34 | @property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView; 35 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView; 36 | 37 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 38 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; 39 | #endif 40 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation; 41 | 42 | @end 43 | 44 | @implementation UIActivityIndicatorView (AFNetworking) 45 | 46 | - (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver { 47 | AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); 48 | if (notificationObserver == nil) { 49 | notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self]; 50 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 51 | } 52 | return notificationObserver; 53 | } 54 | 55 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 56 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 57 | [[self af_notificationObserver] setAnimatingWithStateOfTask:task]; 58 | } 59 | #endif 60 | 61 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation { 62 | [[self af_notificationObserver] setAnimatingWithStateOfOperation:operation]; 63 | } 64 | 65 | @end 66 | 67 | @implementation AFActivityIndicatorViewNotificationObserver 68 | 69 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView 70 | { 71 | self = [super init]; 72 | if (self) { 73 | _activityIndicatorView = activityIndicatorView; 74 | } 75 | return self; 76 | } 77 | 78 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 79 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 80 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 81 | 82 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 83 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 84 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 85 | 86 | if (task) { 87 | if (task.state != NSURLSessionTaskStateCompleted) { 88 | 89 | #pragma clang diagnostic push 90 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 91 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 92 | if (task.state == NSURLSessionTaskStateRunning) { 93 | [self.activityIndicatorView startAnimating]; 94 | } else { 95 | [self.activityIndicatorView stopAnimating]; 96 | } 97 | #pragma clang diagnostic pop 98 | 99 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task]; 100 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task]; 101 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; 102 | } 103 | } 104 | } 105 | #endif 106 | 107 | #pragma mark - 108 | 109 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation { 110 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 111 | 112 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 113 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 114 | 115 | if (operation) { 116 | if (![operation isFinished]) { 117 | 118 | #pragma clang diagnostic push 119 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 120 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 121 | if ([operation isExecuting]) { 122 | [self.activityIndicatorView startAnimating]; 123 | } else { 124 | [self.activityIndicatorView stopAnimating]; 125 | } 126 | #pragma clang diagnostic pop 127 | 128 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingOperationDidStartNotification object:operation]; 129 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingOperationDidFinishNotification object:operation]; 130 | } 131 | } 132 | } 133 | 134 | #pragma mark - 135 | 136 | - (void)af_startAnimating { 137 | dispatch_async(dispatch_get_main_queue(), ^{ 138 | #pragma clang diagnostic push 139 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 140 | [self.activityIndicatorView startAnimating]; 141 | #pragma clang diagnostic pop 142 | }); 143 | } 144 | 145 | - (void)af_stopAnimating { 146 | dispatch_async(dispatch_get_main_queue(), ^{ 147 | #pragma clang diagnostic push 148 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 149 | [self.activityIndicatorView stopAnimating]; 150 | #pragma clang diagnostic pop 151 | }); 152 | } 153 | 154 | #pragma mark - 155 | 156 | - (void)dealloc { 157 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 158 | 159 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 160 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 161 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 162 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 163 | #endif 164 | 165 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 166 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 167 | } 168 | 169 | @end 170 | 171 | #endif 172 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class AFURLConnectionOperation; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIAlertView` class. The methods in this category provide support for automatically showing an alert if a session task or request operation finishes with an error. Alert title and message are filled from the corresponding `localizedDescription` & `localizedRecoverySuggestion` or `localizedFailureReason` of the error. 36 | */ 37 | @interface UIAlertView (AFNetworking) 38 | 39 | ///------------------------------------- 40 | /// @name Showing Alert for Session Task 41 | ///------------------------------------- 42 | 43 | /** 44 | Shows an alert view with the error of the specified session task, if any. 45 | 46 | @param task The session task. 47 | @param delegate The alert view delegate. 48 | */ 49 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 50 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 51 | delegate:(nullable id)delegate NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extensions."); 52 | #endif 53 | 54 | /** 55 | Shows an alert view with the error of the specified session task, if any, with a custom cancel button title and other button titles. 56 | 57 | @param task The session task. 58 | @param delegate The alert view delegate. 59 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 60 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 61 | */ 62 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 63 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 64 | delegate:(nullable id)delegate 65 | cancelButtonTitle:(nullable NSString *)cancelButtonTitle 66 | otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extensions."); 67 | #endif 68 | 69 | ///------------------------------------------ 70 | /// @name Showing Alert for Request Operation 71 | ///------------------------------------------ 72 | 73 | /** 74 | Shows an alert view with the error of the specified request operation, if any. 75 | 76 | @param operation The request operation. 77 | @param delegate The alert view delegate. 78 | */ 79 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 80 | delegate:(nullable id)delegate NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extensions."); 81 | 82 | /** 83 | Shows an alert view with the error of the specified request operation, if any, with a custom cancel button title and other button titles. 84 | 85 | @param operation The request operation. 86 | @param delegate The alert view delegate. 87 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 88 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 89 | */ 90 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 91 | delegate:(nullable id)delegate 92 | cancelButtonTitle:(nullable NSString *)cancelButtonTitle 93 | otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extensions."); 94 | 95 | @end 96 | 97 | NS_ASSUME_NONNULL_END 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIAlertView+AFNetworking.h" 23 | 24 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 25 | 26 | #import "AFURLConnectionOperation.h" 27 | 28 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 29 | #import "AFURLSessionManager.h" 30 | #endif 31 | 32 | static void AFGetAlertViewTitleAndMessageFromError(NSError *error, NSString * __autoreleasing *title, NSString * __autoreleasing *message) { 33 | if (error.localizedDescription && (error.localizedRecoverySuggestion || error.localizedFailureReason)) { 34 | *title = error.localizedDescription; 35 | 36 | if (error.localizedRecoverySuggestion) { 37 | *message = error.localizedRecoverySuggestion; 38 | } else { 39 | *message = error.localizedFailureReason; 40 | } 41 | } else if (error.localizedDescription) { 42 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 43 | *message = error.localizedDescription; 44 | } else { 45 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 46 | *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %ld", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, (long)error.code]; 47 | } 48 | } 49 | 50 | @implementation UIAlertView (AFNetworking) 51 | 52 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 53 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 54 | delegate:(id)delegate 55 | { 56 | [self showAlertViewForTaskWithErrorOnCompletion:task delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlertView Cancel Button Title") otherButtonTitles:nil, nil]; 57 | } 58 | 59 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 60 | delegate:(id)delegate 61 | cancelButtonTitle:(NSString *)cancelButtonTitle 62 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 63 | { 64 | NSMutableArray *mutableOtherTitles = [NSMutableArray array]; 65 | va_list otherButtonTitleList; 66 | va_start(otherButtonTitleList, otherButtonTitles); 67 | { 68 | for (NSString *otherButtonTitle = otherButtonTitles; otherButtonTitle != nil; otherButtonTitle = va_arg(otherButtonTitleList, NSString *)) { 69 | [mutableOtherTitles addObject:otherButtonTitle]; 70 | } 71 | } 72 | va_end(otherButtonTitleList); 73 | 74 | __block __weak id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingTaskDidCompleteNotification object:task queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 75 | NSError *error = notification.userInfo[AFNetworkingTaskDidCompleteErrorKey]; 76 | if (error) { 77 | NSString *title, *message; 78 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 79 | 80 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil]; 81 | for (NSString *otherButtonTitle in mutableOtherTitles) { 82 | [alertView addButtonWithTitle:otherButtonTitle]; 83 | } 84 | [alertView setTitle:title]; 85 | [alertView setMessage:message]; 86 | [alertView show]; 87 | } 88 | 89 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 90 | }]; 91 | } 92 | #endif 93 | 94 | #pragma mark - 95 | 96 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 97 | delegate:(id)delegate 98 | { 99 | [self showAlertViewForRequestOperationWithErrorOnCompletion:operation delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlertView Cancel Button Title") otherButtonTitles:nil, nil]; 100 | } 101 | 102 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 103 | delegate:(id)delegate 104 | cancelButtonTitle:(NSString *)cancelButtonTitle 105 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 106 | { 107 | NSMutableArray *mutableOtherTitles = [NSMutableArray array]; 108 | va_list otherButtonTitleList; 109 | va_start(otherButtonTitleList, otherButtonTitles); 110 | { 111 | for (NSString *otherButtonTitle = otherButtonTitles; otherButtonTitle != nil; otherButtonTitle = va_arg(otherButtonTitleList, NSString *)) { 112 | [mutableOtherTitles addObject:otherButtonTitle]; 113 | } 114 | } 115 | va_end(otherButtonTitleList); 116 | 117 | __block __weak id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingOperationDidFinishNotification object:operation queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 118 | 119 | if (notification.object && [notification.object isKindOfClass:[AFURLConnectionOperation class]]) { 120 | NSError *error = [(AFURLConnectionOperation *)notification.object error]; 121 | if (error) { 122 | NSString *title, *message; 123 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 124 | 125 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil]; 126 | for (NSString *otherButtonTitle in mutableOtherTitles) { 127 | [alertView addButtonWithTitle:otherButtonTitle]; 128 | } 129 | [alertView setTitle:title]; 130 | [alertView setMessage:message]; 131 | [alertView show]; 132 | } 133 | } 134 | 135 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 136 | }]; 137 | } 138 | 139 | @end 140 | 141 | #endif 142 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+AFNetworking.h 3 | // 4 | // 5 | // Created by Paulo Ferreira on 08/07/15. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import 28 | 29 | @interface UIImage (AFNetworking) 30 | 31 | + (UIImage*) safeImageWithData:(NSData*)data; 32 | 33 | @end 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @protocol AFURLResponseSerialization, AFImageCache; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. 36 | */ 37 | @interface UIImageView (AFNetworking) 38 | 39 | ///---------------------------- 40 | /// @name Accessing Image Cache 41 | ///---------------------------- 42 | 43 | /** 44 | The image cache used to improve image loading performance on scroll views. By default, this is an `NSCache` subclass conforming to the `AFImageCache` protocol, which listens for notification warnings and evicts objects accordingly. 45 | */ 46 | + (id )sharedImageCache; 47 | 48 | /** 49 | Set the cache used for image loading. 50 | 51 | @param imageCache The image cache. 52 | */ 53 | + (void)setSharedImageCache:(__nullable id )imageCache; 54 | 55 | ///------------------------------------ 56 | /// @name Accessing Response Serializer 57 | ///------------------------------------ 58 | 59 | /** 60 | The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. 61 | 62 | @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer 63 | */ 64 | @property (nonatomic, strong) id imageResponseSerializer; 65 | 66 | ///-------------------- 67 | /// @name Setting Image 68 | ///-------------------- 69 | 70 | /** 71 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 72 | 73 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 74 | 75 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 76 | 77 | @param url The URL used for the image request. 78 | */ 79 | - (void)setImageWithURL:(NSURL *)url; 80 | 81 | /** 82 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 83 | 84 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 85 | 86 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 87 | 88 | @param url The URL used for the image request. 89 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 90 | */ 91 | - (void)setImageWithURL:(NSURL *)url 92 | placeholderImage:(nullable UIImage *)placeholderImage; 93 | 94 | /** 95 | Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 96 | 97 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 98 | 99 | If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied. 100 | 101 | @param urlRequest The URL request used for the image request. 102 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 103 | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. 104 | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. 105 | */ 106 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 107 | placeholderImage:(nullable UIImage *)placeholderImage 108 | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, UIImage *image))success 109 | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, NSError *error))failure; 110 | 111 | /** 112 | Cancels any executing image operation for the receiver, if one exists. 113 | */ 114 | - (void)cancelImageRequestOperation; 115 | 116 | @end 117 | 118 | #pragma mark - 119 | 120 | /** 121 | The `AFImageCache` protocol is adopted by an object used to cache images loaded by the AFNetworking category on `UIImageView`. 122 | */ 123 | @protocol AFImageCache 124 | 125 | /** 126 | Returns a cached image for the specified request, if available. 127 | 128 | @param request The image request. 129 | 130 | @return The cached image. 131 | */ 132 | - (nullable UIImage *)cachedImageForRequest:(NSURLRequest *)request; 133 | 134 | /** 135 | Caches a particular image for the specified request. 136 | 137 | @param image The image to cache. 138 | @param request The request to be used as a cache key. 139 | */ 140 | - (void)cacheImage:(UIImage *)image 141 | forRequest:(NSURLRequest *)request; 142 | @end 143 | 144 | NS_ASSUME_NONNULL_END 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #if TARGET_OS_IOS 24 | #import 25 | 26 | #ifndef _UIKIT_AFNETWORKING_ 27 | #define _UIKIT_AFNETWORKING_ 28 | 29 | #import "AFNetworkActivityIndicatorManager.h" 30 | 31 | #import "UIActivityIndicatorView+AFNetworking.h" 32 | #import "UIAlertView+AFNetworking.h" 33 | #import "UIButton+AFNetworking.h" 34 | #import "UIImageView+AFNetworking.h" 35 | #import "UIProgressView+AFNetworking.h" 36 | #import "UIRefreshControl+AFNetworking.h" 37 | #import "UIWebView+AFNetworking.h" 38 | #endif /* _UIKIT_AFNETWORKING_ */ 39 | #endif 40 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class AFURLConnectionOperation; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task or request operation. 36 | */ 37 | @interface UIProgressView (AFNetworking) 38 | 39 | ///------------------------------------ 40 | /// @name Setting Session Task Progress 41 | ///------------------------------------ 42 | 43 | /** 44 | Binds the progress to the upload progress of the specified session task. 45 | 46 | @param task The session task. 47 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 48 | */ 49 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 50 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 51 | animated:(BOOL)animated; 52 | #endif 53 | 54 | /** 55 | Binds the progress to the download progress of the specified session task. 56 | 57 | @param task The session task. 58 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 59 | */ 60 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 61 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 62 | animated:(BOOL)animated; 63 | #endif 64 | 65 | ///------------------------------------ 66 | /// @name Setting Session Task Progress 67 | ///------------------------------------ 68 | 69 | /** 70 | Binds the progress to the upload progress of the specified request operation. 71 | 72 | @param operation The request operation. 73 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 74 | */ 75 | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation 76 | animated:(BOOL)animated; 77 | 78 | /** 79 | Binds the progress to the download progress of the specified request operation. 80 | 81 | @param operation The request operation. 82 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 83 | */ 84 | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation 85 | animated:(BOOL)animated; 86 | 87 | @end 88 | 89 | NS_ASSUME_NONNULL_END 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIProgressView+AFNetworking.h" 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import "AFURLConnectionOperation.h" 29 | 30 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 31 | #import "AFURLSessionManager.h" 32 | #endif 33 | 34 | static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext; 35 | static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext; 36 | 37 | @interface AFURLConnectionOperation (_UIProgressView) 38 | @property (readwrite, nonatomic, copy) void (^uploadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); 39 | @property (readwrite, nonatomic, assign, setter = af_setUploadProgressAnimated:) BOOL af_uploadProgressAnimated; 40 | 41 | @property (readwrite, nonatomic, copy) void (^downloadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); 42 | @property (readwrite, nonatomic, assign, setter = af_setDownloadProgressAnimated:) BOOL af_downloadProgressAnimated; 43 | @end 44 | 45 | @implementation AFURLConnectionOperation (_UIProgressView) 46 | @dynamic uploadProgress; // Implemented in AFURLConnectionOperation 47 | @dynamic af_uploadProgressAnimated; 48 | 49 | @dynamic downloadProgress; // Implemented in AFURLConnectionOperation 50 | @dynamic af_downloadProgressAnimated; 51 | @end 52 | 53 | #pragma mark - 54 | 55 | @implementation UIProgressView (AFNetworking) 56 | 57 | - (BOOL)af_uploadProgressAnimated { 58 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue]; 59 | } 60 | 61 | - (void)af_setUploadProgressAnimated:(BOOL)animated { 62 | objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 63 | } 64 | 65 | - (BOOL)af_downloadProgressAnimated { 66 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue]; 67 | } 68 | 69 | - (void)af_setDownloadProgressAnimated:(BOOL)animated { 70 | objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 71 | } 72 | 73 | #pragma mark - 74 | 75 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 76 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 77 | animated:(BOOL)animated 78 | { 79 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; 80 | [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; 81 | 82 | [self af_setUploadProgressAnimated:animated]; 83 | } 84 | 85 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 86 | animated:(BOOL)animated 87 | { 88 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; 89 | [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; 90 | 91 | [self af_setDownloadProgressAnimated:animated]; 92 | } 93 | #endif 94 | 95 | #pragma mark - 96 | 97 | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation 98 | animated:(BOOL)animated 99 | { 100 | __weak __typeof(self)weakSelf = self; 101 | void (^original)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) = [operation.uploadProgress copy]; 102 | [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { 103 | if (original) { 104 | original(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); 105 | } 106 | 107 | dispatch_async(dispatch_get_main_queue(), ^{ 108 | if (totalBytesExpectedToWrite > 0) { 109 | __strong __typeof(weakSelf)strongSelf = weakSelf; 110 | [strongSelf setProgress:(totalBytesWritten / (totalBytesExpectedToWrite * 1.0f)) animated:animated]; 111 | } 112 | }); 113 | }]; 114 | } 115 | 116 | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation 117 | animated:(BOOL)animated 118 | { 119 | __weak __typeof(self)weakSelf = self; 120 | void (^original)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) = [operation.downloadProgress copy]; 121 | [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) { 122 | if (original) { 123 | original(bytesRead, totalBytesRead, totalBytesExpectedToRead); 124 | } 125 | 126 | dispatch_async(dispatch_get_main_queue(), ^{ 127 | if (totalBytesExpectedToRead > 0) { 128 | __strong __typeof(weakSelf)strongSelf = weakSelf; 129 | [strongSelf setProgress:(totalBytesRead / (totalBytesExpectedToRead * 1.0f)) animated:animated]; 130 | } 131 | }); 132 | }]; 133 | } 134 | 135 | #pragma mark - NSKeyValueObserving 136 | 137 | - (void)observeValueForKeyPath:(NSString *)keyPath 138 | ofObject:(id)object 139 | change:(__unused NSDictionary *)change 140 | context:(void *)context 141 | { 142 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 143 | if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) { 144 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { 145 | if ([object countOfBytesExpectedToSend] > 0) { 146 | dispatch_async(dispatch_get_main_queue(), ^{ 147 | [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated]; 148 | }); 149 | } 150 | } 151 | 152 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { 153 | if ([object countOfBytesExpectedToReceive] > 0) { 154 | dispatch_async(dispatch_get_main_queue(), ^{ 155 | [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated]; 156 | }); 157 | } 158 | } 159 | 160 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) { 161 | if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) { 162 | @try { 163 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))]; 164 | 165 | if (context == AFTaskCountOfBytesSentContext) { 166 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; 167 | } 168 | 169 | if (context == AFTaskCountOfBytesReceivedContext) { 170 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; 171 | } 172 | } 173 | @catch (NSException * __unused exception) {} 174 | } 175 | } 176 | } 177 | #endif 178 | } 179 | 180 | @end 181 | 182 | #endif 183 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | NS_ASSUME_NONNULL_BEGIN 32 | 33 | @class AFURLConnectionOperation; 34 | 35 | /** 36 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a request operation or session task. 37 | */ 38 | @interface UIRefreshControl (AFNetworking) 39 | 40 | ///----------------------------------- 41 | /// @name Refreshing for Session Tasks 42 | ///----------------------------------- 43 | 44 | /** 45 | Binds the refreshing state to the state of the specified task. 46 | 47 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 48 | */ 49 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 50 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 51 | #endif 52 | 53 | ///---------------------------------------- 54 | /// @name Refreshing for Request Operations 55 | ///---------------------------------------- 56 | 57 | /** 58 | Binds the refreshing state to the execution state of the specified operation. 59 | 60 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 61 | */ 62 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; 63 | 64 | @end 65 | 66 | NS_ASSUME_NONNULL_END 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIRefreshControl+AFNetworking.h" 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import "AFHTTPRequestOperation.h" 29 | 30 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 31 | #import "AFURLSessionManager.h" 32 | #endif 33 | 34 | @interface AFRefreshControlNotificationObserver : NSObject 35 | @property (readonly, nonatomic, weak) UIRefreshControl *refreshControl; 36 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl; 37 | 38 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 39 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 40 | #endif 41 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; 42 | 43 | @end 44 | 45 | @implementation UIRefreshControl (AFNetworking) 46 | 47 | - (AFRefreshControlNotificationObserver *)af_notificationObserver { 48 | AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); 49 | if (notificationObserver == nil) { 50 | notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self]; 51 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 52 | } 53 | return notificationObserver; 54 | } 55 | 56 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 57 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 58 | [[self af_notificationObserver] setRefreshingWithStateOfTask:task]; 59 | } 60 | #endif 61 | 62 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation { 63 | [[self af_notificationObserver] setRefreshingWithStateOfOperation:operation]; 64 | } 65 | 66 | @end 67 | 68 | @implementation AFRefreshControlNotificationObserver 69 | 70 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl 71 | { 72 | self = [super init]; 73 | if (self) { 74 | _refreshControl = refreshControl; 75 | } 76 | return self; 77 | } 78 | 79 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 80 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 81 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 82 | 83 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 84 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 85 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 86 | 87 | if (task) { 88 | #pragma clang diagnostic push 89 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 90 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 91 | if (task.state == NSURLSessionTaskStateRunning) { 92 | [self.refreshControl beginRefreshing]; 93 | 94 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task]; 95 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task]; 96 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task]; 97 | } else { 98 | [self.refreshControl endRefreshing]; 99 | } 100 | #pragma clang diagnostic pop 101 | } 102 | } 103 | #endif 104 | 105 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation { 106 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 107 | 108 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 109 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 110 | 111 | if (operation) { 112 | #pragma clang diagnostic push 113 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 114 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 115 | if (![operation isFinished]) { 116 | if ([operation isExecuting]) { 117 | [self.refreshControl beginRefreshing]; 118 | } else { 119 | [self.refreshControl endRefreshing]; 120 | } 121 | 122 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingOperationDidStartNotification object:operation]; 123 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingOperationDidFinishNotification object:operation]; 124 | } 125 | #pragma clang diagnostic pop 126 | } 127 | } 128 | 129 | #pragma mark - 130 | 131 | - (void)af_beginRefreshing { 132 | dispatch_async(dispatch_get_main_queue(), ^{ 133 | #pragma clang diagnostic push 134 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 135 | [self.refreshControl beginRefreshing]; 136 | #pragma clang diagnostic pop 137 | }); 138 | } 139 | 140 | - (void)af_endRefreshing { 141 | dispatch_async(dispatch_get_main_queue(), ^{ 142 | #pragma clang diagnostic push 143 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 144 | [self.refreshControl endRefreshing]; 145 | #pragma clang diagnostic pop 146 | }); 147 | } 148 | 149 | #pragma mark - 150 | 151 | - (void)dealloc { 152 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 153 | 154 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 155 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 156 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 157 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 158 | #endif 159 | 160 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 161 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 162 | } 163 | 164 | @end 165 | 166 | #endif 167 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class AFHTTPRequestSerializer, AFHTTPResponseSerializer; 33 | @protocol AFURLRequestSerialization, AFURLResponseSerialization; 34 | 35 | /** 36 | This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. 37 | 38 | @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly. 39 | */ 40 | @interface UIWebView (AFNetworking) 41 | 42 | /** 43 | The request serializer used to serialize requests made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPRequestSerializer`. 44 | */ 45 | @property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; 46 | 47 | /** 48 | The response serializer used to serialize responses made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPResponseSerializer`. 49 | */ 50 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 51 | 52 | /** 53 | Asynchronously loads the specified request. 54 | 55 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 56 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 57 | @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. 58 | @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 59 | */ 60 | - (void)loadRequest:(NSURLRequest *)request 61 | progress:(nullable void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 62 | success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 63 | failure:(nullable void (^)(NSError *error))failure; 64 | 65 | /** 66 | Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. 67 | 68 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 69 | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. 70 | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. 71 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 72 | @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. 73 | @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 74 | */ 75 | - (void)loadRequest:(NSURLRequest *)request 76 | MIMEType:(nullable NSString *)MIMEType 77 | textEncodingName:(nullable NSString *)textEncodingName 78 | progress:(nullable void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 79 | success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 80 | failure:(nullable void (^)(NSError *error))failure; 81 | 82 | @end 83 | 84 | NS_ASSUME_NONNULL_END 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIWebView+AFNetworking.h" 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import "AFHTTPRequestOperation.h" 29 | #import "AFURLResponseSerialization.h" 30 | #import "AFURLRequestSerialization.h" 31 | 32 | @interface UIWebView (_AFNetworking) 33 | @property (readwrite, nonatomic, strong, setter = af_setHTTPRequestOperation:) AFHTTPRequestOperation *af_HTTPRequestOperation; 34 | @end 35 | 36 | @implementation UIWebView (_AFNetworking) 37 | 38 | - (AFHTTPRequestOperation *)af_HTTPRequestOperation { 39 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_HTTPRequestOperation)); 40 | } 41 | 42 | - (void)af_setHTTPRequestOperation:(AFHTTPRequestOperation *)operation { 43 | objc_setAssociatedObject(self, @selector(af_HTTPRequestOperation), operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 44 | } 45 | 46 | @end 47 | 48 | #pragma mark - 49 | 50 | @implementation UIWebView (AFNetworking) 51 | 52 | - (AFHTTPRequestSerializer *)requestSerializer { 53 | static AFHTTPRequestSerializer *_af_defaultRequestSerializer = nil; 54 | static dispatch_once_t onceToken; 55 | dispatch_once(&onceToken, ^{ 56 | _af_defaultRequestSerializer = [AFHTTPRequestSerializer serializer]; 57 | }); 58 | 59 | #pragma clang diagnostic push 60 | #pragma clang diagnostic ignored "-Wgnu" 61 | return objc_getAssociatedObject(self, @selector(requestSerializer)) ?: _af_defaultRequestSerializer; 62 | #pragma clang diagnostic pop 63 | } 64 | 65 | - (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { 66 | objc_setAssociatedObject(self, @selector(requestSerializer), requestSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 67 | } 68 | 69 | - (AFHTTPResponseSerializer *)responseSerializer { 70 | static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil; 71 | static dispatch_once_t onceToken; 72 | dispatch_once(&onceToken, ^{ 73 | _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; 74 | }); 75 | 76 | #pragma clang diagnostic push 77 | #pragma clang diagnostic ignored "-Wgnu" 78 | return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer; 79 | #pragma clang diagnostic pop 80 | } 81 | 82 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 83 | objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 84 | } 85 | 86 | #pragma mark - 87 | 88 | - (void)loadRequest:(NSURLRequest *)request 89 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 90 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 91 | failure:(void (^)(NSError *error))failure 92 | { 93 | [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) { 94 | NSStringEncoding stringEncoding = NSUTF8StringEncoding; 95 | if (response.textEncodingName) { 96 | CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); 97 | if (encoding != kCFStringEncodingInvalidId) { 98 | stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); 99 | } 100 | } 101 | 102 | NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding]; 103 | if (success) { 104 | string = success(response, string); 105 | } 106 | 107 | return [string dataUsingEncoding:stringEncoding]; 108 | } failure:failure]; 109 | } 110 | 111 | - (void)loadRequest:(NSURLRequest *)request 112 | MIMEType:(NSString *)MIMEType 113 | textEncodingName:(NSString *)textEncodingName 114 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 115 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 116 | failure:(void (^)(NSError *error))failure 117 | { 118 | NSParameterAssert(request); 119 | 120 | if (self.af_HTTPRequestOperation) { 121 | [self.af_HTTPRequestOperation cancel]; 122 | } 123 | 124 | request = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil]; 125 | 126 | self.af_HTTPRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; 127 | self.af_HTTPRequestOperation.responseSerializer = self.responseSerializer; 128 | 129 | __weak __typeof(self)weakSelf = self; 130 | [self.af_HTTPRequestOperation setDownloadProgressBlock:progress]; 131 | [self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __unused responseObject) { 132 | NSData *data = success ? success(operation.response, operation.responseData) : operation.responseData; 133 | 134 | #pragma clang diagnostic push 135 | #pragma clang diagnostic ignored "-Wgnu" 136 | __strong __typeof(weakSelf) strongSelf = weakSelf; 137 | [strongSelf loadData:data MIMEType:(MIMEType ?: [operation.response MIMEType]) textEncodingName:(textEncodingName ?: [operation.response textEncodingName]) baseURL:[operation.response URL]]; 138 | 139 | if ([strongSelf.delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) { 140 | [strongSelf.delegate webViewDidFinishLoad:strongSelf]; 141 | } 142 | 143 | #pragma clang diagnostic pop 144 | } failure:^(AFHTTPRequestOperation * __unused operation, NSError *error) { 145 | if (failure) { 146 | failure(error); 147 | } 148 | }]; 149 | 150 | [self.af_HTTPRequestOperation start]; 151 | 152 | if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) { 153 | [self.delegate webViewDidStartLoad:self]; 154 | } 155 | } 156 | 157 | @end 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/PINCache/Nullability.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/Nullability.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/PINCache/PINCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/PINCache/PINDiskCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINDiskCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/PINCache/PINMemoryCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINMemoryCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Private/SVProgressHUD/SVRadialGradientLayer.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/PINCache/Nullability.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/Nullability.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/PINCache/PINCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/PINCache/PINDiskCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINDiskCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/PINCache/PINMemoryCache.h: -------------------------------------------------------------------------------- 1 | ../../../PINCache/PINCache/PINMemoryCache.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Headers/Public/SVProgressHUD/SVRadialGradientLayer.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.h -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.6.3): 3 | - AFNetworking/NSURLConnection (= 2.6.3) 4 | - AFNetworking/NSURLSession (= 2.6.3) 5 | - AFNetworking/Reachability (= 2.6.3) 6 | - AFNetworking/Security (= 2.6.3) 7 | - AFNetworking/Serialization (= 2.6.3) 8 | - AFNetworking/UIKit (= 2.6.3) 9 | - AFNetworking/NSURLConnection (2.6.3): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.6.3): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.6.3) 18 | - AFNetworking/Security (2.6.3) 19 | - AFNetworking/Serialization (2.6.3) 20 | - AFNetworking/UIKit (2.6.3): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - PINCache (2.1.2) 24 | - SVProgressHUD (HEAD based on 2.0-beta) 25 | 26 | DEPENDENCIES: 27 | - AFNetworking (~> 2.0) 28 | - PINCache (~> 2.1) 29 | - SVProgressHUD (HEAD) 30 | 31 | SPEC CHECKSUMS: 32 | AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 33 | PINCache: 9e70271f1bdd60c0465b7208adcc4b6acc1fc376 34 | SVProgressHUD: c83337f10ed32d701c423d519059a249973c8662 35 | 36 | COCOAPODS: 0.39.0 37 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/PINCache/PINCache/Nullability.h: -------------------------------------------------------------------------------- 1 | // PINCache is a modified version of TMCache 2 | // Modifications by Garrett Moon 3 | // Copyright (c) 2015 Pinterest. All rights reserved. 4 | 5 | #ifndef PINCache_nullability_h 6 | #define PINCache_nullability_h 7 | 8 | #if !__has_feature(nullability) 9 | #define NS_ASSUME_NONNULL_BEGIN 10 | #define NS_ASSUME_NONNULL_END 11 | #define nullable 12 | #define nonnull 13 | #define null_unspecified 14 | #define null_resettable 15 | #define __nullable 16 | #define __nonnull 17 | #define __null_unspecified 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/PINCache/PINCache/PINCache.h: -------------------------------------------------------------------------------- 1 | // PINCache is a modified version of TMCache 2 | // Modifications by Garrett Moon 3 | // Copyright (c) 2015 Pinterest. All rights reserved. 4 | 5 | #import 6 | 7 | #import "PINDiskCache.h" 8 | #import "PINMemoryCache.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @class PINCache; 13 | 14 | /** 15 | A callback block which provides only the cache as an argument 16 | */ 17 | 18 | typedef void (^PINCacheBlock)(PINCache *cache); 19 | 20 | /** 21 | A callback block which provides the cache, key and object as arguments 22 | */ 23 | 24 | typedef void (^PINCacheObjectBlock)(PINCache *cache, NSString *key, id __nullable object); 25 | 26 | /** 27 | `PINCache` is a thread safe key/value store designed for persisting temporary objects that are expensive to 28 | reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar 29 | stores, one in memory () and one on disk (). 30 | 31 | `PINCache` itself actually does very little; its main function is providing a front end for a common use case: 32 | a small, fast memory cache that asynchronously persists itself to a large, slow disk cache. When objects are 33 | removed from the memory cache in response to an "apocalyptic" event they remain in the disk cache and are 34 | repopulated in memory the next time they are accessed. `PINCache` also does the tedious work of creating a 35 | dispatch group to wait for both caches to finish their operations without blocking each other. 36 | 37 | The parallel caches are accessible as public properties ( and ) and can be manipulated 38 | separately if necessary. See the docs for and for more details. 39 | 40 | @warning when using in extension or watch extension, define PIN_APP_EXTENSIONS=1 41 | */ 42 | 43 | @interface PINCache : NSObject 44 | 45 | #pragma mark - 46 | /// @name Core 47 | 48 | /** 49 | The name of this cache, used to create the and also appearing in stack traces. 50 | */ 51 | @property (readonly) NSString *name; 52 | 53 | /** 54 | A concurrent queue on which blocks passed to the asynchronous access methods are run. 55 | */ 56 | @property (readonly) dispatch_queue_t concurrentQueue; 57 | 58 | /** 59 | Synchronously retrieves the total byte count of the on the shared disk queue. 60 | */ 61 | @property (readonly) NSUInteger diskByteCount; 62 | 63 | /** 64 | The underlying disk cache, see for additional configuration and trimming options. 65 | */ 66 | @property (readonly) PINDiskCache *diskCache; 67 | 68 | /** 69 | The underlying memory cache, see for additional configuration and trimming options. 70 | */ 71 | @property (readonly) PINMemoryCache *memoryCache; 72 | 73 | #pragma mark - 74 | /// @name Initialization 75 | 76 | /** 77 | A shared cache. 78 | 79 | @result The shared singleton cache instance. 80 | */ 81 | + (instancetype)sharedCache; 82 | 83 | - (instancetype)init NS_UNAVAILABLE; 84 | 85 | /** 86 | Multiple instances with the same name are allowed and can safely access 87 | the same data on disk thanks to the magic of seriality. Also used to create the . 88 | 89 | @see name 90 | @param name The name of the cache. 91 | @result A new cache with the specified name. 92 | */ 93 | - (instancetype)initWithName:(NSString *)name; 94 | 95 | /** 96 | Multiple instances with the same name are allowed and can safely access 97 | the same data on disk thanks to the magic of seriality. Also used to create the . 98 | 99 | @see name 100 | @param name The name of the cache. 101 | @param rootPath The path of the cache on disk. 102 | @result A new cache with the specified name. 103 | */ 104 | - (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath NS_DESIGNATED_INITIALIZER; 105 | 106 | #pragma mark - 107 | /// @name Asynchronous Methods 108 | 109 | /** 110 | Retrieves the object for the specified key. This method returns immediately and executes the passed 111 | block after the object is available, potentially in parallel with other blocks on the . 112 | 113 | @param key The key associated with the requested object. 114 | @param block A block to be executed concurrently when the object is available. 115 | */ 116 | - (void)objectForKey:(NSString *)key block:(PINCacheObjectBlock)block; 117 | 118 | /** 119 | Stores an object in the cache for the specified key. This method returns immediately and executes the 120 | passed block after the object has been stored, potentially in parallel with other blocks on the . 121 | 122 | @param object An object to store in the cache. 123 | @param key A key to associate with the object. This string will be copied. 124 | @param block A block to be executed concurrently after the object has been stored, or nil. 125 | */ 126 | - (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINCacheObjectBlock)block; 127 | 128 | /** 129 | Removes the object for the specified key. This method returns immediately and executes the passed 130 | block after the object has been removed, potentially in parallel with other blocks on the . 131 | 132 | @param key The key associated with the object to be removed. 133 | @param block A block to be executed concurrently after the object has been removed, or nil. 134 | */ 135 | - (void)removeObjectForKey:(NSString *)key block:(nullable PINCacheObjectBlock)block; 136 | 137 | /** 138 | Removes all objects from the cache that have not been used since the specified date. This method returns immediately and 139 | executes the passed block after the cache has been trimmed, potentially in parallel with other blocks on the . 140 | 141 | @param date Objects that haven't been accessed since this date are removed from the cache. 142 | @param block A block to be executed concurrently after the cache has been trimmed, or nil. 143 | */ 144 | - (void)trimToDate:(NSDate *)date block:(nullable PINCacheBlock)block; 145 | 146 | /** 147 | Removes all objects from the cache.This method returns immediately and executes the passed block after the 148 | cache has been cleared, potentially in parallel with other blocks on the . 149 | 150 | @param block A block to be executed concurrently after the cache has been cleared, or nil. 151 | */ 152 | - (void)removeAllObjects:(nullable PINCacheBlock)block; 153 | 154 | #pragma mark - 155 | /// @name Synchronous Methods 156 | 157 | /** 158 | Retrieves the object for the specified key. This method blocks the calling thread until the object is available. 159 | Uses a semaphore to achieve synchronicity on the disk cache. 160 | 161 | @see objectForKey:block: 162 | @param key The key associated with the object. 163 | @result The object for the specified key. 164 | */ 165 | - (__nullable id)objectForKey:(NSString *)key; 166 | 167 | /** 168 | Stores an object in the cache for the specified key. This method blocks the calling thread until the object has been set. 169 | Uses a semaphore to achieve synchronicity on the disk cache. 170 | 171 | @see setObject:forKey:block: 172 | @param object An object to store in the cache. 173 | @param key A key to associate with the object. This string will be copied. 174 | */ 175 | - (void)setObject:(id )object forKey:(NSString *)key; 176 | 177 | /** 178 | Removes the object for the specified key. This method blocks the calling thread until the object 179 | has been removed. 180 | Uses a semaphore to achieve synchronicity on the disk cache. 181 | 182 | @param key The key associated with the object to be removed. 183 | */ 184 | - (void)removeObjectForKey:(NSString *)key; 185 | 186 | /** 187 | Removes all objects from the cache that have not been used since the specified date. 188 | This method blocks the calling thread until the cache has been trimmed. 189 | Uses a semaphore to achieve synchronicity on the disk cache. 190 | 191 | @param date Objects that haven't been accessed since this date are removed from the cache. 192 | */ 193 | - (void)trimToDate:(NSDate *)date; 194 | 195 | /** 196 | Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared. 197 | Uses a semaphore to achieve synchronicity on the disk cache. 198 | */ 199 | - (void)removeAllObjects; 200 | 201 | @end 202 | 203 | NS_ASSUME_NONNULL_END 204 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/PINCache/README.md: -------------------------------------------------------------------------------- 1 | # PINCache 2 | 3 | [![CocoaPods](https://img.shields.io/cocoapods/v/PINCache.svg)](http://cocoadocs.org/docsets/PINCache/) 4 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 5 | 6 | ## Fast, non-deadlocking parallel object cache for iOS and OS X. 7 | 8 | [PINCache](PINCache/PINCache.h) is a fork of [TMCache](https://github.com/tumblr/TMCache) re-architected to fix issues with deadlocking caused by heavy use. It is a key/value store designed for persisting temporary objects that are expensive to reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar stores, one in memory ([PINMemoryCache](PINCache/PINMemoryCache.h)) and one on disk ([PINDiskCache](PINCache/PINDiskCache.h)), all backed by GCD and safe to access from multiple threads simultaneously. On iOS, `PINMemoryCache` will clear itself when the app receives a memory warning or goes into the background. Objects stored in `PINDiskCache` remain until you trim the cache yourself, either manually or by setting a byte or age limit. 9 | 10 | `PINCache` and `PINDiskCache` accept any object conforming to [NSCoding](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html). Put things in like this: 11 | 12 | ```objective-c 13 | UIImage *img = [[UIImage alloc] initWithData:data scale:[[UIScreen mainScreen] scale]]; 14 | [[PINCache sharedCache] setObject:img forKey:@"image" block:nil]; // returns immediately 15 | ``` 16 | 17 | Get them back out like this: 18 | 19 | ```objective-c 20 | [[PINCache sharedCache] objectForKey:@"image" 21 | block:^(PINCache *cache, NSString *key, id object) { 22 | UIImage *image = (UIImage *)object; 23 | NSLog(@"image scale: %f", image.scale); 24 | }]; 25 | ``` 26 | 27 | Both `PINMemoryCache` and PINDiskCache use locks to protect reads and writes. `PINCache` coordinates them so that objects added to memory are available immediately to other threads while being written to disk safely in the background. Both caches are public properties of `PINCache`, so it's easy to manipulate one or the other separately if necessary. 28 | 29 | Collections work too. Thanks to the magic of `NSKeyedArchiver`, objects repeated in a collection only occupy the space of one on disk: 30 | 31 | ```objective-c 32 | NSArray *images = @[ image, image, image ]; 33 | [[PINCache sharedCache] setObject:images forKey:@"images"]; 34 | NSLog(@"3 for the price of 1: %d", [[[PINCache sharedCache] diskCache] byteCount]); 35 | ``` 36 | 37 | ## Installation 38 | 39 | ### Manually 40 | 41 | [Download the latest tag](https://github.com/pinterest/PINCache/tags) and drag the `PINCache` folder into your Xcode project. 42 | 43 | Install the docs by double clicking the `.docset` file under `docs/`, or view them online at [cocoadocs.org](http://cocoadocs.org/docsets/PINCache/) 44 | 45 | ### Git Submodule 46 | 47 | git submodule add https://github.com/pinterest/PINCache.git 48 | git submodule update --init 49 | 50 | ### CocoaPods 51 | 52 | Add [PINCache](http://cocoapods.org/?q=name%3APINCache) to your `Podfile` and run `pod install`. 53 | 54 | ### Carthage 55 | 56 | Add the following line to your `Cartfile` and run `carthage update --platform ios`. Then follow [this instruction of Carthage](https://github.com/carthage/carthage#adding-frameworks-to-unit-tests-or-a-framework) to embed the framework. 57 | 58 | ```github "pinterest/PINCache"``` 59 | 60 | ## Requirements 61 | 62 | __PINCache__ requires iOS 5.0 or OS X 10.7 and greater. 63 | 64 | ## Contact 65 | 66 | [Garrett Moon](mailto:garrett@pinterest.com) 67 | 68 | ## License 69 | 70 | Copyright 2013 Tumblr, Inc. 71 | Copyright 2015 Pinterest, Inc. 72 | 73 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 74 | 75 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. [See the License](LICENSE.txt) for the specific language governing permissions and limitations under the License. 76 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Sam Vermette 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | A different license may apply to other resources included in this package, 25 | including Freepik Icons. Please consult their 26 | respective headers for the terms of their individual licenses. -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVIndefiniteAnimatedView.h 3 | // SVProgressHUD, https://github.com/TransitApp/SVProgressHUD 4 | // 5 | // Copyright (c) 2014 Guillaume Campagna. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface SVIndefiniteAnimatedView : UIView 11 | 12 | @property (nonatomic, assign) CGFloat strokeThickness; 13 | @property (nonatomic, assign) CGFloat radius; 14 | @property (nonatomic, strong) UIColor *strokeColor; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVIndefiniteAnimatedView.m 3 | // SVProgressHUD, https://github.com/TransitApp/SVProgressHUD 4 | // 5 | // Copyright (c) 2014 Guillaume Campagna. All rights reserved. 6 | // 7 | 8 | #import "SVIndefiniteAnimatedView.h" 9 | 10 | #pragma mark SVIndefiniteAnimatedView 11 | 12 | @interface SVIndefiniteAnimatedView () 13 | 14 | @property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer; 15 | 16 | @end 17 | 18 | @implementation SVIndefiniteAnimatedView 19 | 20 | - (void)willMoveToSuperview:(UIView *)newSuperview { 21 | if (newSuperview) { 22 | [self layoutAnimatedLayer]; 23 | } else { 24 | [_indefiniteAnimatedLayer removeFromSuperlayer]; 25 | _indefiniteAnimatedLayer = nil; 26 | } 27 | } 28 | 29 | - (void)layoutAnimatedLayer { 30 | CALayer *layer = self.indefiniteAnimatedLayer; 31 | [self.layer addSublayer:layer]; 32 | 33 | CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds); 34 | CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds); 35 | layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2); 36 | } 37 | 38 | - (CAShapeLayer*)indefiniteAnimatedLayer { 39 | if(!_indefiniteAnimatedLayer) { 40 | CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5); 41 | CGRect rect = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2); 42 | 43 | UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter 44 | radius:self.radius 45 | startAngle:(CGFloat) (M_PI*3/2) 46 | endAngle:(CGFloat) (M_PI/2+M_PI*5) 47 | clockwise:YES]; 48 | 49 | _indefiniteAnimatedLayer = [CAShapeLayer layer]; 50 | _indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale]; 51 | _indefiniteAnimatedLayer.frame = rect; 52 | _indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor; 53 | _indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor; 54 | _indefiniteAnimatedLayer.lineWidth = self.strokeThickness; 55 | _indefiniteAnimatedLayer.lineCap = kCALineCapRound; 56 | _indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel; 57 | _indefiniteAnimatedLayer.path = smoothedPath.CGPath; 58 | 59 | CALayer *maskLayer = [CALayer layer]; 60 | 61 | NSBundle *bundle = [NSBundle bundleForClass:self.class]; 62 | NSURL *url = [bundle URLForResource:@"SVProgressHUD" withExtension:@"bundle"]; 63 | NSBundle *imageBundle = [NSBundle bundleWithURL:url]; 64 | NSString *path = [imageBundle pathForResource:@"angle-mask" ofType:@"png"]; 65 | 66 | maskLayer.contents = (__bridge id)[[UIImage imageWithContentsOfFile:path] CGImage]; 67 | maskLayer.frame = _indefiniteAnimatedLayer.bounds; 68 | _indefiniteAnimatedLayer.mask = maskLayer; 69 | 70 | NSTimeInterval animationDuration = 1; 71 | CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 72 | 73 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 74 | animation.fromValue = (id) 0; 75 | animation.toValue = @(M_PI*2); 76 | animation.duration = animationDuration; 77 | animation.timingFunction = linearCurve; 78 | animation.removedOnCompletion = NO; 79 | animation.repeatCount = INFINITY; 80 | animation.fillMode = kCAFillModeForwards; 81 | animation.autoreverses = NO; 82 | [_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"]; 83 | 84 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 85 | animationGroup.duration = animationDuration; 86 | animationGroup.repeatCount = INFINITY; 87 | animationGroup.removedOnCompletion = NO; 88 | animationGroup.timingFunction = linearCurve; 89 | 90 | CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 91 | strokeStartAnimation.fromValue = @0.015; 92 | strokeStartAnimation.toValue = @0.515; 93 | 94 | CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 95 | strokeEndAnimation.fromValue = @0.485; 96 | strokeEndAnimation.toValue = @0.985; 97 | 98 | animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation]; 99 | [_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"]; 100 | 101 | } 102 | return _indefiniteAnimatedLayer; 103 | } 104 | 105 | - (void)setFrame:(CGRect)frame { 106 | if(!CGRectEqualToRect(frame, super.frame)){ 107 | [super setFrame:frame]; 108 | 109 | if (self.superview) { 110 | [self layoutAnimatedLayer]; 111 | } 112 | } 113 | 114 | } 115 | 116 | - (void)setRadius:(CGFloat)radius { 117 | if(radius != _radius){ 118 | _radius = radius; 119 | 120 | [_indefiniteAnimatedLayer removeFromSuperlayer]; 121 | _indefiniteAnimatedLayer = nil; 122 | 123 | if (self.superview) { 124 | [self layoutAnimatedLayer]; 125 | } 126 | } 127 | } 128 | 129 | - (void)setStrokeColor:(UIColor *)strokeColor { 130 | _strokeColor = strokeColor; 131 | _indefiniteAnimatedLayer.strokeColor = strokeColor.CGColor; 132 | } 133 | 134 | - (void)setStrokeThickness:(CGFloat)strokeThickness { 135 | _strokeThickness = strokeThickness; 136 | _indefiniteAnimatedLayer.lineWidth = _strokeThickness; 137 | } 138 | 139 | - (CGSize)sizeThatFits:(CGSize)size { 140 | return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2); 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@3x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@2x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@3x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@3x.png -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.h 3 | // SVProgressHUD, https://github.com/TransitApp/SVProgressHUD 4 | // 5 | // Copyright (c) 2011-2014 Sam Vermette and contributors. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 12 | 13 | #define UI_APPEARANCE_SELECTOR 14 | 15 | #endif 16 | 17 | extern NSString * const SVProgressHUDDidReceiveTouchEventNotification; 18 | extern NSString * const SVProgressHUDDidTouchDownInsideNotification; 19 | extern NSString * const SVProgressHUDWillDisappearNotification; 20 | extern NSString * const SVProgressHUDDidDisappearNotification; 21 | extern NSString * const SVProgressHUDWillAppearNotification; 22 | extern NSString * const SVProgressHUDDidAppearNotification; 23 | 24 | extern NSString * const SVProgressHUDStatusUserInfoKey; 25 | 26 | typedef NS_ENUM(NSInteger, SVProgressHUDStyle) { 27 | SVProgressHUDStyleLight, // default style, white HUD with black text, HUD background will be blurred on iOS 8 and above 28 | SVProgressHUDStyleDark, // black HUD and white text, HUD background will be blurred on iOS 8 and above 29 | SVProgressHUDStyleCustom // uses the fore- and background color properties 30 | }; 31 | 32 | typedef NS_ENUM(NSUInteger, SVProgressHUDMaskType) { 33 | SVProgressHUDMaskTypeNone = 1, // default mask type, allow user interactions while HUD is displayed 34 | SVProgressHUDMaskTypeClear, // don't allow user interactions 35 | SVProgressHUDMaskTypeBlack, // don't allow user interactions and dim the UI in the back of the HUD, as on iOS 7 and above 36 | SVProgressHUDMaskTypeGradient // don't allow user interactions and dim the UI with a a-la UIAlertView background gradient, as on iOS 6 37 | }; 38 | 39 | typedef NS_ENUM(NSUInteger, SVProgressHUDAnimationType) { 40 | SVProgressHUDAnimationTypeFlat, // default animation type, custom flat animation (indefinite animated ring) 41 | SVProgressHUDAnimationTypeNative // iOS native UIActivityIndicatorView 42 | }; 43 | 44 | @interface SVProgressHUD : UIView 45 | 46 | #pragma mark - Customization 47 | 48 | @property (assign, nonatomic) SVProgressHUDStyle defaultStyle UI_APPEARANCE_SELECTOR; // default is SVProgressHUDStyleLight 49 | @property (assign, nonatomic) SVProgressHUDMaskType defaultMaskType UI_APPEARANCE_SELECTOR; // default is SVProgressHUDMaskTypeNone 50 | @property (assign, nonatomic) SVProgressHUDAnimationType defaultAnimationType UI_APPEARANCE_SELECTOR; // default is SVProgressHUDAnimationTypeFlat 51 | @property (assign, nonatomic) CGSize minimumSize UI_APPEARANCE_SELECTOR; // default is CGSizeZero, can be used to avoid resizing for a larger message 52 | @property (assign, nonatomic) CGFloat ringThickness UI_APPEARANCE_SELECTOR; // default is 2 pt 53 | @property (assign, nonatomic) CGFloat ringRadius UI_APPEARANCE_SELECTOR; // default is 18 pt 54 | @property (assign, nonatomic) CGFloat ringNoTextRadius UI_APPEARANCE_SELECTOR; // default is 24 pt 55 | @property (assign, nonatomic) CGFloat cornerRadius UI_APPEARANCE_SELECTOR; // default is 14 pt 56 | @property (strong, nonatomic) UIFont *font UI_APPEARANCE_SELECTOR; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] 57 | @property (strong, nonatomic) UIColor *backgroundColor UI_APPEARANCE_SELECTOR; // default is [UIColor whiteColor] 58 | @property (strong, nonatomic) UIColor *foregroundColor UI_APPEARANCE_SELECTOR; // default is [UIColor blackColor] 59 | @property (strong, nonatomic) UIImage *infoImage UI_APPEARANCE_SELECTOR; // default is the bundled info image provided by Freepik 60 | @property (strong, nonatomic) UIImage *successImage UI_APPEARANCE_SELECTOR; // default is the bundled success image provided by Freepik 61 | @property (strong, nonatomic) UIImage *errorImage UI_APPEARANCE_SELECTOR; // default is the bundled error image provided by Freepik 62 | @property (strong, nonatomic) UIView *viewForExtension UI_APPEARANCE_SELECTOR; // default is nil, only used if #define SV_APP_EXTENSIONS is set 63 | @property (assign, nonatomic) NSTimeInterval minimumDismissTimeInterval; // default is 5.0 seconds 64 | 65 | @property (assign, nonatomic) UIOffset offsetFromCenter UI_APPEARANCE_SELECTOR; // default is 0, 0 66 | 67 | + (void)setDefaultStyle:(SVProgressHUDStyle)style; // default is SVProgressHUDStyleLight 68 | + (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone 69 | + (void)setDefaultAnimationType:(SVProgressHUDAnimationType)type; // default is SVProgressHUDAnimationTypeFlat 70 | + (void)setMinimumSize:(CGSize)minimumSize; // default is CGSizeZero, can be used to avoid resizing for a larger message 71 | + (void)setRingThickness:(CGFloat)ringThickness; // default is 2 pt 72 | + (void)setRingRadius:(CGFloat)radius; // default is 18 pt 73 | + (void)setRingNoTextRadius:(CGFloat)radius; // default is 24 pt 74 | + (void)setCornerRadius:(CGFloat)cornerRadius; // default is 14 pt 75 | + (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] 76 | + (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor], only used for SVProgressHUDStyleCustom 77 | + (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor], only used for SVProgressHUDStyleCustom 78 | + (void)setInfoImage:(UIImage*)image; // default is the bundled info image provided by Freepik 79 | + (void)setSuccessImage:(UIImage*)image; // default is the bundled success image provided by Freepik 80 | + (void)setErrorImage:(UIImage*)image; // default is the bundled error image provided by Freepik 81 | + (void)setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set 82 | + (void)setMinimumDismissTimeInterval:(NSTimeInterval)interval; // default is 5.0 seconds 83 | 84 | #pragma mark - Show Methods 85 | 86 | + (void)show; 87 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use show and setDefaultMaskType: instead."))); 88 | + (void)showWithStatus:(NSString*)status; 89 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showWithStatus: and setDefaultMaskType: instead."))); 90 | 91 | + (void)showProgress:(float)progress; 92 | + (void)showProgress:(float)progress maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showProgress: and setDefaultMaskType: instead."))); 93 | + (void)showProgress:(float)progress status:(NSString*)status; 94 | + (void)showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showProgress: and setDefaultMaskType: instead."))); 95 | 96 | + (void)setStatus:(NSString*)status; // change the HUD loading status while it's showing 97 | 98 | // stops the activity indicator, shows a glyph + status, and dismisses the HUD a little bit later 99 | + (void)showInfoWithStatus:(NSString*)status; 100 | + (void)showInfoWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showInfoWithStatus: and setDefaultMaskType: instead."))); 101 | + (void)showSuccessWithStatus:(NSString*)status; 102 | + (void)showSuccessWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showSuccessWithStatus: and setDefaultMaskType: instead."))); 103 | + (void)showErrorWithStatus:(NSString*)status; 104 | + (void)showErrorWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showErrorWithStatus: and setDefaultMaskType: instead."))); 105 | 106 | // shows a image + status, use 28x28 white PNGs 107 | + (void)showImage:(UIImage*)image status:(NSString*)status; 108 | + (void)showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType __attribute__((deprecated("Use showImage: and setDefaultMaskType: instead."))); 109 | 110 | + (void)setOffsetFromCenter:(UIOffset)offset; 111 | + (void)resetOffsetFromCenter; 112 | 113 | + (void)popActivity; // decrease activity count, if activity count == 0 the HUD is dismissed 114 | + (void)dismiss; 115 | + (void)dismissWithDelay:(NSTimeInterval)delay; // delayes the dismissal 116 | 117 | + (BOOL)isVisible; 118 | 119 | + (NSTimeInterval)displayDurationForString:(NSString*)string; 120 | 121 | @end 122 | 123 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVRadialGradientLayer.h 3 | // SVProgressHUD, https://github.com/TransitApp/SVProgressHUD 4 | // 5 | // Copyright (c) 2014 Tobias Tiemerding. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface SVRadialGradientLayer : CALayer 11 | 12 | @property (nonatomic) CGPoint gradientCenter; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVRadialGradientLayer.m 3 | // SVProgressHUD, https://github.com/TransitApp/SVProgressHUD 4 | // 5 | // Copyright (c) 2014 Tobias Tiemerding. All rights reserved. 6 | // 7 | 8 | #import "SVRadialGradientLayer.h" 9 | 10 | @implementation SVRadialGradientLayer 11 | 12 | - (void)drawInContext:(CGContextRef)context { 13 | size_t locationsCount = 2; 14 | CGFloat locations[2] = {0.0f, 1.0f}; 15 | CGFloat colors[8] = {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.75f}; 16 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 17 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount); 18 | CGColorSpaceRelease(colorSpace); 19 | 20 | float radius = MIN(self.bounds.size.width , self.bounds.size.height) ; 21 | CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation); 22 | CGGradientRelease(gradient); 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #ifndef TARGET_OS_IOS 6 | #define TARGET_OS_IOS TARGET_OS_IPHONE 7 | #endif 8 | 9 | #ifndef TARGET_OS_WATCH 10 | #define TARGET_OS_WATCH 0 11 | #endif 12 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/PINCache" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | OTHER_LDFLAGS = -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/PINCache/PINCache-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PINCache : NSObject 3 | @end 4 | @implementation PodsDummy_PINCache 5 | @end 6 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/PINCache/PINCache-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/PINCache/PINCache.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PINCache" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/PINCache" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | OTHER_LDFLAGS = -framework "Foundation" -weak_framework "UIKit" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/Pods/Pods-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | if [[ "$CONFIGURATION" == "Debug" ]]; then 61 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 62 | fi 63 | if [[ "$CONFIGURATION" == "Release" ]]; then 64 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 65 | fi 66 | 67 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 68 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 69 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 70 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 71 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 72 | fi 73 | rm -f "$RESOURCES_TO_COPY" 74 | 75 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 76 | then 77 | case "${TARGETED_DEVICE_FAMILY}" in 78 | 1,2) 79 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 80 | ;; 81 | 1) 82 | TARGET_DEVICE_ARGS="--target-device iphone" 83 | ;; 84 | 2) 85 | TARGET_DEVICE_ARGS="--target-device ipad" 86 | ;; 87 | *) 88 | TARGET_DEVICE_ARGS="--target-device mac" 89 | ;; 90 | esac 91 | 92 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 93 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 94 | while read line; do 95 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 96 | XCASSET_FILES+=("$line") 97 | fi 98 | done <<<"$OTHER_XCASSETS" 99 | 100 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 101 | fi 102 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/PINCache" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/PINCache" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"PINCache" -l"SVProgressHUD" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -weak_framework "UIKit" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/PINCache" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/PINCache" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"PINCache" -l"SVProgressHUD" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -weak_framework "UIKit" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/SVProgressHUD/SVProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SVProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_SVProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/SVProgressHUD/SVProgressHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /FGTranslatorDemo/Pods/Target Support Files/SVProgressHUD/SVProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SVProgressHUD" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/PINCache" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | OTHER_LDFLAGS = -framework "QuartzCore" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /fgtranslator_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpolak/FGTranslator/7cd8a640f91be7a16eac5da9719782082b752a4c/fgtranslator_logo.png --------------------------------------------------------------------------------