Bug has been resolved

Alerts and validation have been added to posting process to prevent bad input, as well as alerts to network selection, to alert user when no networks have been selected or authorized
This commit is contained in:
Okechi Onyeje 2016-11-26 15:16:08 -05:00
parent b74bab3241
commit eee7986ffb
5 changed files with 109 additions and 98 deletions

View File

@ -186,7 +186,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift"
timestampString = "501868546.548886" timestampString = "501881724.556734"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "570" startingLineNumber = "570"
@ -201,7 +201,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift"
timestampString = "501868546.549061" timestampString = "501881724.556878"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "572" startingLineNumber = "572"
@ -744,7 +744,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "501868546.567523" timestampString = "501881724.576913"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "194" startingLineNumber = "194"
@ -759,7 +759,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "501868546.567615" timestampString = "501881724.577081"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "197" startingLineNumber = "197"
@ -792,11 +792,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/ItemImagePickerViewController.swift" filePath = "Vendoo/ItemImagePickerViewController.swift"
timestampString = "501823514.544138" timestampString = "501879828.267358"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "519" startingLineNumber = "536"
endingLineNumber = "519" endingLineNumber = "536"
landmarkName = "ItemImagePickerViewController" landmarkName = "ItemImagePickerViewController"
landmarkType = "3"> landmarkType = "3">
</BreakpointContent> </BreakpointContent>
@ -840,27 +840,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/ItemImagePickerViewController.swift" filePath = "Vendoo/ItemImagePickerViewController.swift"
timestampString = "501824288.668123" timestampString = "501879828.267358"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "167" startingLineNumber = "537"
endingLineNumber = "167" endingLineNumber = "537"
landmarkName = "prepareForSegue(_:sender:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ItemImagePickerViewController.swift"
timestampString = "501863821.46129"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "520"
endingLineNumber = "520"
landmarkName = "cancelNewListing(_:)" landmarkName = "cancelNewListing(_:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -904,7 +888,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "501868546.571367" timestampString = "501881724.580763"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "16" startingLineNumber = "16"
@ -919,7 +903,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "501868546.571482" timestampString = "501881724.580877"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "16" startingLineNumber = "16"
@ -934,7 +918,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "501868546.571568" timestampString = "501881724.580974"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "16" startingLineNumber = "16"
@ -958,38 +942,6 @@
endingLineNumber = "31" endingLineNumber = "31"
landmarkName = "init()" landmarkName = "init()"
landmarkType = "5"> landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FirebaseManager.init () -&gt; Vendoo.FirebaseManager"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FirebaseManager.swift"
timestampString = "501868546.572473"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "31"
endingLineNumber = "31"
offsetFromSymbolStart = "1491">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FirebaseManager.(init () -&gt; Vendoo.FirebaseManager).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FirebaseManager.swift"
timestampString = "501868546.572569"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
offsetFromSymbolStart = "19">
</Location>
</Locations>
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy <BreakpointProxy
@ -1008,5 +960,21 @@
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ItemImagePickerViewController.swift"
timestampString = "501880171.766869"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "138"
endingLineNumber = "138"
landmarkName = "prepareForSegue(_:sender:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>

View File

@ -40,6 +40,8 @@ class FirebaseManager: NSObject {
dispatch_group_leave(self.firGroup) dispatch_group_leave(self.firGroup)
}) })
}else{
dispatch_group_leave(self.firGroup)
} }
}) })
} }

View File

@ -135,7 +135,22 @@ extension ItemImagePickerViewController {
print(self.itemDescription.text!) print(self.itemDescription.text!)
print(self.possibleItemImageMain.image) print(self.possibleItemImageMain.image)
print(self.itemPrice.text!) print(self.itemPrice.text!)
if (
self.itemName.text! == "" ||
Int(self.itemQuantity.text!) == nil ||
Int(self.itemQuantity.text!) < 1 ||
self.itemPrice.text! == "" ||
Double(self.itemPrice.text!) == nil ||
Double(self.itemPrice.text!) < 0.30 ||
self.itemDescription.text! == "Description"
){
let alert = UIAlertController(title: "Required Information Missing", message: "To proceed with your listing, at least one image must be provided. Along with all provided fields including:\n Title\nDescription\nQuantity (must be greater than 0)\nPrice (must be greater than $0.30).", 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{
var dict: Dictionary<String, AnyObject!> = ["title":self.itemName.text!, "description":self.itemDescription.text!, "price":self.itemPrice.text!, "quantity":self.itemQuantity.text!] var dict: Dictionary<String, AnyObject!> = ["title":self.itemName.text!, "description":self.itemDescription.text!, "price":self.itemPrice.text!, "quantity":self.itemQuantity.text!]
var counter = 0 var counter = 0
var images: [UIImageView] = [] var images: [UIImageView] = []
@ -173,6 +188,8 @@ extension ItemImagePickerViewController {
fireManager: ((self.tabBarController as? HomeViewController)?.firebaseManager)!, ebayManager: ((self.tabBarController as? HomeViewController)?.ebayGraphManager)!, fireManager: ((self.tabBarController as? HomeViewController)?.firebaseManager)!, ebayManager: ((self.tabBarController as? HomeViewController)?.ebayGraphManager)!,
etsyManager: ((self.tabBarController as? HomeViewController)?.etsyManager)!) etsyManager: ((self.tabBarController as? HomeViewController)?.etsyManager)!)
} }
}
} }

View File

@ -35,6 +35,7 @@ class NetworksTableViewController: UIViewController {
private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager() private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager()
private var shouldShowDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false] private var shouldShowDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false]
private var networkOrderSelection: [String] = [] private var networkOrderSelection: [String] = []
private var networkCount = 0
@ -81,6 +82,7 @@ class NetworksTableViewController: UIViewController {
var string = "" var string = ""
for (market, visibility) in self.shouldShowDictionary { for (market, visibility) in self.shouldShowDictionary {
if visibility { if visibility {
self.networkCount += 1
self.shouldShowDictionary[market] = !self.shouldShowDictionary[market]! self.shouldShowDictionary[market] = !self.shouldShowDictionary[market]!
string = market string = market
self.networkOrderSelection.append(market) self.networkOrderSelection.append(market)
@ -126,9 +128,31 @@ extension NetworksTableViewController {
// Pass the selected object to the new view controller. // Pass the selected object to the new view controller.
if(segue.identifier == "ItemPreviewSegue"){ if(segue.identifier == "ItemPreviewSegue"){
if(networkCount > 0){
var count = 0;
for (_,v) in self.networksDictionary{
if v {
count += 1
}
}
if(count > 0){
(segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary, itemdictionary: self.itemListingDictionary) (segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary, itemdictionary: self.itemListingDictionary)
(segue.destinationViewController as! ListingPreviewViewController).setManagers(self.graphManager, fireManager: self.firManager, ebayManager: self.ebayManager, etsyManager: self.etsyManager) (segue.destinationViewController as! ListingPreviewViewController).setManagers(self.graphManager, fireManager: self.firManager, ebayManager: self.ebayManager, etsyManager: self.etsyManager)
}else{
let alert = UIAlertController(title: "No Networks Selected", message: "You have not selected any networks to publish on. At least 1 network must be selected to continue.", 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{
let alert = UIAlertController(title: "No Networks Authorized", message: "You currently have no authorized networks to post on. You will not be able to publish this listing until at least 1 network has been authorized and selected for publishing.", 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)
}
} }
if(segue.identifier == "EbaySettingsSegue") { if(segue.identifier == "EbaySettingsSegue") {