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 | 54 | let tencentAppId: String = "1112336586" |
| 55 | 55 | //微信 appId |
| 56 | 56 | let wxAppId: String = "wx82209bed331a549b" |
| 57 | +//微信 appId | |
| 58 | +let wxSecret: String = "5b124a6e88f6f0928b55fbaf786f471f" | |
| 57 | 59 | |
| 58 | 60 | ///APP 环境类型 |
| 59 | 61 | enum CNLiveEnvironment { | ... | ... |
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
| ... | ... | @@ -9,6 +9,7 @@ import Foundation |
| 9 | 9 | import UIKit |
| 10 | 10 | import SnapKit |
| 11 | 11 | import APButton |
| 12 | +import CNLiveShareToolKit | |
| 12 | 13 | |
| 13 | 14 | class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 14 | 15 | |
| ... | ... | @@ -65,6 +66,18 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 65 | 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 | 81 | var is_agree : Bool = false //是否同意协议 |
| 69 | 82 | var country : String = "86" |
| 70 | 83 | var timeOut = 30//多少秒计时器 |
| ... | ... | @@ -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 | 226 | func setupLoginButtonView() { |
| 208 | 227 | |
| 209 | 228 | let selectButton = HotButton(type: .custom) |
| ... | ... | @@ -239,16 +258,25 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 239 | 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 | 269 | view.addSubview(loginButton) |
| 244 | 270 | loginButton.snp.makeConstraints { make in |
| 245 | 271 | make.centerX.equalTo(view) |
| 246 | - make.bottom.equalTo(textView.snp.top).offset(-10) | |
| 272 | + make.bottom.equalTo(wxButton.snp.top).offset(-10) | |
| 247 | 273 | make.left.equalTo(40) |
| 248 | 274 | make.right.equalTo(-40) |
| 249 | 275 | make.height.equalTo(40) |
| 250 | 276 | } |
| 277 | + | |
| 251 | 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 | 302 | is_agree = sender.isSelected |
| 275 | 303 | if is_agree { |
| 276 | 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 | 306 | } else { |
| 278 | 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 | 23 | // Override point for customization after application launch. |
| 24 | 24 | //tencentAppId wxAppId |
| 25 | 25 | CNLiveShareManager.registeredShareView(whenDidFinishLaunch: universalLinkURL, appId: APPId, tencentAppId: tencentAppId, wxAppId: wxAppId, wxSecret: "", weiBoAppId: "") |
| 26 | + CNLiveShareImageManager().wxAppid = wxAppId | |
| 27 | + CNLiveShareImageManager().wxSecret = wxSecret | |
| 26 | 28 | |
| 27 | 29 | CNLiveNetworking.networkStatus { status in |
| 28 | 30 | ... | ... |
metaCode/metaCode.entitlements
| ... | ... | @@ -2,6 +2,10 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | + <key>com.apple.developer.applesignin</key> | |
| 6 | + <array> | |
| 7 | + <string>Default</string> | |
| 8 | + </array> | |
| 5 | 9 | <key>com.apple.developer.associated-domains</key> |
| 6 | 10 | <array> |
| 7 | 11 | <string>applinks:metacode.cnlive.com</string> | ... | ... |