You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Foundation
import FacebookCore
// MARK: - Facebook
class FacebookEventManager {
static let shared = FacebookEventManager()
private init() {}
// MARK: - Facebook SDK
func configure() {
// Facebook SDK
FacebookCore.ApplicationDelegate.shared.application(
UIApplication.shared,
didFinishLaunchingWithOptions: nil
)
}
// MARK: -
func logAppLaunch() {
FacebookCore.AppEvents.shared.logEvent(.completedRegistration)
}
// MARK: -
func logQRCodeScan(type: String) {
let parameters = [
FacebookCore.AppEvents.ParameterName.contentType: "qr_code",
FacebookCore.AppEvents.ParameterName.content: type
]
FacebookCore.AppEvents.shared.logEvent(.viewedContent, parameters: parameters)
}
// MARK: -
func logQRCodeGeneration(type: String) {
let parameters = [
FacebookCore.AppEvents.ParameterName.contentType: "qr_code_generation",
FacebookCore.AppEvents.ParameterName.content: type
]
FacebookCore.AppEvents.shared.logEvent(.completedTutorial, parameters: parameters)
}
// MARK: - 使
func logFeatureUsage(feature: String) {
let parameters = [
FacebookCore.AppEvents.ParameterName.contentType: "feature_usage",
FacebookCore.AppEvents.ParameterName.content: feature
]
FacebookCore.AppEvents.shared.logEvent(.searched, parameters: parameters)
}
// MARK: -
func logShare(contentType: String) {
let parameters = [
FacebookCore.AppEvents.ParameterName.contentType: contentType
]
FacebookCore.AppEvents.shared.logEvent(.completedTutorial, parameters: parameters)
}
// MARK: -
func logPurchase(amount: Double, currency: String = "USD") {
FacebookCore.AppEvents.shared.logPurchase(amount: amount, currency: currency)
}
}