Skip to content

Commit

Permalink
Merge pull request #2 from KiwiTechLLC/facebookChanges
Browse files Browse the repository at this point in the history
Facebook changes
  • Loading branch information
anuj-gola authored Jan 8, 2019
2 parents cbc9e5d + 2535b10 commit 24d8e8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 12 additions & 2 deletions KiwiPods/Social/Facebook/FacebookHandler.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// FacebookHandler.swift
// Integrations
//
//
// Created by KiwiTech on 12/12/18.
// Copyright © 2018 KiwiTech. All rights reserved.
Expand All @@ -21,8 +21,18 @@ open class FacebookHandler: NSObject {
})

}
public func getFacebookUserToken(controller: UIViewController, completion: @escaping (String?, Error?) -> Void) {
FacebookLoginHelper().checklogin { (success, error) in
if success {
let token = FacebookLoginHelper.getCurrentAccessToken()
completion(token, nil)
} else {
completion(nil, error)
}
}
}
public func getFacebookUserInfo(controller: UIViewController, completion: @escaping (_ result: FaceBookLoginData?, _ error: Error?) -> Void) {

// FacebookLoginHelper().getUserInfo(requestData: <#T##[String]#>, completion: <#T##(FaceBookLoginData?, Error?) -> Void#>)
}
fileprivate static var imageUrls = [String: String]()
fileprivate static var queuedUrls = [String]()
Expand Down
8 changes: 5 additions & 3 deletions KiwiPods/Social/Facebook/FacebookLoginHelper.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// FacebookLoginHelper.swift
// CleanSwiftDemo
//
//
// Created by KiwiTech on 17/07/2018.
// Copyright © 2018 KiwiTech. All rights reserved.
Expand Down Expand Up @@ -97,7 +97,7 @@ final class FacebookLoginHelper {
class func getCurrentAccessToken() -> String? {
return FBSDKAccessToken.current()?.tokenString
}
fileprivate func checklogin(completion: ((Bool, Error?) -> Void)?) {
public func checklogin(completion: ((Bool, Error?) -> Void)?) {
if let _ = FBSDKAccessToken.current() {
completion?(true, nil)
} else {
Expand All @@ -107,12 +107,14 @@ final class FacebookLoginHelper {
} else {
if let result = result, !result.isCancelled {
completion?(true, nil)
} else {
completion?(false, nil)
}
}
}
}
}
public func getUserInfo(_ accessToken: FBSDKAccessToken, requestData: [String], completion: @escaping (_ result: FaceBookLoginData?, _ error: Error?) -> Void) {
public func getUserInfo(requestData: [String], completion: @escaping (_ result: FaceBookLoginData?, _ error: Error?) -> Void) {
checklogin { (success, error) in
if success {
let graphRequest = FBSDKGraphRequest(graphPath: "/me", parameters: ["fields": requestData.joined(separator: ",")])
Expand Down

0 comments on commit 24d8e8d

Please sign in to comment.