diff --git a/Vendoo/CategoriesTableViewController.swift b/Vendoo/CategoriesTableViewController.swift new file mode 100644 index 0000000..a6d192f --- /dev/null +++ b/Vendoo/CategoriesTableViewController.swift @@ -0,0 +1,196 @@ +// +// CategoriesTableViewController.swift +// Vendoo +// +// Created by Okechi Onyeje on 7/16/16. +// Copyright © 2016 Okechi Onyeje. All rights reserved. +// + +import UIKit + +class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { + + private var itemListingDictionary: Dictionary! = Dictionary() + private var graphManager: FacebookGraphAPIManager! = nil + private var firManager: FirebaseManager! = nil + private var etsyManager: EtsyRESTAPIManager! = nil + private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager() + private var selectedCategory: String! + + //@TODO: replace with etsy categories and make a custom cell to contain a collection view of images for ebay/etsy approriatecolumns relevant to the category + private var categories = ["Accessories", + "Art", + "Bath & Beauty", + "Bags & Purses", + "Books", + "Candles", + "Ceramics & Pottery", + "Children", + "Clothing", + "Crochet", + "Dolls & Miniatures", + "Everything Else", + "Furniture", + "Geekery", + "Glass", + "Holidays", + "Houseware", + "Jewelry", + "Knitting", + "Music", + "Needlecraft", + "Paper Goods", + "Patterns", + "Plants and Edibles", + "Quilts", + "Supplies", + "Toys", + "Vintage", + "Wedding", + "Woodworking"] + @IBOutlet weak var table: UITableView! + + + override func viewDidLoad() { + super.viewDidLoad() + + self.table.delegate = self + self.table.dataSource = self + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + // MARK: - Table view data source + + func numberOfSectionsInTableView(tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 1 + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return self.categories.count + } + + + func setListingDictionary(listingDictionary: Dictionary){ + + self.itemListingDictionary = listingDictionary + + } + + func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){ + self.graphManager = fbManager + self.firManager = fireManager + self.ebayManager = ebayManager + self.etsyManager = etsyManager + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + let cell: CategoryCell! = tableView.dequeueReusableCellWithIdentifier("CategoryCell", forIndexPath: indexPath) as? CategoryCell + + // Configure the cell... + + dispatch_async(dispatch_get_main_queue(), { + cell.categoryName.text = self.categories[indexPath.row] + + //ebay + if(true){ + cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true + } + //amazon + if(true){ + cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true + } + //etsy + if(false){ + cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true + + } + //facebook + if(false){ + cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true + } + + }) + + + return cell + } + + + func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + self.selectedCategory = self.categories[indexPath.row] + self.performSegueWithIdentifier("NetworkSelectionSegue", sender: self) + } + + /* + // Override to support conditional editing of the table view. + override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { + if editingStyle == .Delete { + // Delete the row from the data source + tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) + } else if editingStyle == .Insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + + if(segue.identifier == "NetworkSelectionSegue") { + self.itemListingDictionary["category"] = self.selectedCategory + (segue.destinationViewController as! NetworksTableViewController).setListingDictionary(self.itemListingDictionary) + (segue.destinationViewController as! NetworksTableViewController).setManagers(self.graphManager, + fireManager: self.firManager, ebayManager: self.ebayManager, etsyManager: self.etsyManager ) + + (segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true) + //print(self.categoryPicker.selectedRowInComponent(0)) + } + } + + + @IBAction func cancelCategorySelection(sender: AnyObject) { + + self.dismissViewControllerAnimated(true, completion: nil) + } + + +} diff --git a/Vendoo/CategoryCell.swift b/Vendoo/CategoryCell.swift new file mode 100644 index 0000000..c71f8aa --- /dev/null +++ b/Vendoo/CategoryCell.swift @@ -0,0 +1,113 @@ +// +// CategoryCell.swift +// Vendoo +// +// Created by Okechi Onyeje on 7/18/16. +// Copyright © 2016 Okechi Onyeje. All rights reserved. +// + +import UIKit + +class CategoryCell: UITableViewCell, UICollectionViewDelegate { + + @IBOutlet weak var categoryName: UILabel! + @IBOutlet weak var networks: UICollectionView! + + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + self.networks.delegate = self + self.networks.dataSource = self + self.networks.backgroundView?.backgroundColor = UIColor.whiteColor() + } + + override func setSelected(selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } + +} + + + +// MARK: UICollectionViewDataSource +extension CategoryCell: UICollectionViewDataSource{ + + func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 1 + } + + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of items + return 4 + } + + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + + let cell: UICollectionViewCell! + + switch (indexPath.row){ + case 0: + cell = collectionView.dequeueReusableCellWithReuseIdentifier("ebay", forIndexPath: indexPath) + break + case 1: + cell = collectionView.dequeueReusableCellWithReuseIdentifier("amazon", forIndexPath: indexPath) + break + case 2: + cell = collectionView.dequeueReusableCellWithReuseIdentifier("etsy", forIndexPath: indexPath) + break + default: + cell = collectionView.dequeueReusableCellWithReuseIdentifier("facebook", forIndexPath: indexPath) + break + } + + + // Configure the cell (in this case show or hide the cell depending on which network the item is being listed on) + + return cell + } + + +} + + +// MARK: UICollectionViewDelegate +extension CategoryCell { + + /* + // Uncomment this method to specify if the specified item should be highlighted during tracking + override func collectionView(collectionView: UICollectionView, shouldHighlightItemAtIndexPath indexPath: NSIndexPath) -> Bool { + return true + } + */ + + /* + // Uncomment this method to specify if the specified item should be selected + override func collectionView(collectionView: UICollectionView, shouldSelectItemAtIndexPath indexPath: NSIndexPath) -> Bool { + return true + } + */ + + /* + // Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item + override func collectionView(collectionView: UICollectionView, shouldShowMenuForItemAtIndexPath indexPath: NSIndexPath) -> Bool { + return false + } + + override func collectionView(collectionView: UICollectionView, canPerformAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -> Bool { + return false + } + + override func collectionView(collectionView: UICollectionView, performAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) { + + } + */ + +} + + + diff --git a/Vendoo/EtsyRESTAPIManager.swift b/Vendoo/EtsyRESTAPIManager.swift index 3531e87..db70192 100644 --- a/Vendoo/EtsyRESTAPIManager.swift +++ b/Vendoo/EtsyRESTAPIManager.swift @@ -73,7 +73,7 @@ class EtsyRESTAPIManager: NSObject { EtsyRESTAPIManager.settingsDictionary = ([ "who_made":"i_did", - "is_supply":"true", + "is_supply":true, "when_made":"made_to_order" ] as Dictionary) diff --git a/Vendoo/ItemImagePickerViewController.swift b/Vendoo/ItemImagePickerViewController.swift index e110fc3..64d2ec7 100644 --- a/Vendoo/ItemImagePickerViewController.swift +++ b/Vendoo/ItemImagePickerViewController.swift @@ -23,7 +23,7 @@ class ItemImagePickerViewController: UIViewController { @IBOutlet weak var possibleItemImage3: UIImageView! @IBOutlet weak var possibleItemImage4: UIImageView! @IBOutlet weak var possibleItemImage5: UIImageView! - + @IBOutlet weak var itemQuantity: UITextField! @IBOutlet weak var itemName: UITextField! @IBOutlet weak var itemDescription: UITextView! @IBOutlet weak var itemPrice: UITextField! @@ -48,6 +48,7 @@ class ItemImagePickerViewController: UIViewController { self.categoryPicker.dataSource = self self.itemDescription.delegate = self self.itemName.delegate = self + self.itemQuantity.delegate = self self.itemPrice.delegate = self self.picker.delegate = self @@ -91,13 +92,13 @@ extension ItemImagePickerViewController { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. - if(segue.identifier == "SelectNetworkSegue"){ + if(segue.identifier == "CategoriesSegue"){ print(self.itemName.text!) print(self.itemDescription.text!) print(self.possibleItemImageMain.image) print(self.itemPrice.text!) - var dict: Dictionary = ["title":self.itemName.text!, "description":self.itemDescription.text!, "price":self.itemPrice.text!, "category":self.pickerData[self.categoryPicker.selectedRowInComponent(0)]] + var dict: Dictionary = ["title":self.itemName.text!, "description":self.itemDescription.text!, "price":self.itemPrice.text!, "quantity":self.itemQuantity.text!] var counter = 0 var images: [UIImageView] = [] for bool in self.itemImagesSelections { @@ -124,12 +125,13 @@ extension ItemImagePickerViewController { } dict["pictures"] = images - (segue.destinationViewController as! NetworksTableViewController).setListingDictionary(dict) - (segue.destinationViewController as! NetworksTableViewController).setManagers(((self.tabBarController as? HomeViewController)?.fbGraphManager)!, - fireManager: ((self.tabBarController as? HomeViewController)?.firebaseManager)!, ebayManager: ((self.tabBarController as? HomeViewController)?.ebayGraphManager)! ) + (segue.destinationViewController as! CategoriesTableViewController).setListingDictionary(dict) + (segue.destinationViewController as! CategoriesTableViewController).setManagers(((self.tabBarController as? HomeViewController)?.fbGraphManager)!, + fireManager: ((self.tabBarController as? HomeViewController)?.firebaseManager)!, ebayManager: ((self.tabBarController as? HomeViewController)?.ebayGraphManager)!, + etsyManager: ((self.tabBarController as? HomeViewController)?.etsyManager)!) - (segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true) - print(self.categoryPicker.selectedRowInComponent(0)) + //(segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true) + //print(self.categoryPicker.selectedRowInComponent(0)) } diff --git a/Vendoo/ListingPreviewViewController.swift b/Vendoo/ListingPreviewViewController.swift index 1504dc6..1462065 100644 --- a/Vendoo/ListingPreviewViewController.swift +++ b/Vendoo/ListingPreviewViewController.swift @@ -16,9 +16,10 @@ import UIKit class ListingPreviewViewController: UIViewController { - + //IBOutlets @IBOutlet weak var containerScrollView: UIScrollView! + @IBOutlet weak var itemQuantity: UITextView! @IBOutlet weak var itemPicture: UIImageView! @IBOutlet weak var itemTitle: UITextView! @IBOutlet weak var itemDescription: UITextView! @@ -31,13 +32,14 @@ class ListingPreviewViewController: UIViewController { private var graphManager: FacebookGraphAPIManager! = nil private var firManager: FirebaseManager! = nil private var ebayManager: EbayWebServiceManager! = nil + private var etsyManager: EtsyRESTAPIManager! = nil private var itemListingDictionary: Dictionary! = Dictionary() private var alert = UIAlertController(title: "Listing Published", message: "Your listing has been published", preferredStyle: .Alert) private var lastListingKey: String! override func viewDidLoad() { super.viewDidLoad() - + // Do any additional setup after loading the view. // Initialization code @@ -50,7 +52,7 @@ class ListingPreviewViewController: UIViewController { override func viewDidAppear(animated: Bool) { self.setListing() } - + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -64,6 +66,7 @@ class ListingPreviewViewController: UIViewController { self.itemDescription.text = self.itemListingDictionary["description"] as! String self.itemPrice.text = self.itemListingDictionary["price"] as! String self.itemCategory.text = self.itemListingDictionary["category"] as! String + self.itemQuantity.text = self.itemListingDictionary["quantity"] as! String } func setDictionary(netdictionary:Dictionary, itemdictionary: Dictionary){ @@ -71,16 +74,17 @@ class ListingPreviewViewController: UIViewController { self.itemListingDictionary = itemdictionary } - func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager){ + func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){ self.graphManager = fbManager self.firManager = fireManager self.ebayManager = ebayManager + self.etsyManager = etsyManager } - + // MARK: - Navigation - + // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. @@ -92,10 +96,11 @@ class ListingPreviewViewController: UIViewController { vc.itemPrice.text? = self.itemPrice.text vc.itemDescription.text? = self.itemDescription.text vc.possibleItemImageMain = self.itemPicture + vc.itemQuantity.text? = self.itemQuantity.text } } - - + + } @@ -115,7 +120,7 @@ extension ListingPreviewViewController: FacebookGraphAPIManagerDelegate { //MARK: - IBActions extension ListingPreviewViewController { - + @IBAction func publishItem(sender: AnyObject) { @@ -125,7 +130,11 @@ extension ListingPreviewViewController { self.presentViewController(alert, animated: true, completion: nil) }else{ - + self.networksDictionary["areNetworksChosen"] = true + + //save listing to private user path in firebase + let newListingRef = self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").childByAutoId() + //post to ebay if(self.networksDictionary["ebay"]!){ @@ -138,25 +147,144 @@ extension ListingPreviewViewController { } + //post to etsy if(self.networksDictionary["etsy"]!){ + var categoryCode: Int! + //@FIXME: settings dctionary is staying nil + switch self.itemCategory.text { + case "Accessories": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["accessories"] as! Int + break + case "Art": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["art"] as! Int + break + case "Bath & Beauty": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["bath_and_beauty"] as! Int + break + case "Bags & Purses": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["bags_and_purses"] as! Int + break + case "Books": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["books_and_zines"] as! Int + break + case "Candles": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["candles"] as! Int + break + case "Ceramics & Pottery": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["ceramics_and_pottery"] as! Int + break + case "Children": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["children"] as! Int + break + case "Clothing": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["clothing"] as! Int + break + case "Crochet": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["crochet"] as! Int + break + case "Dolls & Miniatures": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["dolls_and_miniatures"] as! Int + break + case "Everything Else": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["everything_else"] as! Int + break + case "Furniture": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["furniture"] as! Int + break + case "Geekery": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["geekery"] as! Int + break + case "Glass": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["glass"] as! Int + break + case "Holidays": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["holidays"] as! Int + break + case "Houseware": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["housewares"] as! Int + break + case "Jewelry": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["jewelry"] as! Int + break + case "Knitting": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["knitting"] as! Int + break + case "Music": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["music"] as! Int + break + case "Needlecraft": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["needlecraft"] as! Int + break + case "Paper Goods": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["paper_goods"] as! Int + break + case "Patterns": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["patterns"] as! Int + break + case "Plants and Edibles": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["plants_and_edibles"] as! Int + break + case "Quilts": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["quilts"] as! Int + break + case "Supplies": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["supplies"] as! Int + break + case "Toys": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["toys"] as! Int + break + case "Vintage": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["vintage"] as! Int + break + case "Wedding": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["weddings"] as! Int + break + case "Woodworking": + categoryCode = EtsyRESTAPIManager.settingsDictionary["categories"]!["woodworking"] as! Int + break + default: + break + } + + let body: [String: AnyObject] = [ "title": self.itemTitle.text, + "quantity":self.itemQuantity.text, + "description":self.itemDescription.text, + "price":self.itemPrice.text, + "category_id":categoryCode, + "who_made": EtsyRESTAPIManager.settingsDictionary["who_made"] as! String, + "is_supply": EtsyRESTAPIManager.settingsDictionary["is_supply"]!, + "when_made": EtsyRESTAPIManager.settingsDictionary["when_made"] as! String, + "state":"draft" + + ] + + self.etsyManager.sendPOSTRequest("/listings", body: body, onCompletion: {(JSON, NSError) -> Void in print(JSON)}) } + //post to facebook + if(self.networksDictionary["facebook"]!){ + let parameters: Dictionary = ["message":("**"+self.itemTitle.text!+"**\n\n"+"Price: "+self.itemPrice.text! + "\n\n"+self.itemDescription.text!)] + + self.lastListingKey = newListingRef.key + self.graphManager.makePOSTResquest("me/feed", params: parameters) + + //let parameters: Dictionary = ["":""] + + + } - //save listing to private user path in firebase - let newListingRef = self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").childByAutoId() - self.networksDictionary["areNetworksChosen"] = true let listing: Dictionary = ["listingID": newListingRef.key, - "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, - "listingTitle": self.itemTitle.text, - "listingPrice": self.itemPrice.text, - "listingCategory": self.itemCategory.text, - "listingDescription": self.itemDescription.text, - "numberOfSupportingImages" : ((self.itemListingDictionary["pictures"] as? [UIImageView])?.count)! - 1, - "isListingDraft": false, - "networks": self.networksDictionary] + "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, + "listingTitle": self.itemTitle.text, + "listingPrice": self.itemPrice.text, + "listingCategory": self.itemCategory.text, + "listingDescription": self.itemDescription.text, + "numberOfSupportingImages" : ((self.itemListingDictionary["pictures"] as? [UIImageView])?.count)! - 1, + "isListingDraft": false, + "networks": self.networksDictionary] self.firManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in @@ -182,30 +310,9 @@ extension ListingPreviewViewController { self.alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in self.alert.dismissViewControllerAnimated(true, completion: nil)})) - let parameters: Dictionary = ["message":("**"+self.itemTitle.text!+"**\n\n"+"Price: "+self.itemPrice.text! + "\n\n"+self.itemDescription.text!)] - - - - - //post to facebook - if(self.networksDictionary["facebook"]!){ - - //need to reverse process and upload to firebase last so that all network listing id's can be saved to firebase for notification access. - self.lastListingKey = newListingRef.key - self.graphManager.makePOSTResquest("me/feed", params: parameters) - - //let parameters: Dictionary = ["":""] - - - } - - - - - //register new listing id in global path of firebase root' self.firManager.ref.child("Global_listings").child(newListingRef.key).setValue(newListingRef.key) - + }) @@ -213,7 +320,7 @@ extension ListingPreviewViewController { }) - + } diff --git a/Vendoo/Main.storyboard b/Vendoo/Main.storyboard index b9fabd0..2a49c19 100755 --- a/Vendoo/Main.storyboard +++ b/Vendoo/Main.storyboard @@ -377,7 +377,7 @@ - + @@ -418,6 +418,9 @@ + + + @@ -437,6 +440,7 @@ + @@ -1025,6 +1029,7 @@ + @@ -1995,7 +2000,7 @@ - + @@ -2005,549 +2010,100 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2560,6 +2116,9 @@ + + + @@ -2568,10 +2127,14 @@ + + + + - + @@ -2813,8 +2376,9 @@ - - + + + diff --git a/Vendoo/NetworksTableViewController.swift b/Vendoo/NetworksTableViewController.swift index a90dddf..8fb8d56 100644 --- a/Vendoo/NetworksTableViewController.swift +++ b/Vendoo/NetworksTableViewController.swift @@ -88,10 +88,11 @@ extension NetworksTableViewController { } - func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager){ + func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){ self.graphManager = fbManager self.firManager = fireManager self.ebayManager = ebayManager + self.etsyManager = etsyManager } } @@ -108,7 +109,7 @@ extension NetworksTableViewController { if(segue.identifier == "ItemPreviewSegue"){ (segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary, itemdictionary: self.itemListingDictionary) - (segue.destinationViewController as! ListingPreviewViewController).setManagers(self.graphManager, fireManager: self.firManager, ebayManager: self.ebayManager) + (segue.destinationViewController as! ListingPreviewViewController).setManagers(self.graphManager, fireManager: self.firManager, ebayManager: self.ebayManager, etsyManager: self.etsyManager) } if(segue.identifier == "EtsySettingsSegue") { @@ -415,12 +416,12 @@ extension NetworksTableViewController: UITableViewDelegate { cell = (self.tableView.dequeueReusableCellWithIdentifier("etsy", forIndexPath: indexPath) as! EtsyTableViewCell) cell.setSelected(false, animated: false) - //selection code for etsy if(cell.networkToggle.on == true){ dispatch_async(dispatch_get_main_queue(), { () -> Void in cell.networkToggle.setOn(false, animated: true) + cell.networkToggle.on = false }) //code to deselect network @@ -430,6 +431,7 @@ extension NetworksTableViewController: UITableViewDelegate { dispatch_async(dispatch_get_main_queue(), { () -> Void in cell.networkToggle.setOn(true, animated: true) + cell.networkToggle.on = true }) //code to select network self.networksDictionary["etsy"] = true