mirror of
https://bitbucket.org/vendoo/vendoo_v1.0.git
synced 2025-12-25 11:47:40 +00:00
Merge branch 'Rapid-Dev-Branch'
Conflicts: Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist Vendoo/EbayWebServiceManager.swift
This commit is contained in:
commit
6e8ca0cfde
@ -90,11 +90,207 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
<<<<<<< HEAD
|
||||
timestampString = "494390858.671323"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "568"
|
||||
endingLineNumber = "568"
|
||||
=======
|
||||
timestampString = "494685275.012942"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "573"
|
||||
endingLineNumber = "573">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
timestampString = "494685275.012942"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "571"
|
||||
endingLineNumber = "571">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494630189.759007"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "82"
|
||||
endingLineNumber = "82"
|
||||
landmarkName = "checkVisibility()"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494630189.759007"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "178"
|
||||
endingLineNumber = "178"
|
||||
landmarkName = "tableView(_:cellForRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/CategoriesTableViewController.swift"
|
||||
timestampString = "494631326.508326"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "583"
|
||||
endingLineNumber = "583"
|
||||
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/CategoriesTableViewController.swift"
|
||||
timestampString = "494631326.508326"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "695"
|
||||
endingLineNumber = "695"
|
||||
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494635088.267954"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "788"
|
||||
endingLineNumber = "788"
|
||||
landmarkName = "toggleAuth(_:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.toggleAuth (__ObjC.UIButton) -> ()"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494637260.284101"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "788"
|
||||
endingLineNumber = "788"
|
||||
offsetFromSymbolStart = "1462">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.(toggleAuth (__ObjC.UIButton) -> ()).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/include/dispatch/queue.h"
|
||||
timestampString = "494637260.284213"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "325"
|
||||
endingLineNumber = "325"
|
||||
offsetFromSymbolStart = "44">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494636143.418834"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "791"
|
||||
endingLineNumber = "791"
|
||||
landmarkName = "toggleAuth(_:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.(toggleAuth (__ObjC.UIButton) -> ()).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494637260.28507"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "791"
|
||||
endingLineNumber = "791"
|
||||
offsetFromSymbolStart = "64">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.(toggleAuth (__ObjC.UIButton) -> ()).(closure #1).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494637260.285178"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "792"
|
||||
endingLineNumber = "792"
|
||||
offsetFromSymbolStart = "34">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
timestampString = "494685275.012942"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "411"
|
||||
endingLineNumber = "411"
|
||||
>>>>>>> Rapid-Dev-Branch
|
||||
landmarkName = "parser(_:foundCharacters:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
@ -105,6 +301,7 @@
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
<<<<<<< HEAD
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
timestampString = "494391829.589686"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
@ -112,6 +309,79 @@
|
||||
startingLineNumber = "566"
|
||||
endingLineNumber = "566"
|
||||
landmarkName = "parser(_:foundCharacters:)"
|
||||
=======
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494636097.069833"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "764"
|
||||
endingLineNumber = "764"
|
||||
landmarkName = "webViewDidFinishLoad(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
timestampString = "494685275.012942"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "309"
|
||||
endingLineNumber = "309"
|
||||
landmarkName = "fetchToken()"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494636370.565199"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "793"
|
||||
endingLineNumber = "793"
|
||||
landmarkName = "toggleAuth(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/EbayWebServiceManager.swift"
|
||||
timestampString = "494685275.012942"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "473"
|
||||
endingLineNumber = "473"
|
||||
landmarkName = "parser(_:foundCharacters:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "494637280.732776"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "765"
|
||||
endingLineNumber = "765"
|
||||
landmarkName = "webViewDidFinishLoad(_:)"
|
||||
>>>>>>> Rapid-Dev-Branch
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
|
||||
@ -17,7 +17,10 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager()
|
||||
private var selectedCategory: String!
|
||||
private var selectedSub: String!
|
||||
|
||||
private var potentialEbay = false
|
||||
private var potentialEtsy = false
|
||||
private var potentialAmazon = false
|
||||
|
||||
private var categories = ["Accessories",
|
||||
"Antiques",
|
||||
"Art",
|
||||
@ -124,9 +127,16 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
|
||||
// Configure the cell...
|
||||
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
cell.categoryName.text = self.categories[indexPath.row]
|
||||
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true //facebook
|
||||
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true //etsy
|
||||
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon
|
||||
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay
|
||||
|
||||
//leaving this in for category debugging purposes
|
||||
/*
|
||||
switch (cell.categoryName.text!) {
|
||||
case ("Accessories") :
|
||||
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook
|
||||
@ -514,7 +524,7 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}*/
|
||||
|
||||
/*//ebay
|
||||
if(true){
|
||||
@ -576,15 +586,18 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
case "Art":
|
||||
self.selectedCategory = "Art"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Baby":
|
||||
self.selectedCategory = "Baby"
|
||||
break
|
||||
case "Bath, Beauty & Health":
|
||||
self.selectedCategory = "Health and Beauty"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Books":
|
||||
self.selectedCategory = "Books"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Business & Industrial":
|
||||
self.selectedCategory = "Business and Industrial"
|
||||
@ -597,6 +610,7 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
case "Clothing & Shoes":
|
||||
self.selectedCategory = "Clothing, Shoes and Accessories"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Coins & Paper Money":
|
||||
self.selectedCategory = "Coins and Paper Money"
|
||||
@ -615,6 +629,7 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
case "Dolls & Miniatures":
|
||||
self.selectedCategory = "Dolls and Bears"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "DVDs & Movies":
|
||||
self.selectedCategory = "DVDs & Movies"
|
||||
@ -624,15 +639,18 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
case "Everything Else":
|
||||
self.selectedCategory = "Everything Else"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Gift Cards & Coupons":
|
||||
self.selectedCategory = "Gift Cards and Coupons"
|
||||
break
|
||||
case "Home/Houseware & Garden":
|
||||
self.selectedCategory = "Coins and Paper Money"
|
||||
self.selectedCategory = "Home and Garden"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Jewelry & Watches":
|
||||
self.selectedCategory = "Jewelry and Watches"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Musical Instruments & Gear":
|
||||
self.selectedCategory = "Musical Instruments and Gear"
|
||||
@ -660,6 +678,7 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
break
|
||||
case "Toys & Hobbies":
|
||||
self.selectedCategory = "Toys and Hobbies"
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
case "Travel":
|
||||
self.selectedCategory = "Travel"
|
||||
@ -668,24 +687,15 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
self.selectedCategory = "Video Games and Consoles"
|
||||
break
|
||||
default:
|
||||
self.selectedCategory = self.categories[indexPath.row]
|
||||
self.potentialEtsy = true
|
||||
break
|
||||
}
|
||||
|
||||
let cell: CategoryCell! = tableView.cellForRowAtIndexPath(indexPath) as! CategoryCell//tableView.dequeueReusableCellWithIdentifier("CategoryCell", forIndexPath: indexPath) as? CategoryCell
|
||||
if(cell.shouldAskAboutLeafCategories){
|
||||
let alert = UIAlertController(title: "Explore Subcategories", message: "Would you like to see the subcategories for \(self.selectedCategory). NOTE: Only Required If Posting to Ebay", preferredStyle: .Alert)
|
||||
|
||||
alert.addAction(UIAlertAction(title: "Yes", style: .Default, handler: {(action: UIAlertAction!) in
|
||||
self.navigateCategories()
|
||||
}))
|
||||
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: {(action: UIAlertAction!) in
|
||||
}))
|
||||
alert.addAction(UIAlertAction(title: "No", style: .Default, handler: {(action: UIAlertAction!) in
|
||||
self.performSegueWithIdentifier("NetworkSelectionSegue", sender: self)
|
||||
}))
|
||||
self.presentViewController(alert, animated: true, completion: nil)
|
||||
|
||||
if(self.ebayManager.isAuthorized && cell.shouldAskAboutLeafCategories){
|
||||
self.potentialEbay = true
|
||||
self.navigateCategories()
|
||||
}
|
||||
else {
|
||||
self.performSegueWithIdentifier("NetworkSelectionSegue", sender: self)
|
||||
@ -743,6 +753,20 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa
|
||||
fireManager: self.firManager, ebayManager: self.ebayManager, etsyManager: self.etsyManager )
|
||||
|
||||
(segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true)
|
||||
|
||||
//check what networks to load in network selection view
|
||||
if self.graphManager.isAuthorized {
|
||||
(segue.destinationViewController as! NetworksTableViewController).toggleMarketPlaceVisibitlity("facebook")
|
||||
}
|
||||
if self.potentialEbay && self.ebayManager.isAuthorized {
|
||||
(segue.destinationViewController as! NetworksTableViewController).toggleMarketPlaceVisibitlity("ebay")
|
||||
}
|
||||
if self.potentialEtsy && self.etsyManager.isAuthorized {
|
||||
(segue.destinationViewController as! NetworksTableViewController).toggleMarketPlaceVisibitlity("etsy")
|
||||
}
|
||||
if self.potentialAmazon {
|
||||
(segue.destinationViewController as! NetworksTableViewController).toggleMarketPlaceVisibitlity("amazon")
|
||||
}
|
||||
//print(self.categoryPicker.selectedRowInComponent(0))
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ class EbayWebServiceManager: NSObject {
|
||||
private var completion: ServiceResponse!
|
||||
private var isGettingSubCategories: Bool = false
|
||||
private var isRevisingListing: Bool = false
|
||||
private var requestGroup: dispatch_group_t = dispatch_group_create()
|
||||
var isGettingNotification: Bool = false
|
||||
//---------------------------------------------//
|
||||
|
||||
@ -124,7 +125,7 @@ extension EbayWebServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
func authorizeApp(){
|
||||
func authorizeApp(onComplete: ServiceResponse){
|
||||
|
||||
let soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<GetSessionIDRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" +
|
||||
@ -134,18 +135,21 @@ extension EbayWebServiceManager {
|
||||
let url = NSURL(string: self.baseURL)
|
||||
let theRequest = NSMutableURLRequest(URL: url!)
|
||||
theRequest.addValue("GetSessionID", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
|
||||
|
||||
self.completion = onComplete
|
||||
self.requestMaker(soapMessage, theRequest: theRequest)
|
||||
|
||||
|
||||
}
|
||||
|
||||
func deauthorizeApp(){
|
||||
let soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
//@TODO: Add an alert to let user know if their account has not been deauthorized and keep them logged in.
|
||||
var soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<RevokeTokenRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" +
|
||||
"<RequesterCredentials>" +
|
||||
"<eBayAuthToken>\(self.xmlResponseDictionary["eBayAuthToken"])</eBayAuthToken>" +
|
||||
"</RequesterCredentials></RevokeTokenRequest>"
|
||||
"<eBayAuthToken>\(self.xmlResponseDictionary["eBayAuthToken"]!)</eBayAuthToken>" +
|
||||
"</RequesterCredentials>"
|
||||
soapMessage = soapMessage + "<ErrorLanguage>en_US</ErrorLanguage>" +
|
||||
"<WarningLevel>High</WarningLevel></RevokeTokenRequest>"
|
||||
|
||||
let url = NSURL(string: self.baseURL)
|
||||
let theRequest = NSMutableURLRequest(URL: url!)
|
||||
@ -304,7 +308,7 @@ extension EbayWebServiceManager {
|
||||
let url = NSURL(string: self.baseURL)
|
||||
let theRequest = NSMutableURLRequest(URL: url!)
|
||||
theRequest.addValue("FetchToken", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
|
||||
|
||||
//dispatch_group_enter(self.requestGroup)
|
||||
self.requestMaker(soapMessage, theRequest: theRequest)
|
||||
}
|
||||
|
||||
@ -426,6 +430,7 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
|
||||
print("account credentials saved")
|
||||
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "ebayAuthorized")
|
||||
self.isAuthorized = true
|
||||
//self.completion(nil, nil)
|
||||
|
||||
//Test authentication
|
||||
let soapmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
@ -487,7 +492,7 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
|
||||
let url = NSURL(string: self.baseURL)
|
||||
let theRequest = NSMutableURLRequest(URL: url!)
|
||||
theRequest.addValue("GetCategories", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
|
||||
|
||||
self.completion(nil, nil)
|
||||
self.requestMaker(soapmessage, theRequest: theRequest)
|
||||
break
|
||||
/*
|
||||
|
||||
@ -33,6 +33,8 @@ class NetworksTableViewController: UIViewController {
|
||||
private var firManager: FirebaseManager! = nil
|
||||
private var etsyManager: EtsyRESTAPIManager! = nil
|
||||
private var ebayManager: EbayWebServiceManager! = EbayWebServiceManager()
|
||||
private var shouldShowDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false]
|
||||
private var networkOrderSelection: [String] = []
|
||||
|
||||
|
||||
|
||||
@ -71,6 +73,23 @@ class NetworksTableViewController: UIViewController {
|
||||
self.networkToggleOrSelect = bool
|
||||
}
|
||||
|
||||
func toggleMarketPlaceVisibitlity (market: String) {
|
||||
self.shouldShowDictionary[market] = !self.shouldShowDictionary[market]!
|
||||
}
|
||||
|
||||
private func checkVisibility () -> String? {
|
||||
var string = ""
|
||||
for (market, visibility) in self.shouldShowDictionary {
|
||||
if visibility {
|
||||
self.shouldShowDictionary[market] = !self.shouldShowDictionary[market]!
|
||||
string = market
|
||||
self.networkOrderSelection.append(market)
|
||||
break
|
||||
}
|
||||
}
|
||||
return string
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
if(!networkToggleOrSelect) {
|
||||
@ -129,8 +148,20 @@ extension NetworksTableViewController: UITableViewDataSource {
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
// #warning Incomplete implementation, return the number of rows
|
||||
return 4
|
||||
if(self.networkToggleOrSelect) {
|
||||
var count = 0
|
||||
// #warning Incomplete implementation, return the number of rows
|
||||
for (_, visibility) in self.shouldShowDictionary {
|
||||
if visibility {
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
else {
|
||||
return 4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -142,7 +173,27 @@ extension NetworksTableViewController: UITableViewDataSource {
|
||||
//may hide future networks that don't apply to a listing
|
||||
if(self.networkToggleOrSelect){
|
||||
|
||||
switch (indexPath.row){
|
||||
let market = self.checkVisibility()!
|
||||
switch (market) {
|
||||
case "facebook":
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell)
|
||||
break
|
||||
case "ebay":
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("ebay", forIndexPath: indexPath) as! EbayTableViewCell)
|
||||
break
|
||||
case "etsy":
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("etsy", forIndexPath: indexPath) as! EtsyTableViewCell)
|
||||
break
|
||||
case "amazon":
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("amazon", forIndexPath: indexPath) as! AmazonTableViewCell)
|
||||
break
|
||||
default:
|
||||
cell = UITableViewCell()
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
/*switch (indexPath.row){
|
||||
|
||||
case 0:
|
||||
|
||||
@ -162,7 +213,7 @@ extension NetworksTableViewController: UITableViewDataSource {
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell)
|
||||
|
||||
break
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
else{
|
||||
@ -353,8 +404,8 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
//case where class is being used in new item posting workflow to select which network to sell on
|
||||
if(self.networkToggleOrSelect){
|
||||
|
||||
switch (indexPath.row){
|
||||
case 0:
|
||||
switch (self.networkOrderSelection[indexPath.row]){
|
||||
case "ebay":
|
||||
let cell: EbayTableViewCell!
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("ebay", forIndexPath: indexPath) as! EbayTableViewCell)
|
||||
cell.setSelected(false, animated: false)
|
||||
@ -383,7 +434,7 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
}
|
||||
|
||||
break
|
||||
case 1:
|
||||
case "amazon":
|
||||
let cell: AmazonTableViewCell!
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("amazon", forIndexPath: indexPath) as! AmazonTableViewCell)
|
||||
cell.setSelected(false, animated: false)
|
||||
@ -413,7 +464,7 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
break
|
||||
|
||||
|
||||
case 2:
|
||||
case "etsy":
|
||||
let cell: EtsyTableViewCell!
|
||||
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("etsy", forIndexPath: indexPath) as! EtsyTableViewCell)
|
||||
@ -451,7 +502,7 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
|
||||
break
|
||||
|
||||
default:
|
||||
case "facebook":
|
||||
|
||||
let cell: FBTableViewCell!
|
||||
|
||||
@ -477,16 +528,9 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
//code to select network
|
||||
self.networksDictionary["facebook"] = true
|
||||
|
||||
//this is the type of code desired to access the REST management classes
|
||||
/*
|
||||
let tabBar = self.tabBarController
|
||||
(tabBar as? HomeViewController)?.fbGraphManager.authorizeApp(self)
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
@ -682,10 +726,19 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
extension NetworksTableViewController: EbayWebServiceManagerDelegate {
|
||||
|
||||
func signInUser(signInString : String!) {
|
||||
let myWebView:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
|
||||
let mywebViewController = UIViewController()
|
||||
|
||||
//let myWebView:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
|
||||
let myWebView = UIWebView(frame: mywebViewController.view.bounds)
|
||||
myWebView.delegate = self
|
||||
myWebView.loadRequest(NSURLRequest(URL: NSURL(string: signInString)!))
|
||||
self.view.addSubview(myWebView)
|
||||
mywebViewController.view = myWebView
|
||||
|
||||
let navController = UINavigationController(rootViewController: mywebViewController)
|
||||
mywebViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: Selector("dismiss"))
|
||||
|
||||
self.presentViewController(navController, animated: true, completion: nil)
|
||||
//self.view.addSubview(myWebView)
|
||||
}
|
||||
|
||||
}
|
||||
@ -712,24 +765,15 @@ extension NetworksTableViewController: UIWebViewDelegate {
|
||||
NSLog("Oauth successful")
|
||||
((self.tabBarController as? HomeViewController)?.ebayGraphManager)!.fetchToken()
|
||||
}
|
||||
|
||||
/*var data : NSData? = NSData(contentsOfURL: NSURL(string: responseString as! String)!)!
|
||||
if (data != nil){
|
||||
let jsonObject: AnyObject?
|
||||
do {
|
||||
try jsonObject = NSJSONSerialization.JSONObjectWithData(data!, options: .MutableLeaves)
|
||||
print(jsonObject)
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NetworksTableViewController {
|
||||
@ -741,12 +785,16 @@ extension NetworksTableViewController {
|
||||
switch (sender.superview?.superview?.classForCoder){
|
||||
case is EbayTableViewCell.Type:
|
||||
let tabBar = self.tabBarController
|
||||
((tabBar as? HomeViewController)?.ebayGraphManager.authorizeApp())!
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
sender.setTitle("Logout", forState: UIControlState.Normal)
|
||||
(sender.superview?.superview as! EbayTableViewCell).settingsBtn.enabled = true
|
||||
(sender.superview?.superview as! EbayTableViewCell).settingsBtn.hidden = false
|
||||
})
|
||||
((tabBar as? HomeViewController)?.ebayGraphManager.authorizeApp({
|
||||
something,_ -> Void in
|
||||
// // //
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
sender.setTitle("Logout", forState: UIControlState.Normal)
|
||||
(sender.superview?.superview as! EbayTableViewCell).settingsBtn.enabled = true
|
||||
(sender.superview?.superview as! EbayTableViewCell).settingsBtn.hidden = false
|
||||
})
|
||||
}))!
|
||||
|
||||
break
|
||||
case is AmazonTableViewCell.Type:
|
||||
break
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user