Implemented deletion of an account

added network exclusion into pulling notifications
This commit is contained in:
Okechi Onyeje 2016-11-21 12:02:18 -05:00
parent a74ed60419
commit 5d7b0c9dc9
4 changed files with 129 additions and 8 deletions

View File

@ -186,7 +186,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift"
timestampString = "501429659.558836" timestampString = "501438723.320631"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "570" startingLineNumber = "570"
@ -201,7 +201,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/CategoriesTableViewController.swift"
timestampString = "501429659.559" timestampString = "501438723.320746"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "572" startingLineNumber = "572"
@ -689,5 +689,101 @@
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "501431362.91266"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "196"
endingLineNumber = "196"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "501431365.398348"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "197"
endingLineNumber = "197"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "501431572.028953"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "194"
endingLineNumber = "194"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "501438723.339454"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "194"
endingLineNumber = "194"
offsetFromSymbolStart = "2591">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "501438723.339576"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "197"
endingLineNumber = "197"
offsetFromSymbolStart = "34">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "501438721.606962"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "172"
endingLineNumber = "172"
landmarkName = "viewDidLoad()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>

View File

@ -41,10 +41,28 @@ class HomeViewController: UITabBarController {
if userDict!["notifications"] != nil { if userDict!["notifications"] != nil {
self.notifications = [] self.notifications = []
for (_, v) in userDict!["notifications"] as! [String : AnyObject] { for (_, v) in userDict!["notifications"] as! [String : AnyObject] {
if v["seen"] as! Bool == false { 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<String, AnyObject>) self.notifications.append(v as! Dictionary<String, AnyObject>)
} }
} }
}
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications") NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
} }
@ -151,6 +169,13 @@ class HomeViewController: UITabBarController {
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil) NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
self.notificationsManager.setListings(self.userListings) self.notificationsManager.setListings(self.userListings)
self.notificationsManager.startServicePolling() self.notificationsManager.startServicePolling()
/*self.notificationsManager.startServicePolling({
(_,_) -> Void in
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
})*/
} }

View File

@ -17,7 +17,7 @@ class SettingsViewController: UIViewController {
//IBOutlet //IBOutlet
@IBOutlet weak var closeButton: UIBarButtonItem! @IBOutlet weak var closeButton: UIBarButtonItem!
@IBOutlet weak var table: UITableView! @IBOutlet weak var table: UITableView!
var firbase = FirebaseManager()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -191,7 +191,7 @@ extension SettingsViewController: UITableViewDelegate {
//get all listing information for current user //get all listing information for current user
print((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!) 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 (snapshot) -> Void in
let userDict = snapshot.value as? [String : AnyObject] let userDict = snapshot.value as? [String : AnyObject]
@ -199,14 +199,14 @@ extension SettingsViewController: UITableViewDelegate {
if listingDict != nil { if listingDict != nil {
for (key, values) in listingDict! { 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({ FIRStorage.storage().referenceForURL((userDict!["image_storage"] as? String)!).child("images/\(key)").deleteWithCompletion({
(error) -> Void in (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 (error, ref) -> Void in
if error == nil { if error == nil {