diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate index cdb134f..d592cd1 100644 Binary files a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate and b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 21c9e4e..188026f 100644 --- a/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Vendoo.xcworkspace/xcuserdata/okechi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -186,7 +186,7 @@ moduleName = "Vendoo" usesParentBreakpointCondition = "Yes" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" - timestampString = "501429659.558836" + timestampString = "501438723.320631" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "570" @@ -201,7 +201,7 @@ moduleName = "Vendoo" usesParentBreakpointCondition = "Yes" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" - timestampString = "501429659.559" + timestampString = "501438723.320746" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "572" @@ -689,5 +689,101 @@ landmarkType = "5"> + + + + + + + + + + + + + + + + + + + + + + diff --git a/Vendoo/HomeViewController.swift b/Vendoo/HomeViewController.swift index d1cdf12..ac3be80 100644 --- a/Vendoo/HomeViewController.swift +++ b/Vendoo/HomeViewController.swift @@ -41,8 +41,26 @@ class HomeViewController: UITabBarController { if userDict!["notifications"] != nil { self.notifications = [] for (_, v) in userDict!["notifications"] as! [String : AnyObject] { - if v["seen"] as! Bool == false { - self.notifications.append(v as! Dictionary) + if v["seen"] as! Bool == false/*add network visibility as well*/{ + var is_networkAuth = false + switch((v["network"] as! String)){ + case "ebay": + is_networkAuth = NSUserDefaults.standardUserDefaults().boolForKey("ebayAuthorized") + break + case "etsy": + is_networkAuth = NSUserDefaults.standardUserDefaults().boolForKey("etsyAuthorized") + break + case "facebook" : + is_networkAuth = NSUserDefaults.standardUserDefaults().boolForKey("fbAuthorized") + break + case "amazon": + break + default: + break + } + if is_networkAuth { + self.notifications.append(v as! Dictionary) + } } } @@ -151,6 +169,13 @@ class HomeViewController: UITabBarController { 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) + + + })*/ + } diff --git a/Vendoo/SettingsViewController.swift b/Vendoo/SettingsViewController.swift index e0635ed..a7c8c0a 100644 --- a/Vendoo/SettingsViewController.swift +++ b/Vendoo/SettingsViewController.swift @@ -17,7 +17,7 @@ class SettingsViewController: UIViewController { //IBOutlet @IBOutlet weak var closeButton: UIBarButtonItem! @IBOutlet weak var table: UITableView! - + var firbase = FirebaseManager() override func viewDidLoad() { super.viewDidLoad() @@ -191,7 +191,7 @@ extension SettingsViewController: UITableViewDelegate { //get all listing information for current user print((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!) - FIRDatabase.database().reference().child("Users").child((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!).observeSingleEventOfType( .Value, withBlock: { + self.firbase.ref.child("Users/\(self.firbase.user_email)").observeSingleEventOfType( .Value, withBlock: { (snapshot) -> Void in let userDict = snapshot.value as? [String : AnyObject] @@ -199,14 +199,14 @@ extension SettingsViewController: UITableViewDelegate { if listingDict != nil { for (key, values) in listingDict! { - FIRDatabase.database().reference().child("Global_listings").child(key).removeValue() + self.firbase.ref.child("Global_listings").child(key).removeValue() FIRStorage.storage().referenceForURL((userDict!["image_storage"] as? String)!).child("images/\(key)").deleteWithCompletion({ (error) -> Void in }) } } - FIRDatabase.database().reference().child("Users").child((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!).removeValueWithCompletionBlock({ + self.firbase.ref.child("Users").child(self.firbase.user_email).removeValueWithCompletionBlock({ (error, ref) -> Void in if error == nil {