Commit 86731c4f109406f0ed3fb09f89957941e8a80032
1 parent
b06a975c
本机号码一键登录功能 , 12promax 版本18.6.10 测试报错 ,客服反馈线上同版本手机成功 , 暂时忽略
Showing
18 changed files
with
268 additions
and
8 deletions
Podfile
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # platform :ios, '9.0' |
| 3 | 3 | source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' |
| 4 | 4 | #source 'https://github.com/CocoaPods/Specs.git' |
| 5 | -source 'https://cdn.cocoapods.org' | |
| 5 | +#source 'https://cdn.cocoapods.org' | |
| 6 | 6 | |
| 7 | 7 | source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git' |
| 8 | 8 | source 'http://bj.gitlab.cnlive.com/DSIOSTeam/DSSpecRepos.git' |
| ... | ... | @@ -106,6 +106,9 @@ target 'metaCode' do |
| 106 | 106 | 'CN' #必须引入 |
| 107 | 107 | ] |
| 108 | 108 | |
| 109 | + #阿里云号码管理SDK封装 | |
| 110 | + pod 'CNLiveAliNumberAuthenticationSDK','1.0.0' | |
| 111 | + | |
| 109 | 112 | #依赖三方私有库,如果里面有.a的时候加上这个 |
| 110 | 113 | pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} |
| 111 | 114 | end |
| ... | ... | @@ -117,7 +120,8 @@ target 'metaCode' do |
| 117 | 120 | dir_web = File.join(installer.sandbox.pod_dir('WebViewJavascriptBridge'), 'WebViewJavascriptBridge') |
| 118 | 121 | Dir.foreach(dir_web) {|x| |
| 119 | 122 | real_path = File.join(dir_web, x) |
| 120 | - if (!File.directory?(real_path) && File.exists?(real_path)) | |
| 123 | + if (!File.directory?(real_path) && File.exist?(real_path))# if (!File.directory?(real_path) && File.exists?(real_path)) exists?,这是在 Ruby 中检查文件是否存在的方法,但在 Ruby 3.x 版本中,该方法已被弃用并从 File 类中移除 ,替换为 File.exist?(path)(没有 's')。25年6月11日 | |
| 124 | + | |
| 121 | 125 | if(x == 'WebViewJavascriptBridge.h' || x == 'WebViewJavascriptBridge.m') |
| 122 | 126 | File.delete(real_path) |
| 123 | 127 | end | ... | ... |
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -276,6 +276,7 @@ |
| 276 | 276 | 19FA20192AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */; }; |
| 277 | 277 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */; }; |
| 278 | 278 | 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; |
| 279 | + 3401CF462DF969410019C16F /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3401CF452DF969410019C16F /* ATAuthSDK.bundle */; }; | |
| 279 | 280 | 3D30BC782DBF8A2500CA9AD3 /* CNLiveZFPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D30BC772DBF8A2500CA9AD3 /* CNLiveZFPlayerController.swift */; }; |
| 280 | 281 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */; }; |
| 281 | 282 | 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */; }; |
| ... | ... | @@ -684,6 +685,8 @@ |
| 684 | 685 | 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideRecommendCell.swift; sourceTree = "<group>"; }; |
| 685 | 686 | 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTodayRecommendCell.swift; sourceTree = "<group>"; }; |
| 686 | 687 | 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModelLayout.swift; sourceTree = "<group>"; }; |
| 688 | + 3401CF452DF969410019C16F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; }; | |
| 689 | + 342676E42DF0440800111771 /* Network.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Network.framework; path = System/Library/Frameworks/Network.framework; sourceTree = SDKROOT; }; | |
| 687 | 690 | 3D30BC772DBF8A2500CA9AD3 /* CNLiveZFPlayerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveZFPlayerController.swift; sourceTree = "<group>"; }; |
| 688 | 691 | 7902A8BA2B551C6E009AA653 /* metaCode.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = metaCode.entitlements; sourceTree = "<group>"; }; |
| 689 | 692 | 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineAuthResultViewController.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -1878,6 +1881,7 @@ |
| 1878 | 1881 | 7963988E2A260C0100D045EB /* Resources */ = { |
| 1879 | 1882 | isa = PBXGroup; |
| 1880 | 1883 | children = ( |
| 1884 | + 3401CF452DF969410019C16F /* ATAuthSDK.bundle */, | |
| 1881 | 1885 | 790D01A62A2DF84C00C5978D /* countries.plist */, |
| 1882 | 1886 | 7C4931332A307B58000E44B4 /* slide_down.gif */, |
| 1883 | 1887 | 7C4931352A307B60000E44B4 /* slide_up.gif */, |
| ... | ... | @@ -2175,6 +2179,7 @@ |
| 2175 | 2179 | 83CDF822130E4A93D9977EBC /* Frameworks */ = { |
| 2176 | 2180 | isa = PBXGroup; |
| 2177 | 2181 | children = ( |
| 2182 | + 342676E42DF0440800111771 /* Network.framework */, | |
| 2178 | 2183 | 79B6CCD82B58C5B50041B445 /* WechatOpenSDK-XCFramework.xcframework */, |
| 2179 | 2184 | 7963DEF32B5508540086037D /* CNLiveShareToolKit.framework */, |
| 2180 | 2185 | 7963DEF12B5507830086037D /* libsqlite3.tbd */, |
| ... | ... | @@ -2295,6 +2300,7 @@ |
| 2295 | 2300 | buildActionMask = 2147483647; |
| 2296 | 2301 | files = ( |
| 2297 | 2302 | 818163C82A25CFCF00579C86 /* LaunchScreen.storyboard in Resources */, |
| 2303 | + 3401CF462DF969410019C16F /* ATAuthSDK.bundle in Resources */, | |
| 2298 | 2304 | 790D01A72A2DF84C00C5978D /* countries.plist in Resources */, |
| 2299 | 2305 | 818163C52A25CFCF00579C86 /* Assets.xcassets in Resources */, |
| 2300 | 2306 | 19F2E53F2BB3F863006AAAD6 /* LaunchImage.png in Resources */, |
| ... | ... | @@ -3023,7 +3029,7 @@ |
| 3023 | 3029 | "\"${PODS_ROOT}/PLPlayerKit/Pod/Library\"", |
| 3024 | 3030 | "\"${PODS_CONFIGURATION_BUILD_DIR}/ZFPlayer\"", |
| 3025 | 3031 | "\"${PODS_ROOT}/WechatOpenSDK/OpenSDK1.8.7.1\"", |
| 3026 | - "\"\"${PODS_ROOT}/CNLiveTencentopenapi/CNLiveTencentopenapi/Classes\"", | |
| 3032 | + "\"\"${PODS_ROOT}/CNLiveTencentopenapi/CNLiveTencentopenapi/Classes\" $(PROJECT_DIR)/metaCode", | |
| 3027 | 3033 | ); |
| 3028 | 3034 | GENERATE_INFOPLIST_FILE = YES; |
| 3029 | 3035 | INFOPLIST_FILE = metaCode/Info.plist; |
| ... | ... | @@ -3278,7 +3284,7 @@ |
| 3278 | 3284 | "\"${PODS_ROOT}/PLPlayerKit/Pod/Library\"", |
| 3279 | 3285 | "\"${PODS_CONFIGURATION_BUILD_DIR}/ZFPlayer\"", |
| 3280 | 3286 | "\"${PODS_ROOT}/WechatOpenSDK/OpenSDK1.8.7.1\"", |
| 3281 | - "\"\"${PODS_ROOT}/CNLiveTencentopenapi/CNLiveTencentopenapi/Classes\"", | |
| 3287 | + "\"\"${PODS_ROOT}/CNLiveTencentopenapi/CNLiveTencentopenapi/Classes\" $(PROJECT_DIR)/metaCode", | |
| 3282 | 3288 | ); |
| 3283 | 3289 | GENERATE_INFOPLIST_FILE = YES; |
| 3284 | 3290 | INFOPLIST_FILE = metaCode/Info.plist; | ... | ... |
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
| ... | ... | @@ -12,6 +12,34 @@ import APButton |
| 12 | 12 | import CNLiveShareToolKit |
| 13 | 13 | import AuthenticationServices |
| 14 | 14 | import CNLivePayCostModule |
| 15 | +import CNLiveAliNumberAuthenticationSDK | |
| 16 | + | |
| 17 | + | |
| 18 | +/*************** 号码认证授权页相关返回码 START ***************/ | |
| 19 | + | |
| 20 | +/// 唤起授权页成功 | |
| 21 | +let PNSCodeLoginControllerPresentSuccess = "600001" | |
| 22 | +/// 唤起授权页失败 | |
| 23 | +let PNSCodeLoginControllerPresentFailed = "600002" | |
| 24 | +/// 授权页已加载时不允许调用加速或预取号接口 | |
| 25 | +let PNSCodeCallPreLoginInAuthPage = "600026" | |
| 26 | +/// 点击返回,⽤户取消一键登录 | |
| 27 | +let PNSCodeLoginControllerClickCancel = "700000" | |
| 28 | +/// 点击切换按钮,⽤户取消免密登录 | |
| 29 | +let PNSCodeLoginControllerClickChangeBtn = "700001" | |
| 30 | +/// 点击登录按钮事件 | |
| 31 | +let PNSCodeLoginControllerClickLoginBtn = "700002" | |
| 32 | +/// 点击CheckBox事件 | |
| 33 | +let PNSCodeLoginControllerClickCheckBoxBtn = "700003" | |
| 34 | +/// 点击协议富文本文字 | |
| 35 | +let PNSCodeLoginControllerClickProtocol = "700004" | |
| 36 | +/// 中断页面消失的时候,也就是suspendDisMissVC设置为YES的时候,点击左上角返回按钮时透出的状态码 | |
| 37 | +let PNSCodeLoginControllerSuspendDisMissVC = "700010" | |
| 38 | +/// 授权页已销毁 | |
| 39 | +let PNSCodeLoginControllerDeallocVC = "700020" | |
| 40 | + | |
| 41 | + | |
| 42 | +/*************** 号码认证授权页相关返回码 FINISH ***************/ | |
| 15 | 43 | |
| 16 | 44 | class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 17 | 45 | |
| ... | ... | @@ -56,6 +84,15 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 56 | 84 | return veriText |
| 57 | 85 | }() |
| 58 | 86 | |
| 87 | + lazy var oneClickLoginButton: UIButton = { | |
| 88 | + let wxButton = UIButton() | |
| 89 | + wxButton.setTitle("本机号码一键登录 >", for: .normal) | |
| 90 | + wxButton.setTitleColor(HexColor("#464646"), for: .normal) | |
| 91 | + wxButton.titleLabel?.font = BoldFont_16_Fit | |
| 92 | + wxButton.addTarget(self, action: #selector(oneClickLoginActionMothod), for: .touchUpInside) | |
| 93 | + return wxButton | |
| 94 | + }() | |
| 95 | + | |
| 59 | 96 | lazy var loginButton: APButton = { |
| 60 | 97 | let loginButton = APButton() |
| 61 | 98 | loginButton.setTitle("登 录", for: .normal) |
| ... | ... | @@ -396,14 +433,28 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 396 | 433 | make.right.equalTo(view.snp.right).offset(-25) |
| 397 | 434 | } |
| 398 | 435 | |
| 436 | + view.addSubview(oneClickLoginButton) | |
| 437 | + oneClickLoginButton.snp.makeConstraints { make in | |
| 438 | + make.centerX.equalTo(view) | |
| 439 | + make.top.equalTo(tipLabel.snp.bottom).offset(adapt_length(length: 52)) | |
| 440 | + make.left.equalTo(40) | |
| 441 | + make.right.equalTo(-40) | |
| 442 | + make.height.equalTo(30) | |
| 443 | + } | |
| 444 | + | |
| 399 | 445 | view.addSubview(loginButton) |
| 400 | 446 | loginButton.snp.makeConstraints { make in |
| 401 | 447 | make.centerX.equalTo(view) |
| 402 | - make.top.equalTo(tipLabel.snp.bottom).offset(adapt_length(length: 102)) | |
| 448 | + make.top.equalTo(oneClickLoginButton.snp.bottom).offset(10) | |
| 403 | 449 | make.left.equalTo(40) |
| 404 | 450 | make.right.equalTo(-40) |
| 405 | 451 | make.height.equalTo(40) |
| 406 | 452 | } |
| 453 | + | |
| 454 | + TXCommonHandler.sharedInstance().accelerateLoginPage(withTimeout: 3.0) { resultDic in | |
| 455 | + print(resultDic) | |
| 456 | + } | |
| 457 | + | |
| 407 | 458 | if WXApi.isWXAppInstalled(){ |
| 408 | 459 | view.addSubview(wxButton) |
| 409 | 460 | }else{ |
| ... | ... | @@ -580,6 +631,116 @@ extension CNLiveLoginViewController { |
| 580 | 631 | } |
| 581 | 632 | } |
| 582 | 633 | |
| 634 | + @objc func oneClickLoginActionMothod(sender : UIButton) { | |
| 635 | + //一键登录 | |
| 636 | + // 假设TXCustomModel是一个已定义的Swift类,且具有相应的属性 | |
| 637 | + let model = TXCustomModel() | |
| 638 | + model.supportedInterfaceOrientations = .portrait | |
| 639 | + model.suspendDisMissVC = true | |
| 640 | + model.navColor = UIColor(red:0.33, green:0.55, blue:0.97, alpha:1.00) | |
| 641 | + | |
| 642 | + let attributes: [NSAttributedString.Key: Any] = [ | |
| 643 | + .foregroundColor: UIColor.white, | |
| 644 | + .font: UIFont.systemFont(ofSize: 20.0) | |
| 645 | + ] | |
| 646 | + model.navTitle = NSAttributedString(string: "一键登录", attributes: attributes) | |
| 647 | + model.navBackImage = UIImage(named: "ATAuthSDK.bundle/icon_nav_back_light")! | |
| 648 | + model.logoImage = UIImage(named: "icon_90")! | |
| 649 | + model.changeBtnIsHidden = true | |
| 650 | + model.privacyOne = ["用户协议", "https://wjjh5.cnlive.com/yuanmaYhxy.html"] | |
| 651 | + model.privacyTwo = ["隐私政策", "https://wjjh5.cnlive.com/yuanmaYszc.html"] | |
| 652 | + | |
| 653 | + // 创建关键帧动画 | |
| 654 | + let animation = CAKeyframeAnimation(keyPath: "transform.translation.y") | |
| 655 | + animation.values = [-0.0, -10.0, 10.0, -10.0, 5.0, -5.0, 0.0] | |
| 656 | + animation.keyTimes = [NSNumber(value: 0),NSNumber(value: 1/6.0),NSNumber(value: 2/6.0),NSNumber(value: 3/6.0),NSNumber(value: 4/6.0),NSNumber(value: 5/6.0),NSNumber(value: 1)] | |
| 657 | + animation.timingFunctions = [ | |
| 658 | + CAMediaTimingFunction(name: .easeOut), | |
| 659 | + CAMediaTimingFunction(name: .easeOut), | |
| 660 | + CAMediaTimingFunction(name: .easeOut), | |
| 661 | + CAMediaTimingFunction(name: .easeOut), | |
| 662 | + CAMediaTimingFunction(name: .easeOut), | |
| 663 | + CAMediaTimingFunction(name: .easeOut) | |
| 664 | + ] | |
| 665 | + animation.duration = 0.5 | |
| 666 | + | |
| 667 | + model.checkboxAnimation = animation | |
| 668 | + | |
| 669 | + // 切换到其他方式按钮 | |
| 670 | + let button1: UIButton = UIButton(type: .system) | |
| 671 | + button1.setTitle("切换到其他方式", for: .normal) | |
| 672 | + button1.setTitleColor(.lightGray, for: .normal) | |
| 673 | + button1.titleLabel?.font = Font_14 | |
| 674 | + button1.addTarget(self, action: #selector(changeOtherLoginActionMethod), for: .touchUpInside) | |
| 675 | + | |
| 676 | + model.customViewBlock = { superCustomView in | |
| 677 | + superCustomView.addSubview(button1) | |
| 678 | + } | |
| 679 | + model.customViewLayoutBlock = { screenSize, contentViewFrame, navFrame, titleBarFrame, logoFrame, sloganFrame, numberFrame, loginFrame, changeBtnFrame, privacyFrame in | |
| 680 | + button1.frame = CGRect(x: loginFrame.minX, | |
| 681 | + y: loginFrame.maxY + 20, | |
| 682 | + width: loginFrame.width, | |
| 683 | + height: 30) | |
| 684 | + } | |
| 685 | + | |
| 686 | + TXCommonHandler.sharedInstance().getLoginToken(withTimeout: 3.0, controller: self, model: model) { resultDic in | |
| 687 | + print("一键登录结果:\(resultDic)") | |
| 688 | + if let resultCode = resultDic["resultCode"] as? String{ | |
| 689 | + if PNSCodeLoginControllerPresentSuccess == resultCode{ | |
| 690 | + print("授权页拉起成功回调:\(resultDic)") | |
| 691 | + }else if PNSCodeLoginControllerClickCancel == resultCode || | |
| 692 | + PNSCodeLoginControllerClickChangeBtn == resultCode || | |
| 693 | + PNSCodeLoginControllerClickLoginBtn == resultCode || | |
| 694 | + PNSCodeLoginControllerClickCheckBoxBtn == resultCode || | |
| 695 | + PNSCodeLoginControllerClickProtocol == resultCode || | |
| 696 | + PNSCodeLoginClickPrivacyAlertView == resultCode || | |
| 697 | + PNSCodeLoginPrivacyAlertViewClickContinue == resultCode || | |
| 698 | + PNSCodeLoginPrivacyAlertViewClose == resultCode || | |
| 699 | + PNSCodeLoginPrivacyAlertViewPrivacyContentClick == resultCode{ | |
| 700 | + print("页面点击事件回调:\(resultDic)") | |
| 701 | + }else if "700020" == resultCode{ | |
| 702 | + print("页面已完全销毁dealloc:\(resultDic)") | |
| 703 | + }else if PNSCodeSuccess == resultCode{ | |
| 704 | + print("获取LoginToken成功回调:\(resultDic)") | |
| 705 | + let token = resultDic["token"] as! String | |
| 706 | + //"接下来可以拿着Token去服务端换取手机号,有了手机号就可以登录,SDK提供服务到此结束" | |
| 707 | +// print(token) | |
| 708 | + TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) {} | |
| 709 | + CNLiveLoginViewModel.oneClickLogin(accessToken: token, frmld: "apple") { result, status in | |
| 710 | + if status == .success{//result:UserInfoModel | |
| 711 | + //成功 | |
| 712 | + NotificationCenter.default.post(name: Notification.Name.LoginManage.CNLiveLoginSuccessNotification, object: nil) | |
| 713 | + metaAppDelegate.isLogin = true | |
| 714 | + if self.navBackButton.isHidden{ | |
| 715 | + //退出登录后->登录 | |
| 716 | + let window = UIApplication.shared.delegate?.window | |
| 717 | + window??.rootViewController = CNLiveBaseTabBarViewController.init() | |
| 718 | + }else{ | |
| 719 | + //未登录push过来的 | |
| 720 | + self.navigationController?.popViewController(animated: true) | |
| 721 | + } | |
| 722 | + }else{ | |
| 723 | + let window = UIApplication.shared.delegate?.window | |
| 724 | + window??.rootViewController = CNLiveBaseTabBarViewController.init() | |
| 725 | + } | |
| 726 | + | |
| 727 | + } | |
| 728 | + }else if PNSCodeLoginControllerSuspendDisMissVC == resultCode{ | |
| 729 | + TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) {} | |
| 730 | + }else { | |
| 731 | + print("获取LoginToken或拉起授权页失败回调:\(resultDic)") | |
| 732 | + showMessage(message: "无法一键登录,错误码:\(resultCode)") | |
| 733 | + } | |
| 734 | + } | |
| 735 | + | |
| 736 | + } | |
| 737 | + } | |
| 738 | + | |
| 739 | + @objc func changeOtherLoginActionMethod() { | |
| 740 | + print("获取changeOtherLoginActionMethod") | |
| 741 | + TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) {} | |
| 742 | + } | |
| 743 | + | |
| 583 | 744 | @objc func sendLoginActionMothod(sender : UIButton) { |
| 584 | 745 | if !is_agree { |
| 585 | 746 | showMessage(message: "请先阅读并同意协议") | ... | ... |
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
| ... | ... | @@ -354,5 +354,68 @@ class CNLiveLoginViewModel : NSObject { |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | + | |
| 358 | + | |
| 359 | + /** | |
| 360 | + * @abstract App 一键登录 | |
| 361 | + * | |
| 362 | + * @param accessToken 阿里云号码认证token | |
| 363 | + * @param block 回调 | |
| 364 | + */ | |
| 365 | + static func oneClickLogin(accessToken: String, frmld:String, resultBlock: @escaping downSlideResultBlock) { | |
| 366 | + showLoading(message: "") | |
| 367 | + | |
| 368 | + // 获取当前时间戳(自1970年以来的秒数) | |
| 369 | + let timeInterval = Date().timeIntervalSince1970 | |
| 370 | + // 将时间戳转换为字符串 | |
| 371 | + let timeString = "\(Int64(timeInterval))" | |
| 372 | + let bundleIdentifier = Bundle.main.bundleIdentifier | |
| 373 | + let shortVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String | |
| 374 | + | |
| 375 | + let param = NSMutableDictionary() | |
| 376 | + param.setValue(accessToken, forKey: "accessToken") | |
| 377 | + param.setValue(CNLiveBusinessTools.getUidForStat(Date()), forKey: "uuid") | |
| 378 | + param.setValue(frmld, forKey: "frmId") | |
| 379 | + param.setValue("i", forKey: "clientPlat") | |
| 380 | + param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId") | |
| 381 | + param.setValue("i", forKey: "plat") | |
| 382 | + param.setValue(shortVersion, forKey: "ver") | |
| 383 | + param.setValue(bundleIdentifier, forKey: "platform_id") | |
| 384 | + param.setValue(timeString, forKey: "timestamp") | |
| 385 | + | |
| 386 | + let signStr = CNLiveBusinessTools.signvalue(param as! [AnyHashable : Any]) | |
| 387 | + let string1 = "\(signStr)&key=\(CNLiveMCEnvironmentManager.shared.appKey)" | |
| 388 | + let signString1 = CNLiveBusinessTools.sha1(string1).uppercased() | |
| 389 | + param.setValue(signString1, forKey: "sign") | |
| 390 | + | |
| 391 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/getMobileAndLoginApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 392 | + hiddenLoading() | |
| 393 | + if (error == nil) { | |
| 394 | + let resp = result as! NSDictionary | |
| 395 | + let errorCode = resp["errorCode"] | |
| 396 | + if (errorCode as! String == "0") { | |
| 397 | + if resp.allKeys.contains(where: { item in | |
| 398 | + return item as! String == "data" | |
| 399 | + }) { | |
| 400 | + let userInfoModel = dictionaryToModel(resp as! [String : Any], UserInfoModel.self,"data") | |
| 401 | + UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel) | |
| 402 | + UserDefaults.standard.set(true,forKey: "is_login") | |
| 403 | + RangersAPM.setUserID(UserInfoManager.shared.userInfo.uid) | |
| 404 | + resultBlock(userInfoModel, .success) | |
| 405 | + } | |
| 406 | + } else { | |
| 407 | + if errorCode as? String == "42013"{ | |
| 408 | + resultBlock(errorCode ?? "", .failed) | |
| 409 | + }else{ | |
| 410 | + resultBlock(NSNull(), .failed) | |
| 411 | + } | |
| 412 | + } | |
| 413 | + } else { | |
| 414 | + showMessage(message: "登录失败") | |
| 415 | + resultBlock(NSNull(), .failed) | |
| 416 | + } | |
| 417 | + | |
| 418 | + } | |
| 419 | + } | |
| 357 | 420 | |
| 358 | 421 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveInfoShowViewController.swift
| ... | ... | @@ -58,10 +58,10 @@ class CNLiveInfoShowViewController: CNLiveBaseViewController, WKNavigationDelega |
| 58 | 58 | var attrString = "" |
| 59 | 59 | switch _show_type { |
| 60 | 60 | case .service: |
| 61 | - titleName = "APP用户服务协议" | |
| 61 | + titleName = "用户协议" | |
| 62 | 62 | attrString = "https://wjjh5.cnlive.com/yuanmaYhxy.html" |
| 63 | 63 | case .privacy: |
| 64 | - titleName = "个人信息保护政策" | |
| 64 | + titleName = "隐私政策" | |
| 65 | 65 | attrString = "https://wjjh5.cnlive.com/yuanmaYszc.html" |
| 66 | 66 | case .yinsi: |
| 67 | 67 | titleName = "隐私协议" | ... | ... |
metaCode/Classes/Other/AppDelegate.swift
| ... | ... | @@ -14,7 +14,7 @@ import CNLiveEnvironment |
| 14 | 14 | import CNLivePayCostModule |
| 15 | 15 | import JFHeroBrowser |
| 16 | 16 | import ZFPlayer |
| 17 | - | |
| 17 | +import CNLiveAliNumberAuthenticationSDK | |
| 18 | 18 | |
| 19 | 19 | @main |
| 20 | 20 | class AppDelegate: UIResponder, UIApplicationDelegate { |
| ... | ... | @@ -56,6 +56,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 56 | 56 | CNLiveShareImageManager().wxSecret = wxSecret |
| 57 | 57 | |
| 58 | 58 | |
| 59 | + //阿里云号码认证 | |
| 60 | + TXCommonHandler.sharedInstance().setAuthSDKInfo("IJJp981/KavMTpYzLMiHJzEdH8T4CPO1QCONwhUvwdne4pTj/0YZ8qaPnaTqVwI8omBT2abEE+a8pRGKFpDrrIDnV3sPGvZ0kMOqvwGvD7fDYfMNY7tTkG1ln+EQqFNmiQyHhRmLDp2v1ZDaIuG8+viOA6vbIeTRsBS9vhnnrP62wlTXm0bZygr75tXu57dsN3dR8cVzu1x9oVVsQPOEOB5o0PiyBBSC1AhwTYnX9utGuYdnCg0UDy+Atwtq39WF2fdhDg5uZXw=") { resultDic in | |
| 61 | + print("设置密钥结果:\(resultDic)") | |
| 62 | + } | |
| 63 | + | |
| 59 | 64 | CNLiveNetworking.networkStatus { status in |
| 60 | 65 | |
| 61 | 66 | if(status == .notReachable){ | ... | ... |
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_check@2x.png
0 → 100644
2.67 KB
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_check@3x.png
0 → 100644
4.66 KB
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_close_gray@2x.png
0 → 100644
240 Bytes
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_close_gray@3x.png
0 → 100644
309 Bytes
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_nav_back_gray@2x.png
0 → 100755
1.03 KB
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_nav_back_gray@3x.png
0 → 100755
1.57 KB
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_nav_back_light@2x.png
0 → 100755
573 Bytes
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_nav_back_light@3x.png
0 → 100755
950 Bytes
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_uncheck@2x.png
0 → 100644
1.96 KB
metaCode/Classes/Resources/ATAuthSDK.bundle/icon_uncheck@3x.png
0 → 100644
3.74 KB
metaCode/Supporting Files/Assets.xcassets/LoginPage/icon_90.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "icon_90@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/LoginPage/icon_90.imageset/icon_90@2x.png
0 → 100644
25.7 KB