|
@@ -11,22 +11,20 @@ import UIKit
|
|
|
import UserNotifications
|
|
|
import WechatOpenSDK
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// MARK: - Bugly初始化工具类
|
|
|
+
|
|
|
public class PQSingletoBuglyUtil: NSObject {
|
|
|
public static let shared = PQSingletoBuglyUtil()
|
|
|
-
|
|
|
- public func registerBugly(appID:String) {
|
|
|
-
|
|
|
- let versionName = "\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "1.0.0")"
|
|
|
-
|
|
|
+
|
|
|
+ public func registerBugly(appID: String) {
|
|
|
+ let versionName = "\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "1.0.0")"
|
|
|
+
|
|
|
// 注册bugly
|
|
|
let buglyConfig = BuglyConfig()
|
|
|
buglyConfig.reportLogLevel = .warn
|
|
|
#if DEBUG
|
|
|
buglyConfig.version = versionName + ".6666"
|
|
|
-
|
|
|
+
|
|
|
#else
|
|
|
if PQENVUtil.shared.envMode == .ENVModeOnline {
|
|
|
buglyConfig.version = versionName + "." + versionCode
|
|
@@ -47,6 +45,7 @@ public class PQSingletoBuglyUtil: NSObject {
|
|
|
}
|
|
|
|
|
|
// MARK: - 微信相关工具类
|
|
|
+
|
|
|
// 初始化微信要使用的参数 e.g.
|
|
|
/*
|
|
|
let state: String = "com.piaoquan.pqspeed"
|
|
@@ -62,6 +61,7 @@ public class WXApiInfo: NSObject {
|
|
|
public var universalLink: String = ""
|
|
|
public var scope = ""
|
|
|
}
|
|
|
+
|
|
|
public class PQSingletoWXApiUtil: NSObject {
|
|
|
public static let shared = PQSingletoWXApiUtil()
|
|
|
var openId: String? // openID
|
|
@@ -133,7 +133,7 @@ public class PQSingletoWXApiUtil: NSObject {
|
|
|
let message = WXMediaMessage()
|
|
|
message.title = title ?? ""
|
|
|
message.description = description ?? ""
|
|
|
-
|
|
|
+
|
|
|
ImageDownloader.default.downloadImage(with: URL(string: imageUrl ?? "")!, options: nil) { result in
|
|
|
switch result {
|
|
|
case let .success(imageResult):
|
|
@@ -142,24 +142,24 @@ public class PQSingletoWXApiUtil: NSObject {
|
|
|
let wxMiniObject = WXMiniProgramObject()
|
|
|
wxMiniObject.miniProgramType = PQENVUtil.shared.envMode == .ENVModeOnline ? .release : .test
|
|
|
wxMiniObject.userName = shareWeappRawId ?? cShareWeappRawId
|
|
|
- var preParams: String = ""
|
|
|
- var page: String = ""
|
|
|
+ var homePagePath: String = ""
|
|
|
+ var targetPagePath: String = ""
|
|
|
var isRhythmVideo = 0
|
|
|
if type == 3 {
|
|
|
- preParams = "package-point/show/show"
|
|
|
- page = "pages/post/post"
|
|
|
+ homePagePath = "pages/post/post"
|
|
|
+ targetPagePath = "package-point/show/show"
|
|
|
isRhythmVideo = 1
|
|
|
} else {
|
|
|
- preParams = "user-videos"
|
|
|
- page = "pages/category"
|
|
|
+ homePagePath = "pages/category"
|
|
|
+ targetPagePath = "user-videos"
|
|
|
isRhythmVideo = 0
|
|
|
}
|
|
|
- var params = (preParams + "?id=\(videoId)&tp=share&rootPageSource=\(pageSource.rawValue)&shareDepth=1&rootLaunchShareId=\(shareId)&parentShareId=\(shareId)&shareId=\(shareId)&shareAppType=13&mid=\(getMachineCode())&su=\(BFLoginUserInfo.shared.uid)&isRhythmVideo=\(isRhythmVideo)").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
|
|
+ var params = (targetPagePath + "?id=\(videoId)&tp=share&rootPageSource=\(pageSource.rawValue)&shareDepth=1&rootLaunchShareId=\(shareId)&parentShareId=\(shareId)&shareId=\(shareId)&shareAppType=\(PQBFConfig.shared.appType)&mid=\(getMachineCode())&su=\(BFLoginUserInfo.shared.uid)&isRhythmVideo=\(isRhythmVideo)").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
|
|
["/", "=", "?", "&"].forEach { char in
|
|
|
let custom = CharacterSet(charactersIn: char).inverted
|
|
|
params = params?.addingPercentEncoding(withAllowedCharacters: custom) ?? ""
|
|
|
}
|
|
|
- wxMiniObject.path = "\(page)?jumpPage=" + (params ?? "")
|
|
|
+ wxMiniObject.path = "\(homePagePath)?jumpPage=" + (params ?? "")
|
|
|
wxMiniObject.webpageUrl = "https://piaoquan.yishihui.com/"
|
|
|
wxMiniObject.hdImageData = message.thumbData
|
|
|
message.mediaObject = wxMiniObject
|