mirror of
https://bitbucket.org/vendoo/vendoo_v1.0.git
synced 2025-12-25 11:47:40 +00:00
Enabled multiple images being saved
can now save multiple images to firebase when drafting a listing
This commit is contained in:
parent
775e41690c
commit
f944d27012
Binary file not shown.
@ -10,12 +10,12 @@
|
|||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
timestampString = "487758106.283634"
|
timestampString = "487821260.588406"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "125"
|
startingLineNumber = "379"
|
||||||
endingLineNumber = "125"
|
endingLineNumber = "379"
|
||||||
landmarkName = "takePicture()"
|
landmarkName = "draftItem(_:)"
|
||||||
landmarkType = "5">
|
landmarkType = "5">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
@ -26,12 +26,12 @@
|
|||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
timestampString = "487758106.283634"
|
timestampString = "487821264.116041"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "58"
|
startingLineNumber = "388"
|
||||||
endingLineNumber = "58"
|
endingLineNumber = "388"
|
||||||
landmarkName = "viewDidLoad()"
|
landmarkName = "draftItem(_:)"
|
||||||
landmarkType = "5">
|
landmarkType = "5">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
@ -41,13 +41,157 @@
|
|||||||
shouldBeEnabled = "Yes"
|
shouldBeEnabled = "Yes"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "Vendoo/ListingPreviewViewController.swift"
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
timestampString = "487757808.448492"
|
timestampString = "487821268.676583"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "210"
|
startingLineNumber = "397"
|
||||||
endingLineNumber = "210"
|
endingLineNumber = "397"
|
||||||
landmarkName = "editListing(_:)"
|
landmarkName = "draftItem(_:)"
|
||||||
|
landmarkType = "5">
|
||||||
|
<Locations>
|
||||||
|
<Location
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "Vendoo.ItemImagePickerViewController.(draftItem (Swift.AnyObject) -> ()).(closure #2)"
|
||||||
|
moduleName = "Vendoo"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821710.468983"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "397"
|
||||||
|
endingLineNumber = "397"
|
||||||
|
offsetFromSymbolStart = "6258">
|
||||||
|
</Location>
|
||||||
|
<Location
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "Vendoo.ItemImagePickerViewController.(draftItem (Swift.AnyObject) -> ()).(closure #2).(closure #3)"
|
||||||
|
moduleName = "Vendoo"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821710.469135"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "399"
|
||||||
|
endingLineNumber = "399"
|
||||||
|
offsetFromSymbolStart = "16">
|
||||||
|
</Location>
|
||||||
|
</Locations>
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821272.612667"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "406"
|
||||||
|
endingLineNumber = "406"
|
||||||
|
landmarkName = "draftItem(_:)"
|
||||||
|
landmarkType = "5">
|
||||||
|
<Locations>
|
||||||
|
<Location
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "Vendoo.ItemImagePickerViewController.(draftItem (Swift.AnyObject) -> ()).(closure #2)"
|
||||||
|
moduleName = "Vendoo"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821710.469919"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "406"
|
||||||
|
endingLineNumber = "406"
|
||||||
|
offsetFromSymbolStart = "8160">
|
||||||
|
</Location>
|
||||||
|
<Location
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "Vendoo.ItemImagePickerViewController.(draftItem (Swift.AnyObject) -> ()).(closure #2).(closure #4)"
|
||||||
|
moduleName = "Vendoo"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821710.470065"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "408"
|
||||||
|
endingLineNumber = "408"
|
||||||
|
offsetFromSymbolStart = "16">
|
||||||
|
</Location>
|
||||||
|
</Locations>
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821278.466487"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "417"
|
||||||
|
endingLineNumber = "417"
|
||||||
|
landmarkName = "draftItem(_:)"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821488.893187"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "375"
|
||||||
|
endingLineNumber = "375"
|
||||||
|
landmarkName = "draftItem(_:)"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821497.055538"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "384"
|
||||||
|
endingLineNumber = "384"
|
||||||
|
landmarkName = "draftItem(_:)"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "Vendoo/ItemImagePickerViewController.swift"
|
||||||
|
timestampString = "487821601.709206"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "380"
|
||||||
|
endingLineNumber = "380"
|
||||||
|
landmarkName = "draftItem(_:)"
|
||||||
landmarkType = "5">
|
landmarkType = "5">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
|||||||
@ -39,6 +39,8 @@ class HomeViewController: UITabBarController {
|
|||||||
let storageRef = self.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
|
let storageRef = self.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
|
||||||
let listingImage = storageRef.child("images/\(keys).jpg")
|
let listingImage = storageRef.child("images/\(keys).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: {
|
listingImage.dataWithMaxSize(10 * 1024 * 1024, completion: {
|
||||||
(data, error) -> Void in
|
(data, error) -> Void in
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,8 @@ class ItemImagePickerViewController: UIViewController {
|
|||||||
var itemImages:[UIImageView]!
|
var itemImages:[UIImageView]!
|
||||||
var itemImagesSelections = [false,false,false,false,false]
|
var itemImagesSelections = [false,false,false,false,false]
|
||||||
private var picker = UIImagePickerController()
|
private var picker = UIImagePickerController()
|
||||||
|
private var currImageSelected: UIImageView!
|
||||||
|
private var currUILabel: UILabel!
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
@ -56,8 +57,9 @@ class ItemImagePickerViewController: UIViewController {
|
|||||||
let tapGestureMain = UITapGestureRecognizer(target: self, action: #selector(ItemImagePickerViewController.takePicture))
|
let tapGestureMain = UITapGestureRecognizer(target: self, action: #selector(ItemImagePickerViewController.takePicture))
|
||||||
let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(ItemImagePickerViewController.takePicture))
|
let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(ItemImagePickerViewController.takePicture))
|
||||||
//tapGesture.cancelsTouchesInView = true
|
//tapGesture.cancelsTouchesInView = true
|
||||||
self.possibleItemImageMain.addGestureRecognizer(tapGestureMain)
|
self.view.addGestureRecognizer(tapGestureMain)
|
||||||
self.possibleItemImage2.addGestureRecognizer(tapGesture2)
|
//self.possibleItemImageMain.addGestureRecognizer(tapGestureMain)
|
||||||
|
//self.possibleItemImage2.addGestureRecognizer(tapGesture2)
|
||||||
//self.possibleItemImage3.addGestureRecognizer(tapGesture)
|
//self.possibleItemImage3.addGestureRecognizer(tapGesture)
|
||||||
//self.possibleItemImage4.addGestureRecognizer(tapGesture)
|
//self.possibleItemImage4.addGestureRecognizer(tapGesture)
|
||||||
//self.possibleItemImage5.addGestureRecognizer(tapGesture)
|
//self.possibleItemImage5.addGestureRecognizer(tapGesture)
|
||||||
@ -112,7 +114,11 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
|
|||||||
|
|
||||||
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
|
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
|
||||||
|
|
||||||
self.possibleItemImageMain.image = image
|
if (self.possibleItemImageMain.image != nil && self.currUILabel != nil ){
|
||||||
|
self.currUILabel.hidden = true
|
||||||
|
}
|
||||||
|
self.currImageSelected.image = image
|
||||||
|
|
||||||
dismissViewControllerAnimated(true, completion: nil)
|
dismissViewControllerAnimated(true, completion: nil)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -122,7 +128,93 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func takePicture(){
|
func takePicture(sender: UITapGestureRecognizer ){
|
||||||
|
let location: CGPoint = sender.locationInView(self.view)
|
||||||
|
|
||||||
|
if(sender.state == UIGestureRecognizerState.Ended) {
|
||||||
|
var viewsWereSaved = [false, false]
|
||||||
|
for view in self.view.subviews {
|
||||||
|
if (view.isKindOfClass(UIImageView) && CGRectContainsPoint(view.frame, location)) {
|
||||||
|
self.currImageSelected = view as! UIImageView
|
||||||
|
switch (view.tag) {
|
||||||
|
case 1:
|
||||||
|
if(self.itemImagesSelections[0]) {
|
||||||
|
self.itemImagesSelections[1] = true
|
||||||
|
viewsWereSaved[0] = true
|
||||||
|
} else {
|
||||||
|
let alert = UIAlertController(title: "Main Image Needed", message: "You must have a main image before saving supporting images.", 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if(self.itemImagesSelections[0] && self.itemImagesSelections[1]) {
|
||||||
|
self.itemImagesSelections[2] = true
|
||||||
|
viewsWereSaved[0] = true
|
||||||
|
} else {
|
||||||
|
let alert = UIAlertController(title: "Support Image 1 Missing", message: "You must save your first supporting image before saving more.", 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
if(self.itemImagesSelections[0] && self.itemImagesSelections[1]
|
||||||
|
&& self.itemImagesSelections[2]) {
|
||||||
|
self.itemImagesSelections[3] = true
|
||||||
|
viewsWereSaved[0] = true
|
||||||
|
} else {
|
||||||
|
let alert = UIAlertController(title: "Support Image 2 Missing", message: "You must save your first two supporting images before saving more.", 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
if(self.itemImagesSelections[0] && self.itemImagesSelections[1]
|
||||||
|
&& self.itemImagesSelections[2] && self.itemImagesSelections[3]) {
|
||||||
|
self.itemImagesSelections[4] = true
|
||||||
|
viewsWereSaved[0] = true
|
||||||
|
} else {
|
||||||
|
let alert = UIAlertController(title: "Support Image 3 Missing", message: "You must save your first three supporting images before saving more.", 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
self.itemImagesSelections[0] = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (view.isKindOfClass(UILabel) && CGRectContainsPoint(view.frame, location)) {
|
||||||
|
self.currUILabel = view as! UILabel
|
||||||
|
viewsWereSaved[1] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
let captureMenu = UIAlertController(title: nil, message:nil, preferredStyle: .ActionSheet)
|
let captureMenu = UIAlertController(title: nil, message:nil, preferredStyle: .ActionSheet)
|
||||||
|
|
||||||
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
|
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
|
||||||
@ -153,6 +245,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//MARK: - UIPickerViewDelegate
|
//MARK: - UIPickerViewDelegate
|
||||||
extension ItemImagePickerViewController: UIPickerViewDelegate {
|
extension ItemImagePickerViewController: UIPickerViewDelegate {
|
||||||
|
|
||||||
@ -252,7 +345,7 @@ extension ItemImagePickerViewController {
|
|||||||
@IBAction func draftItem(sender: AnyObject) {
|
@IBAction func draftItem(sender: AnyObject) {
|
||||||
|
|
||||||
if(self.possibleItemImageMain.image == nil){
|
if(self.possibleItemImageMain.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)
|
let alert = UIAlertController(title: "Main 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)}))
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||||
|
|
||||||
self.presentViewController(alert, animated: true, completion: nil)
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
@ -262,13 +355,21 @@ extension ItemImagePickerViewController {
|
|||||||
let newListingRef = (self.tabBarController as? HomeViewController)?.firebaseManager.ref.child("Users").child("\(((self.tabBarController as? HomeViewController)?.firebaseManager.user_email)!)").child("user_Listings").childByAutoId()
|
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 category = (self.pickerData[self.categoryPicker.selectedRowInComponent(0)])
|
||||||
|
var counter = -1
|
||||||
|
for bool in self.itemImagesSelections {
|
||||||
|
if bool {
|
||||||
|
counter += 1
|
||||||
|
}else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
let listing: Dictionary<String, AnyObject?> = ["listingID": newListingRef!.key,
|
let listing: Dictionary<String, AnyObject?> = ["listingID": newListingRef!.key,
|
||||||
"seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!,
|
"seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!,
|
||||||
"listingTitle": self.itemName.text,
|
"listingTitle": self.itemName.text,
|
||||||
"listingPrice": self.itemPrice.text,
|
"listingPrice": self.itemPrice.text,
|
||||||
"listingCategory": category,
|
"listingCategory": category,
|
||||||
"listingDescription": self.itemDescription.text,
|
"listingDescription": self.itemDescription.text,
|
||||||
|
"numberOfSupportingImages" : counter,
|
||||||
"isListingDraft": true,
|
"isListingDraft": true,
|
||||||
"networks": ["areNetworksChosen": false]]
|
"networks": ["areNetworksChosen": false]]
|
||||||
|
|
||||||
@ -278,24 +379,60 @@ extension ItemImagePickerViewController {
|
|||||||
|
|
||||||
let storageRef = (self.tabBarController as? HomeViewController)?.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
|
let storageRef = (self.tabBarController as? HomeViewController)?.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!)
|
||||||
|
|
||||||
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+".jpg")
|
//check each imageview to see if there is an image to upload
|
||||||
|
if(self.possibleItemImage2.image != nil){
|
||||||
|
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+"/2.jpg")
|
||||||
|
|
||||||
|
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImage2.image!, 0.8)!, metadata: nil,completion:
|
||||||
|
{(metadata, error) -> Void in
|
||||||
|
print(metadata)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImageMain.image!, 0.8)!, metadata: nil,completion:
|
if(self.possibleItemImage3.image != nil){
|
||||||
{(metadata, error) -> Void in
|
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+"/3.jpg")
|
||||||
|
|
||||||
newListingRef!.setValue(listing as? Dictionary<String,AnyObject>)
|
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImage3.image!, 0.8)!, metadata: nil,completion:
|
||||||
let alert = UIAlertController(title: "Item Saved", message: "Your listing has been saved by a draft", preferredStyle: .Alert)
|
{(metadata, error) -> Void in
|
||||||
|
print(metadata)
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: {
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self.possibleItemImage4.image != nil){
|
||||||
|
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+"/4.jpg")
|
||||||
|
|
||||||
|
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImage4.image!, 0.8)!, metadata: nil,completion:
|
||||||
|
{(metadata, error) -> Void in
|
||||||
|
|
||||||
self.dismissViewControllerAnimated(true, completion: nil)
|
})
|
||||||
})}))
|
}
|
||||||
|
|
||||||
self.presentViewController(alert, animated: true, completion: nil)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
if(self.possibleItemImage5.image != nil){
|
||||||
|
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+"/5.jpg")
|
||||||
|
|
||||||
|
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImage5.image!, 0.8)!, metadata: nil,completion:
|
||||||
|
{(metadata, error) -> Void in
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self.possibleItemImageMain.image != nil){
|
||||||
|
let listingImageRef = storageRef!.child("images/\(newListingRef!.key)"+"/main.jpg")
|
||||||
|
|
||||||
|
listingImageRef.putData(UIImageJPEGRepresentation(self.possibleItemImageMain.image!, 0.8)!, metadata: nil,completion:
|
||||||
|
{(metadata, error) -> Void in
|
||||||
|
|
||||||
|
newListingRef!.setValue(listing as? Dictionary<String,AnyObject>)
|
||||||
|
let alert = UIAlertController(title: "Item Saved", message: "Your listing has been saved by a draft", preferredStyle: .Alert)
|
||||||
|
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: {
|
||||||
|
|
||||||
|
self.dismissViewControllerAnimated(true, completion: nil)
|
||||||
|
})}))
|
||||||
|
|
||||||
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -252,52 +252,57 @@
|
|||||||
<action selector="draftItem:" destination="0di-oP-cGQ" eventType="touchUpInside" id="0nQ-OL-TyI"/>
|
<action selector="draftItem:" destination="0di-oP-cGQ" eventType="touchUpInside" id="0nQ-OL-TyI"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
|
<view contentMode="scaleToFill" id="cei-ES-Ffz">
|
||||||
|
<rect key="frame" x="0.0" y="266" width="375" height="66"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</view>
|
||||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ktF-gc-qhF" userLabel="First Image">
|
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ktF-gc-qhF" userLabel="First Image">
|
||||||
<rect key="frame" x="0.0" y="55" width="375" height="280"/>
|
<rect key="frame" x="0.0" y="55" width="375" height="211"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
|
||||||
<color key="backgroundColor" red="1" green="0.94432476799999998" blue="0.29461320000000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<gestureRecognizers/>
|
<gestureRecognizers/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="smo-O2-fSf" userLabel="Image 1">
|
<imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="smo-O2-fSf" userLabel="Image 1">
|
||||||
<rect key="frame" x="6" y="271" width="81" height="56"/>
|
<rect key="frame" x="6" y="271" width="81" height="56"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Ylh-7V-Brd">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="85d-iR-Lgx">
|
||||||
<rect key="frame" x="23" y="284" width="46" height="30"/>
|
<rect key="frame" x="6" y="274" width="76" height="53"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<state key="normal" title="ADD">
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="titleColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</state>
|
<color key="highlightedColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</button>
|
</label>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ZfH-0j-qER" userLabel="Image 2">
|
<imageView userInteractionEnabled="NO" tag="2" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ZfH-0j-qER" userLabel="Image 2">
|
||||||
<rect key="frame" x="104" y="271" width="81" height="56"/>
|
<rect key="frame" x="104" y="271" width="81" height="56"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="XLp-fc-Ydp">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4zU-13-6Dw">
|
||||||
<rect key="frame" x="121" y="274" width="46" height="53"/>
|
<rect key="frame" x="104" y="274" width="81" height="53"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<state key="normal" title="ADD">
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="titleColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</state>
|
<color key="highlightedColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</button>
|
</label>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="Krl-yM-1dX" userLabel="Image 3">
|
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="Krl-yM-1dX" userLabel="Image 3">
|
||||||
<rect key="frame" x="198" y="271" width="81" height="56"/>
|
<rect key="frame" x="198" y="271" width="81" height="56"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="y50-6b-MTy">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cDy-4Q-c7H">
|
||||||
<rect key="frame" x="215" y="284" width="46" height="30"/>
|
<rect key="frame" x="198" y="274" width="81" height="53"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<state key="normal" title="ADD">
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="titleColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</state>
|
<nil key="highlightedColor"/>
|
||||||
</button>
|
</label>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="nJi-Yt-UXk" userLabel="Image 4">
|
<imageView userInteractionEnabled="NO" tag="4" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="nJi-Yt-UXk" userLabel="Image 4">
|
||||||
<rect key="frame" x="287" y="271" width="81" height="56"/>
|
<rect key="frame" x="287" y="271" width="81" height="56"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="459-0A-OZB">
|
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="459-0A-OZB">
|
||||||
<rect key="frame" x="0.0" y="335" width="375" height="288"/>
|
<rect key="frame" x="0.0" y="335" width="375" height="288"/>
|
||||||
@ -358,13 +363,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="nUK-o3-Zzs">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JrY-LB-hod">
|
||||||
<rect key="frame" x="304" y="284" width="46" height="30"/>
|
<rect key="frame" x="287" y="274" width="81" height="53"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<state key="normal" title="ADD">
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="titleColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
</state>
|
<nil key="highlightedColor"/>
|
||||||
</button>
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</view>
|
</view>
|
||||||
@ -1534,6 +1539,19 @@
|
|||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="2359.5" y="-430.5"/>
|
<point key="canvasLocation" x="2359.5" y="-430.5"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="zlz-Xg-gtg">
|
||||||
|
<objects>
|
||||||
|
<viewController id="xzf-rH-zNA" sceneMemberID="viewController">
|
||||||
|
<view key="view" contentMode="scaleToFill" id="Vov-c0-qAI">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="W8b-SQ-rnD" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="account" width="52" height="52"/>
|
<image name="account" width="52" height="52"/>
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#import "EBayTradingServiceClient.h"
|
//#import "EBayTradingServiceClient.h"
|
||||||
|
|
||||||
|
|
||||||
#endif /* Vendoo_Bridging_Header_h */
|
#endif /* Vendoo_Bridging_Header_h */
|
||||||
Loading…
x
Reference in New Issue
Block a user