Commit 340fbb99fb287da734027e40de985070f2c166e6
1 parent
6dadae49
提交修改
Showing
5 changed files
with
43 additions
and
2 deletions
metaCode/Classes/Environment/CNLiveEnvironment.swift
| @@ -54,6 +54,8 @@ let universalLinkURL: String = "https://metacode.cnlive.com" | @@ -54,6 +54,8 @@ let universalLinkURL: String = "https://metacode.cnlive.com" | ||
| 54 | let tencentAppId: String = "1112336586" | 54 | let tencentAppId: String = "1112336586" |
| 55 | //微信 appId | 55 | //微信 appId |
| 56 | let wxAppId: String = "wx82209bed331a549b" | 56 | let wxAppId: String = "wx82209bed331a549b" |
| 57 | +//微信 appId | ||
| 58 | +let wxSecret: String = "5b124a6e88f6f0928b55fbaf786f471f" | ||
| 57 | 59 | ||
| 58 | ///APP 环境类型 | 60 | ///APP 环境类型 |
| 59 | enum CNLiveEnvironment { | 61 | enum CNLiveEnvironment { |
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
| @@ -9,6 +9,7 @@ import Foundation | @@ -9,6 +9,7 @@ import Foundation | ||
| 9 | import UIKit | 9 | import UIKit |
| 10 | import SnapKit | 10 | import SnapKit |
| 11 | import APButton | 11 | import APButton |
| 12 | +import CNLiveShareToolKit | ||
| 12 | 13 | ||
| 13 | class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | 14 | class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 14 | 15 | ||
| @@ -65,6 +66,18 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | @@ -65,6 +66,18 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | ||
| 65 | return loginButton | 66 | return loginButton |
| 66 | }() | 67 | }() |
| 67 | 68 | ||
| 69 | + lazy var wxButton: APButton = { | ||
| 70 | + let wxButton = APButton() | ||
| 71 | + wxButton.setTitle("微信登录", for: .normal) | ||
| 72 | + wxButton.setTitleColor(.white, for: .normal) | ||
| 73 | + wxButton.titleLabel?.font = BoldFont_16_Fit | ||
| 74 | + wxButton.layer.cornerRadius = 20 | ||
| 75 | + wxButton.activityIndicator.color = .white | ||
| 76 | + wxButton.layer.masksToBounds = true | ||
| 77 | + wxButton.addTarget(self, action: #selector(sendWXLoginActionMothod), for: .touchUpInside) | ||
| 78 | + return wxButton | ||
| 79 | + }() | ||
| 80 | + | ||
| 68 | var is_agree : Bool = false //是否同意协议 | 81 | var is_agree : Bool = false //是否同意协议 |
| 69 | var country : String = "86" | 82 | var country : String = "86" |
| 70 | var timeOut = 30//多少秒计时器 | 83 | var timeOut = 30//多少秒计时器 |
| @@ -204,6 +217,12 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | @@ -204,6 +217,12 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | ||
| 204 | } | 217 | } |
| 205 | } | 218 | } |
| 206 | 219 | ||
| 220 | + @objc func sendWXLoginActionMothod() { | ||
| 221 | + CNLiveShareImageManager.send(CNLiveSendAuthRespWX) { resp, userInfo, error in | ||
| 222 | + | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + | ||
| 207 | func setupLoginButtonView() { | 226 | func setupLoginButtonView() { |
| 208 | 227 | ||
| 209 | let selectButton = HotButton(type: .custom) | 228 | let selectButton = HotButton(type: .custom) |
| @@ -239,16 +258,25 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | @@ -239,16 +258,25 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { | ||
| 239 | make.right.equalTo(view.snp.right).offset(-25) | 258 | make.right.equalTo(view.snp.right).offset(-25) |
| 240 | } | 259 | } |
| 241 | 260 | ||
| 242 | - | 261 | + view.addSubview(wxButton) |
| 262 | + wxButton.snp.makeConstraints { make in | ||
| 263 | + make.centerX.equalTo(view) | ||
| 264 | + make.bottom.equalTo(textView.snp.top).offset(-10) | ||
| 265 | + make.left.equalTo(40) | ||
| 266 | + make.right.equalTo(-40) | ||
| 267 | + make.height.equalTo(40) | ||
| 268 | + } | ||
| 243 | view.addSubview(loginButton) | 269 | view.addSubview(loginButton) |
| 244 | loginButton.snp.makeConstraints { make in | 270 | loginButton.snp.makeConstraints { make in |
| 245 | make.centerX.equalTo(view) | 271 | make.centerX.equalTo(view) |
| 246 | - make.bottom.equalTo(textView.snp.top).offset(-10) | 272 | + make.bottom.equalTo(wxButton.snp.top).offset(-10) |
| 247 | make.left.equalTo(40) | 273 | make.left.equalTo(40) |
| 248 | make.right.equalTo(-40) | 274 | make.right.equalTo(-40) |
| 249 | make.height.equalTo(40) | 275 | make.height.equalTo(40) |
| 250 | } | 276 | } |
| 277 | + | ||
| 251 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | 278 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) |
| 279 | + wxButton.setGradient(colors: [UIColor(red: 35/255.0, green: 203/255.0, blue: 105/255.0, alpha: 0.3),UIColor(red: 13/255.0, green: 179/255.0, blue: 85/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | ||
| 252 | } | 280 | } |
| 253 | } | 281 | } |
| 254 | 282 | ||
| @@ -274,8 +302,10 @@ extension CNLiveLoginViewController { | @@ -274,8 +302,10 @@ extension CNLiveLoginViewController { | ||
| 274 | is_agree = sender.isSelected | 302 | is_agree = sender.isSelected |
| 275 | if is_agree { | 303 | if is_agree { |
| 276 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | 304 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) |
| 305 | + wxButton.setGradient(colors: [UIColor(red: 35/255.0, green: 203/255.0, blue: 105/255.0, alpha: 1),UIColor(red: 13/255.0, green: 179/255.0, blue: 85/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | ||
| 277 | } else { | 306 | } else { |
| 278 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | 307 | loginButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) |
| 308 | + wxButton.setGradient(colors: [UIColor(red: 35/255.0, green: 203/255.0, blue: 105/255.0, alpha: 0.3),UIColor(red: 13/255.0, green: 179/255.0, blue: 85/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | ||
| 279 | } | 309 | } |
| 280 | } | 310 | } |
| 281 | 311 |
metaCode/Classes/Main/LoginPage/View/CNLiveLoginAuthView.swift
metaCode/Classes/Other/AppDelegate.swift
| @@ -23,6 +23,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | @@ -23,6 +23,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | ||
| 23 | // Override point for customization after application launch. | 23 | // Override point for customization after application launch. |
| 24 | //tencentAppId wxAppId | 24 | //tencentAppId wxAppId |
| 25 | CNLiveShareManager.registeredShareView(whenDidFinishLaunch: universalLinkURL, appId: APPId, tencentAppId: tencentAppId, wxAppId: wxAppId, wxSecret: "", weiBoAppId: "") | 25 | CNLiveShareManager.registeredShareView(whenDidFinishLaunch: universalLinkURL, appId: APPId, tencentAppId: tencentAppId, wxAppId: wxAppId, wxSecret: "", weiBoAppId: "") |
| 26 | + CNLiveShareImageManager().wxAppid = wxAppId | ||
| 27 | + CNLiveShareImageManager().wxSecret = wxSecret | ||
| 26 | 28 | ||
| 27 | CNLiveNetworking.networkStatus { status in | 29 | CNLiveNetworking.networkStatus { status in |
| 28 | 30 |
metaCode/metaCode.entitlements
| @@ -2,6 +2,10 @@ | @@ -2,6 +2,10 @@ | ||
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | <plist version="1.0"> | 3 | <plist version="1.0"> |
| 4 | <dict> | 4 | <dict> |
| 5 | + <key>com.apple.developer.applesignin</key> | ||
| 6 | + <array> | ||
| 7 | + <string>Default</string> | ||
| 8 | + </array> | ||
| 5 | <key>com.apple.developer.associated-domains</key> | 9 | <key>com.apple.developer.associated-domains</key> |
| 6 | <array> | 10 | <array> |
| 7 | <string>applinks:metacode.cnlive.com</string> | 11 | <string>applinks:metacode.cnlive.com</string> |