diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate index 6518c2a..cae4aa3 100644 Binary files a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate and b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index eb86d1b..1771a8c 100644 --- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -9,13 +9,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Vendoo/HomeViewController.swift" - timestampString = "500473804.952967" + filePath = "Vendoo/ListingPreviewViewController.swift" + timestampString = "500531783.995661" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "286" - endingLineNumber = "286" - landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)" + startingLineNumber = "584" + endingLineNumber = "584" + landmarkName = "publishItem(_:)" landmarkType = "5"> @@ -25,45 +25,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Vendoo/HomeViewController.swift" - timestampString = "500473804.952967" + filePath = "Vendoo/EbayWebServiceManager.swift" + timestampString = "500698080.42828" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "293" - endingLineNumber = "293" - landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)" - landmarkType = "5"> - - - - - - - - @@ -73,13 +41,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Vendoo/EtsyRESTAPIManager.swift" - timestampString = "498402567.760806" + filePath = "Vendoo/EbayWebServiceManager.swift" + timestampString = "500698080.42828" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "623" - endingLineNumber = "623" - landmarkName = "getListingInfo(_:onCompletion:)" + startingLineNumber = "333" + endingLineNumber = "333" + landmarkName = "getSubCategories(_:detailLevel:catCode:onCompletion:)" landmarkType = "5"> @@ -89,27 +57,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Vendoo/ServiceNotificationManager.swift" - timestampString = "500473804.952967" + filePath = "Vendoo/CategoriesTableViewController.swift" + timestampString = "500532339.280573" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "236" - endingLineNumber = "236"> - - - - @@ -119,59 +73,139 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Vendoo/HomeViewController.swift" - timestampString = "500475450.307316" + filePath = "Vendoo/CategoriesTableViewController.swift" + timestampString = "500532383.97993" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "375" - endingLineNumber = "375" - landmarkName = "listingHasNewNotifications(_:ebayInfo:amazonInfo:etsyInfo:)" + startingLineNumber = "572" + endingLineNumber = "572" + landmarkName = "navigateCategories()" landmarkType = "5"> + + + + + + + + + + + + + + + + + + + + + startingLineNumber = "570" + endingLineNumber = "570" + offsetFromSymbolStart = "1532"> @@ -180,77 +214,95 @@ - - - - - - - - + + + + + + + + + + + + @@ -262,525 +314,14 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Vendoo/ServiceNotificationManager.swift" - timestampString = "500473804.952967" + timestampString = "500698687.065339" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "203" - endingLineNumber = "203" + startingLineNumber = "229" + endingLineNumber = "229" landmarkName = "pollServices()" landmarkType = "5"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Vendoo/EbayWebServiceManager.swift b/Vendoo/EbayWebServiceManager.swift index 1458763..50c9d87 100644 --- a/Vendoo/EbayWebServiceManager.swift +++ b/Vendoo/EbayWebServiceManager.swift @@ -282,9 +282,9 @@ extension EbayWebServiceManager { "\(dict["listingDuration"] as! String!)" + "\(dict["listingType"] as! String!)" + "\(dict["payment"] as! String!)" + - "\(dict["paypal_email"] as! String!)" + "\(dict["paypal_email"] as! String!)Gallery" - for i in 0...(0/*imageUrls.count - 1*/) { //will replace with actual count once everything is working with images + for i in 0...(imageUrls.count - 1) { //will replace with actual count once everything is working with images soapMessage = soapMessage + "\(imageUrls[i].stringByReplacingOccurrencesOfString("&", withString: "&"))" @@ -329,6 +329,7 @@ extension EbayWebServiceManager { } func getSubCategories(selectedCategory: String, detailLevel: Int, catCode: String, onCompletion: ServiceResponse) { + self.isGettingNotification = false self.isGettingSubCategories = true //var dict = EbayWebServiceManager.settingsDictionary["categories"]! var soapMessage = "" + @@ -344,7 +345,6 @@ extension EbayWebServiceManager { let url = NSURL(string: self.baseURL) let theRequest = NSMutableURLRequest(URL: url!) theRequest.addValue("GetCategories", forHTTPHeaderField: "X-EBAY-API-CALL-NAME") - self.completion = onCompletion self.catDetailLevel = detailLevel self.requestMaker(soapMessage, theRequest: theRequest) @@ -534,23 +534,25 @@ extension EbayWebServiceManager: NSXMLParserDelegate { EbayWebServiceManager.settingsDictionary["categories"] = dict NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings") } - var dict: Dictionary> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary> + else { + if "\(self.catDetailLevel)" == self.catLevel { + if((self.subCategories[string] == nil )){ + self.subCategories[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel] + } + + + } + self.currentCategory = string + } + + /* var dict: Dictionary> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary> dict[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel] EbayWebServiceManager.settingsDictionary["categories"] = dict - NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings") + NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings")*/ } - else { - /*if "\(self.catDetailLevel)" == self.catLevel { - if((self.subCategories[string] == nil )){ - self.subCategories[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel] - } - - - } - self.currentCategory = string*/ - } + break @@ -562,6 +564,7 @@ extension EbayWebServiceManager: NSXMLParserDelegate { dict[self.currentCategory]!["isLeaf"] = true } else { + //@FIXME: breaking here retrieveing subcategories if (self.catDetailLevel == Int((self.subCategories[self.currentCategory]!["level"] as! String))) { self.subCategories[self.currentCategory]!["isLeaf"] = true diff --git a/Vendoo/ListingPreviewViewController.swift b/Vendoo/ListingPreviewViewController.swift index fd7b2ff..8eff47a 100644 --- a/Vendoo/ListingPreviewViewController.swift +++ b/Vendoo/ListingPreviewViewController.swift @@ -136,9 +136,31 @@ class ListingPreviewViewController: UIViewController { self.etsyManager = etsyManager } - func saveToFirebase(listingImageRef: FIRStorageReference, completion: ServiceResponse! ) { + func saveToFirebase(listingImageRef: FIRStorageReference, completion: ServiceResponse! , index: Int!) { - listingImageRef.putData(UIImageJPEGRepresentation(self.itemPictureMain.image!, 0.8)!, metadata: nil,completion: { + var image: UIImage! + + switch(index){ + case 0: + image = self.itemPictureMain.image! + break + case 1: + image = self.itemPictureSup1.image! + break + case 2: + image = self.itemPictureSup2.image! + break + case 3: + image = self.itemPictureSup3.image! + break + case 4: + image = self.itemPictureSup4.image! + break + default: + break + } + + listingImageRef.putData(UIImageJPEGRepresentation(image, 0.8)!, metadata: nil,completion: { (metadata, error) -> Void in completion(metadata, error) }) @@ -559,6 +581,7 @@ extension ListingPreviewViewController { if (error == nil) { //for ebay due to its unique posting flow, will use firbase image storage url to add pictures if (self.networksDictionary["ebay"]!){ + print((metadata?.downloadURL()?.absoluteString)!) imageURLs.append((metadata?.downloadURL()?.absoluteString)!) dispatch_group_leave(postingGroup) }else{ @@ -588,27 +611,27 @@ extension ListingPreviewViewController { case 0: dispatch_group_enter(postingGroup) let listingImageRef = storageRef.child("images/\(newListingRef.key)/main"+".jpg") - self.saveToFirebase(listingImageRef, completion: completion) + self.saveToFirebase(listingImageRef, completion: completion, index: 0) break case 1: dispatch_group_enter(postingGroup) let listingImageRef = storageRef.child("images/\(newListingRef.key)/1"+".jpg") - self.saveToFirebase(listingImageRef, completion: completion) + self.saveToFirebase(listingImageRef, completion: completion, index: 1) break case 2: dispatch_group_enter(postingGroup) let listingImageRef = storageRef.child("images/\(newListingRef.key)/2"+".jpg") - self.saveToFirebase(listingImageRef, completion: completion) + self.saveToFirebase(listingImageRef, completion: completion, index: 2) break case 3: dispatch_group_enter(postingGroup) let listingImageRef = storageRef.child("images/\(newListingRef.key)/3"+".jpg") - self.saveToFirebase(listingImageRef, completion: completion) + self.saveToFirebase(listingImageRef, completion: completion, index: 3) break case 4: dispatch_group_enter(postingGroup) let listingImageRef = storageRef.child("images/\(newListingRef.key)/4"+".jpg") - self.saveToFirebase(listingImageRef, completion: completion) + self.saveToFirebase(listingImageRef, completion: completion, index: 4) break default: break diff --git a/Vendoo/ServiceNotificationManager.swift b/Vendoo/ServiceNotificationManager.swift index 8e94bd3..6adbecd 100644 --- a/Vendoo/ServiceNotificationManager.swift +++ b/Vendoo/ServiceNotificationManager.swift @@ -54,11 +54,13 @@ class ServiceNotificationManager: NSObject { func pollServices(){ let notificationGroup = dispatch_group_create() + //let notificationEndCount = 0 + //dispatch_group_enter(notificationGroup) for listing in userListings { self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(listing.key)").observeSingleEventOfType( .Value, withBlock: { (snapshot) -> Void in - //dispatch_group_enter(notificationGroup) + let listingDict = snapshot.value as? [String : AnyObject] @@ -72,7 +74,6 @@ class ServiceNotificationManager: NSObject { //@TODO: Skeleton for Notfications Manager is set up. Need to implement listing request for each listing to retrieve relevant notifications for user such as if listing has ended if(ebayID != nil){ if self.ebayGraphManager.isAuthorized { - self.ebayGraphManager.isGettingNotification = true self.ebayGraphManager.getListingInfo(ebayID!, onComplete: { (listingNotificationInfo, error) -> Void in //dispatch_group_leave(notificationGroup) @@ -220,13 +221,12 @@ class ServiceNotificationManager: NSObject { } }) } - self.ebayGraphManager.isGettingNotification = false //dispatch_group_notify(notificationGroup, dispatch_get_main_queue(), { //self.delegate?.listingHasNewNotifications(nil, ebayInfo: nil, amazonInfo: nil, etsyInfo: nil) //}) - + self.ebayGraphManager.isGettingNotification = false } }