123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // FMTrackEventManager.swift
- // PDF Reader Pro
- //
- // Created by liujiajie on 2024/2/7.
- //
- import Foundation
- import AppCenterAnalytics
- let kTrackEventManager = FMTrackEventManager.defaultManager
- @objcMembers class FMTrackEventManager: NSObject{
- static let defaultManager: FMTrackEventManager = {
- let manager = FMTrackEventManager()
-
- return manager
- }()
-
- override init() {
- super.init()
- }
-
- func trackEvent(event: String, withProperties properties: [String: String]?) {
- if event.count < 1 { return }
- #if DEBUG
- let keyStr: String = properties?.keys.first ?? ""
- let vStr: String = properties?.values.first ?? ""
- NSLog("###-FireBaseEvent-(%@)-properties(%@):(%@)",event,keyStr,vStr)
- #endif
- // if RIAnalytics.isNewUserForCurrentVersion()
- if let props = properties {
- Analytics.trackEvent(event, withProperties: props)
- } else {
- Analytics.trackEvent(event)
- }
- }
-
- func trackOnceEvent(event: String, withProperties properties: [String: String]?) {
- if event.count < 1 { return }
- var eventString = event
- if properties?.keys.count ?? 0 > 0 && properties?.values.count ?? 0 > 0 {
- var keyString = ""
- for key in properties!.keys {
- keyString += key
- }
- for value in properties!.values {
- keyString += value
- }
- eventString += keyString
- }
-
- if let props = properties {
- Analytics.trackEvent(event, withProperties: props)
- } else {
- Analytics.trackEvent(event)
- }
- }
-
- }
|