|
@@ -11,7 +11,6 @@ import Kingfisher
|
|
|
import UIKit
|
|
|
import UserNotifications
|
|
|
import WechatOpenSDK
|
|
|
-
|
|
|
// MARK: - 第三方相关工具类
|
|
|
|
|
|
/// 第三方相关工具类
|
|
@@ -20,22 +19,20 @@ public class PQThirdPlatformUtil: NSObject {
|
|
|
// 注册第三方
|
|
|
func register() {
|
|
|
// 注册微信
|
|
|
- PQSingletoWXApiUtil.shared.registerApp()
|
|
|
+ PQSingletoWXApiUtil.shared.registerApp(appInfo: PQBFConfig.shared.appInfo)
|
|
|
// 注册bugly
|
|
|
PQSingleBuglyUtil.shared.register()
|
|
|
- // 注册友盟
|
|
|
- PQUMApiUtil.register()
|
|
|
}
|
|
|
|
|
|
override private init() {
|
|
|
super.init()
|
|
|
}
|
|
|
|
|
|
- override func copy() -> Any {
|
|
|
+ public override func copy() -> Any {
|
|
|
return self
|
|
|
}
|
|
|
|
|
|
- override func mutableCopy() -> Any {
|
|
|
+ public override func mutableCopy() -> Any {
|
|
|
return self
|
|
|
}
|
|
|
}
|
|
@@ -51,7 +48,6 @@ public class PQSingleBuglyUtil: NSObject {
|
|
|
buglyConfig.reportLogLevel = .warn
|
|
|
#if DEBUG
|
|
|
buglyConfig.version = versionName + ".6666"
|
|
|
- PQLog(message: "Bugly版本号:\(BuglyConfig.version())")
|
|
|
#else
|
|
|
if PQENVUtil.shared.envMode == .ENVModeOnline {
|
|
|
buglyConfig.version = versionName + "." + versionCode
|
|
@@ -62,7 +58,7 @@ public class PQSingleBuglyUtil: NSObject {
|
|
|
}
|
|
|
#endif
|
|
|
buglyConfig.channel = PQBFConfig.shared.channelID
|
|
|
- buglyConfig.deviceIdentifier = PQLoginUserInfo.shared.isLogin() ? PQLoginUserInfo.shared.uid : getMachineCode()
|
|
|
+ buglyConfig.deviceIdentifier = BFLoginUserInfo.shared.isLogin() ? BFLoginUserInfo.shared.uid : getMachineCode()
|
|
|
buglyConfig.unexpectedTerminatingDetectionEnable = true
|
|
|
buglyConfig.blockMonitorEnable = true
|
|
|
buglyConfig.blockMonitorTimeout = 2
|
|
@@ -108,8 +104,11 @@ public class PQSingletoWXApiUtil: NSObject {
|
|
|
// 回调
|
|
|
public var wxApiUtilHander: ((_ userData: [String: Any]?, _ errorMsg: String?) -> Void)?
|
|
|
var mAppInfo: WXApiInfo = WXApiInfo()
|
|
|
- public func registerApp(appInfo: WXApiInfo) {
|
|
|
- mAppInfo = appInfo
|
|
|
+ public func registerApp(appInfo: WXApiInfo?) {
|
|
|
+ if appInfo == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mAppInfo = appInfo!
|
|
|
#if DEBUG
|
|
|
WXApi.startLog(by: .detail) { msg in
|
|
|
BFLog(message: "微信回调Log--\(msg)")
|
|
@@ -355,68 +354,3 @@ extension PQSingletoWXApiUtil: WXApiDelegate {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// MARK: - 友盟相关工具类
|
|
|
-
|
|
|
-/// 友盟相关工具类
|
|
|
-class PQUMApiUtil: NSObject {
|
|
|
- class func register() {
|
|
|
- // 注册友盟
|
|
|
- UMConfigure.setEncryptEnabled(true)
|
|
|
- // 初始化友盟所有组件产品
|
|
|
- UMConfigure.initWithAppkey(PQBFConfig.shared.umAppkey, channel: PQBFConfig.shared.channelID)
|
|
|
- #if DEBUG
|
|
|
- UMConfigure.setLogEnabled(true)
|
|
|
- #endif
|
|
|
- PQLog(message: "友盟版本号:\(UMConfigure.version())")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// MARK: - 统计分析工具类
|
|
|
-
|
|
|
-/// 统计分析工具类
|
|
|
-class PQAnalyticsUtil: NSObject {
|
|
|
- /// 页面时长统计
|
|
|
- /// - Parameters:
|
|
|
- /// - pageName: 页面名称
|
|
|
- /// - isBegin: 开始/结束
|
|
|
- /// - Returns: <#description#>
|
|
|
- class func pageAutoTimeAnalytics(pageName: String?, isBegin: Bool) {
|
|
|
- if pageName == nil || pageName?.count ?? 0 <= 0 {
|
|
|
- return
|
|
|
- }
|
|
|
- PQLog(message: "页面时长统计:isBegin = \(isBegin),pageName = \(pageName ?? "")")
|
|
|
- if isBegin {
|
|
|
- MobClick.beginLogPageView(pageName)
|
|
|
- } else {
|
|
|
- MobClick.endLogPageView(pageName)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// 事件统计
|
|
|
- /// - Parameters:
|
|
|
- /// - eventId: 事件ID
|
|
|
- /// - attributes: 事件属性
|
|
|
- /// - Returns: <#description#>
|
|
|
- class func eventAnalytics(eventId: String?, attributes: [String: Any]?) {
|
|
|
- if eventId == nil || eventId?.count ?? 0 <= 0 {
|
|
|
- return
|
|
|
- }
|
|
|
- PQLog(message: "自定义事件统计:eventId = \(eventId ?? ""),attributes = \(attributes ?? [:])")
|
|
|
- if attributes != nil && attributes?.count ?? 0 > 0 {
|
|
|
- MobClick.event(eventId!, attributes: attributes!)
|
|
|
- } else {
|
|
|
- MobClick.event(eventId!)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// 账号统计
|
|
|
- /// - Returns: <#description#>
|
|
|
- class func accountAnalytics() {
|
|
|
- if PQLoginUserInfo.shared.accessToken.count > 0 {
|
|
|
- MobClick.profileSignIn(withPUID: PQLoginUserInfo.shared.accessToken, provider: cPrimarykey)
|
|
|
- } else {
|
|
|
- MobClick.profileSignOff()
|
|
|
- }
|
|
|
- }
|
|
|
-}
|