Skip to content

Commit

Permalink
Fixing code that looks out of place.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Chen committed Apr 26, 2017
1 parent c064e4c commit 4e4d0e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Example/Tests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Tests: XCTestCase {
}

}
(Tests.dispatchQueue).async{
Tests.dispatchQueue.async{

DMP.getAudienceData {
result in
Expand Down
17 changes: 8 additions & 9 deletions Pod/Classes/DMP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ open class DMP:NSObject{

let behaviorCopy = sharedManager.behaviors
Alamofire.request(Router.sendBehaviorData(baseUrlString: sharedManager.baseBCPUrl, params: behaviorCopy))
.validate().response{
response in DispatchQueue.main.async{
if let statusCode = response.response?.statusCode , statusCode == 200 {
.validate().response{ response in
DispatchQueue.main.async{
if let statusCode = response.response?.statusCode, statusCode == 200 {
completion(Result<Data>.success(Data()))
}else{
completion(Result<Data>.failure(LotameError.unexpectedResponse))
Expand Down Expand Up @@ -254,10 +254,9 @@ open class DMP:NSObject{
Used by objective-c code that does not support generics. Do not use in swift. Use getAudienceData instead
*/
@objc open class func getAudienceDataWithHandler(_ handler:@escaping (_ profile: LotameProfile?, _ success: Bool)->Void) {
getAudienceData{
result in
if result.isSuccess{
handler(result.value!, true)
getAudienceData{ result in
if let resultValue = result.value, result.isSuccess {
handler(resultValue, true)
}else{
handler(nil, false)
}
Expand Down Expand Up @@ -290,8 +289,8 @@ open class DMP:NSObject{

Alamofire.request(Router.audienceData(baseUrlString: sharedManager.baseADUrl, params: nil))
.validate()
.responseJSON(options: .allowFragments){
response in DispatchQueue.main.async{
.responseJSON(options: .allowFragments){ response in
DispatchQueue.main.async{
if let value = response.result.value, response.response?.statusCode == 200 && response.result.isSuccess{
completion(Result<LotameProfile>.success(LotameProfile(json: JSON(value))))
} else {
Expand Down

0 comments on commit 4e4d0e6

Please sign in to comment.