diff --git a/.DS_Store b/.DS_Store
index da681fb..18fdf36 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate
index 4210765..1b37a7d 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 41fdc58..f3fdb64 100644
--- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -58,11 +58,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
- timestampString = "486128108.896927"
+ timestampString = "486180405.211327"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "55"
- endingLineNumber = "55"
+ startingLineNumber = "51"
+ endingLineNumber = "51"
landmarkName = "setNetworkSelectFunctionality(_:)"
landmarkType = "5">
@@ -74,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
- timestampString = "486128108.896927"
+ timestampString = "486187285.19423"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "91"
- endingLineNumber = "91"
+ startingLineNumber = "104"
+ endingLineNumber = "104"
landmarkName = "tableView(_:cellForRowAtIndexPath:)"
landmarkType = "5">
@@ -90,14 +90,46 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
- timestampString = "486128132.689875"
+ timestampString = "486187285.19423"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "380"
- endingLineNumber = "380"
+ startingLineNumber = "402"
+ endingLineNumber = "402"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
+
+
+
+
+
+
+
+
diff --git a/Vendoo/.DS_Store b/Vendoo/.DS_Store
index 92ab870..2097962 100644
Binary files a/Vendoo/.DS_Store and b/Vendoo/.DS_Store differ
diff --git a/Vendoo/Base.lproj/Main.storyboard b/Vendoo/Base.lproj/Main.storyboard
index 16db3d3..2e762cf 100644
--- a/Vendoo/Base.lproj/Main.storyboard
+++ b/Vendoo/Base.lproj/Main.storyboard
@@ -203,65 +203,74 @@
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
-
+
@@ -272,10 +281,10 @@
-
+
-
+
@@ -436,6 +445,17 @@
+
@@ -448,7 +468,7 @@
-
+
@@ -489,7 +509,7 @@
-
+
@@ -510,7 +530,7 @@
-
+
@@ -538,7 +558,7 @@
-
+
@@ -552,7 +572,7 @@
-
+
@@ -1182,6 +1202,6 @@
-
+
diff --git a/Vendoo/ItemImagePickerViewController.swift b/Vendoo/ItemImagePickerViewController.swift
index 42db451..88785b0 100644
--- a/Vendoo/ItemImagePickerViewController.swift
+++ b/Vendoo/ItemImagePickerViewController.swift
@@ -6,6 +6,10 @@
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
+/*
+ need to make this class display a top navigation bar so user may cancel the new item posting if need be
+ */
+
import UIKit
class ItemImagePickerViewController: UIViewController {
@@ -13,7 +17,7 @@ class ItemImagePickerViewController: UIViewController {
//Outlets
@IBOutlet weak var possibleItemImage: UIImageView!
@IBOutlet weak var itemName: UITextField!
- @IBOutlet weak var itemDescription: UITextField!
+ @IBOutlet weak var itemDescription: UITextView!
@IBOutlet weak var itemPrice: UITextField!
@IBOutlet weak var categoryPicker: UIPickerView!
@IBOutlet weak var containerScrollView: UIScrollView!
@@ -26,9 +30,13 @@ class ItemImagePickerViewController: UIViewController {
// Do any additional setup after loading the view.
+
// Connect data:
self.categoryPicker.delegate = self
self.categoryPicker.dataSource = self
+ self.itemDescription.delegate = self
+ self.itemName.delegate = self
+ self.itemPrice.delegate = self
// Input data into the Array:
pickerData = ["Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6"]
@@ -49,7 +57,16 @@ class ItemImagePickerViewController: UIViewController {
// Pass the selected object to the new view controller.
if(segue.identifier == "SelectNetworkSegue"){
- (segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true)
+ print(self.itemName.text!)
+ print(self.itemDescription.text!)
+ //print(self.possibleItemImage.image!)
+ print(self.itemPrice.text!)
+
+ let dict: Dictionary = ["title":self.itemName.text!, "description":self.itemDescription.text!, "picture": UIImage() /*"picture":self.possibleItemImage.image!*/ , "price":self.itemPrice.text!, "category":self.pickerData[self.categoryPicker.selectedRowInComponent(0)]]
+
+ (segue.destinationViewController as! NetworksTableViewController).setListingDictionary(dict)
+
+ print(self.categoryPicker.selectedRowInComponent(0))
}
@@ -96,6 +113,56 @@ extension ItemImagePickerViewController: UIPickerViewDataSource {
}
+extension ItemImagePickerViewController: UITextViewDelegate {
+
+ func textViewDidBeginEditing(textView: UITextView) {
+ if (textView.text! == "Description") {
+ textView.text = ""
+ textView.textColor = UIColor.blackColor()
+ //optional
+ }
+ textView.becomeFirstResponder()
+ }
+
+ func textViewDidEndEditing(textView: UITextView) {
+ if (textView.text! == "") {
+ textView.text = "Description"
+ textView.textColor = UIColor.lightGrayColor()
+ //optional
+ }
+ textView.resignFirstResponder()
+ }
+
+ func textViewDidChange(textView: UITextView) {
+ let fixedWidth = textView.frame.size.width
+ textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
+ let newSize = textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
+ var newFrame = textView.frame
+ newFrame.size = CGSize(width: max(newSize.width, fixedWidth), height: newSize.height)
+ textView.frame = newFrame;
+ }
+}
+
+extension ItemImagePickerViewController: UITextFieldDelegate {
+
+ func textFieldShouldReturn(textField: UITextField) -> Bool {
+ self.view.endEditing(true)
+ return false
+ }
+
+ func hideKeyboard() {
+ self.view.endEditing(true)
+ }
+
+ func textFieldDidBeginEditing(textField: UITextField) {
+ self.containerScrollView.setContentOffset(CGPointMake(0, 200), animated: true)
+ }
+
+ func textFieldDidEndEditing(textField: UITextField) {
+ self.containerScrollView.setContentOffset(CGPointMake(0, 0), animated: true)
+ }
+}
+
//Mark: - IBActions
extension ItemImagePickerViewController {
diff --git a/Vendoo/ListingPreviewViewController.swift b/Vendoo/ListingPreviewViewController.swift
index c12c6bb..f571672 100644
--- a/Vendoo/ListingPreviewViewController.swift
+++ b/Vendoo/ListingPreviewViewController.swift
@@ -6,6 +6,13 @@
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
+/*
+ NOTES:
+
+ need to display navigation bar so user can navigate back to previous screens if changes need to be made
+
+ */
+
import UIKit
class ListingPreviewViewController: UIViewController {
@@ -19,11 +26,18 @@ class ListingPreviewViewController: UIViewController {
@IBOutlet weak var itemCategory: UITextView!
@IBOutlet weak var networks: UICollectionView!
+ //class variables
+ private var networksDictionary: Dictionary = Dictionary()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
+
+ // Initialization code
+ self.networks.delegate = self
+ self.networks.dataSource = self
+ self.networks.backgroundView?.backgroundColor = UIColor.whiteColor()
}
override func didReceiveMemoryWarning() {
@@ -31,6 +45,22 @@ class ListingPreviewViewController: UIViewController {
// Dispose of any resources that can be recreated.
}
+ func setListing(pic: UIImage, title: String, description: String, price: String, category: String){
+
+ //fatal error: unexpectedly found nil while unwrapping an Optional value <- need to figure this out
+ /*
+ self.itemPicture.image = pic
+ self.itemTitle.text = title
+ self.itemDescription.text = description
+ self.itemPrice.text = price
+ self.itemCategory.text = category
+ */
+ }
+
+ func setDictionary(dictionary:Dictionary){
+ self.networksDictionary = dictionary
+ }
+
/*
// MARK: - Navigation
@@ -58,3 +88,77 @@ extension ListingPreviewViewController {
}
+
+extension ListingPreviewViewController: UICollectionViewDelegate {
+
+ /*
+ // 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?) {
+
+ }
+ */
+
+}
+
+//Mark: - UICollectionViewDataSource methods
+//need to dynamically show, hide, and rearrange the network cells based on users choice of networks
+extension ListingPreviewViewController: 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
+ }
+
+
+ return cell
+ }
+
+}
diff --git a/Vendoo/NetworksTableViewController.swift b/Vendoo/NetworksTableViewController.swift
index 8b89029..20ae9b6 100644
--- a/Vendoo/NetworksTableViewController.swift
+++ b/Vendoo/NetworksTableViewController.swift
@@ -12,8 +12,7 @@
//Make it so u are accessing REST api service managers from TabController
//to promote more centralized code.
- //For now putting rest service managers in this controller file to test OAuth: EtsyRESTServiceManager,
- //FacebookGraphAPIServiceManager, EbayServiceManager, and AmazonServiceManager.
+ //need to make the class control the navigation bar by changing the buttons on it to show a back button in the case where class is controlling network selection, and hide back button for the case where class is controlling network authorization
*/
import UIKit
@@ -26,11 +25,8 @@ class NetworksTableViewController: UIViewController {
//class variables
private var networkToggleOrSelect: Bool = false
private var networksDictionary: Dictionary = ["ebay":false, "amazon":false,"etsy":false,"facebook":false]
-
-
- //temporary class variables /*TESTING*/
- //let etsyManager = EtsyRESTAPIManager()
- //let fbGraphManager = FacebookGraphAPIManager()
+ private var itemListingDictionary: Dictionary! = Dictionary()
+
override func viewDidLoad() {
super.viewDidLoad()
@@ -58,6 +54,17 @@ class NetworksTableViewController: UIViewController {
}
+//MARK: - class methods Network Selection when creating a new listing
+extension NetworksTableViewController {
+
+ func setListingDictionary(listingDictionary: Dictionary){
+
+ self.itemListingDictionary = listingDictionary
+
+ }
+
+}
+
// MARK: - Navigation
extension NetworksTableViewController {
@@ -68,7 +75,9 @@ extension NetworksTableViewController {
// Pass the selected object to the new view controller.
if(segue.identifier == "ItemPreviewSegue"){
+ (segue.destinationViewController as! ListingPreviewViewController).setListing(self.itemListingDictionary["picture"] as! UIImage, title: self.itemListingDictionary["title"] as! String, description: self.itemListingDictionary["description"] as! String, price: self.itemListingDictionary["price"] as! String, category: self.itemListingDictionary["category"] as! String)
+ (segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary)
}
}
}
@@ -150,6 +159,15 @@ extension NetworksTableViewController: UITableViewDataSource {
}
+//MARK: - IBActions
+extension NetworksTableViewController {
+
+ @IBAction func showListingPreview(sender: AnyObject) {
+
+ self.performSegueWithIdentifier("ItemPreviewSegue", sender: self)
+ }
+
+}
//SET UP TO ADD EACH INTEGRATION AS DEVELOPMENT GETS TO IT
@@ -434,6 +452,7 @@ extension NetworksTableViewController: UITableViewDelegate {
}
+
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
@@ -468,4 +487,4 @@ extension NetworksTableViewController: UITableViewDelegate {
return true
}
*/
-}
+}
\ No newline at end of file