Merged branch Set-Up-Error-Messages-For-Ebay into master

This commit is contained in:
Okechi Onyeje 2017-01-25 18:46:49 -05:00
commit c1b8171fd1
10 changed files with 521 additions and 52 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -280,7 +280,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift"
timestampString = "506444138.580552" timestampString = "507078870.598666"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "32" startingLineNumber = "32"
@ -295,7 +295,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift"
timestampString = "506444138.580651" timestampString = "507078870.59876"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "32" startingLineNumber = "32"
@ -310,7 +310,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift"
timestampString = "506444138.580732" timestampString = "507078870.598847"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "32" startingLineNumber = "32"
@ -325,7 +325,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ExternalWebViewController.swift"
timestampString = "506444138.580811" timestampString = "507078870.598953"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "32" startingLineNumber = "32"
@ -610,15 +610,15 @@
<BreakpointProxy <BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent <BreakpointContent
shouldBeEnabled = "Yes" shouldBeEnabled = "No"
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift" filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "506359165.328679" timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "438" startingLineNumber = "441"
endingLineNumber = "438" endingLineNumber = "441"
landmarkName = "parser(_:foundCharacters:)" landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -630,11 +630,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift" filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "506415773.009495" timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "245" startingLineNumber = "246"
endingLineNumber = "245" endingLineNumber = "246"
landmarkName = "listItem(_:imageUrls:completion:)" landmarkName = "listItem(_:imageUrls:completion:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -646,11 +646,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift" filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "506416123.471754" timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "296" startingLineNumber = "297"
endingLineNumber = "296" endingLineNumber = "297"
landmarkName = "listItem(_:imageUrls:completion:)" landmarkName = "listItem(_:imageUrls:completion:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -658,15 +658,15 @@
<BreakpointProxy <BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent <BreakpointContent
shouldBeEnabled = "No" shouldBeEnabled = "Yes"
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift" filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "506416197.569007" timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "559" startingLineNumber = "562"
endingLineNumber = "559" endingLineNumber = "562"
landmarkName = "parser(_:foundCharacters:)" landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -914,7 +914,7 @@
<BreakpointProxy <BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent <BreakpointContent
shouldBeEnabled = "Yes" shouldBeEnabled = "No"
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/NetworkCollectionViewCell.swift" filePath = "Vendoo/NetworkCollectionViewCell.swift"
@ -927,5 +927,325 @@
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "471"
endingLineNumber = "471"
landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "249"
endingLineNumber = "249"
landmarkName = "listItem(_:imageUrls:completion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "258"
endingLineNumber = "258"
landmarkName = "listItem(_:imageUrls:completion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "275"
endingLineNumber = "275"
landmarkName = "listItem(_:imageUrls:completion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ListingPreviewViewController.swift"
timestampString = "507051612.416592"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "661"
endingLineNumber = "661"
landmarkName = "publishItem(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ListingPreviewViewController.swift"
timestampString = "507050170.120996"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "658"
endingLineNumber = "658"
landmarkName = "publishItem(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "433"
endingLineNumber = "433"
landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "421"
endingLineNumber = "421"
landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "422"
endingLineNumber = "422"
landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EbayWebServiceManager.swift"
timestampString = "507078869.180288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "438"
endingLineNumber = "438"
landmarkName = "parser(_:foundCharacters:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "507076939.688083"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "270"
endingLineNumber = "270"
landmarkName = "tableView(_:cellForRowAtIndexPath:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, cellForRowAtIndexPath : __ObjC.NSIndexPath) -&gt; __ObjC.UITableViewCell"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
timestampString = "507078870.605126"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "270"
endingLineNumber = "270"
offsetFromSymbolStart = "2884">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, cellForRowAtIndexPath : __ObjC.NSIndexPath) -&gt; __ObjC.UITableViewCell"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
timestampString = "507078870.60528"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "270"
endingLineNumber = "270"
offsetFromSymbolStart = "8228">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "507076431.735087"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "105"
endingLineNumber = "105"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "507076491.230844"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "103"
endingLineNumber = "103"
landmarkName = "pollServices()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.ServiceNotificationManager.(pollServices () -&gt; ()).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ServiceNotificationManager.swift"
timestampString = "507078870.605994"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "103"
endingLineNumber = "103"
offsetFromSymbolStart = "4122">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.ServiceNotificationManager.(pollServices () -&gt; ()).(closure #1).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ServiceNotificationManager.swift"
timestampString = "507078870.606092"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "104"
endingLineNumber = "104"
offsetFromSymbolStart = "19">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "507076610.492511"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "108"
endingLineNumber = "108"
landmarkName = "pollServices()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.ServiceNotificationManager.(pollServices () -&gt; ()).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ServiceNotificationManager.swift"
timestampString = "507078870.607268"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "108"
endingLineNumber = "108"
offsetFromSymbolStart = "4459">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.ServiceNotificationManager.(pollServices () -&gt; ()).(closure #1).(closure #1).(closure #2)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Kroleo/Vendoo/Vendoo_bb/Vendoo/Vendoo/ServiceNotificationManager.swift"
timestampString = "507078870.60736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "110"
endingLineNumber = "110"
offsetFromSymbolStart = "23">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>

BIN
Vendoo/.DS_Store vendored

Binary file not shown.

View File

@ -45,10 +45,16 @@ class EbayWebServiceManager: NSObject {
private var completion: ServiceResponse! private var completion: ServiceResponse!
private var isGettingSubCategories: Bool = false private var isGettingSubCategories: Bool = false
private var isRevisingListing: Bool = false private var isRevisingListing: Bool = false
private var isErrorHandling: Bool = false
private var currErrorCodeKey: String = ""
private var currErrorMessage: String = ""
private var errorCount = 0
var errorInfo: [[String:String]] = []
private var requestGroup: dispatch_group_t = dispatch_group_create() private var requestGroup: dispatch_group_t = dispatch_group_create()
var isGettingNotification: Bool = false var isGettingNotification: Bool = false
private var qtySold: Int! private var qtySold: Int!
private var currItemQuantity: Int! private var currItemQuantity: Int!
private var currViewController: UIViewController!
//---------------------------------------------// //---------------------------------------------//
@ -307,7 +313,7 @@ extension EbayWebServiceManager {
} }
//after getting a sessionID get a unique oauth token //after getting a sessionID get a unique oauth token
func fetchToken() { func fetchToken(onComplete: ServiceResponse?) {
let soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + let soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<FetchTokenRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\"><SessionID>\(self.xmlResponseDictionary["SessionID"] as! String!)</SessionID></FetchTokenRequest>" "<FetchTokenRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\"><SessionID>\(self.xmlResponseDictionary["SessionID"] as! String!)</SessionID></FetchTokenRequest>"
@ -315,6 +321,7 @@ extension EbayWebServiceManager {
let theRequest = NSMutableURLRequest(URL: url!) let theRequest = NSMutableURLRequest(URL: url!)
theRequest.addValue("FetchToken", forHTTPHeaderField: "X-EBAY-API-CALL-NAME") theRequest.addValue("FetchToken", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
//dispatch_group_enter(self.requestGroup) //dispatch_group_enter(self.requestGroup)
self.completion = onComplete
self.requestMaker(soapMessage, theRequest: theRequest) self.requestMaker(soapMessage, theRequest: theRequest)
} }
@ -382,6 +389,7 @@ extension EbayWebServiceManager: NSURLConnectionDelegate {
print(response) print(response)
var response_fixed = response!.stringByReplacingOccurrencesOfString("&amp;", withString: "and") var response_fixed = response!.stringByReplacingOccurrencesOfString("&amp;", withString: "and")
response_fixed = response_fixed.stringByReplacingOccurrencesOfString("&apos;", withString: "'")
let data_fixed = response_fixed.dataUsingEncoding(NSUTF8StringEncoding) let data_fixed = response_fixed.dataUsingEncoding(NSUTF8StringEncoding)
print(response_fixed) print(response_fixed)
let xmlParser = NSXMLParser(data: data_fixed!) let xmlParser = NSXMLParser(data: data_fixed!)
@ -417,6 +425,45 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
self.isRevisingListing = false self.isRevisingListing = false
} }
} }
else if(string == "Failure") {
self.isErrorHandling = true
}
break
case "Errors":
if(self.isErrorHandling) {
}
case "ShortMessage":
if(self.isErrorHandling) {
self.errorInfo.append(Dictionary<String, String>())
self.errorInfo[self.errorCount]["short_message"] = string
}
break
case "LongMessage":
if(self.isErrorHandling) {
self.errorInfo[self.errorCount]["long_message"] = string
}
break
case "ErrorCode":
if(self.isErrorHandling) {
self.errorInfo[self.errorCount]["error_code"] = string
}
break
case "SeverityCode":
if(self.isErrorHandling) {
self.errorInfo[self.errorCount]["severity_code"] = string
}
break
case "ErrorClassification":
if(self.isErrorHandling) {
self.errorInfo[self.errorCount]["error_classification"] = string
self.errorCount+=1
}
break
case "Build":
if(self.isErrorHandling){
self.completion(self.errorInfo, true)
}
break break
/* /*
Used to authorize user to allow posting new listings to ebay sites and fetches all necessary information when posting to Ebay Used to authorize user to allow posting new listings to ebay sites and fetches all necessary information when posting to Ebay
@ -439,7 +486,7 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
print("account credentials saved") print("account credentials saved")
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "ebayAuthorized") NSUserDefaults.standardUserDefaults().setBool(true, forKey: "ebayAuthorized")
self.isAuthorized = true self.isAuthorized = true
//self.completion(nil, nil) self.completion(nil, nil)
//Test authentication //Test authentication
let soapmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + let soapmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -595,3 +642,4 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
} }
} }

View File

@ -14,7 +14,7 @@ import OAuthSwift
import Locksmith import Locksmith
typealias ServiceResponse = (AnyObject?, NSError?) -> Void typealias ServiceResponse = (AnyObject?, AnyObject?) -> Void
class EtsyRESTAPIManager: NSObject { class EtsyRESTAPIManager: NSObject {

View File

@ -216,6 +216,7 @@ class HomeViewController: UITabBarController {
self.soldListings.sortInPlace({$0.title.lowercaseString < $1.title.lowercaseString}) self.soldListings.sortInPlace({$0.title.lowercaseString < $1.title.lowercaseString})
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil) NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
self.notificationsManager.setListings(self.userListings) self.notificationsManager.setListings(self.userListings)
self.notificationsManager.setVC(self.selectedViewController!)
self.notificationsManager.startServicePolling() self.notificationsManager.startServicePolling()
} }

View File

@ -652,14 +652,35 @@ extension ListingPreviewViewController {
"category_id":self.itemListingDictionary["ebaySubCategoryID"] as! String "category_id":self.itemListingDictionary["ebaySubCategoryID"] as! String
] ]
let listingCompletion: ServiceResponse = { let listingCompletion: ServiceResponse = {
(listingID, error) -> Void in (listingData, error) -> Void in
if((self.newInProgressListing["networkIDs"] == nil)){
self.newInProgressListing["networkIDs"] = Dictionary<String, AnyObject>() //checks if there is an error from the xml response
if((error as? Bool) != nil && (error as! Bool) && listingData as? [[String : String]] != nil){
var listOfErrors = ""
for errorData in listingData as! [[String:String]] {
if(errorData["severity_code"] == "Error") {
listOfErrors += "Error Code: " + errorData["error_code"]! + "\n"
listOfErrors += "Message: " + errorData["long_message"]! + "\n\n"
}
}
let alert = UIAlertController(title: "A Problem Occurred With Ebay", message: "The following is the list of errors when trying to post to ebay.\n\n\(listOfErrors)", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in
alert.dismissViewControllerAnimated(true, completion: {
dispatch_group_leave(postingGroup)
})
}))
}else{
if((self.newInProgressListing["networkIDs"] == nil)){
self.newInProgressListing["networkIDs"] = Dictionary<String, AnyObject>()
}
var networkIDs = (self.newInProgressListing["networkIDs"] as! Dictionary<String, AnyObject>)
networkIDs["ebay"] = listingData as! String
self.newInProgressListing["networkIDs"] = networkIDs
dispatch_group_leave(postingGroup)
} }
var networkIDs = (self.newInProgressListing["networkIDs"] as! Dictionary<String, AnyObject>)
networkIDs["ebay"] = listingID as! String
self.newInProgressListing["networkIDs"] = networkIDs
dispatch_group_leave(postingGroup)
} }
self.ebayManager.listItem(body, imageUrls: imageURLs, completion: listingCompletion) self.ebayManager.listItem(body, imageUrls: imageURLs, completion: listingCompletion)

View File

@ -64,6 +64,7 @@ class NetworksTableViewController: UIViewController {
override func viewDidAppear(animated: Bool) { override func viewDidAppear(animated: Bool) {
if (!self.networkToggleOrSelect) { if (!self.networkToggleOrSelect) {
(menuButton.target as! SWRevealViewController).delegate = self (menuButton.target as! SWRevealViewController).delegate = self
self.tableView.reloadData()
} }
} }
@ -269,11 +270,14 @@ extension NetworksTableViewController: UITableViewDataSource {
if(((self.tabBarController as? HomeViewController)?.ebayGraphManager.isAuthorized)!){ if(((self.tabBarController as? HomeViewController)?.ebayGraphManager.isAuthorized)!){
dispatch_async(dispatch_get_main_queue(), { dispatch_async(dispatch_get_main_queue(), {
(cell as! EbayTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) (cell as! EbayTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal)
(cell as! EbayTableViewCell).settingsBtn.enabled = true
(cell as! EbayTableViewCell).settingsBtn.hidden = false
}) })
}else{ }else{
(cell as! EbayTableViewCell).settingsBtn.enabled = false (cell as! EbayTableViewCell).settingsBtn.enabled = false
(cell as! EbayTableViewCell).settingsBtn.hidden = true (cell as! EbayTableViewCell).settingsBtn.hidden = true
(cell as! EbayTableViewCell).authorizeBtn.setTitle("Login", forState: UIControlState.Normal)
} }
break break
@ -289,12 +293,14 @@ extension NetworksTableViewController: UITableViewDataSource {
if(((tabBar as? HomeViewController)?.etsyManager.isAuthorized)!){ if(((tabBar as? HomeViewController)?.etsyManager.isAuthorized)!){
dispatch_async(dispatch_get_main_queue(), { dispatch_async(dispatch_get_main_queue(), {
(cell as! EtsyTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) (cell as! EtsyTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal)
(cell as! EtsyTableViewCell).settingsBtn.enabled = true
(cell as! EtsyTableViewCell).settingsBtn.hidden = false
}) })
}else{ }else{
(cell as! EtsyTableViewCell).settingsBtn.enabled = false (cell as! EtsyTableViewCell).settingsBtn.enabled = false
(cell as! EtsyTableViewCell).settingsBtn.hidden = true (cell as! EtsyTableViewCell).settingsBtn.hidden = true
(cell as! EtsyTableViewCell).authorizeBtn.setTitle("Login", forState: UIControlState.Normal)
} }
break break
default: default:
@ -304,12 +310,15 @@ extension NetworksTableViewController: UITableViewDataSource {
let tabBar = self.tabBarController let tabBar = self.tabBarController
if(((tabBar as? HomeViewController)?.fbGraphManager.isAuthorized)!){ if(((tabBar as? HomeViewController)?.fbGraphManager.isAuthorized)!){
dispatch_async(dispatch_get_main_queue(), { dispatch_async(dispatch_get_main_queue(), {
(cell as! FBTableViewCell).settingsBtn.enabled = true
(cell as! FBTableViewCell).settingsBtn.hidden = false
(cell as! FBTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) (cell as! FBTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal)
}) })
}else{ }else{
dispatch_async(dispatch_get_main_queue(), { dispatch_async(dispatch_get_main_queue(), {
(cell as! FBTableViewCell).settingsBtn.enabled = false (cell as! FBTableViewCell).settingsBtn.enabled = false
(cell as! FBTableViewCell).settingsBtn.hidden = true (cell as! FBTableViewCell).settingsBtn.hidden = true
(cell as! FBTableViewCell).authorizeBtn.setTitle("Login", forState: UIControlState.Normal)
}) })
} }
@ -624,7 +633,32 @@ extension NetworksTableViewController: UIWebViewDelegate {
var responseString : NSString? = webView.stringByEvaluatingJavaScriptFromString("document.documentElement.outerHTML")! var responseString : NSString? = webView.stringByEvaluatingJavaScriptFromString("document.documentElement.outerHTML")!
if((responseString!.containsString("Authorization successfully completed"))){ if((responseString!.containsString("Authorization successfully completed"))){
NSLog("Oauth successful") NSLog("Oauth successful")
((self.tabBarController as? HomeViewController)?.ebayGraphManager)!.fetchToken() ((self.tabBarController as? HomeViewController)?.ebayGraphManager)!.fetchToken({
(loginResponse, error) in
if((error as? Bool) != nil && (error as! Bool) && loginResponse as? [[String : String]] != nil){
var listOfErrors = ""
for errorData in loginResponse as! [[String:String]] {
if(errorData["severity_code"] == "Error") {
listOfErrors += "Error Code: " + errorData["error_code"]! + "\n"
if errorData["error_code"] == "931" {
listOfErrors += "Message: Must relogin into your account to reauthorize your Ebay account for Vendoo."
}else{
listOfErrors += "Message: " + errorData["long_message"]! + "\n\n"
}
}
}
let alert = UIAlertController(title: "A Problem With Ebay Login", message: "The following is the list of errors when logging in to ebay.\n\n\(listOfErrors).\n\nAn easy fix to this would be to deauthorize vendoo from your account manually on the Ebay official site and relogin with the Vendoo application.", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in
alert.dismissViewControllerAnimated(true, completion: {
})
}))
self.presentViewController(alert, animated: true, completion: nil)
}
})
} }
} }

View File

@ -7,6 +7,8 @@
// //
import Foundation import Foundation
import UIKit
import Locksmith
protocol ServiceNotificationManagerDelegate { protocol ServiceNotificationManagerDelegate {
func listingHasEnded(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?) func listingHasEnded(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?)
@ -24,6 +26,7 @@ class ServiceNotificationManager: NSObject {
var ebayGraphManager: EbayWebServiceManager! var ebayGraphManager: EbayWebServiceManager!
var userListings: [Listing] = [] var userListings: [Listing] = []
var timer: NSTimer! var timer: NSTimer!
var vc: UIViewController!
static var delegate: ServiceNotificationManagerDelegate? static var delegate: ServiceNotificationManagerDelegate?
override init() { override init() {
@ -43,6 +46,10 @@ class ServiceNotificationManager: NSObject {
timer.invalidate() timer.invalidate()
} }
func setVC(vc: UIViewController){
self.vc = vc
}
func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){ func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){
self.fbGraphManager = fbManager self.fbGraphManager = fbManager
self.firebaseManager = fireManager self.firebaseManager = fireManager
@ -76,37 +83,75 @@ class ServiceNotificationManager: NSObject {
self.ebayGraphManager.getListingInfo(ebayID!, onComplete: { self.ebayGraphManager.getListingInfo(ebayID!, onComplete: {
(listingNotificationInfo, error) -> Void in (listingNotificationInfo, error) -> Void in
let info = (listingNotificationInfo as! [String : AnyObject])
if(info["status"] as! String == "Ended") { //checks if there is an error from the xml response
if((info["quantitySold"] as! Int) > 0) { if((error as? Bool) != nil && (error as! Bool) && listingNotificationInfo as? [[String : String]] != nil){
var listOfErrors = ""
//checks if listing is sold out for errorData in listingNotificationInfo as! [[String:String]] {
if (((info["itemQuantity"] as! Int) - (info["quantitySold"] as! Int)) == 0) { if(errorData["severity_code"] == "Error") {
listOfErrors += "Error Code: " + errorData["error_code"]! + "\n"
if errorData["error_code"] == "931" {
listOfErrors += "Message: Must relogin into your account to reauthorize your Ebay account for Vendoo."
}else{
listOfErrors += "Message: " + errorData["long_message"]! + "\n\n"
}
}
}
let alert = UIAlertController(title: "A Problem Occurred With Ebay", message: "The following is the list of errors when trying to to retrieve notifications from ebay.\n\n\(listOfErrors)", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in
alert.dismissViewControllerAnimated(true, completion: {
ServiceNotificationManager.delegate?.listingHasNewNotifications( })
}))
self.vc.presentViewController(alert, animated: true, completion: {
do {
try Locksmith.deleteDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo_oauth_ebay")
NSUserDefaults.standardUserDefaults().setBool(false, forKey: "ebayAuthorized")
self.ebayGraphManager.isAuthorized = false
}catch {
(error)
print(error)
}
})
}else{
let info = (listingNotificationInfo as! [String : AnyObject])
if(info["status"] as! String == "Ended") {
if((info["quantitySold"] as! Int) > 0) {
//checks if listing is sold out
if (((info["itemQuantity"] as! Int) - (info["quantitySold"] as! Int)) == 0) {
ServiceNotificationManager.delegate?.listingHasNewNotifications(
nil,
ebayInfo: [
"type": "Sold",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has sold out on ebay.",
"listingKey": listing.key],
amazonInfo: nil,
etsyInfo: nil
)
}
}else{
ServiceNotificationManager.delegate?.listingHasEnded(
nil, nil,
ebayInfo: [ ebayInfo: [
"type": "Sold", "type": "Ended",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has sold out on ebay.", "notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has ended on ebay.",
"listingKey": listing.key], "listingKey": listing.key],
amazonInfo: nil, amazonInfo: nil,
etsyInfo: nil etsyInfo: nil
) )
} }
}else{
ServiceNotificationManager.delegate?.listingHasEnded(
nil,
ebayInfo: [
"type": "Ended",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has ended on ebay.",
"listingKey": listing.key],
amazonInfo: nil,
etsyInfo: nil
)
} }
} }
}) })
} }