Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Update FacebookCore.framework to Swift 3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko committed Sep 24, 2016
1 parent 2f3a4a0 commit 2539f59
Show file tree
Hide file tree
Showing 29 changed files with 369 additions and 381 deletions.
2 changes: 1 addition & 1 deletion Configurations/FacebookCore.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PRODUCT_NAME = FacebookCore
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.swift.core

SWIFT_VERSION = 2.3
SWIFT_VERSION = 3.0

IPHONEOS_DEPLOYMENT_TARGET = 8.0

Expand Down
191 changes: 94 additions & 97 deletions Sources/Core/AppEvents/AppEvent.Builtin.swift

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Sources/Core/AppEvents/AppEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,33 +82,33 @@ public protocol AppEventLoggable {
*/
public protocol AppEventParameterValueType {
/// Object value. Can be either `NSNumber` or `String`.
var appEventParameterValue: AnyObject { get }
var appEventParameterValue: Any { get }
}

extension NSNumber: AppEventParameterValueType {
/// An object representation of `self`, suitable for parameter value of `AppEventLoggable`.
public var appEventParameterValue: AnyObject {
public var appEventParameterValue: Any {
return self
}
}

extension IntegerLiteralType: AppEventParameterValueType {
/// An object representation of `self`, suitable for parameter value of `AppEventLoggable`.
public var appEventParameterValue: AnyObject {
public var appEventParameterValue: Any {
return self as NSNumber
}
}

extension FloatLiteralType: AppEventParameterValueType {
/// An object representation of `self`, suitable for parameter value of `AppEventLoggable`.
public var appEventParameterValue: AnyObject {
public var appEventParameterValue: Any {
return self as NSNumber
}
}

extension String: AppEventParameterValueType {
/// An object representation of `self`, suitable for parameter value of `AppEventLoggable`.
public var appEventParameterValue: AnyObject {
public var appEventParameterValue: Any {
return self
}
}
94 changes: 47 additions & 47 deletions Sources/Core/AppEvents/AppEventName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,50 @@ public enum AppEventName {
// MARK: General

/// Name of the event that indicates that the user has completed a registration.
case CompletedRegistration
case completedRegistration
/// Name of the event that indicates that the user has completed a tutorial.
case CompletedTutorial
case completedTutorial
/// Name of the event that indicates that the user has viewed a content.
case ViewedContent
case viewedContent
/// Name of the event that indicates that the user has performed search within the application.
case Searched
case searched
/// Name of the event that indicates that the user has has rated an item in the app.
case Rated
case rated

// MARK: Commerce

/// Name of the event that indicates that the user has purchased something in the application.
case Purchased
case purchased
/// Name of the event that indicates that the user has added an item to the cart.
case AddedToCart
case addedToCart
/// Name of the event that indicates that the user has added an item to the wishlist.
case AddedToWishlist
case addedToWishlist
/// Name of the event that indicates that the user has added payment information.
case AddedPaymentInfo
case addedPaymentInfo
/// Name of the event that indicates that the user has initiated a checkout.
case InitiatedCheckout
case initiatedCheckout

// MARK: Gaming

/// Name of the event that indicates that the user has achieved a level.
case AchievedLevel
case achievedLevel
/// Name of the event that indicates that the user has unlocked an achievement.
case UnlockedAchievement
case unlockedAchievement
/// Name of the event that indicates that the user has spent in-app credits.
case SpentCredits
case spentCredits

// MARK: Custom

/// Custom name of the event that is represented by a string.
case Custom(String)
case custom(String)

/**
Create an `AppEventName` from `String`.

- parameter string: String to create an app event name from.
*/
public init(_ string: String) {
self = .Custom(string)
self = .custom(string)
}
}

Expand All @@ -84,41 +84,41 @@ extension AppEventName: RawRepresentable {
- parameter rawValue: String to create an app event name from.
*/
public init?(rawValue: String) {
self = .Custom(rawValue)
self = .custom(rawValue)
}

/// The corresponding `String` value.
public var rawValue: String {
switch self {
case .CompletedRegistration: return FBSDKAppEventNameCompletedRegistration
case .CompletedTutorial: return FBSDKAppEventNameCompletedTutorial
case .ViewedContent: return FBSDKAppEventNameViewedContent
case .Searched: return FBSDKAppEventNameSearched
case .Rated: return FBSDKAppEventNameRated

case .Purchased: return "fb_mobile_purchase" // Hard-coded as a string, since it's internal API of FBSDKCoreKit.
case .AddedToCart: return FBSDKAppEventNameAddedToCart
case .AddedToWishlist: return FBSDKAppEventNameAddedToWishlist
case .AddedPaymentInfo: return FBSDKAppEventNameAddedPaymentInfo
case .InitiatedCheckout: return FBSDKAppEventNameInitiatedCheckout

case .AchievedLevel: return FBSDKAppEventNameAchievedLevel
case .UnlockedAchievement: return FBSDKAppEventNameUnlockedAchievement
case .SpentCredits: return FBSDKAppEventNameSpentCredits

case .Custom(let string): return string
case .completedRegistration: return FBSDKAppEventNameCompletedRegistration
case .completedTutorial: return FBSDKAppEventNameCompletedTutorial
case .viewedContent: return FBSDKAppEventNameViewedContent
case .searched: return FBSDKAppEventNameSearched
case .rated: return FBSDKAppEventNameRated

case .purchased: return "fb_mobile_purchase" // Hard-coded as a string, since it's internal API of FBSDKCoreKit.
case .addedToCart: return FBSDKAppEventNameAddedToCart
case .addedToWishlist: return FBSDKAppEventNameAddedToWishlist
case .addedPaymentInfo: return FBSDKAppEventNameAddedPaymentInfo
case .initiatedCheckout: return FBSDKAppEventNameInitiatedCheckout

case .achievedLevel: return FBSDKAppEventNameAchievedLevel
case .unlockedAchievement: return FBSDKAppEventNameUnlockedAchievement
case .spentCredits: return FBSDKAppEventNameSpentCredits

case .custom(let string): return string
}
}
}

extension AppEventName: StringLiteralConvertible {
extension AppEventName: ExpressibleByStringLiteral {
/**
Create an `AppEventName` from a string literal.

- parameter value: The string literal to create from.
*/
public init(stringLiteral value: StringLiteralType) {
self = .Custom(value)
self = .custom(value)
}

/**
Expand All @@ -145,6 +145,18 @@ extension AppEventName: Hashable {
public var hashValue: Int {
return self.rawValue.hashValue
}

/**
Compare two `AppEventName`s for equality.

- parameter lhs: The first app event name to compare.
- parameter rhs: The second app event name to compare.

- returns: Whether or not the app event names are equal.
*/
public static func == (lhs: AppEventName, rhs: AppEventName) -> Bool {
return lhs.rawValue == rhs.rawValue
}
}

extension AppEventName: CustomStringConvertible {
Expand All @@ -153,15 +165,3 @@ extension AppEventName: CustomStringConvertible {
return rawValue
}
}

/**
Compare two `AppEventName`s for equality.

- parameter lhs: The first app event name to compare.
- parameter rhs: The second app event name to compare.

- returns: Whether or not the app event names are equal.
*/
public func == (lhs: AppEventName, rhs: AppEventName) -> Bool {
return lhs.rawValue == rhs.rawValue
}
76 changes: 38 additions & 38 deletions Sources/Core/AppEvents/AppEventParameterName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ import FBSDKCoreKit.FBSDKAppEvents
*/
public enum AppEventParameterName {
/// Identifier for the specific piece of content.
case ContentId
case contentId
/// Type of the content, e.g. "music"/"photo"/"video".
case ContentType
case contentType
/// Currency. E.g. "USD"/"EUR"/"GBP". See ISO-4217 for specific values.
case Currency
case currency
/// Appropriate description for the event.
case Description
/// Current level or level achieved.
case Level
case level
/// Maximum rating available. E.g. "5"/"10".
case MaxRatingValue
case maxRatingValue
/// Count of items being proccessed.
case ItemCount
case itemCount
/// Boolean value indicating whether payment information is available.
case PaymentInfoAvailable
case paymentInfoAvailable
/// Registration method used. E.g. "Facebook"/"email"/"sms".
case RegistrationMethod
case registrationMethod
/// String provided by the user for a search operation.
case SearchedString
case searchedString
/// Boolean value indicating wehtehr an activity being logged was succesful.
case Successful
case successful
/// Custom name of the parameter that is represented by a string.
case Custom(String)
case custom(String)

/**
Create an `AppEventParameterName` from `String`.

- parameter string: String to create an app event name from.
*/
public init(_ string: String) {
self = .Custom(string)
self = .custom(string)
}
}

Expand All @@ -64,36 +64,36 @@ extension AppEventParameterName: RawRepresentable {
- parameter rawValue: String to create an app event name from.
*/
public init?(rawValue: String) {
self = .Custom(rawValue)
self = .custom(rawValue)
}

/// The corresponding `String` value.
public var rawValue: String {
switch self {
case .ContentId: return FBSDKAppEventParameterNameContentID
case .ContentType: return FBSDKAppEventParameterNameContentType
case .Currency: return FBSDKAppEventParameterNameCurrency
case .contentId: return FBSDKAppEventParameterNameContentID
case .contentType: return FBSDKAppEventParameterNameContentType
case .currency: return FBSDKAppEventParameterNameCurrency
case .Description: return FBSDKAppEventParameterNameDescription
case .Level: return FBSDKAppEventNameAchievedLevel
case .MaxRatingValue: return FBSDKAppEventParameterNameMaxRatingValue
case .ItemCount: return FBSDKAppEventParameterNameNumItems
case .PaymentInfoAvailable: return FBSDKAppEventParameterNamePaymentInfoAvailable
case .RegistrationMethod: return FBSDKAppEventParameterNameRegistrationMethod
case .SearchedString: return FBSDKAppEventParameterNameSearchString
case .Successful: return FBSDKAppEventParameterNameSuccess
case .Custom(let string): return string
case .level: return FBSDKAppEventNameAchievedLevel
case .maxRatingValue: return FBSDKAppEventParameterNameMaxRatingValue
case .itemCount: return FBSDKAppEventParameterNameNumItems
case .paymentInfoAvailable: return FBSDKAppEventParameterNamePaymentInfoAvailable
case .registrationMethod: return FBSDKAppEventParameterNameRegistrationMethod
case .searchedString: return FBSDKAppEventParameterNameSearchString
case .successful: return FBSDKAppEventParameterNameSuccess
case .custom(let string): return string
}
}
}

extension AppEventParameterName: StringLiteralConvertible {
extension AppEventParameterName: ExpressibleByStringLiteral {
/**
Create an `AppEventParameterName` from a string literal.

- parameter value: The string literal to create from.
*/
public init(stringLiteral value: StringLiteralType) {
self = .Custom(value)
self = .custom(value)
}

/**
Expand All @@ -120,6 +120,18 @@ extension AppEventParameterName: Hashable {
public var hashValue: Int {
return self.rawValue.hashValue
}

/**
Compare two `AppEventParameterName`s for equality.

- parameter lhs: The first parameter name to compare.
- parameter rhs: The second parameter name to compare.

- returns: Whether or not the parameter names are equal.
*/
public static func == (lhs: AppEventParameterName, rhs: AppEventParameterName) -> Bool {
return lhs.rawValue == rhs.rawValue
}
}

extension AppEventParameterName: CustomStringConvertible {
Expand All @@ -128,15 +140,3 @@ extension AppEventParameterName: CustomStringConvertible {
return rawValue
}
}

/**
Compare two `AppEventParameterName`s for equality.

- parameter lhs: The first parameter name to compare.
- parameter rhs: The second parameter name to compare.

- returns: Whether or not the parameter names are equal.
*/
public func == (lhs: AppEventParameterName, rhs: AppEventParameterName) -> Bool {
return lhs.rawValue == rhs.rawValue
}
12 changes: 6 additions & 6 deletions Sources/Core/AppEvents/AppEventsLogger.FlushBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@ extension AppEventsLogger {
/**
Flush automatically: periodically (once a minute or every 100 logged events) and always at app reactivation.
*/
case Auto
case auto

/**
Only flush when the `flush` method is called.
When an app is moved to background/terminated, the events are persisted and re-established at activation,
but they will only be written with an explicit call to `flush`.
*/
case ExplicitOnly
case explicitOnly
}
}

extension AppEventsLogger.FlushBehavior {
internal init(sdkFlushBehavior: FBSDKAppEventsFlushBehavior) {
switch sdkFlushBehavior {
case .Auto: self = .Auto
case .ExplicitOnly: self = .ExplicitOnly
case .auto: self = .auto
case .explicitOnly: self = .explicitOnly
}
}

internal var sdkFlushBehavior: FBSDKAppEventsFlushBehavior {
switch self {
case .Auto: return .Auto
case .ExplicitOnly: return .ExplicitOnly
case .auto: return .auto
case .explicitOnly: return .explicitOnly
}
}
}
Loading

0 comments on commit 2539f59

Please sign in to comment.