diff --git a/.DS_Store b/.DS_Store
index 2e4d1af..bf52147 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Pods/.DS_Store b/Pods/.DS_Store
index 513b61d..faf1da8 100644
Binary files a/Pods/.DS_Store and b/Pods/.DS_Store differ
diff --git a/Pods/Locksmith/.DS_Store b/Pods/Locksmith/.DS_Store
new file mode 100644
index 0000000..66458ec
Binary files /dev/null and b/Pods/Locksmith/.DS_Store differ
diff --git a/Pods/Locksmith/Source/.DS_Store b/Pods/Locksmith/Source/.DS_Store
new file mode 100644
index 0000000..f91e7e1
Binary files /dev/null and b/Pods/Locksmith/Source/.DS_Store differ
diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate
index 8fc46f0..ed50c83 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 4bb104f..caa82d4 100644
--- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -6,15 +6,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -22,16 +148,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,13 +231,13 @@
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "Vendoo/NetworksTableViewController.swift"
- timestampString = "488937324.611765"
+ filePath = "Vendoo/HomeViewController.swift"
+ timestampString = "490366185.766714"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "737"
- endingLineNumber = "737"
- landmarkName = "toggleAuth(_:)"
+ startingLineNumber = "73"
+ endingLineNumber = "73"
+ landmarkName = "viewDidLoad()"
landmarkType = "5">
diff --git a/Vendoo/HomeViewController.swift b/Vendoo/HomeViewController.swift
index a42d8bb..7cb02ea 100644
--- a/Vendoo/HomeViewController.swift
+++ b/Vendoo/HomeViewController.swift
@@ -30,38 +30,78 @@ class HomeViewController: UITabBarController {
if listingDict != nil {
dispatch_async(dispatch_get_main_queue(), {
- for (keys, values) in listingDict! {
-
+
+
+ for (key, values) in listingDict! {
+ let serviceGroup: dispatch_group_t = dispatch_group_create()
+ //@TODO: this is now getting all images but it is only displaying the last retrieved listings's set of images
+ /*dispatch_group_notify(countGroup, dispatch_get_main_queue(), {
+ print(HomeViewController.completionCount)
+ HomeViewController.completionCount += 1
+ if(HomeViewController.completionCount == 4){
+
+ HomeViewController.completionCount = 0
+ dispatch_group_leave(serviceGroup)
+ }
+ })*/
self.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
let databaseDict = snapshot.value as! [String : AnyObject]
let storageRef = self.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
- let listingImage = storageRef.child("images/\(keys).jpg")
+ let mainListingImage = storageRef.child("images/\(key)/main.jpg")
//@TODO: add in logic to programmatically retrieve each stored image and store in listing object as a way to display each image
- listingImage.dataWithMaxSize(10 * 1024 * 1024, completion: {
- (data, error) -> Void in
+ dispatch_group_enter(serviceGroup)
+ mainListingImage.dataWithMaxSize(10 * 1024 * 1024, completion: {
+ (dataMain, error) -> Void in
if(error != nil){
print("problem retrieving items")
}else{
- let listingInfo = values as? [String : AnyObject]
- let imageData = UIImage(data: data!)
- self.userListings.append(
- Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
- itemCategory: listingInfo!["listingCategory"] as? String,
- itemPrice: listingInfo!["listingPrice"] as? String,
- itemDescription: listingInfo!["listingDescription"] as? String,
- itemImage: imageData!,
- isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
- itemKey: keys,
- networksSellingOn: (listingInfo!["networks"] as? Dictionary)!
- ))
+ let mainImage = UIImage(data: dataMain!)
+ var listingImages: [UIImage] = [mainImage!]
+ var count = 0
+ //Get supporting images
+ for i in 2...5 {
+ let supportListingImg1 = storageRef.child("images/\(key)/\(i).jpg")
+ supportListingImg1.dataWithMaxSize(10 * 1024 * 1024, completion: {
+ (data1, error) -> Void in
+
+ if(error != nil){
+ print("support image \(i - 1) for key, \(key), does not exist")
+ }else{
+ listingImages.append(UIImage(data: data1!)!)
+ }
+ print(key)
+ count+=1
+ if(count == 4){
+ dispatch_group_leave(serviceGroup)
+ }
+ })
+
+ }
+
+
+ dispatch_group_notify(serviceGroup, dispatch_get_main_queue(), {
+ print(listingImages.count)
+ let listingInfo = values as? [String : AnyObject]
+ self.userListings.append(
+ Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
+ itemCategory: listingInfo!["listingCategory"] as? String,
+ itemPrice: listingInfo!["listingPrice"] as? String,
+ itemDescription: listingInfo!["listingDescription"] as? String,
+ itemImages: listingImages,
+ isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
+ itemKey: key,
+ networksSellingOn: (listingInfo!["networks"] as? Dictionary)!
+ ))
+
+ NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
+ })
- NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
}
@@ -82,21 +122,22 @@ class HomeViewController: UITabBarController {
})
})
}
-
+
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
-
+
// 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.
}
-
-
+
+
}
diff --git a/Vendoo/ItemImagePickerViewController.swift b/Vendoo/ItemImagePickerViewController.swift
index 3c80b70..e110fc3 100644
--- a/Vendoo/ItemImagePickerViewController.swift
+++ b/Vendoo/ItemImagePickerViewController.swift
@@ -39,9 +39,9 @@ class ItemImagePickerViewController: UIViewController {
private var imageIndex: Int!
override func viewDidLoad() {
super.viewDidLoad()
-
- // Do any additional setup after loading the view.
+ // Do any additional setup after loading the view.
+ self.tabBarController?.tabBar.hidden = true
// Connect data:
self.categoryPicker.delegate = self
@@ -66,22 +66,25 @@ class ItemImagePickerViewController: UIViewController {
}
-
+
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
-
+
+ override func viewWillAppear(animated: Bool) {
+ super.viewWillAppear(animated)
+ self.tabBarController?.tabBar.hidden = true
+ }
-
}
//MARK: - Navigation methods
extension ItemImagePickerViewController {
-
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
@@ -150,7 +153,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
dismissViewControllerAnimated(true, completion: nil)
-
+
}
func takePicture(sender: UITapGestureRecognizer ){
@@ -174,7 +177,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
self.presentViewController(alert, animated: true, completion: nil)
-
+
}
break
@@ -240,19 +243,19 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
}
}
/*
- for (UIView *view in self.view.subviews)
- {
- if ([view isKindOfClass:[UIImageView class]] && CGRectContainsPoint(view.frame, location))
- {
- UIImageView *image = (UIImageView *) view;
-
- // ok, now you know which image you received your long press for
- // do whatever you wanted on it at this point
-
- return;
- }
- }
- */
+ for (UIView *view in self.view.subviews)
+ {
+ if ([view isKindOfClass:[UIImageView class]] && CGRectContainsPoint(view.frame, location))
+ {
+ UIImageView *image = (UIImageView *) view;
+
+ // ok, now you know which image you received your long press for
+ // do whatever you wanted on it at this point
+
+ return;
+ }
+ }
+ */
}
@@ -286,7 +289,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
captureMenu.addAction(cancelAction)
self.presentViewController(captureMenu, animated: true, completion: nil)
}
-
+
}
@@ -294,7 +297,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
//MARK: - UIPickerViewDelegate
extension ItemImagePickerViewController: UIPickerViewDelegate {
-
+
// Catpure the picker view selection
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
// This method is triggered whenever the user makes a change to the picker selection.
@@ -326,7 +329,7 @@ extension ItemImagePickerViewController: UIPickerViewDataSource {
}
extension ItemImagePickerViewController: UITextViewDelegate {
-
+
func textViewDidBeginEditing(textView: UITextView) {
if (textView.text! == "Description") {
textView.text = ""
@@ -360,7 +363,7 @@ extension ItemImagePickerViewController: UITextViewDelegate {
}
extension ItemImagePickerViewController: UITextFieldDelegate {
-
+
func textFieldShouldReturn(textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
@@ -381,7 +384,7 @@ extension ItemImagePickerViewController: UITextFieldDelegate {
//Mark: - IBActions
extension ItemImagePickerViewController {
-
+
@IBAction func chooseSellerNetworks(sender: AnyObject) {
//segue to networks selection
@@ -404,20 +407,20 @@ extension ItemImagePickerViewController {
var counter = -1
for bool in self.itemImagesSelections {
if bool {
- counter += 1
+ counter += 1
}else {
break
}
}
let listing: Dictionary = ["listingID": newListingRef!.key,
- "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!,
- "listingTitle": self.itemName.text,
- "listingPrice": self.itemPrice.text,
- "listingCategory": category,
- "listingDescription": self.itemDescription.text,
- "numberOfSupportingImages" : counter,
- "isListingDraft": true,
- "networks": ["areNetworksChosen": false]]
+ "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!,
+ "listingTitle": self.itemName.text,
+ "listingPrice": self.itemPrice.text,
+ "listingCategory": category,
+ "listingDescription": self.itemDescription.text,
+ "numberOfSupportingImages" : counter,
+ "isListingDraft": true,
+ "networks": ["areNetworksChosen": false]]
(self.tabBarController as? HomeViewController)?.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
@@ -485,11 +488,11 @@ extension ItemImagePickerViewController {
}
-
+
@IBAction func cancelNewListing(sender: AnyObject) {
//nil out all data user may have entered so that when they reopen new listing page
//it initialized to a fresh screen.
- self.tabBarController?.selectedIndex = 1
+ self.tabBarController?.selectedIndex = 0
}
diff --git a/Vendoo/ItemTableViewController.swift b/Vendoo/ItemTableViewController.swift
index 5663eab..eb8685b 100644
--- a/Vendoo/ItemTableViewController.swift
+++ b/Vendoo/ItemTableViewController.swift
@@ -28,6 +28,8 @@ class ItemTableViewController: UIViewController {
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
+ self.tabBarController?.tabBar.hidden = false
+
//set delegates
self.itemTable.dataSource = self
self.itemTable.delegate = self
@@ -43,6 +45,11 @@ class ItemTableViewController: UIViewController {
}
+
+ override func viewWillAppear(animated: Bool) {
+ super.viewWillAppear(animated)
+ self.tabBarController?.tabBar.hidden = false
+ }
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
@@ -94,7 +101,7 @@ extension ItemTableViewController: UITableViewDataSource{
// Configure the cell...
//for each listing cell generated need to find the marketplaces it belongs to, the listing price, the name of the item, the status of the item, and the item image.
//Once these objects are retrieved, access the ItemCell properties and manipulate as needed
- cell.itemImage.image = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row].image
+ cell.itemImage.image = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row].images[0] //come back
cell.itemName.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].title
cell.itemPrice.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].price
diff --git a/Vendoo/Listing.swift b/Vendoo/Listing.swift
index 6d98fdb..a86601b 100644
--- a/Vendoo/Listing.swift
+++ b/Vendoo/Listing.swift
@@ -16,18 +16,18 @@ class Listing : NSObject {
var price: String!
var desc: String!
var isDraft: Bool!
- var image: UIImage!
+ var images: [UIImage]!
var key: String!
var networks: Dictionary!
- init(itemTitle:String, itemCategory: String!, itemPrice: String!, itemDescription: String!, itemImage: UIImage, isDraftListing: Bool, itemKey: String, networksSellingOn: Dictionary){
+ init(itemTitle:String, itemCategory: String!, itemPrice: String!, itemDescription: String!, itemImages: [UIImage], isDraftListing: Bool, itemKey: String, networksSellingOn: Dictionary){
self.title = itemTitle
self.category = itemCategory
self.price = itemPrice
self.desc = itemDescription
self.isDraft = isDraftListing
- self.image = itemImage
+ self.images = itemImages
self.key = itemKey
self.networks = networksSellingOn
diff --git a/Vendoo/Main.storyboard b/Vendoo/Main.storyboard
index 161b594..b9fabd0 100755
--- a/Vendoo/Main.storyboard
+++ b/Vendoo/Main.storyboard
@@ -215,7 +215,7 @@
-
+
@@ -329,7 +329,7 @@
-
+
@@ -339,7 +339,7 @@
@@ -1953,7 +2016,7 @@
-
+
@@ -1970,7 +2033,7 @@
-
+
@@ -1987,7 +2050,7 @@
-
+
@@ -2004,7 +2067,7 @@
-
+
@@ -2021,7 +2084,7 @@
-
+
@@ -2038,7 +2101,7 @@
-
+
@@ -2055,7 +2118,7 @@
-
+
@@ -2072,7 +2135,7 @@
-
+
@@ -2089,7 +2152,7 @@
-
+
@@ -2106,7 +2169,7 @@
-
+
@@ -2123,7 +2186,7 @@
-
+
@@ -2140,7 +2203,7 @@
-
+
@@ -2157,7 +2220,7 @@
-
+
@@ -2174,7 +2237,7 @@
-
+
@@ -2191,7 +2254,7 @@
-
+
@@ -2208,7 +2271,7 @@
-
+
@@ -2225,7 +2288,7 @@
-
+
@@ -2242,7 +2305,7 @@
-
+
@@ -2259,7 +2322,7 @@
-
+
@@ -2276,7 +2339,7 @@
-
+
@@ -2293,7 +2356,7 @@
-
+
@@ -2310,7 +2373,7 @@
-
+
@@ -2327,7 +2390,7 @@
-
+
@@ -2344,7 +2407,7 @@
-
+
@@ -2361,7 +2424,7 @@
-
+
@@ -2378,7 +2441,7 @@
-
+
@@ -2395,7 +2458,7 @@
-
+
@@ -2412,7 +2475,7 @@
-
+
@@ -2429,7 +2492,7 @@
-
+
@@ -2446,7 +2509,7 @@
-
+
@@ -2463,7 +2526,7 @@
-
+
@@ -2480,7 +2543,7 @@
-
+
@@ -2550,7 +2613,7 @@
-
+
@@ -2625,15 +2688,21 @@
+
+
+
-
+
+
+
+
@@ -2643,6 +2712,9 @@
+
+
+
@@ -2652,6 +2724,9 @@
+
+
+
@@ -2661,6 +2736,9 @@
+
+
+
@@ -2670,6 +2748,9 @@
+
+
+
@@ -2679,6 +2760,9 @@
+
+
+
@@ -2690,6 +2774,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -2717,10 +2811,10 @@
-
-
+
+
diff --git a/Vendoo/NetworksTableViewController.swift b/Vendoo/NetworksTableViewController.swift
index 350328e..fdcac31 100644
--- a/Vendoo/NetworksTableViewController.swift
+++ b/Vendoo/NetworksTableViewController.swift
@@ -33,8 +33,8 @@ class NetworksTableViewController: UIViewController {
private var firManager: FirebaseManager! = nil
private var etsyManager: EtsyRESTAPIManager! = nil
private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager()
-
-
+
+
override func viewDidLoad() {
super.viewDidLoad()
@@ -71,13 +71,19 @@ class NetworksTableViewController: UIViewController {
self.networkToggleOrSelect = bool
}
+ override func viewWillAppear(animated: Bool) {
+ super.viewWillAppear(animated)
+ if(!networkToggleOrSelect) {
+ self.tabBarController?.tabBar.hidden = false
+ }
+ }
}
//MARK: - class methods Network Selection when creating a new listing
extension NetworksTableViewController {
-
- func setListingDictionary(listingDictionary: Dictionary){
+ func setListingDictionary(listingDictionary: Dictionary){
+
self.itemListingDictionary = listingDictionary
}
@@ -150,10 +156,10 @@ extension NetworksTableViewController: UITableViewDataSource {
break
}
-
+
}
else{
-
+
//case where class is being used to authorize a network for the app to post on
switch (indexPath.row){
@@ -227,7 +233,7 @@ extension NetworksTableViewController: UITableViewDataSource {
//MARK: - IBActions
extension NetworksTableViewController {
-
+
@IBAction func showListingPreview(sender: AnyObject) {
self.performSegueWithIdentifier("ItemPreviewSegue", sender: self)
@@ -236,7 +242,7 @@ extension NetworksTableViewController {
@IBAction func draftItem(sender: AnyObject) {
if((self.itemListingDictionary["pictures"]! as? [UIImageView])?[0].image == nil){
-
+
let alert = UIAlertController(title: "Image Needed", message: "To save the listing as a draft, you must supply at least one picture for your listing.", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))