diff --git a/Cartfile b/Cartfile index bd89cb0a..e006cb7b 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "facebook/facebook-ios-sdk" ~> 4.14 +github "facebook/facebook-ios-sdk" ~> 4.16 diff --git a/Cartfile.resolved b/Cartfile.resolved index 19d2a920..65603cf6 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ github "BoltsFramework/Bolts-ObjC" "1.8.4" -github "facebook/facebook-ios-sdk" "sdk-version-4.15.0" +github "facebook/facebook-ios-sdk" "sdk-version-4.16.0" diff --git a/Carthage/Checkouts/facebook-ios-sdk b/Carthage/Checkouts/facebook-ios-sdk index 07dd5904..31797f4d 160000 --- a/Carthage/Checkouts/facebook-ios-sdk +++ b/Carthage/Checkouts/facebook-ios-sdk @@ -1 +1 @@ -Subproject commit 07dd5904e4fd0683143d3d0a61f5a11fb3b52c88 +Subproject commit 31797f4dd1977f44441ce0753e7788857119a765 diff --git a/FacebookCore.podspec b/FacebookCore.podspec index 14f63b2d..798e710e 100644 --- a/FacebookCore.podspec +++ b/FacebookCore.podspec @@ -26,5 +26,5 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'ENABLE_TESTABILITY' => 'YES' } s.ios.dependency 'Bolts', '~> 1.8' - s.ios.dependency 'FBSDKCoreKit', '~> 4.15' + s.ios.dependency 'FBSDKCoreKit', '~> 4.16' end diff --git a/FacebookLogin.podspec b/FacebookLogin.podspec index d4dddbd9..55aee879 100644 --- a/FacebookLogin.podspec +++ b/FacebookLogin.podspec @@ -21,6 +21,6 @@ Pod::Spec.new do |s| s.ios.dependency 'FacebookCore', '~> 0.2' s.ios.dependency 'Bolts', '~> 1.8' - s.ios.dependency 'FBSDKCoreKit', '~> 4.15' - s.ios.dependency 'FBSDKLoginKit', '~> 4.15' + s.ios.dependency 'FBSDKCoreKit', '~> 4.16' + s.ios.dependency 'FBSDKLoginKit', '~> 4.16' end diff --git a/FacebookShare.podspec b/FacebookShare.podspec index fa44f419..3957fd22 100644 --- a/FacebookShare.podspec +++ b/FacebookShare.podspec @@ -26,6 +26,6 @@ Pod::Spec.new do |s| s.ios.dependency 'FacebookCore', '~> 0.2' s.ios.dependency 'Bolts', '~> 1.8' - s.ios.dependency 'FBSDKCoreKit', '~> 4.15' - s.ios.dependency 'FBSDKShareKit', '~> 4.15' + s.ios.dependency 'FBSDKCoreKit', '~> 4.16' + s.ios.dependency 'FBSDKShareKit', '~> 4.16' end diff --git a/Samples/Catalog/Sources/AlertController.swift b/Samples/Catalog/Sources/AlertController.swift index aa294aea..d4ab8fca 100644 --- a/Samples/Catalog/Sources/AlertController.swift +++ b/Samples/Catalog/Sources/AlertController.swift @@ -19,12 +19,94 @@ import Foundation import UIKit +extension UIAlertAction { + + /// Action types most commonly used + public enum actionType{ + + ///Ok Option + case ok + + /// Default Cancel Option + case cancel + + /// Destructive action with custom title + case destructive(String) + + /// Custom action with title and style + case custom(String,UIAlertActionStyle) + + /** + Creates the action instance for UIAlertController + - parameter handler: Call Back function + - returns UIAlertAction Instance + */ + public func action(handler:((String) -> Void)? = nil) -> UIAlertAction { + + //Default value + var actionStyle = UIAlertActionStyle.default + var title = "" + + // Action configuration based on the action type + switch self { + + case .cancel: + actionStyle = .cancel + title = "Cancel" + + case .destructive(let optionTitle): + title = optionTitle + actionStyle = .destructive + + case .custom(let optionTitle, let style): + title = optionTitle + actionStyle = style + + default: + title = "Ok" + } + + //Creating UIAlertAction instance + let action = UIAlertAction(title:title,style:actionStyle, handler: {(nativeAction) in + if (handler != nil){ + handler!(title) + } + }) + + return action + } + } +} + extension UIAlertController { - convenience init(title: String, message: String) { - self.init(title: title, message: message, preferredStyle: .alert) - let action = UIAlertAction(title: NSLocalizedString("OK", comment: "OK action"), - style: .default, - handler: nil) - addAction(action) + + /** + Creates the alert view controller using the actions specified + + - parameter title: Title of the alert. + - parameter message: Alert message body. + - parameter actions: Variable numbre of actions as an Array of actionType values. + - parameter style: UIAlertControllerStyle enum value + - parameter handler: Handler block/closure for the clicked option. + + - let alert = UIAlertController.init(title:"Confirm",message:"Do you want to quit sign up and login with other account ?",actions:.custom("Yes,.default),.custom("Cancel",.destructive)){ (buttonTitle) in + if buttonTitle == "Yes"{ + print("Yes Clicked") + } + } + + self.present(alert, animated: true, completion: nil) + + */ + convenience init(title: String, message: String ,actions:[UIAlertAction.actionType] = [.ok],style: UIAlertControllerStyle = .alert,handler:((String) -> Swift.Void)? = nil) { + + //initialize the contoller (self) instance + self.init(title: title, message: message, preferredStyle:style) + + //Fetching actions specidied by the user and adding actions accordingly + for actionType in actions { + addAction(actionType.action(handler: handler)) + } } } +