//
//  User.swift
//  PartyUP
//
//  Created by Fritz Vander Heide on 2016-06-30.
//  Copyright © 2016 Sandcastle Application Development. All rights reserved.
//

import Foundation
import FBSDKCoreKit

class User {
	var aliases = [NSLocalizedString("Anonymous Milquetoast", comment: "anonymous user moniker")]

	init() {
		refresh()

		NSNotificationCenter.defaultCenter().addObserverForName(FBSDKAccessTokenDidChangeNotification, object: nil, queue: NSOperationQueue.mainQueue()) { _ in self.refresh() }
	}

	func refresh() {
		if let token = FBSDKAccessToken.currentAccessToken() where token.hasGranted("public_profile") {
			FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"name"]).startWithCompletionHandler({ (connection, profile, error) in
				if error == nil {
                    if let name = profile["name"] as? String {
                        self.aliases.append(name)
                    }
				}
			})
		}
	}
}
//
//  User.swift
//  PartyUP
//
//  Created by Fritz Vander Heide on 2016-06-30.
//  Copyright © 2016 Sandcastle Application Development. All rights reserved.
//

import Foundation
import FBSDKCoreKit

class User {
	var aliases = [NSLocalizedString("Anonymous Milquetoast", comment: "anonymous user moniker")]

	init() {
		refresh()

		NSNotificationCenter.defaultCenter().addObserverForName(FBSDKAccessTokenDidChangeNotification, object: nil, queue: NSOperationQueue.mainQueue()) { _ in self.refresh() }
	}

	func refresh() {
		if let token = FBSDKAccessToken.currentAccessToken() where token.hasGranted("public_profile") {
			FBSDKGraphRequest.init(graphPath: "me", parameters: ["fields":"name"]).startWithCompletionHandler({ (connection, profile, error) in
				if error == nil {
                    if let name = profile["name"] as? String {
                        self.aliases.append(name)
                    }
				}
			})
		}
	}
}
--- 
+++ 
@@ -20,7 +20,7 @@
 
 	func refresh() {
 		if let token = FBSDKAccessToken.currentAccessToken() where token.hasGranted("public_profile") {
-			FBSDKGraphRequest.init(graphPath: "me", parameters: ["fields":"name"]).startWithCompletionHandler({ (connection, profile, error) in
+			FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"name"]).startWithCompletionHandler({ (connection, profile, error) in
 				if error == nil {
                     if let name = profile["name"] as? String {
                         self.aliases.append(name)
Remove an unnecessary explicit call to init.
