Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent 9274d7fd9b
commit c11b82ba30

@ -279,11 +279,7 @@ extension GiphyError: LocalizedError {
private let kGiphyBaseURL = "https://api.giphy.com/"
private func giphyAPISessionManager() -> AFHTTPSessionManager? {
guard let baseUrl = NSURL(string:kGiphyBaseURL) else {
Logger.error("\(TAG) Invalid base URL.")
return nil
}
public class func giphySessionConfiguration() -> URLSessionConfiguration {
let configuration = URLSessionConfiguration.ephemeral
let proxyHost = "giphy-proxy-production.whispersystems.org"
let proxyPort = 80
@ -295,9 +291,16 @@ extension GiphyError: LocalizedError {
"HTTPSProxy": proxyHost,
"HTTPSPort": proxyPort
]
return configuration
}
private func giphyAPISessionManager() -> AFHTTPSessionManager? {
guard let baseUrl = NSURL(string:kGiphyBaseURL) else {
Logger.error("\(TAG) Invalid base URL.")
return nil
}
let sessionManager = AFHTTPSessionManager(baseURL:baseUrl as URL,
sessionConfiguration:configuration)
sessionConfiguration:GiphyAPI.giphySessionConfiguration())
sessionManager.requestSerializer = AFJSONRequestSerializer()
sessionManager.responseSerializer = AFJSONResponseSerializer()

@ -181,20 +181,11 @@ extension URLSessionTask {
private let kGiphyBaseURL = "https://api.giphy.com/"
private func giphyDownloadSession() -> URLSession? {
let configuration = URLSessionConfiguration.ephemeral
let proxyHost = "giphy-proxy-production.whispersystems.org"
let proxyPort = 80
configuration.connectionProxyDictionary = [
"HTTPEnable": 1,
"HTTPProxy": proxyHost,
"HTTPPort": proxyPort,
"HTTPSEnable": 1,
"HTTPSProxy": proxyHost,
"HTTPSPort": proxyPort
]
let configuration = GiphyAPI.giphySessionConfiguration()
configuration.urlCache = nil
configuration.requestCachePolicy = .reloadIgnoringCacheData
let session = URLSession(configuration:configuration, delegate:self, delegateQueue:operationQueue)
let session = URLSession(configuration:configuration,
delegate:self, delegateQueue:operationQueue)
return session
}

Loading…
Cancel
Save