diff --git a/.DS_Store b/.DS_Store
index fe5d633..60c8d41 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Pods/.DS_Store b/Pods/.DS_Store
index 9bd7137..513b61d 100644
Binary files a/Pods/.DS_Store and b/Pods/.DS_Store differ
diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate
index 222f204..a7172ce 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 a676b84..edee9af 100644
--- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -73,12 +73,12 @@
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "Vendoo/ListingPreviewViewController.swift"
- timestampString = "486606146.906102"
+ filePath = "Vendoo/NetworksTableViewController.swift"
+ timestampString = "486613323.35873"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "146"
- endingLineNumber = "146"
+ startingLineNumber = "196"
+ endingLineNumber = "196"
landmarkName = "draftItem(_:)"
landmarkType = "5">
@@ -89,12 +89,108 @@
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "Vendoo/ListingPreviewViewController.swift"
- timestampString = "486606818.991987"
+ filePath = "Vendoo/NetworksTableViewController.swift"
+ timestampString = "486614508.813063"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "167"
- endingLineNumber = "167"
+ startingLineNumber = "194"
+ endingLineNumber = "194"
+ landmarkName = "draftItem(_:)"
+ landmarkType = "5">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Vendoo/.DS_Store b/Vendoo/.DS_Store
index 91f98e0..7c1f929 100644
Binary files a/Vendoo/.DS_Store and b/Vendoo/.DS_Store differ
diff --git a/Vendoo/Base.lproj/.DS_Store b/Vendoo/Base.lproj/.DS_Store
index 4a7b954..f7af3d5 100644
Binary files a/Vendoo/Base.lproj/.DS_Store and b/Vendoo/Base.lproj/.DS_Store differ
diff --git a/Vendoo/Base.lproj/Main.storyboard b/Vendoo/Base.lproj/Main.storyboard
index c09efd0..53bc79e 100644
--- a/Vendoo/Base.lproj/Main.storyboard
+++ b/Vendoo/Base.lproj/Main.storyboard
@@ -1,5 +1,5 @@
-
+
@@ -137,7 +137,7 @@
-
+
@@ -148,14 +148,14 @@
-
-
+
+
@@ -186,6 +186,20 @@
+
+
+
+
+
+
+
@@ -198,14 +212,14 @@
-
+
-
+
@@ -213,59 +227,126 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -273,18 +354,22 @@
-
+
+
+
+
+
-
+
-
+
-
+
@@ -442,6 +527,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -468,7 +573,7 @@
-
+
@@ -487,28 +592,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -674,6 +757,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -692,7 +786,7 @@
-
+
@@ -707,7 +801,7 @@
-
+
@@ -716,7 +810,7 @@
-
+
@@ -847,6 +941,14 @@
+
+
+
+
+
+
+
+
@@ -859,7 +961,7 @@
-
+
@@ -880,17 +982,17 @@
-
+
-
+
-
+
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -1020,7 +1265,7 @@
-
+
@@ -1187,7 +1432,7 @@
-
+
@@ -1200,8 +1445,8 @@
-
-
-
+
+
+
diff --git a/Vendoo/FacebookGraphAPIManager.swift b/Vendoo/FacebookGraphAPIManager.swift
index bc9e910..bf17a7b 100644
--- a/Vendoo/FacebookGraphAPIManager.swift
+++ b/Vendoo/FacebookGraphAPIManager.swift
@@ -90,19 +90,21 @@ extension FacebookGraphAPIManager {
print("user logged in through facebook")
self.makeGETRequest("me",params: nil)
- }
- if(!FBSDKAccessToken.currentAccessToken().hasGranted("publish_actions")){
- dispatch_async(dispatch_get_main_queue(), { () -> Void in
-
- self.login.logInWithPublishPermissions(["publish_actions"], fromViewController: nil,handler: {
- (result, error) -> Void in
+ if(!FBSDKAccessToken.currentAccessToken().hasGranted("publish_actions")){
+ dispatch_async(dispatch_get_main_queue(), { () -> Void in
+
+ self.login.logInWithPublishPermissions(["publish_actions"], fromViewController: nil,handler: {
+ (result, error) -> Void in
+
+ NSLog("Logged in with publish permisions")
+ })
- NSLog("Logged in with publish permisions")
})
- })
+ }
}
+
})
})
diff --git a/Vendoo/ItemImagePickerViewController.swift b/Vendoo/ItemImagePickerViewController.swift
index 120524a..890c0e3 100644
--- a/Vendoo/ItemImagePickerViewController.swift
+++ b/Vendoo/ItemImagePickerViewController.swift
@@ -15,7 +15,12 @@ import UIKit
class ItemImagePickerViewController: UIViewController {
//Outlets
- @IBOutlet weak var possibleItemImage: UIImageView!
+ @IBOutlet weak var possibleItemImage1: UIImageView!
+ @IBOutlet weak var possibleItemImage2: UIImageView!
+ @IBOutlet weak var possibleItemImage3: UIImageView!
+ @IBOutlet weak var possibleItemImage4: UIImageView!
+ @IBOutlet weak var possibleItemImage5: UIImageView!
+
@IBOutlet weak var itemName: UITextField!
@IBOutlet weak var itemDescription: UITextView!
@IBOutlet weak var itemPrice: UITextField!
@@ -24,6 +29,7 @@ class ItemImagePickerViewController: UIViewController {
//class variables
var pickerData: [String] = [String]()
+ var itemImages:[UIImageView]!
override func viewDidLoad() {
super.viewDidLoad()
@@ -59,11 +65,11 @@ class ItemImagePickerViewController: UIViewController {
if(segue.identifier == "SelectNetworkSegue"){
print(self.itemName.text!)
print(self.itemDescription.text!)
- print(self.possibleItemImage.image)
+ print(self.possibleItemImage1.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)]]
- dict["picture"] = self.possibleItemImage
+ dict["picture"] = self.possibleItemImage1
(segue.destinationViewController as! NetworksTableViewController).setListingDictionary(dict)
(segue.destinationViewController as! NetworksTableViewController).setManagers(((self.tabBarController as? HomeViewController)?.fbGraphManager)!,
fireManager: ((self.tabBarController as? HomeViewController)?.firebaseManager)!)
@@ -175,5 +181,54 @@ extension ItemImagePickerViewController {
self.performSegueWithIdentifier("SelectNetworkSegue", sender: self)
}
+ @IBAction func draftItem(sender: AnyObject) {
+
+ if(self.possibleItemImage1.image == nil){
+ let alert = UIAlertController(title: "Image Needed", message: "To proceed to save your 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)}))
+
+ self.presentViewController(alert, animated: true, completion: nil)
+ }else{
+
+ //save listing to private user path in firebase
+ let newListingRef = (self.tabBarController as? HomeViewController)?.firebaseManager.ref.child("Users").child("\((self.tabBarController as? HomeViewController)?.firebaseManager.user_email)").child("user_Listings").childByAutoId()
+
+ let category = (self.pickerData[self.categoryPicker.selectedRowInComponent(0)])
+
+ 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,
+ "isListingDraft": false]
+
+ (self.tabBarController as? HomeViewController)?.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
+
+ let databaseDict = snapshot.value as! [String : AnyObject]
+
+ let storageRef = (self.tabBarController as? HomeViewController)?.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
+
+ let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+".jpg")
+
+ listingImageRef.putData(UIImagePNGRepresentation(self.possibleItemImage1.image!)!, metadata: nil,completion:
+ {(metadata, error) -> Void in
+
+ newListingRef!.setValue(listing as? Dictionary)
+ })
+
+
+
+ //register new listing id in global path of firebase root'
+ (self.tabBarController as? HomeViewController)?.firebaseManager.ref.child("Global_listings").setValue(newListingRef!.key)
+
+ })
+
+ }
+
+
+ }
+
+
}
diff --git a/Vendoo/ListingPreviewViewController.swift b/Vendoo/ListingPreviewViewController.swift
index 57a56fb..815d7bf 100644
--- a/Vendoo/ListingPreviewViewController.swift
+++ b/Vendoo/ListingPreviewViewController.swift
@@ -135,52 +135,7 @@ extension ListingPreviewViewController {
}
- @IBAction func draftItem(sender: AnyObject) {
-
- if(self.itemPicture.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)}))
-
- self.presentViewController(alert, animated: true, completion: nil)
- }else{
-
- //save listing to private user path in firebase
- let newListingRef = self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").childByAutoId()
-
-
- let listing = ["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,
- "isListingDraft": true]
-
- self.firManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
-
- let databaseDict = snapshot.value as! [String : AnyObject]
-
- let storageRef = self.firManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
- let listingImageRef = storageRef.child("images/\(newListingRef.key)"+".jpg")
- listingImageRef.putData(UIImagePNGRepresentation(self.itemPicture.image!)!, metadata: nil,completion:
- {(metadata, error) -> Void in
-
- newListingRef.setValue(listing)
- })
-
-
-
- //register new listing id in global path of firebase root'
- self.firManager.ref.child("Global_listings").setValue(newListingRef.key)
-
- })
-
-
-
- }
-
-
- }
+
}
diff --git a/Vendoo/NetworksTableViewController.swift b/Vendoo/NetworksTableViewController.swift
index 323f939..fda6c08 100644
--- a/Vendoo/NetworksTableViewController.swift
+++ b/Vendoo/NetworksTableViewController.swift
@@ -191,6 +191,56 @@ extension NetworksTableViewController {
self.performSegueWithIdentifier("ItemPreviewSegue", sender: self)
}
+ @IBAction func draftItem(sender: AnyObject) {
+
+ if((self.itemListingDictionary["picture"]! as? UIImageView)?.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)}))
+
+ self.presentViewController(alert, animated: true, completion: nil)
+ }else{
+
+ //save listing to private user path in firebase
+ let newListingRef = self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").childByAutoId()
+
+
+ let listing = ["listingID": newListingRef.key,
+ "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!,
+ "listingTitle": self.itemListingDictionary["title"],
+ "listingPrice": self.itemListingDictionary["price"],
+ "listingCategory": self.itemListingDictionary["category"],
+ "listingDescription": self.itemListingDictionary["description"],
+ "isListingDraft": true]
+
+ self.firManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
+
+ let databaseDict = snapshot.value as! [String : AnyObject]
+
+ let storageRef = self.firManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
+ let listingImageRef = storageRef.child("images/\(newListingRef.key)"+".jpg")
+
+ listingImageRef.putData(
+ UIImagePNGRepresentation(((self.itemListingDictionary["picture"]! as? UIImageView)?.image)!)!, metadata: nil,completion:
+ {(metadata, error) -> Void in
+
+ newListingRef.setValue(listing as? Dictionary)
+ })
+
+
+
+ //register new listing id in global path of firebase root'
+ self.firManager.ref.child("Global_listings").setValue(newListingRef.key)
+
+ })
+
+
+
+ }
+
+
+ }
+
}
//SET UP TO ADD EACH INTEGRATION AS DEVELOPMENT GETS TO IT