From f5b3ab295594925d62ca824f32a3c05ce26e05c8 Mon Sep 17 00:00:00 2001 From: Okechi Onyeje Date: Tue, 29 Nov 2016 19:02:06 -0500 Subject: [PATCH] all comments made as well as alerts added --- .../UserInterfaceState.xcuserstate | Bin 37597 -> 36924 bytes .../xcdebugger/Breakpoints_v2.xcbkptlist | 1333 +---------------- Vendoo/AppDelegate.swift | 4 + Vendoo/CategoriesTableViewController.swift | 451 +----- Vendoo/CategoryPopUpController.swift | 1 - Vendoo/EbaySettingsViewController.swift | 1 + Vendoo/EbayWebServiceManager.swift | 80 +- Vendoo/EtsyRESTAPIManager.swift | 131 +- Vendoo/EtsySettingsViewController.swift | 1 + Vendoo/FacebookGraphAPIManager.swift | 8 +- Vendoo/FirebaseManager.swift | 6 +- Vendoo/HomeViewController.swift | 92 +- Vendoo/ListingPreviewViewController.swift | 137 +- Vendoo/MenuPanelViewController.swift | 52 +- Vendoo/NetworksTableViewController.swift | 245 +-- Vendoo/NotificationsViewController.swift | 8 + Vendoo/RecoverPasswordViewController.swift | 2 +- Vendoo/ServiceNotificationManager.swift | 28 +- Vendoo/SettingsViewController.swift | 13 +- Vendoo/SignInViewController.swift | 110 +- Vendoo/SignUpViewController.swift | 50 +- 21 files changed, 317 insertions(+), 2436 deletions(-) diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate index 2e5e7bbd367b12b27ad51ca9432806c26f5295d3..80dd903ba7a9a29cbd22fc76edc526051730460f 100644 GIT binary patch delta 18666 zcma)i2Xqrh*S2<6Tje4f3AWaC6M%|Fm!Svn< zgpyD~LP9Sg^j<=T0D(Xt-$w1*d*+0>>F%4HUpc3bz%#!h1gPT8MX>rjjhKvVBcYzvG1`TuwB@X z*dFW`Y(I7YJAxg>e#cH=XRx!_MI&|zyM|rIZeh2v``82QG4>bs4113K3wVGJ2*3aq z*a3Uc1#|_@pa%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k>&DWZ5>YML0-)sK9`G@9LEkq05B51K_v2N+#GO%TE%g`3@7QYr@i?~JFB5O%$ zQMXjKG`8qlrnF3Nnbq=M%Yv4LElXOKw{*6wY1!7Yt7T8i{+7cnM_Z1!oNT$+a=Ybm z%afL8EiYPrZTY>GYGqr^Tdi9Awc57YwfeNmS`%7xS{qvR<6B|tq}HjeGg@c0E^J-W zy1cckbye${)@`jjTX(naZ9UL>u=RB7xz>xVms_v3-e`T;`ndH;>$BDut*_dMHo8sF zX3=Kd*00UA&7;k;&8y9~&A%uTWi~t zwoPpZ+P-f4vF)|K?GGKMstxi_)QTSC^s7)Me>%bfvlq zU6rmzSFdZ-b?7GOChMl@X6k0^7U`Djx^$~_>vbD-TXdi5zR;c0UDJJ|yQ90O`$6}k z?y2rsJJ!y&4{UdAcWHNTAKLES?$;jB9@U=Ep3@#Oy1lTyq`jiOy1ll&zI}fCmJYj) c(2k^z^p0H9$1*$sdj1MN>G|9HyCeVq0Uu^(+W-In diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 5371c7f..1e4358b 100644 --- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -3,580 +3,6 @@ type = "0" version = "2.0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -600,11 +26,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Vendoo/ItemTableViewController.swift" - timestampString = "502118113.759358" + timestampString = "502130607.978907" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "232" - endingLineNumber = "232" + startingLineNumber = "253" + endingLineNumber = "253" landmarkName = "tableView(_:cellForRowAtIndexPath:)" landmarkType = "5"> @@ -616,23 +42,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Vendoo/ItemTableViewController.swift" - timestampString = "502118113.759358" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "237" - endingLineNumber = "237" - landmarkName = "tableView(_:cellForRowAtIndexPath:)" - landmarkType = "5"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Vendoo/AppDelegate.swift b/Vendoo/AppDelegate.swift index a38a8a6..3db7e02 100644 --- a/Vendoo/AppDelegate.swift +++ b/Vendoo/AppDelegate.swift @@ -28,6 +28,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let storyboard = UIStoryboard(name: "Main", bundle: nil) let view: UIViewController! + + //based on if there is a currently logged in user, the entry view controller will either be signin or sign up if NSUserDefaults.standardUserDefaults().boolForKey("signedIn"){ view = storyboard.instantiateViewControllerWithIdentifier("SignInViewController") }else { @@ -73,6 +75,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { extension AppDelegate { func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { + + //set up oauth for use with etsy if (url.host == "oauth-callback") { print(url) let components = NSURLComponents(URL: url, resolvingAgainstBaseURL: false) diff --git a/Vendoo/CategoriesTableViewController.swift b/Vendoo/CategoriesTableViewController.swift index 50f38d9..38873c8 100644 --- a/Vendoo/CategoriesTableViewController.swift +++ b/Vendoo/CategoriesTableViewController.swift @@ -136,415 +136,6 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa 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 - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Antiques") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Art") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Baby") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Bags & Purses") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Bath, Beauty & Health") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Books") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Business & Industrial") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Cameras & Photo") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Candles") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Cell Phones & Accessories") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Clothing & Shoes") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Ceramics & Pottery") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Children") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Coins & Paper Money") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Collectibles") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Computers/Tablets & Networking") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Consumer Electronics") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Crafts") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Dolls & Miniatures") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("DVDs & Movies") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Entertainment Memorabilia") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Everything Else") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Furniture") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Gift Cards & Coupons") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Geekery") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Glass") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Holidays") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Home/Houseware & Garden") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Jewelry & Watches") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Knitting") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Music") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Musical Instruments & Gear") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Needlecraft") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Paper Goods") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Patterns") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Pet Supplies") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Pottery & Glass") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Plants and Edibles") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Quilts") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Real Estate") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Specialty Services") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Sporting Goods") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Sports Memorabilia & Fan Shop") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Stamps") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Supplies") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Tickets & Experiences") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Toys & Hobbies") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Travel") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Video Games & Consoles") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //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 = false //ebay - //ask to drill into ebay categories - cell.shouldAskAboutLeafCategories = true - break - case ("Vintage") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Wedding") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - case ("Woodworking") : - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = false //facebook - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = false //etsy - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true //amazon - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true //ebay - break - default: - break - }*/ - - /*//ebay - if(true){ - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true - } - //amazon - if(true){ - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true - } - //etsy - if(false){ - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true - - } - //facebook - if(false){ - cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true - }*/ - }) @@ -567,6 +158,8 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa popover!.sourceRect = CGRectMake(100,100,50,50) popoverContent.setManagers(self.ebayManager) + + //dynamically loads ebay categories until leaf category is reached popoverContent.loadCategories(self.selectedCategory, selectedCatCompletion: { (categoryID, error) -> Void in self.selectedSub = categoryID as! String @@ -696,11 +289,13 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa let cell: CategoryCell! = tableView.cellForRowAtIndexPath(indexPath) as! CategoryCell//tableView.dequeueReusableCellWithIdentifier("CategoryCell", forIndexPath: indexPath) as? CategoryCell if(self.ebayManager.isAuthorized ) { + + //checks if the selected category is a leaf, if it is then go to choose networks else dynamically load child categories var dict: Dictionary> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary> let catDict = dict[self.selectedCategory] if (catDict != nil && !(catDict!["isLeaf"] as! Bool)){ - self.potentialEbay = true + self.potentialEbay = true //determines whether ebay should be an option for posting self.navigateCategories() } else{ @@ -712,41 +307,6 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa } } - /* - // Override to support conditional editing of the table view. - override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the specified item to be editable. - return true - } - */ - - /* - // Override to support editing the table view. - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - if editingStyle == .Delete { - // Delete the row from the data source - tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - } else if editingStyle == .Insert { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } - } - */ - - /* - // Override to support rearranging the table view. - override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) { - - } - */ - - /* - // Override to support conditional rearranging of the table view. - override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the item to be re-orderable. - return true - } - */ - // MARK: - Navigation @@ -777,7 +337,6 @@ class CategoriesTableViewController: UIViewController, UITableViewDelegate, UITa if self.potentialAmazon { (segue.destinationViewController as! NetworksTableViewController).toggleMarketPlaceVisibitlity("amazon") } - //print(self.categoryPicker.selectedRowInComponent(0)) } } diff --git a/Vendoo/CategoryPopUpController.swift b/Vendoo/CategoryPopUpController.swift index 8e85e20..a59cb5e 100644 --- a/Vendoo/CategoryPopUpController.swift +++ b/Vendoo/CategoryPopUpController.swift @@ -36,7 +36,6 @@ class CategoryPopUpController: UIViewController { self.ebayManager = ebayManager } - //@FIXME: Fix category selection for retrieving categories id values, hybrid categories don't work with this and have to manually add these func loadCategories( selectedCategory: String, selectedCatCompletion: ServiceResponse?) { self.parentCategory.append(selectedCategory) var catCode: String! diff --git a/Vendoo/EbaySettingsViewController.swift b/Vendoo/EbaySettingsViewController.swift index c916219..ed677dc 100644 --- a/Vendoo/EbaySettingsViewController.swift +++ b/Vendoo/EbaySettingsViewController.swift @@ -89,6 +89,7 @@ extension EbaySettingsViewController { } + //@TODO options for switching default settings for ebay listing will be added during beta testing after user input phase @IBAction func selectListingType(sender: AnyObject) { } diff --git a/Vendoo/EbayWebServiceManager.swift b/Vendoo/EbayWebServiceManager.swift index 50c9d87..5ea221c 100644 --- a/Vendoo/EbayWebServiceManager.swift +++ b/Vendoo/EbayWebServiceManager.swift @@ -21,9 +21,13 @@ class EbayWebServiceManager: NSObject { //----------------------------------------------// let baseURL = "https://api.sandbox.ebay.com/ws/api.dll" + //api credentials for app private var apiKey: String! private var devKey: String! private var certID: String! + var isAuthorized: Bool = NSUserDefaults.standardUserDefaults().boolForKey("ebayAuthorized") + + //request variables private var mutableData: NSMutableData = NSMutableData() private var currentElementName:NSString = "" private var catID: NSString! @@ -33,8 +37,9 @@ class EbayWebServiceManager: NSObject { private var userEmail:String = (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)! private var signinURL: String! private var xmlResponseDictionary: Dictionary = Dictionary() + + //class variables var delegate: EbayWebServiceManagerDelegate? - var isAuthorized: Bool = NSUserDefaults.standardUserDefaults().boolForKey("ebayAuthorized") static var settingsDictionary = Dictionary() private var subCategories = Dictionary>() private var completion: ServiceResponse! @@ -107,6 +112,7 @@ class EbayWebServiceManager: NSObject { //MARK: - authentication methods extension EbayWebServiceManager { + //used to set up all xml requests when making calls to ebay service private func requestMaker(soapMessage: String!, theRequest: NSMutableURLRequest!) { let msgLength = soapMessage.characters.count theRequest.addValue("text/xml", forHTTPHeaderField: "Content-Type") @@ -118,6 +124,8 @@ extension EbayWebServiceManager { theRequest.addValue("0", forHTTPHeaderField: "X-EBAY-API-SITEID") theRequest.addValue("", forHTTPHeaderField: "SOAPAction") theRequest.HTTPMethod = "POST" + + //adds xml soap message to request before starting call theRequest.HTTPBody = soapMessage.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) // or false let connection = NSURLConnection(request: theRequest, delegate: self, startImmediately: true) connection!.start() @@ -127,6 +135,7 @@ extension EbayWebServiceManager { } } + //authorize ebay for use with app by first getting a sessionID func authorizeApp(onComplete: ServiceResponse){ let soapMessage = "" + @@ -143,8 +152,8 @@ extension EbayWebServiceManager { } + func deauthorizeApp(){ - //@TODO: Add an alert to let user know if their account has not been deauthorized and keep them logged in. var soapMessage = "" + "" + "" + @@ -176,6 +185,7 @@ extension EbayWebServiceManager { } } + //used to retrieve users paypal email private func getPaypalEmail(onCompletion: ServiceResponse){ var soapMessage = "" + "" + @@ -214,35 +224,10 @@ extension EbayWebServiceManager { self.requestMaker(soapMessage, theRequest: theRequest) } + //used to add images to listing posting request before actually posting func addImagesToListing(listingID: String, imageURLs: [String], listingOnCompletion: ServiceResponse, body: [String:String],onCompletion: ServiceResponse) { listItem(body, imageUrls: imageURLs, completion: listingOnCompletion) - /* - var soapMessage = "" + - "" + - "" + - "\(self.xmlResponseDictionary["eBayAuthToken"] as! String)" + - "" - - soapMessage = soapMessage + "en_US" + - "" + - "\(listingID)" - - for i in 0...(imageURLs.count - 1) { - soapMessage = soapMessage + "" + - "\(imageURLs[i].stringByReplacingOccurrencesOfString("&", withString: "&"))" + - "" - } - - - soapMessage = soapMessage + "" - - let url = NSURL(string: self.baseURL) - let theRequest = NSMutableURLRequest(URL: url!) - theRequest.addValue("ReviseItem", forHTTPHeaderField: "X-EBAY-API-CALL-NAME") - self.completion = onCompletion - self.requestMaker(soapMessage, theRequest: theRequest) - */ } func listItem(params: [String: String], imageUrls: [String], completion: ServiceResponse?){ @@ -254,6 +239,7 @@ extension EbayWebServiceManager { "\(self.xmlResponseDictionary["eBayAuthToken"] as! String)" + "" + //if paypal email not in local cache retrieve it before continuing to post to ebay if((dict["payment"] as? String) == "PayPal") { dispatch_group_enter(emailRetrievalGroup) if((EbayWebServiceManager.settingsDictionary["paypal_email"]) == nil) { @@ -284,7 +270,8 @@ extension EbayWebServiceManager { "\(dict["payment"] as! String!)" + "\(dict["paypal_email"] as! String!)Gallery" - for i in 0...(imageUrls.count - 1) { //will replace with actual count once everything is working with images + //append image urls to listing request + for i in 0...(imageUrls.count - 1) { soapMessage = soapMessage + "\(imageUrls[i].stringByReplacingOccurrencesOfString("&", withString: "&"))" @@ -307,6 +294,8 @@ extension EbayWebServiceManager { "US" + "" print(soapMessage) + + //make request let url = NSURL(string: self.baseURL) let theRequest = NSMutableURLRequest(URL: url!) theRequest.addValue("AddItem", forHTTPHeaderField: "X-EBAY-API-CALL-NAME") @@ -317,6 +306,7 @@ extension EbayWebServiceManager { } } + //after getting a sessionID get a unique oauth token func fetchToken() { let soapMessage = "" + "\(self.xmlResponseDictionary["SessionID"] as! String!)" @@ -328,10 +318,11 @@ extension EbayWebServiceManager { self.requestMaker(soapMessage, theRequest: theRequest) } + //used to get sub categories when creating a new listing func getSubCategories(selectedCategory: String, detailLevel: Int, catCode: String, onCompletion: ServiceResponse) { self.isGettingNotification = false self.isGettingSubCategories = true - //var dict = EbayWebServiceManager.settingsDictionary["categories"]! + var soapMessage = "" + "" + "" + @@ -350,6 +341,7 @@ extension EbayWebServiceManager { self.requestMaker(soapMessage, theRequest: theRequest) } + //used for notifications to retrieve current information about the status of a listing func getListingInfo(listingID: String, onComplete: ServiceResponse?){ var soapMessage = "" + "" + @@ -405,6 +397,7 @@ extension EbayWebServiceManager: NSURLConnectionDelegate { } } +//used to parse xml responses and save data extension EbayWebServiceManager: NSXMLParserDelegate { func parser(parser: NSXMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) { @@ -454,23 +447,6 @@ extension EbayWebServiceManager: NSXMLParserDelegate { "\(string)" + "" - /* - * - - - boolean - ItemIDType (string) - string - - DetailLevelCodeType - - string - string - string - WarningLevelCodeType - - */ - let url = NSURL(string: self.baseURL) let theRequest = NSMutableURLRequest(URL: url!) theRequest.addValue("GetUser", forHTTPHeaderField: "X-EBAY-API-CALL-NAME") @@ -487,6 +463,7 @@ extension EbayWebServiceManager: NSXMLParserDelegate { } break + //saves paypal email from response case "DefaultPayPalEmailAddress": var dict = (EbayWebServiceManager.settingsDictionary) dict["paypal_email"] = string @@ -494,6 +471,8 @@ extension EbayWebServiceManager: NSXMLParserDelegate { NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings") self.completion(nil, nil) break + + //saves userID from response and gets toplevel ebay categories case "UserID" : if(!self.isGettingNotification) { print(string) @@ -545,12 +524,6 @@ extension EbayWebServiceManager: NSXMLParserDelegate { self.currentCategory = string } - /* var dict: Dictionary> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary> - - dict[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel] - EbayWebServiceManager.settingsDictionary["categories"] = dict - NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings")*/ - } @@ -564,7 +537,6 @@ extension EbayWebServiceManager: NSXMLParserDelegate { dict[self.currentCategory]!["isLeaf"] = true } else { - //@FIXME: breaking here retrieveing subcategories if (self.catDetailLevel == Int((self.subCategories[self.currentCategory]!["level"] as! String))) { self.subCategories[self.currentCategory]!["isLeaf"] = true diff --git a/Vendoo/EtsyRESTAPIManager.swift b/Vendoo/EtsyRESTAPIManager.swift index 77dcb8c..fcf0221 100644 --- a/Vendoo/EtsyRESTAPIManager.swift +++ b/Vendoo/EtsyRESTAPIManager.swift @@ -37,7 +37,6 @@ class EtsyRESTAPIManager: NSObject { //User specific class variables private var etsyUser: String! private var oauthswift: OAuth1Swift! - //private let oauthswift = OAuth1Swift(parameters: ["consumerKey":"snbs78qkfy3yqq6yhe6yv49b","consumerSecret":"4sbva4oqb6", "requestTokenUrl": "https://openapi.etsy.com/v2/oauth/request_token?scope=listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w%20"]) override init(){ super.init() @@ -61,7 +60,8 @@ class EtsyRESTAPIManager: NSObject { self.oauthswift.client.credential.oauth_token = (oauthDictionary?["token"] as? String!)! self.oauthswift.client.credential.oauth_token_secret = (oauthDictionary?["secret"] as? String!)! - self.sendGETRequest("/taxonomy/categories", /*body: ["oauth_token":(oauthDictionary?["token"] as? String!)!],*/ onCompletion: { + //used to get all etsy categories if user is authorized + self.sendGETRequest("/taxonomy/categories", onCompletion: { (dict, error) -> Void in var resultDictionary = Dictionary() @@ -75,6 +75,7 @@ class EtsyRESTAPIManager: NSObject { }) } + //sets up posting defaults when posting to etsy if(NSUserDefaults.standardUserDefaults().boolForKey("etsyDefaultsOverriden")) { EtsyRESTAPIManager.settingsDictionary = (NSUserDefaults.standardUserDefaults().objectForKey("etsySettings") as? Dictionary)! @@ -115,20 +116,7 @@ extension EtsyRESTAPIManager { oauthswift!.authorize_url_handler = SafariURLHandler(viewController: viewcontroller) - /* - let authRequest = self.oauthswift.client.makeRequest("https://openapi.etsy.com/v2/oauth/request_token?", method: OAuthSwiftHTTPRequest.Method.GET, parameters: ["scope":"listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w"] , headers: nil) - - do{ - - try authRequest?.makeRequest() - - - }catch{ - (error) - } - */ - - /*["scope":"listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w"]*/ + //start oauth handshake self.oauthswift!.client.get("https://openapi.etsy.com/v2/oauth/request_token?scope=listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w", success: { data, response in @@ -136,9 +124,6 @@ extension EtsyRESTAPIManager { let dataString = NSString(data: data, encoding: NSUTF8StringEncoding) - - //print(response.allHeaderFields) - //print(dataSting) let json = JSON(data) print(json) print(dataString) @@ -147,8 +132,6 @@ extension EtsyRESTAPIManager { self.oauthswift!.authorizeWithCallbackURL( NSURL(string: "vendoo://oauth-callback/etsy")!, success: { credential, response, parameters in - print(credential.oauth_token) - print(credential.oauth_token_secret) print(response) boolResult = false @@ -165,7 +148,7 @@ extension EtsyRESTAPIManager { //save data to keychain - + //sign oauth token with verifier self.oauthswift!.client.get("https://openapi.etsy.com/v2/oauth/access_token", parameters: ["oauth_verifier":(self.oauthswift.client.credential.oauth_verifier)], success: { data, response in @@ -175,8 +158,7 @@ extension EtsyRESTAPIManager { print(response) let json1 = JSON(response) print(json1) - //print(response.allHeaderFields) - //print(dataSting) + let json = JSON(data) print(json) print(dataString!) @@ -197,7 +179,7 @@ extension EtsyRESTAPIManager { } print(matches) - + //save oauth credentials for current user let oauth: Dictionary? = [ "token" : String(matches[1].characters.dropFirst()) , "secret" : String(matches[3].characters.dropFirst()) ] do{ @@ -210,6 +192,9 @@ extension EtsyRESTAPIManager { self.oauthswift.client.credential.oauth_token = oauth!["token"]! as! String self.oauthswift.client.credential.oauth_token_secret = oauth!["secret"]! as! String + // get required credentials from users account to allow posting of new listings + + //get user name self.oauthswift!.client.get("https://openapi.etsy.com/v2/users/__SELF__", success: { data, response in @@ -227,12 +212,14 @@ extension EtsyRESTAPIManager { onComplete(nil,nil) + //get users payment template if one exists, if not create one for user self.sendGETRequest("/private/shops/__SELF__/payment_templates", onCompletion: { (data, error) -> Void in - self.sendGETRequest("/taxonomy/categories", /*body: ["oauth_token":(oauthDictionary?["token"] as? String!)!],*/ onCompletion: { + self.sendGETRequest("/taxonomy/categories", onCompletion: { (dict, error) -> Void in + //save retrieved categories to settings dictionary var resultDictionary = Dictionary() for catDictionary in (dict as! [Dictionary]) { print(catDictionary) @@ -245,7 +232,7 @@ extension EtsyRESTAPIManager { NSUserDefaults.standardUserDefaults().setObject(EtsyRESTAPIManager.settingsDictionary, forKey: "etsySettings") - + //retrieve shipping template if one exists, if not create one self.sendGETRequest("/private/users/__SELF__/shipping/templates", onCompletion: nil) }) @@ -268,19 +255,12 @@ extension EtsyRESTAPIManager { } - /*let results = regex.matchesInString(dataString! as String, - options: [], range: NSMakeRange(0, nsString.length)) - print(results.map { nsString.substringWithRange($0.range)})*/ } catch let error as NSError { print("invalid regex: \(error.localizedDescription)") } - /* - - */ - }, failure: { @@ -289,14 +269,9 @@ extension EtsyRESTAPIManager { }) - //return boolResult - }) }) - //getting error here when trying to retrieve the login url from the response - //var dataDictionary = self.convertStringToDictionary(dataString! as String) - //print(dataDictionary!["login_url"]) } , failure: { error in print(error) @@ -308,27 +283,12 @@ extension EtsyRESTAPIManager { } - - - - - - - - //once everything is authorized save true value to the authorization boolean - /* - NSUserDefaults.standardUserDefaults().setBool(true, forKey: "etsyAuthorized") - self.isAuthorized = NSUserDefaults.standardUserDefaults().boolForKey("etsyAuthorized") - */ } func deAuthorizeApp(viewcontroller: UIViewController){ - - - oauthswift!.authorize_url_handler = SafariURLHandler(viewController: viewcontroller) oauthswift!.client.get("https://openapi.etsy.com/v2/oauth/request_token?scope=listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w", success: { @@ -337,12 +297,6 @@ extension EtsyRESTAPIManager { print(dataString!) print(response) - - - - //getting error here when trying to retrieve the login url from the response - //var dataDictionary = self.convertStringToDictionary(dataString! as String) - //print(dataDictionary!["login_url"]) } , failure: { error in print(error) @@ -409,7 +363,7 @@ extension EtsyRESTAPIManager { //MARK: - Request Methods extension EtsyRESTAPIManager { - + //the following functions are attempts to get image upload working for etsy func sendFile( urlPath:String, fileName:String, @@ -442,10 +396,7 @@ extension EtsyRESTAPIManager { queue: queue, completionHandler:completionHandler) } - - // this is a very verbose version of that function - // you can shorten it, but i left it as-is for clarity - // and as an example + func photoDataToFormData(data:NSData,boundary:String,fileName:String) -> NSData { var fullData = NSMutableData() @@ -486,42 +437,8 @@ extension EtsyRESTAPIManager { return fullData } - func generateUserRequest(etsyName: String!, etsyOptions: [String]!) -> String { - - //starting url for user request to api - var userRequest: String! - - if(etsyName == nil || etsyName == ""){ - userRequest = (baseURL + "/private/users/etsystore?") - } - else{ - userRequest = (baseURL + "/private/users/" + etsyName + "?") - } - - //final api request - return userRequest + "api_key=" + self.apiKey - } - - func generateListingRequest(etsyListing: String!){ - - //starting url for listing request - } - //sends the pregenerated url as a request to api service func sendGETRequest(request: String, onCompletion: ServiceResponse?) { - /* let request = NSMutableURLRequest(URL: NSURL(string: request)!) - - let session = NSURLSession.sharedSession() - - let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in - if let jsonData = data { - let json:JSON = JSON(data: jsonData) - onCompletion(json, error) - } else { - onCompletion(nil, error) - } - }) - task.resume()*/ self.oauthswift.client.get(self.baseURL + request, success: { @@ -534,6 +451,7 @@ extension EtsyRESTAPIManager { switch (request) { case "/private/shops/__SELF__/payment_templates" : + //create a payment template if none is found if ((dict!["results"]!.isKindOfClass(NSNull.classForCoder()))) { //@TODO: Put payment template parameters in function call self.oauthswift.client.post(self.baseURL + "/private/shops/__SELF__/payment_templates", @@ -560,11 +478,13 @@ extension EtsyRESTAPIManager { onCompletion!(nil,nil) } break + case "/private/users/__SELF__/shipping/templates" : var dict2 = (dict!["results"] as! [[String : AnyObject]]) if ((dict!["results"]!.isKindOfClass(NSNull.classForCoder()))) { - //@TODO: Put payment template parameters in function call + + //create default shipping template if none found self.oauthswift.client.post(self.baseURL + "/private/shipping/templates", parameters: [ "title":"vendoo_default", @@ -593,6 +513,8 @@ extension EtsyRESTAPIManager { } break + + //gets etsy categories case "/taxonomy/categories": var dict2 = (dict!["results"] as! [[String : AnyObject]]) onCompletion!(dict2, nil) @@ -635,6 +557,8 @@ extension EtsyRESTAPIManager { //sends the pregenerated url as a request to api service func sendPOSTRequest(request: String, var body: [String: AnyObject]?, onCompletion: ServiceResponse?) { + //attempt to post images to etsy + /* let request = NSMutableURLRequest(URL: NSURL(string: request)!) // Set the method to POST @@ -660,6 +584,7 @@ extension EtsyRESTAPIManager { onCompletion(nil, nil) }*/ + //for posting image to etsy, currently not working if(request.containsString("listings/") && request.containsString("/images")){ let url = NSURL(string: self.baseURL + request)! @@ -680,6 +605,8 @@ extension EtsyRESTAPIManager { } ) + //more attempts to get image uploads to etsy to work :-( + /* let requested = NSMutableURLRequest(URL: url) requested.HTTPMethod = "POST" @@ -814,6 +741,8 @@ extension EtsyRESTAPIManager { case "/private/shipping/templates": break + + //save new listing id from new esty posting case "/private/listings": var dict2 = (dict!["results"] as! [[String : AnyObject]]) print(((dict2[0]["listing_id"])!)) @@ -835,7 +764,6 @@ extension EtsyRESTAPIManager { case "/private/listings": print(error.userInfo["Response-Body"]) if((error.userInfo["Response-Body"]!.isEqualToString("price is below listing fee."))) { - //@TODO: add alert to let user know that the price they have given is too low for etsy } break @@ -857,6 +785,7 @@ extension EtsyRESTAPIManager { //MARK: - JSON Methods extension EtsyRESTAPIManager { + //converts responses from etsy to JSON dictionaries func convertStringToDictionary(text: String) -> [String:AnyObject]? { if let data = text.dataUsingEncoding(NSUTF8StringEncoding) { do { diff --git a/Vendoo/EtsySettingsViewController.swift b/Vendoo/EtsySettingsViewController.swift index 54fb447..848dbf3 100644 --- a/Vendoo/EtsySettingsViewController.swift +++ b/Vendoo/EtsySettingsViewController.swift @@ -8,6 +8,7 @@ import UIKit +/// Used to both display and change options for posting to etsy class EtsySettingsViewController: UIViewController { var wereDefaultsChanged: Bool = NSUserDefaults.standardUserDefaults().boolForKey("etsyDefaultsOverriden") diff --git a/Vendoo/FacebookGraphAPIManager.swift b/Vendoo/FacebookGraphAPIManager.swift index 7cf1a8c..666c029 100644 --- a/Vendoo/FacebookGraphAPIManager.swift +++ b/Vendoo/FacebookGraphAPIManager.swift @@ -18,12 +18,7 @@ protocol FacebookGraphAPIManagerDelegate { func listingUploadedFB(fbID: String) } -/* - NOTE: - I am able to authorize application for use with facebook and deauthorize it while showing the toggle button switching back and forth, but during the last step of the process, for some reason NSUserDefault key for fbauthorized is not being called, in response handler, may need to run in a different thread - - NEED to figure out how to post picture and text as the same timeline post current can only upload item title, price and description. - */ + class FacebookGraphAPIManager: NSObject { //API Manager class variables @@ -52,7 +47,6 @@ class FacebookGraphAPIManager: NSObject { let dictionary = Locksmith.loadDataForUserAccount(self.userEmail, inService: "vendoo") print("account credentials loaded") - //print((NSUserDefaults.standardUserDefaults().objectForKey("") as? FBSDKAccessToken!)) } } diff --git a/Vendoo/FirebaseManager.swift b/Vendoo/FirebaseManager.swift index b1dbc37..17b7253 100644 --- a/Vendoo/FirebaseManager.swift +++ b/Vendoo/FirebaseManager.swift @@ -2,7 +2,6 @@ // FirebaseService.swift // Vendoo // -// This class is responsible for initializing a new user, as well as managing web request to both firebase database and data storage // Created by Okechi Onyeje on 6/2/16. // Copyright © 2016 Okechi Onyeje. All rights reserved. // @@ -13,9 +12,11 @@ import Locksmith import FirebaseStorage import TYMActivityIndicatorView +/// This class is responsible for initializing a new user, as well as managing web request to both firebase database and data storage class FirebaseManager: NSObject { + let ref = FIRDatabase.database().reference() let user_email = ((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!).stringByReplacingOccurrencesOfString(".", withString: "_") let storage = FIRStorage.storage() @@ -27,11 +28,12 @@ class FirebaseManager: NSObject { override init(){ super.init() indicator.color = UIColor.blueColor() + //check if user has been created dispatch_group_enter(self.firGroup) self.ref.child("Users").observeSingleEventOfType(.Value, withBlock: { snapshot in - // do some stuff once + //if user created, setup user's firebase directory for use with app if(!snapshot.hasChild(self.user_email)){ let user = ["name": (NSUserDefaults.standardUserDefaults().objectForKey("name") as? String)!, "user_Listings": "", "listing_Keys": "", "favorite_listings_keys": ""] self.ref.child("Users").child(self.user_email).setValue(user, withCompletionBlock: { diff --git a/Vendoo/HomeViewController.swift b/Vendoo/HomeViewController.swift index d1ff6b7..0c0fb18 100644 --- a/Vendoo/HomeViewController.swift +++ b/Vendoo/HomeViewController.swift @@ -8,24 +8,35 @@ import UIKit +/// This class is resonsible for retrieving all listing information for the current user. +/// Acts as the tab bar controller for entire application. +/// Responsible for retrieving notifications from each currently authorized network + class HomeViewController: UITabBarController { - //acts as RESTful api call manager for etsy - //call this from tabbar controller to use etsy REST calls + + //Web Service Managers let etsyManager: EtsyRESTAPIManager = EtsyRESTAPIManager() let fbGraphManager = FacebookGraphAPIManager() let firebaseManager = FirebaseManager() let ebayGraphManager = EbayWebServiceManager() + + //Retrieved Listing Variables for draft, current, ended, sold var userListings: [Listing] = [] var endedListings: [Listing] = [] var soldListings: [Listing] = [] + + //notification manager variables var notificationsManager = ServiceNotificationManager() var notifications: [Dictionary] = (NSUserDefaults.standardUserDefaults().objectForKey("notifications") == nil ? [] : (NSUserDefaults.standardUserDefaults().objectForKey("notifications") as! [Dictionary])) override func viewDidLoad() { super.viewDidLoad() + + //initialize notifications manager ServiceNotificationManager.delegate = self self.notificationsManager.setManagers(fbGraphManager, fireManager: firebaseManager, ebayManager: ebayGraphManager, etsyManager: etsyManager) + // Do any additional setup after loading the view. dispatch_group_notify(self.firebaseManager.firGroup, dispatch_get_main_queue(), { @@ -37,11 +48,11 @@ class HomeViewController: UITabBarController { let listingDict = userDict!["user_Listings"] as? [String : AnyObject] - //sync notifications + //sync notifications (syncs only the notifications for networks that are currently authorized) if userDict!["notifications"] != nil { self.notifications = [] for (_, v) in userDict!["notifications"] as! [String : AnyObject] { - if v["seen"] as! Bool == false/*add network visibility as well*/{ + if v["seen"] as! Bool == false{ var is_networkAuth = false switch((v["network"] as! String)){ case "ebay": @@ -69,18 +80,23 @@ class HomeViewController: UITabBarController { NSUserDefaults.standardUserDefaults().setObject(userDict!["name"] as? String, forKey: "name") + //check if user has any listings to track for notifications if listingDict != nil { - var notificationStartTracker = 0 + var notificationStartTracker = 0 //number used to indicate when to start retrieving notifications + dispatch_async(dispatch_get_main_queue(), { - //let notificationStartGroup = dispatch_group_create() for (key, values) in listingDict! { + + //use this too make sure all listings are retrieved before showing listings in ItemsTableView let serviceGroup: dispatch_group_t = dispatch_group_create() - //dispatch_group_enter(notificationStartGroup) + self.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in let databaseDict = snapshot.value as! [String : AnyObject] let storageRef = self.firebaseManager.storage.referenceForURL((databaseDict["image_storage"] as? String)!) + + //Get Main image first let mainListingImage = storageRef.child("images/\(key)/main.jpg") @@ -88,14 +104,17 @@ class HomeViewController: UITabBarController { mainListingImage.dataWithMaxSize(10 * 1024 * 1024, completion: { (dataMain, error) -> Void in + //for the case when there are connectivity issues, allows app to continue without waiting if(error != nil){ print("problem retrieving items") notificationStartTracker += 1 }else{ let mainImage = UIImage(data: dataMain!) - var listingImages: [UIImage] = [mainImage!] - var count = 0 + var listingImages: [UIImage] = [mainImage!] //set of all images for this listing + + var count = 0 //indicates when checking of all supporting images are done + //Get supporting images for i in 1...4 { let supportListingImg1 = storageRef.child("images/\(key)/\(i).jpg") @@ -112,21 +131,21 @@ class HomeViewController: UITabBarController { if(count == 4){ dispatch_group_leave(serviceGroup) notificationStartTracker += 1 - //dispatch_group_enter(notificationStartGroup) - //dispatch_group_leave(notificationStartGroup) } }) } - + //once images have been retrieved create a listing object with the reitrieved information dispatch_group_notify(serviceGroup, dispatch_get_main_queue(), { print(listingImages.count) let listingInfo = values as? [String : AnyObject] + //if no Listing status found then the listing is either active or a draft if listingInfo!["listingStatus"] == nil { self.userListings.append( - Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!, + Listing( + itemTitle: (listingInfo!["listingTitle"] as? String)!, itemCategory: listingInfo!["listingCategory"] as? String, itemQuantity: (listingInfo!["listingQuantity"] as? String)!, itemPrice: listingInfo!["listingPrice"] as? String, @@ -137,6 +156,7 @@ class HomeViewController: UITabBarController { networksSellingOn: (listingInfo!["networks"] as? Dictionary)! )) } + //create ended Listing objects else if listingInfo!["listingStatus"] as? String == "Ended" { self.endedListings.append( Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!, @@ -150,6 +170,7 @@ class HomeViewController: UITabBarController { networksSellingOn: (listingInfo!["networks"] as? Dictionary)! )) } + //create sold Listing object else if listingInfo!["listingStatus"] as? String == "Sold" { self.soldListings.append( Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!, @@ -165,16 +186,12 @@ class HomeViewController: UITabBarController { } print(notificationStartTracker) + + //once all listings have been retrieved and processed start retrieving possible notifications if(notificationStartTracker == listingDict?.count){ NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil) self.notificationsManager.setListings(self.userListings) self.notificationsManager.startServicePolling() - /*self.notificationsManager.startServicePolling({ - (_,_) -> Void in - NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil) - - - })*/ } @@ -193,14 +210,7 @@ class HomeViewController: UITabBarController { } - /* - dispatch_group_notify(notificationStartGroup, dispatch_get_main_queue(), { - - })*/ - - - }) }else { NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil) @@ -237,9 +247,10 @@ extension HomeViewController: ServiceNotificationManagerDelegate { } func listingHasStartedRetrievingNotifications() { - + //can be iterated upon to do work when notification retrieval process starts } + //delegate method that is used to add notifications to global notifications set func listingHasEnded(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?) { var notificationArray: [[String: AnyObject]] = self.notifications @@ -269,25 +280,18 @@ extension HomeViewController: ServiceNotificationManagerDelegate { notificationArray.append( notification as! [String : AnyObject] ) + + //Move listing from active to ended on local system self.endedListings.appendContentsOf( self.userListings.filter({$0.key == ((ebayInfo as! [String : AnyObject])["listingKey"] as! String)})) self.userListings = self.userListings.filter({$0.key != ((ebayInfo as! [String : AnyObject])["listingKey"] as! String)}) let itemsView = self.viewControllers![0] as! ItemTableViewController - /*self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(((ebayInfo as! [String : AnyObject])["listingKey"] as! String))").observeSingleEventOfType( .Value, withBlock: { - (snapshot) -> Void in - - var listingDict = snapshot.value as? [String : AnyObject] - listingDict!["listingStatus"] = "Ended" - self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(((ebayInfo as! [String : AnyObject])["listingKey"] as! String))").setValue(listingDict) - - itemsView.itemTable.reloadData() - })*/ - + //Move listing from active to ended and save new notifications to Firebase self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType( .Value, withBlock: { (snapshot) -> Void in var userDict = snapshot.value as? [String : AnyObject] - var notifications = userDict!["notifications"] as? [String: AnyObject] + var notifications = userDict!["notifications"] as? [String: AnyObject] //get the current notifications from firebase if notifications == nil { userDict!["notifications"] = [((ebayInfo as! [String : AnyObject])["listingKey"] as! String):notification] @@ -343,10 +347,13 @@ extension HomeViewController: ServiceNotificationManagerDelegate { notificationArray.append( notification as! [String : AnyObject] ) + + //Move listing from active to ended on local system self.endedListings.appendContentsOf( self.userListings.filter({$0.key == ((etsyInfo as! [String : AnyObject])["listingKey"] as! String)})) self.userListings = self.userListings.filter({$0.key != ((etsyInfo as! [String : AnyObject])["listingKey"] as! String)}) let itemsView = self.viewControllers![0] as! ItemTableViewController + //Move listing from active to ended and save new notifications to Firebase self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType( .Value, withBlock: { (snapshot) -> Void in @@ -356,7 +363,7 @@ extension HomeViewController: ServiceNotificationManagerDelegate { if notifications == nil { userDict!["notifications"] = [((etsyInfo as! [String : AnyObject])["listingKey"] as! String):notification] }else { - notifications![((etsyInfo as! [String : AnyObject])["listingKey"] as! String)] = notification + notifications![((etsyInfo as! [String : AnyObject])["listingKey"] as! String)] = notification //get the current notifications from firebase userDict!["notifications"] = notifications } @@ -383,6 +390,7 @@ extension HomeViewController: ServiceNotificationManagerDelegate { } + //delegate function called mostly by facebook notification when a new comment is posted func listingHasNewNotifications(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?) { var notificationArray: [Dictionary] = self.notifications @@ -395,6 +403,7 @@ extension HomeViewController: ServiceNotificationManagerDelegate { var userDict = snapshot.value as? [String : AnyObject] + //check if there are any notifications currently, if not then create a notifications directory in firebase and append notification to it if (userDict!["notifications"] != nil) { var notificationsFir = userDict!["notifications"] as! [String : AnyObject] notificationsFir[fbInfo!["UUID"] as! String] = fbInfo @@ -408,6 +417,8 @@ extension HomeViewController: ServiceNotificationManagerDelegate { }) }else { + + //if notification directory already exists append existing notification to it let id = (fbInfo!["UUID"] as! String) print(id) userDict!["notifications"] = ([ id : fbInfo as! [String:AnyObject]]) @@ -459,9 +470,6 @@ extension HomeViewController: ServiceNotificationManagerDelegate { ] ) } - - //@TODO: add firbase logic to add notifications and delete already viewed notifications - //reload data for notifications } } diff --git a/Vendoo/ListingPreviewViewController.swift b/Vendoo/ListingPreviewViewController.swift index ab47a80..82e8a7b 100644 --- a/Vendoo/ListingPreviewViewController.swift +++ b/Vendoo/ListingPreviewViewController.swift @@ -222,20 +222,6 @@ extension Dictionary { } } } -/* - //MARK: - FacebookGraphAPIManagerDelegate methods - extension ListingPreviewViewController: FacebookGraphAPIManagerDelegate { - func listingUploadedFB(fbID: String) { - - self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").child(self.lastListingKey).updateChildValues(["network_listing_IDs":["fbID":fbID]]) - - self.alert.title = "Listing Published" - self.alert.message = "Your listing has been published to facebook" - - self.presentViewController(self.alert, animated: true, completion: nil) - } - } - */ //MARK: - IBActions extension ListingPreviewViewController { @@ -273,34 +259,6 @@ extension ListingPreviewViewController { //save listing to private user path in firebase let newListingRef = self.firManager.ref.child("Users").child("\(self.firManager.user_email)").child("user_Listings").childByAutoId() let postingGroup: dispatch_group_t = dispatch_group_create() - - /*if(!(self.networksDictionary["ebay"]!)&&(!(self.networksDictionary["etsy"]!))&&(!(self.networksDictionary["amazon"]!))&&(!(self.networksDictionary["facebook"]!))) { - - }else { - dispatch_g - }*/ - //post to ebay - /*if(self.networksDictionary["ebay"]!){ - dispatch_group_enter(postingGroup) - - let body: [String: String] = [ "title": self.itemTitle.text, - "quantity":self.itemQuantity.text, - "description":self.itemDescription.text, - "price":self.itemPrice.text, - "category_id":self.itemListingDictionary["ebaySubCategoryID"] as! String - ] - - self.ebayManager.listItem(body, completion: { - (listingID, error) -> Void in - if((self.newInProgressListing["networkIDs"] == nil)){ - self.newInProgressListing["networkIDs"] = Dictionary() - } - var networkIDs = (self.newInProgressListing["networkIDs"] as! Dictionary) - networkIDs["ebay"] = listingID as! String - self.newInProgressListing["networkIDs"] = networkIDs - dispatch_group_leave(postingGroup) - }) - }*/ //post to amazon @@ -602,7 +560,6 @@ extension ListingPreviewViewController { //notifies once all selected networks have been posted to dispatch_group_notify(postingGroup, dispatch_get_main_queue(), { - //self.networksDictionary["areNetworksChosen"] = true self.newInProgressListing.update(["listingID": newListingRef.key, "seller email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, "listingTitle": self.itemTitle.text, @@ -649,7 +606,7 @@ extension ListingPreviewViewController { } - //change code to new multi-image saving + //save listing images to firebase for i in 0...(self.itemListingDictionary["pictures"] as! [UIImageView]).count - 1 { switch (i) { @@ -704,23 +661,9 @@ extension ListingPreviewViewController { self.newInProgressListing["networkIDs"] = networkIDs dispatch_group_leave(postingGroup) } - - /*self.ebayManager.listItem(body, completion: { - (listingID, error) -> Void in - if((self.newInProgressListing["networkIDs"] == nil)){ - self.newInProgressListing["networkIDs"] = Dictionary() - } - var networkIDs = (self.newInProgressListing["networkIDs"] as! Dictionary) - networkIDs["ebay"] = listingID as! String - self.newInProgressListing["networkIDs"] = networkIDs - dispatch_group_leave(postingGroup) - })*/ + self.ebayManager.listItem(body, imageUrls: imageURLs, completion: listingCompletion) - //self.ebayManager.addImagesToListing(networkIDs["ebay"] as! String, imageURLs: imageURLs, listingOnCompletion: listingCompletion, body: body, onCompletion: { - //(_, _) -> Void in - //dispatch_group_leave(postingGroup) - //}) - + } else { dispatch_group_leave(postingGroup) @@ -761,35 +704,6 @@ 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 @@ -806,54 +720,11 @@ extension ListingPreviewViewController: UICollectionViewDataSource { return self.selectedNetworks.count } + //used for displaying relevant networks in listing preview func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell: NetworkCollectionViewCell! = self.networks.dequeueReusableCellWithReuseIdentifier("network", forIndexPath: indexPath) as! NetworkCollectionViewCell cell.setImg(selectedNetworks[indexPath.row]) - /*switch (indexPath.row){ - case 0: - cell = collectionView.dequeueReusableCellWithReuseIdentifier("ebay", forIndexPath: indexPath) - - if(self.networksDictionary["ebay"] == false){ - cell.hidden = true - } - else{ - cell.hidden = false - } - break - - case 1: - cell = collectionView.dequeueReusableCellWithReuseIdentifier("amazon", forIndexPath: indexPath) - - if(self.networksDictionary["amazon"] == false){ - cell.hidden = true - } - else{ - cell.hidden = false - } - break - case 2: - cell = collectionView.dequeueReusableCellWithReuseIdentifier("etsy", forIndexPath: indexPath) - - if(self.networksDictionary["etsy"] == false){ - cell.hidden = true - } - else{ - cell.hidden = false - } - break - default: - cell = collectionView.dequeueReusableCellWithReuseIdentifier("facebook", forIndexPath: indexPath) - - if(self.networksDictionary["facebook"] == false){ - cell.hidden = true - } - else{ - cell.hidden = false - } - break - }*/ - return cell } diff --git a/Vendoo/MenuPanelViewController.swift b/Vendoo/MenuPanelViewController.swift index 97a57f2..2de5487 100644 --- a/Vendoo/MenuPanelViewController.swift +++ b/Vendoo/MenuPanelViewController.swift @@ -10,6 +10,7 @@ import UIKit import FirebaseAuth import Locksmith +/// Used to display options for user, help and legal page, the number of notifications for the user has, and logout capability class MenuPanelViewController: UIViewController{ var count = (NSUserDefaults.standardUserDefaults().objectForKey("notifications") == nil ? 0 : (NSUserDefaults.standardUserDefaults().objectForKey("notifications") as! [Dictionary]).count) @@ -46,41 +47,6 @@ class MenuPanelViewController: UIViewController{ extension MenuPanelViewController: UITableViewDelegate { - /* - // Override to support conditional editing of the table view. - override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the specified item to be editable. - return true - } - */ - - /* - // Override to support editing the table view. - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - if editingStyle == .Delete { - // Delete the row from the data source - tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - } else if editingStyle == .Insert { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } - } - */ - - /* - // Override to support rearranging the table view. - override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) { - - } - */ - - /* - // Override to support conditional rearranging of the table view. - override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the item to be re-orderable. - return true - } - */ - } extension MenuPanelViewController: UITableViewDataSource @@ -100,6 +66,8 @@ extension MenuPanelViewController: UITableViewDataSource func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell: UITableViewCell switch(indexPath.row){ + + //display user name and email case 0: cell = (self.table.dequeueReusableCellWithIdentifier("User_Cell", forIndexPath: indexPath) as! UserCell) @@ -107,20 +75,30 @@ extension MenuPanelViewController: UITableViewDataSource (cell as! UserCell).name.text = "Hi " + (NSUserDefaults.standardUserDefaults().objectForKey("name") as? String)! (cell as! UserCell).email.text = (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)! break + + //display notification count case 1: let cellN: Not_TableViewCell! cellN = self.table.dequeueReusableCellWithIdentifier("Notifications_Cell")! as! Not_TableViewCell cellN.count.text = "\(count)" return cellN + + //display settings cell case 2: cell = self.table.dequeueReusableCellWithIdentifier("Settings_Cell")! break + + //display analytics (next iteration) case 3: cell = self.table.dequeueReusableCellWithIdentifier("Sales_Cell")! break + + //display FAQ cell case 4: cell = self.table.dequeueReusableCellWithIdentifier("FAQ_Cell")! break + + //display how to cell default: cell = self.table.dequeueReusableCellWithIdentifier("Getting_Started_Cell")! break @@ -133,6 +111,7 @@ extension MenuPanelViewController: UITableViewDataSource extension MenuPanelViewController{ + //logout user and deauthorize all accounts @IBAction func logoutUser(sender: AnyObject) { do{ @@ -159,7 +138,8 @@ extension MenuPanelViewController{ (error) print(error) } - + + //remove saved information from local cache for key in Array(NSUserDefaults.standardUserDefaults().dictionaryRepresentation().keys) { NSUserDefaults.standardUserDefaults().removeObjectForKey(key) } diff --git a/Vendoo/NetworksTableViewController.swift b/Vendoo/NetworksTableViewController.swift index bff9965..ba7b196 100644 --- a/Vendoo/NetworksTableViewController.swift +++ b/Vendoo/NetworksTableViewController.swift @@ -43,11 +43,6 @@ class NetworksTableViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - // Uncomment the following line to preserve selection between presentations - // self.clearsSelectionOnViewWillAppear = false - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem() self.tableView.delegate = self self.tableView.dataSource = self if(!networkToggleOrSelect){ @@ -259,29 +254,6 @@ extension NetworksTableViewController: UITableViewDataSource { break } - - /*switch (indexPath.row){ - - case 0: - - //loads network cell for ebay - cell = (self.tableView.dequeueReusableCellWithIdentifier("ebay", forIndexPath: indexPath) as! EbayTableViewCell) - break - case 1: - //loads network cell for amazon - cell = (self.tableView.dequeueReusableCellWithIdentifier("amazon", forIndexPath: indexPath) as! AmazonTableViewCell) - break - case 2: - //loads network cell for etsy - cell = (self.tableView.dequeueReusableCellWithIdentifier("etsy", forIndexPath: indexPath) as! EtsyTableViewCell) - break - default: - //loads network cell for facebook - cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell) - - break - }*/ - } else{ @@ -297,7 +269,6 @@ extension NetworksTableViewController: UITableViewDataSource { (cell as! EbayTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) }) - //(cell as! EbayTableViewCell).networkToggle.setOn(true, animated: false) }else{ (cell as! EbayTableViewCell).settingsBtn.enabled = false (cell as! EbayTableViewCell).settingsBtn.hidden = true @@ -317,7 +288,6 @@ extension NetworksTableViewController: UITableViewDataSource { dispatch_async(dispatch_get_main_queue(), { (cell as! EtsyTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) - //(cell as! EtsyTableViewCell).networkToggle.setOn(true, animated: false) }) }else{ @@ -334,7 +304,6 @@ extension NetworksTableViewController: UITableViewDataSource { dispatch_async(dispatch_get_main_queue(), { (cell as! FBTableViewCell).authorizeBtn.setTitle("Logout", forState: UIControlState.Normal) }) - //(cell as! FBTableViewCell).networkToggle.setOn(true, animated: false) }else{ dispatch_async(dispatch_get_main_queue(), { (cell as! FBTableViewCell).settingsBtn.enabled = false @@ -346,11 +315,6 @@ extension NetworksTableViewController: UITableViewDataSource { } } - - - - // Configure the cell (in this case show or hide the cell depending on which network the item is being listed on) - return cell } } @@ -483,7 +447,6 @@ extension NetworksTableViewController: UITableViewDelegate { cell.setSelected(false, animated: false) //selection code for ebay - //print(cell.networkToggle.on) if(cell.networkToggle.on){ @@ -561,15 +524,6 @@ extension NetworksTableViewController: UITableViewDelegate { }) //code to select network self.networksDictionary["etsy"] = true - - - //this is the type of code desired to access the rest management classes - /* - let tabBar = self.tabBarController - (tabBar as? HomeViewController)?.etsyManager.authorizeApp(self) - */ - - } break @@ -609,208 +563,29 @@ extension NetworksTableViewController: UITableViewDelegate { } - else{ - /* - //case where class is being used to authorize a network for the app to post on - switch (indexPath.row){ - case 0: - let cell: EbayTableViewCell! - cell = (self.tableView.dequeueReusableCellWithIdentifier("ebay", forIndexPath: indexPath) as! EbayTableViewCell) - cell.setSelected(false, animated: false) - - /*OAuthorization code for ebay*/ - print(cell.networkToggle.on) - if(((self.tabBarController as? HomeViewController)?.ebayGraphManager.isAuthorized)!){ - //code to deauthorize network - - cell.networkToggle.setOn(false, animated: true) - let tabBar = self.tabBarController - ((tabBar as? HomeViewController)?.ebayGraphManager.deauthorizeApp())! - - cell.networkToggle.on = ((tabBar as? HomeViewController)?.ebayGraphManager.isAuthorized)! - - } - else{ - //code to authorize network - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(true, animated: true) - }) - - let tabBar = self.tabBarController - ((tabBar as? HomeViewController)?.ebayGraphManager.authorizeApp())! - - cell.networkToggle.on = ((tabBar as? HomeViewController)?.ebayGraphManager.isAuthorized)! - } - - break - case 1: - let cell: AmazonTableViewCell! - cell = (self.tableView.dequeueReusableCellWithIdentifier("amazon", forIndexPath: indexPath) as! AmazonTableViewCell) - cell.setSelected(false, animated: false) - - - //OAuthorization code for amazon - if(cell.networkToggle.on == true){ - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(false, animated: true) - }) - //code to deauthorize network - - } - else{ - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(true, animated: true) - }) - //code to authorize network - } - - break - - - case 2: - let cell: EtsyTableViewCell! - - cell = (self.tableView.dequeueReusableCellWithIdentifier("etsy", forIndexPath: indexPath) as! EtsyTableViewCell) - cell.setSelected(false, animated: false) - - - //OAuthorization code for etsy - if(((self.tabBarController as? HomeViewController)?.etsyManager.isAuthorized)!){ - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(false, animated: true) - }) - - //code to deauthorize network - let tabBar = self.tabBarController - - ((tabBar as? HomeViewController)?.etsyManager.deAuthorizeApp(self))! - cell.networkToggle.on = ((tabBar as? HomeViewController)?.etsyManager.isAuthorized)! - } - else{ - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(true, animated: true) - }) - //code to authorize network - - - //this is the type of code desired to access the rest management classes - - let tabBar = self.tabBarController - ((tabBar as? HomeViewController)?.etsyManager.authorizeApp(self))! - - cell.networkToggle.on = ((tabBar as? HomeViewController)?.etsyManager.isAuthorized)! - - - //self.etsyManager.authorizeApp(self) - } - - break - - default: - - let cell: FBTableViewCell! - - cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell) - cell.setSelected(false, animated: false) - - //OAuthorization code for facebook - if((self.tabBarController as? HomeViewController)?.fbGraphManager.isAuthorized)!{ - - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(false, animated: true) - }) - - //code to deauthorize network - let tabBar = self.tabBarController - let didSucceed:Bool = ((tabBar as? HomeViewController)?.fbGraphManager.deAuthorizeApp(self))! - cell.networkToggle.on = !didSucceed - } - else{ - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - cell.networkToggle.setOn(true, animated: true) - }) - //code to authorize network - - //this is the type of code desired to access the rest management classes - - let tabBar = self.tabBarController - let didSucceed: Bool = ((tabBar as? HomeViewController)?.fbGraphManager.authorizeApp(self))! - - cell.networkToggle.on = didSucceed - - - } - - - break - - }*/ - - } + else{} } - - - - /* - // Override to support conditional editing of the table view. - override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the specified item to be editable. - return true - } - */ - - /* - // Override to support editing the table view. - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - if editingStyle == .Delete { - // Delete the row from the data source - tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - } else if editingStyle == .Insert { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } - } - */ - - /* - // Override to support rearranging the table view. - override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) { - - } - */ - - /* - // Override to support conditional rearranging of the table view. - override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool { - // Return false if you do not want the item to be re-orderable. - return true - } - */ } extension NetworksTableViewController: EbayWebServiceManagerDelegate { + //open webview for user to login with ebay func signInUser(signInString : String!) { 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)!)) mywebViewController.view = myWebView let navController = UINavigationController(rootViewController: mywebViewController) + + //selector function to dismiss webview mywebViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: Selector("dismiss")) self.presentViewController(navController, animated: true, completion: nil) - //self.view.addSubview(myWebView) } } @@ -831,7 +606,6 @@ extension NetworksTableViewController: UIWebViewDelegate { print("Webview did finish load") if (webView.request != nil) { - //print(webView.request?.allHTTPHeaderFields) var responseString : NSString? = webView.stringByEvaluatingJavaScriptFromString("document.documentElement.outerHTML")! if((responseString!.containsString("Authorization successfully completed"))){ NSLog("Oauth successful") @@ -842,24 +616,28 @@ extension NetworksTableViewController: UIWebViewDelegate { } + //called when webview is dismissed func dismiss() { self.dismissViewControllerAnimated(true, completion: nil) } } + extension NetworksTableViewController { @IBAction func toggleAuth(sender: UIButton){ print(sender.superview!.superview!.classForCoder) //Authorize app if(sender.titleLabel?.text == "Login") { + + //check which network cell was selected to determine which network to perform oauth on switch (sender.superview?.superview?.classForCoder){ case is EbayTableViewCell.Type: let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.ebayGraphManager.authorizeApp({ something,_ -> Void in - // // // + // switch login button to logout and display settings button once login process is complete dispatch_async(dispatch_get_main_queue(), { sender.setTitle("Logout", forState: UIControlState.Normal) (sender.superview?.superview as! EbayTableViewCell).settingsBtn.enabled = true @@ -874,6 +652,7 @@ extension NetworksTableViewController { let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.etsyManager.authorizeApp(self, onComplete: { something , _ -> Void in + // switch login button to logout and display settings button once login process is complete dispatch_async(dispatch_get_main_queue(), { sender.setTitle("Logout", forState: UIControlState.Normal) (sender.superview?.superview as! EtsyTableViewCell).settingsBtn.enabled = true @@ -886,6 +665,7 @@ extension NetworksTableViewController { let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.fbGraphManager.authorizeApp(self, onComplete: { something , _ -> Void in + // switch login button to logout and display settings button once login process is complete dispatch_async(dispatch_get_main_queue(), { sender.setTitle("Logout", forState: UIControlState.Normal) (sender.superview?.superview as! FBTableViewCell).settingsBtn.enabled = true @@ -906,6 +686,7 @@ extension NetworksTableViewController { let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.ebayGraphManager.deauthorizeApp())! dispatch_async(dispatch_get_main_queue(), { + // switch logout button to login and hide settings button once login process is complete sender.setTitle("Login", forState: UIControlState.Normal) (sender.superview?.superview as! EbayTableViewCell).settingsBtn.enabled = false (sender.superview?.superview as! EbayTableViewCell).settingsBtn.hidden = true @@ -918,6 +699,7 @@ extension NetworksTableViewController { let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.etsyManager.deAuthorizeApp(self))! dispatch_async(dispatch_get_main_queue(), { + // switch logout button to login and hide settings button once login process is complete sender.setTitle("Login", forState: UIControlState.Normal) (sender.superview?.superview as! EtsyTableViewCell).settingsBtn.enabled = false (sender.superview?.superview as! EtsyTableViewCell).settingsBtn.hidden = true @@ -927,6 +709,7 @@ extension NetworksTableViewController { let tabBar = self.tabBarController ((tabBar as? HomeViewController)?.fbGraphManager.deAuthorizeApp(self))! dispatch_async(dispatch_get_main_queue(), { + // switch logout button to login and hide settings button once login process is complete sender.setTitle("Login", forState: UIControlState.Normal) (sender.superview?.superview as! FBTableViewCell).settingsBtn.enabled = false (sender.superview?.superview as! FBTableViewCell).settingsBtn.hidden = true diff --git a/Vendoo/NotificationsViewController.swift b/Vendoo/NotificationsViewController.swift index e3ec6d3..d1ddfdc 100644 --- a/Vendoo/NotificationsViewController.swift +++ b/Vendoo/NotificationsViewController.swift @@ -8,6 +8,7 @@ import UIKit +/// Responsible for displaying notifications from authorized networks class NotificationsViewController: UIViewController { var notifications: [Dictionary]! = (NSUserDefaults.standardUserDefaults().objectForKey("notifications") == nil ? [] : (NSUserDefaults.standardUserDefaults().objectForKey("notifications") as! [Dictionary])) var fireBase = FirebaseManager() @@ -45,11 +46,14 @@ extension NotificationsViewController: UITableViewDelegate { var notification = self.notifications[indexPath.row] switch ( notification["network"] as! String) { + + // displays new comments from faebook listings with option of dismissing them case "facebook": let alert = UIAlertController(title: "New Comment from \(notification["senderName"] as! String)", message: (notification["commentMessage"] as! String), preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: { (action) -> Void in + //when user marks as dismissed, mark it in firebase DB so it is no longer retrieved by app notification["seen"] = true self.notifications[indexPath.row] = notification self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: { @@ -67,11 +71,13 @@ extension NotificationsViewController: UITableViewDelegate { alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: {(action) -> Void in})) self.presentViewController(alert, animated: true, completion: nil) break + case "ebay": let alert = UIAlertController(title: "New Notification", message: "Would you like to dismiss this notification?", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: { (action) -> Void in + //when user marks as dismissed, mark it in firebase DB so it is no longer retrieved by app notification["seen"] = true self.notifications[indexPath.row] = notification self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: { @@ -94,6 +100,7 @@ extension NotificationsViewController: UITableViewDelegate { alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: { (action) -> Void in + //when user marks as dismissed, mark it in firebase DB so it is no longer retrieved by app notification["seen"] = true self.notifications[indexPath.row] = notification self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: { @@ -122,6 +129,7 @@ extension NotificationsViewController: UITableViewDelegate { extension NotificationsViewController: UITableViewDataSource { + //used to display notification title and the image of the market place it belongs too func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell: NotificationTableViewCell! = self.notificationTable.dequeueReusableCellWithIdentifier("notification_cell") as! NotificationTableViewCell let notification = self.notifications[indexPath.row] diff --git a/Vendoo/RecoverPasswordViewController.swift b/Vendoo/RecoverPasswordViewController.swift index 4fb847e..0e6e0bf 100644 --- a/Vendoo/RecoverPasswordViewController.swift +++ b/Vendoo/RecoverPasswordViewController.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Okechi Onyeje. All rights reserved. // -//NEED TO MAKE ALERT NAVIGATE BACK TO LOGIN ONCE RECOVERY IS SENT +//@FIXME: NEED TO MAKE ALERT NAVIGATE BACK TO LOGIN ONCE RECOVERY IS SENT import UIKit import FirebaseAuth diff --git a/Vendoo/ServiceNotificationManager.swift b/Vendoo/ServiceNotificationManager.swift index 6adbecd..0788150 100644 --- a/Vendoo/ServiceNotificationManager.swift +++ b/Vendoo/ServiceNotificationManager.swift @@ -33,7 +33,9 @@ class ServiceNotificationManager: NSObject { } func startServicePolling() { - //timer = NSTimer.scheduledTimerWithTimeInterval(60.0, target: self, selector: #selector(ServiceNotificationManager.pollServices), userInfo: nil, repeats: true) + // notifications can be switched to a set interval by uncommenting the following line and commenting the line below it + + //timer = NSTimer.scheduledTimerWithTimeInterval(1800.0, target: self, selector: #selector(ServiceNotificationManager.pollServices), userInfo: nil, repeats: true) pollServices() } @@ -53,9 +55,7 @@ class ServiceNotificationManager: NSObject { } func pollServices(){ - let notificationGroup = dispatch_group_create() - //let notificationEndCount = 0 - //dispatch_group_enter(notificationGroup) + for listing in userListings { self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(listing.key)").observeSingleEventOfType( .Value, withBlock: { @@ -71,16 +71,16 @@ class ServiceNotificationManager: NSObject { let etsyID = (networksDict["etsy"] as? Int) let amazonID = (networksDict["amazon"] as? String) - //@TODO: Skeleton for Notfications Manager is set up. Need to implement listing request for each listing to retrieve relevant notifications for user such as if listing has ended if(ebayID != nil){ if self.ebayGraphManager.isAuthorized { self.ebayGraphManager.getListingInfo(ebayID!, onComplete: { (listingNotificationInfo, error) -> Void in - //dispatch_group_leave(notificationGroup) + let info = (listingNotificationInfo as! [String : AnyObject]) if(info["status"] as! String == "Ended") { if((info["quantitySold"] as! Int) > 0) { - //@TODO: Add both firbase logic and code logic to do notifications for sold listings + + //checks if listing is sold out if (((info["itemQuantity"] as! Int) - (info["quantitySold"] as! Int)) == 0) { ServiceNotificationManager.delegate?.listingHasNewNotifications( @@ -113,6 +113,8 @@ class ServiceNotificationManager: NSObject { } if(facebookID != nil){ if(self.fbGraphManager.isAuthorized) { + + //get new comments on a listing post from facebook self.fbGraphManager.getListingInfo ("/\(facebookID!)/comments", onCompletion: { (listingNotificationInfo, error) -> Void in @@ -173,7 +175,7 @@ class ServiceNotificationManager: NSObject { let info = (listingNotificationInfo as! [String : AnyObject]) - //@TODO: Test this code with the draft condition for both expired and sold_out + //checks for ended unsold listings if ((info["status"] as! String == "expired") || (info["status"] as! String == "removed")) { ServiceNotificationManager.delegate?.listingHasEnded( @@ -186,7 +188,7 @@ class ServiceNotificationManager: NSObject { "listingKey": listing.key] ) - + //checks for sold listings }else if info["status"] as! String == "sold_out" { ServiceNotificationManager.delegate?.listingHasNewNotifications( @@ -210,22 +212,16 @@ class ServiceNotificationManager: NSObject { if(amazonID != nil){ } - //dispatch_group_leave(notificationGroup) }else { - // dispatch_group_leave(notificationGroup) } }else { - //dispatch_group_leave(notificationGroup) } }) } - - //dispatch_group_notify(notificationGroup, dispatch_get_main_queue(), { - //self.delegate?.listingHasNewNotifications(nil, ebayInfo: nil, amazonInfo: nil, etsyInfo: nil) - //}) + //used to turn off notification mode for ebay so that it may operate as a request manager instead of a notification manager self.ebayGraphManager.isGettingNotification = false } diff --git a/Vendoo/SettingsViewController.swift b/Vendoo/SettingsViewController.swift index a7c8c0a..7faa58f 100644 --- a/Vendoo/SettingsViewController.swift +++ b/Vendoo/SettingsViewController.swift @@ -12,6 +12,7 @@ import FirebaseAuth import FirebaseDatabase import FirebaseStorage +/// This class is responsible for updating current users password and deleting current user account class SettingsViewController: UIViewController { //IBOutlet @@ -107,7 +108,6 @@ extension SettingsViewController: UITableViewDelegate { let dictionary = Locksmith.loadDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo") if(textField1.text == dictionary!["pass"] as? String){ - //put in password changing code later print("password accepted please enter new password") let alert2 = UIAlertController(title: "Change Password", message: "WARNING! You are about to change your vendoo account password. Please enter your new password to continue.", preferredStyle: .Alert) @@ -148,7 +148,6 @@ extension SettingsViewController: UITableViewDelegate { }else{ - //put in password changing code later print("incorrect password") let alert2 = UIAlertController(title: "Incorrect Password", message: "Incorrect password. Please try again.", preferredStyle: .Alert) @@ -184,12 +183,11 @@ extension SettingsViewController: UITableViewDelegate { let dictionary = Locksmith.loadDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo") if(textField.text == dictionary!["pass"] as? String){ - //put in deletion code later print("account deleted, add in deletion code as well as deauthorization code for any network currently authorized") - //get all listing information for current user + //get all listing information for current user and delete from gloabl listings in firebase print((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!) self.firbase.ref.child("Users/\(self.firbase.user_email)").observeSingleEventOfType( .Value, withBlock: { (snapshot) -> Void in @@ -206,7 +204,11 @@ extension SettingsViewController: UITableViewDelegate { } } - self.firbase.ref.child("Users").child(self.firbase.user_email).removeValueWithCompletionBlock({ + + + + //delete all user accounts currently assouciated with user + self.firbase.ref.child("Users").child(self.firbase.user_email).removeValueWithCompletionBlock({ (error, ref) -> Void in if error == nil { @@ -257,7 +259,6 @@ extension SettingsViewController: UITableViewDelegate { alert.dismissViewControllerAnimated(true, completion: nil) }else{ - //put in password changing code later print("incorrect password") let alert2 = UIAlertController(title: "Incorrect Password", message: "Incorrect password. Please try again.", preferredStyle: .Alert) diff --git a/Vendoo/SignInViewController.swift b/Vendoo/SignInViewController.swift index 3679070..1a28550 100644 --- a/Vendoo/SignInViewController.swift +++ b/Vendoo/SignInViewController.swift @@ -6,7 +6,6 @@ // Copyright © 2016 Okechi Onyeje. All rights reserved. // -//NEED TO FIX AUTO LOGIN USING KEYCHAIN AND SECURITY FRAMEWORKS, WILL WORK ON LATER import UIKit import FirebaseAuth @@ -30,6 +29,7 @@ class SignInViewController: UIViewController { self.email.delegate = self self.password.delegate = self + //check if there is a user logged in if NSUserDefaults.standardUserDefaults().boolForKey("signedIn"){ //load user account from keychain @@ -53,42 +53,77 @@ class SignInViewController: UIViewController { //IBActions extension SignInViewController { + //sign in current or returning user @IBAction func signInUser(sender: AnyObject) { - FIRAuth.auth()?.signInWithEmail(email.text!, password: password.text!) { (user, error) in - if let error = error { - print(error.localizedDescription) - return - } else { - - dispatch_async(dispatch_get_main_queue(), { () -> Void in - /*If the user has not already signed in then save their log in info*/ - if !(NSUserDefaults.standardUserDefaults().boolForKey("signedIn")){ - NSUserDefaults.standardUserDefaults().setBool(true, forKey: "signedIn") - NSUserDefaults.standardUserDefaults().setObject(self.email.text, forKey: "email") - //KeychainWrapper.setObject(self.password.text!, forKey: "password") + //add validation + let finalEmail = email!.text!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) + + if isValidEmail(finalEmail){ + FIRAuth.auth()?.signInWithEmail(email.text!, password: password.text!) { (user, error) in + if error != nil { + //alert for wrong pass + if ( error!.userInfo["error_name"] as! String == "ERROR_WRONG_PASSWORD"){ - //save data to keychain - do{ - try Locksmith.saveData(["pass": self.password.text!], forUserAccount: self.email.text!, inService: "vendoo") - print("account credentials saved") - } - catch{ - //could not save data to keychain - print("account credentials could not be saved") - - } - print("User saved") + var alert = UIAlertController(title: "Incorrect Password", message: "The password was invalid for the email given, please reenter the correct password.", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) + + //alert for invalid email + }else if (error!.userInfo["error_name"] as! String == "ERROR_INVALID_EMAIL"){ + + var alert = UIAlertController(title: "Email Invalid", message: "The email given was not valid, please enter a valid email.", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) + + //alert for disabled account + }else if (error!.userInfo["error_name"] as! String == "ERROR_USER_DISABLED"){ + var alert = UIAlertController(title: "User Account Disabled", message: "Your account has temporarily been disabled, please contact support for more information.", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) } + } else { - //will remove this line of code once - //removes saved user until autologin and security keychain operational - //NSUserDefaults.standardUserDefaults().setBool(false, forKey: "signedIn") - self.performSegueWithIdentifier("HomeScreenSegue", sender:nil) - - }) + dispatch_async(dispatch_get_main_queue(), { () -> Void in + + /*If the user has not already signed in then save their log in info*/ + if !(NSUserDefaults.standardUserDefaults().boolForKey("signedIn")){ + NSUserDefaults.standardUserDefaults().setBool(true, forKey: "signedIn") + NSUserDefaults.standardUserDefaults().setObject(self.email.text, forKey: "email") + + //save data to keychain + do{ + try Locksmith.saveData(["pass": self.password.text!], forUserAccount: self.email.text!, inService: "vendoo") + print("account credentials saved") + } + catch{ + //could not save data to keychain + print("account credentials could not be saved") + + } + print("User saved") + } + + self.performSegueWithIdentifier("HomeScreenSegue", sender:nil) + + }) + } } + }else { + //alert for invalid email + let alert = UIAlertController(title: "Bad Email Given", message: "The email given was not valid. Please enter a valid email", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) } + } } @@ -128,7 +163,20 @@ extension SignInViewController { //Private Class Helper Methods extension SignInViewController { - + //Validate Email/Username + func isValidEmail(testStr:String) -> Bool { + + print("Validate emilId: \(testStr)") + + let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" + + let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) + + let result = emailTest.evaluateWithObject(testStr) + + return result + + } } diff --git a/Vendoo/SignUpViewController.swift b/Vendoo/SignUpViewController.swift index 1d58474..176e389 100644 --- a/Vendoo/SignUpViewController.swift +++ b/Vendoo/SignUpViewController.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Okechi Onyeje. All rights reserved. // -//@FIXME: NEED TO PROMPT NEW USER THAT THEY HAVE BEEN LOGGED IN, NEED TO ADD AN INDICTOR TO LET USER KNOW THEY NEED TO WAIT AND NEED TO SEGUE TO MAIN SCREEN VIEW CONTROLLER +//@TODO: NEED TO PROMPT NEW USER THAT THEY HAVE BEEN LOGGED IN, NEED TO ADD AN INDICTOR TO LET USER KNOW THEY NEED TO WAIT AND NEED TO SEGUE TO MAIN SCREEN VIEW CONTROLLER import UIKit import FirebaseAuth @@ -43,21 +43,47 @@ class SignUpViewController: UIViewController { //MARK: - IBAction extension SignUpViewController { + //sign up new user @IBAction func signUpUser(sender: AnyObject) { - if( (self.email.text != "") && (self.name.text != "") && (self.password.text != "")) { + if( (self.email.text != "") && (self.name.text != "") && (self.password.text != "")) { //check for input in all 3 required fields + let finalEmail = email!.text!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) if isValidEmail(finalEmail){ FIRAuth.auth()?.createUserWithEmail(email.text!, password: password.text!) { (user, error) in if error != nil { - /* - if ( error!.userInfo[("error_name" as NSObject!)] == "ERROR_WEAK_PASSWORD"){ + + //alert for weak pass + if ( error!.userInfo["error_name"] as! String == "ERROR_WEAK_PASSWORD"){ + + var alert = UIAlertController(title: "Password too Weak", message: "Please enter a stronger password to complete your sign up process.", preferredStyle: .Alert) + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) - } - */ + //alert for in use email + }else if (error!.userInfo["error_name"] as! String == "ERROR_EMAIL_ALREADY_IN_USE"){ + + var alert = UIAlertController(title: "Email Already in Use", message: "The email provided is already in use, please use a different email.", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) + + //unknown error or error case + }else{ + var alert = UIAlertController(title: "Unknown Error", message: "An unknown error has occurred, please try again later.", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) + + } + print("user could not be created") print(error!.localizedDescription) + return } else{ @@ -80,11 +106,20 @@ extension SignUpViewController { } } + }else{ + //alert for invalid email + let alert = UIAlertController(title: "Bad Email Given", message: "The email given was not valid. Please enter a valid email", preferredStyle: .Alert) + + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in + })) + self.presentViewController(alert, animated: true, completion: nil) + } + //alert for required fields missing }else { - var alert = UIAlertController(title: "Missing Required Fields", message: "You are missing required field(s) to complete your Vendoo sign up. Please make sure the email, name, and password fields have been filled.", preferredStyle: .Alert) + let alert = UIAlertController(title: "Missing Required Fields", message: "You are missing required field(s) to complete your Vendoo sign up. Please make sure the email, name, and password fields have been filled.", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in })) @@ -101,7 +136,6 @@ extension SignUpViewController { extension SignUpViewController: UITextFieldDelegate { func textFieldShouldReturn(textField: UITextField) -> Bool { - //dismissKeyboard() self.view.endEditing(true) return false }