Commit 7a421df265a5357f1192390de34aef3a97648466

Authored by zhangxiaowen
1 parent 6fabb5dc

no message

CNLiveLoginModule.podspec
... ... @@ -71,6 +71,7 @@ TODO: 网家家-登录模块.
71 71 s.dependency 'CNLiveServices'
72 72  
73 73 # pod
  74 + s.dependency 'CNLiveSDKs/CNLiveUserSystemSDK', '~> 0.3.1.3' #GitHub所以指定版本号
74 75 s.dependency 'CNLiveTripartiteManagement/QMUIKit'
75 76 s.dependency 'CNLiveTripartiteManagement/YYKit'
76 77 s.dependency 'CNLiveTripartiteManagement/SDWebImage'
... ... @@ -86,4 +87,18 @@ TODO: 网家家-登录模块.
86 87 # 用户信息本地化
87 88 s.dependency 'CNLiveUserManagement'
88 89  
  90 + # 环境库
  91 + s.dependency 'CNLiveEnvironment'
  92 +
  93 + # 数据请求
  94 + s.dependency 'CNLiveRequestBastKit'
  95 +
  96 + # 用户协议
  97 + s.dependency 'CNLiveUserAgreementManager'
  98 +
  99 + # 管理类
  100 + s.dependency 'CNLiveManager'
  101 +
  102 + s.static_framework = true
  103 +
89 104 end
... ...
CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/select_country_close.imageset/Contents.json renamed to CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/login_close.imageset/Contents.json
... ... @@ -6,12 +6,12 @@
6 6 },
7 7 {
8 8 "idiom" : "universal",
9   - "filename" : "select_country_close@2x.png",
  9 + "filename" : "login_close@2x.png",
10 10 "scale" : "2x"
11 11 },
12 12 {
13 13 "idiom" : "universal",
14   - "filename" : "select_country_close@3x.png",
  14 + "filename" : "login_close@3x.png",
15 15 "scale" : "3x"
16 16 }
17 17 ],
... ...
CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/select_country_close.imageset/select_country_close@2x.png renamed to CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/login_close.imageset/login_close@2x.png

2.92 KB

CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/select_country_close.imageset/select_country_close@3x.png renamed to CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets/login_close.imageset/login_close@3x.png

4.14 KB

CNLiveLoginModule/Classes/Controller/CNLiveLoginController.h
... ... @@ -11,7 +11,7 @@
11 11 NS_ASSUME_NONNULL_BEGIN
12 12  
13 13 @interface CNLiveLoginController : UIViewController
14   -@property (nonatomic, assign) BOOL isShow;
  14 +@property (nonatomic, assign) BOOL isShowClose;
15 15  
16 16 @end
17 17  
... ...
CNLiveLoginModule/Classes/Controller/CNLiveLoginController.m
... ... @@ -12,10 +12,11 @@
12 12 #import "QMUIKit.h"
13 13 #import "YYKit.h"
14 14  
  15 +#import "CNLiveUserAgreementManager.h"
  16 +
15 17 #import "CNLiveLoginView.h"
16 18 #import "CNLiveThreeLoginView.h"
17 19 #import "CNLiveBindingTelController.h"//绑定手机号
18   -//#import "XWAgreementManager.h"//协议
19 20 #import "CNLiveCompleteInfoController.h"//修改昵称
20 21  
21 22 #define HexColor(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
... ... @@ -24,6 +25,7 @@
24 25 @property (nonatomic, weak) CNLiveLoginView *loginView;
25 26 @property (nonatomic, weak) CNLiveThreeLoginView *threeLoginView;
26 27 @property (nonatomic, weak) YYLabel *protocol;
  28 +@property (nonatomic, strong) UIButton *close;
27 29  
28 30 @end
29 31  
... ... @@ -43,17 +45,16 @@
43 45 }
44 46  
45 47 - (void)createUI{
46   - CNLiveLoginView *loginView = [[CNLiveLoginView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop+20, self.view.frame.size.width*3/4.0, 400)];
  48 +
  49 + [self.view addSubview:self.close];
  50 +
  51 +
  52 + CNLiveLoginView *loginView = [[CNLiveLoginView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/8.0, NavigationContentTop+20, SCREEN_WIDTH*3/4.0, 400)];
47 53 loginView.delegate = self;
48 54 [self.view addSubview:loginView];
49 55 self.loginView = loginView;
50 56  
51   - CNLiveThreeLoginView *threeLoginView = [[CNLiveThreeLoginView alloc] initWithFrame:CGRectMake(loginView.left, loginView.bottom+20, loginView.width, 100)];
52   - threeLoginView.delegate = self;
53   - [self.view addSubview:threeLoginView];
54   - self.threeLoginView = threeLoginView;
55   -
56   - YYLabel *protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-30-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)];
  57 + YYLabel *protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-30-SafeAreaInsetsConstantForDeviceWithNotch.bottom, SCREEN_WIDTH, 30)];
57 58 protocol.textAlignment = NSTextAlignmentCenter;
58 59 protocol.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
59 60 protocol.font = [UIFont systemFontOfSize:14.0];
... ... @@ -66,17 +67,21 @@
66 67 __weak typeof(self) weakSelf = self;
67 68 [text setTextHighlightRange:NSMakeRange(11, 4) color:[UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
68 69 [weakSelf.view endEditing:YES];
69   -// [XWAgreementManager jumpToAgreementH5WithType:XWAgreementTypeUser];
  70 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementUser];
70 71 }];
71 72 [text setTextHighlightRange:NSMakeRange(text.length-5, 4) color:[UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
72 73 [weakSelf.view endEditing:YES];
73   -// [XWAgreementManager jumpToAgreementH5WithType:XWAgreementTypePrivacy];
74   -
  74 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementPrivacy];
75 75 }];
76 76 protocol.attributedText = text;
77 77 [self.view addSubview:protocol];
78 78 self.protocol = protocol;
79 79  
  80 + CNLiveThreeLoginView *threeLoginView = [[CNLiveThreeLoginView alloc] initWithFrame:CGRectMake(loginView.left, SCREEN_HEIGHT-30-SafeAreaInsetsConstantForDeviceWithNotch.bottom-100-10, loginView.width, 100)];
  81 + threeLoginView.delegate = self;
  82 + [self.view addSubview:threeLoginView];
  83 + self.threeLoginView = threeLoginView;
  84 +
80 85 }
81 86  
82 87 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
... ... @@ -126,7 +131,25 @@
126 131 // Pass the selected object to the new view controller.
127 132 }
128 133 */
  134 +#pragma mark - 响应事件
  135 +- (void)closeDidSelected:(UIButton *)btn{
  136 + [self dismissViewControllerAnimated:YES completion:nil];
  137 +}
  138 +
129 139 #pragma mark - 懒加载
  140 +- (UIButton *)close{
  141 + if (!_close) {
  142 + _close = [UIButton buttonWithType:UIButtonTypeCustom];
  143 + _close.frame = CGRectMake(SCREEN_WIDTH-44-10, StatusBarHeight, 44, 44);
  144 + _close.hidden = !self.isShowClose;
  145 + UIImage *image = [self xw_getImageName:@"login_close" bundleName:@"CNLiveLoginModule" targetClass:[self class]];
  146 + [_close setImage:image forState:UIControlStateNormal];
  147 + [_close addTarget:self action:@selector(closeDidSelected:) forControlEvents:UIControlEventTouchUpInside];
  148 + _close.adjustsImageWhenHighlighted = NO;
  149 + }
  150 + return _close;
  151 +
  152 +}
130 153  
131 154 /**
132 155 * 创建图片
... ...
CNLiveLoginModule/Classes/Module/CNLiveLoginService.m
... ... @@ -8,9 +8,11 @@
8 8  
9 9 #import "CNLiveLoginService.h"
10 10 #import "CNLiveServices.h"
11   -#import "CNLiveLoginController.h"
  11 +#import "CNLiveManager.h"
12 12 #import "CNUserInfoManager.h"
13 13  
  14 +#import "CNLiveLoginController.h"
  15 +
14 16 @BeeHiveService(CNLiveLoginServiceProtocol,CNLiveLoginService)
15 17 @interface CNLiveLoginService ()<CNLiveLoginServiceProtocol>
16 18  
... ... @@ -26,24 +28,24 @@
26 28 [self pushToLoginViewController:NO];
27 29 }
28 30  
29   -- (void)pushToLoginViewController:(BOOL)isShow{
  31 +- (void)pushToLoginViewController:(BOOL)isShowClose{
30 32 CNLiveLoginController *vc = [[CNLiveLoginController alloc]init];
31   - vc.isShow = isShow;
  33 + vc.isShowClose = isShowClose;
32 34 vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
33 35 vc.hidesBottomBarWhenPushed = YES;
34   -// [CNLivePageJumpManager pushViewController:vc];
  36 + [CNLivePageJumpManager pushViewController:vc];
35 37 }
36 38  
37 39 - (void)presentToLoginViewController{
38 40 [self presentToLoginViewController:NO];
39 41 }
40 42  
41   -- (void)presentToLoginViewController:(BOOL)isShow{
  43 +- (void)presentToLoginViewController:(BOOL)isShowClose{
42 44 CNLiveLoginController *vc = [[CNLiveLoginController alloc]init];
43   - vc.isShow = isShow;
  45 + vc.isShowClose = isShowClose;
44 46 vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
45 47 vc.hidesBottomBarWhenPushed = YES;
46   -// [CNLivePageJumpManager presentViewController:vc];
  48 + [CNLivePageJumpManager presentViewController:vc];
47 49 }
48 50  
49 51 - (void)loginIfNeedWithCompleteBlock:(void (^)(BOOL))completeBlock{
... ...
CNLiveLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.m
... ... @@ -8,7 +8,7 @@
8 8  
9 9 #import "CNLiveBindingTelView.h"
10 10 #import "YYKit.h"
11   -#import "CNLiveLoginCountryView.h"
  11 +#import "QMUIKit.h"
12 12  
13 13 #import "CNLiveLoginCountryView.h"
14 14 #import "CNLiveLoginTextField.h"
... ... @@ -31,6 +31,7 @@
31 31 @implementation CNLiveBindingTelView
32 32 static NSInteger const rowHeight = 40;
33 33 static NSInteger const space = 40;
  34 +static const NSInteger timeValue = 1.5;
34 35  
35 36 - (instancetype)initWithFrame:(CGRect)frame type:(CNLiveThreeLoginType)type{
36 37  
... ... @@ -206,7 +207,7 @@ static NSInteger const space = 40;
206 207 - (void)countDownButtonDidClick:(CNLiveCountDownButton *)button {
207 208 //获取验证码
208 209 if ([_account.text isEqualToString:@""]) {
209   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入手机号" view:self.superview];
  210 + [QMUITips showError:@"请输入手机号" inView:self.superview hideAfterDelay:timeValue];
210 211 return;
211 212 }
212 213 // 按钮点击后将enabled设置为NO
... ... @@ -260,7 +261,7 @@ static NSInteger const space = 40;
260 261 - (void)codeDidClicked:(UIButton *)btn{
261 262 //获取验证码
262 263 if ([_account.text isEqualToString:@""]) {
263   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入手机号" view:self.superview];
  264 + [QMUITips showError:@"请输入手机号" inView:self.superview hideAfterDelay:timeValue];
264 265 return;
265 266 }
266 267 __weak typeof(self) weakSelf = self;
... ...
CNLiveLoginModule/Classes/View/CNLiveCompleteInfoView.m
... ... @@ -9,7 +9,7 @@
9 9 #import "CNLiveCompleteInfoView.h"
10 10 #import "CNLiveLoginTextField.h"
11 11 #import "YYKit.h"
12   -
  12 +#import "QMUIKit.h"
13 13 //#import "UIView+Layout.h"
14 14 //#import "UIImage+Bundle.h"
15 15 //#import "XWColorHeader.h"
... ... @@ -34,6 +34,7 @@
34 34 @implementation CNLiveCompleteInfoView
35 35 static NSInteger const rowHeight = 40;
36 36 static NSInteger const space = 40;
  37 +static const NSInteger timeValue = 1.5;
37 38  
38 39 - (instancetype)initWithFrame:(CGRect)frame{
39 40 self = [super initWithFrame:frame];
... ... @@ -236,7 +237,7 @@ static NSInteger const space = 40;
236 237 - (void)nextDidClicked:(UIButton *)btn{
237 238 [_nickname resignFirstResponder];
238 239 if ([_nickname.text isEqualToString:@""]) {
239   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入昵称" view:self.superview];
  240 + [QMUITips showError:@"请输入昵称" inView:self.superview hideAfterDelay:timeValue];
240 241 return;
241 242 }
242 243 btn.userInteractionEnabled = NO;
... ...
CNLiveLoginModule/Classes/View/CNLiveLoginCountryView.m
... ... @@ -9,10 +9,6 @@
9 9 #import "CNLiveLoginCountryView.h"
10 10 #import "YYKit.h"
11 11  
12   -//#import "UIImage+Bundle.h"
13   -//#import "UIView+Layout.h"
14   -//#import "XWColorHeader.h"
15   -//#import "XWSelectCountryViewController.h"
16 12 #import "CNLiveChooseCountryController.h"
17 13  
18 14 @interface CNLiveLoginCountryView()<ChooseCountriesDelegate>
... ...
CNLiveLoginModule/Classes/View/CNLiveLoginView.m
... ... @@ -9,10 +9,15 @@
9 9 #import "CNLiveLoginView.h"
10 10  
11 11 #import "YYKit.h"
  12 +#import "QMUIKit.h"
  13 +
  14 +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  15 +#import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h>
  16 +#import "CNUserInfoManager.h"
  17 +#import "CNLiveEnvironment.h"
12 18  
13 19 #import "CNLiveLoginCountryView.h"
14 20 #import "CNLiveLoginTextField.h"
15   -
16 21 #import "CNLiveCountDownButton.h"
17 22 //#import "XWLoginNotification.h"
18 23  
... ... @@ -25,9 +30,9 @@
25 30 @property (nonatomic, weak) CNLiveLoginCountryView *country;
26 31 @property (nonatomic, weak) CNLiveLoginTextField *account;
27 32 @property (nonatomic, weak) CNLiveLoginTextField *code;
28   -
29 33 @property (nonatomic, strong) CNLiveCountDownButton *countDown;
30 34  
  35 +@property (nonatomic, weak) UILabel *tips;
31 36 @property (nonatomic, weak) UIButton *login;
32 37  
33 38 @end
... ... @@ -35,6 +40,7 @@
35 40 @implementation CNLiveLoginView
36 41 static NSInteger const rowHeight = 40;
37 42 static NSInteger const space = 20;
  43 +static const NSInteger timeValue = 1.5;
38 44  
39 45 - (instancetype)initWithFrame:(CGRect)frame{
40 46  
... ... @@ -100,8 +106,16 @@ static NSInteger const space = 20;
100 106 [self addSubview:countDown];
101 107 self.countDown = countDown;
102 108  
  109 + UILabel *tips = [[UILabel alloc] initWithFrame:CGRectMake(0, code.bottom+space, frame.size.width, rowHeight/4.0)];
  110 + tips.textColor = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0];
  111 + tips.font = [UIFont systemFontOfSize:10];
  112 + tips.textAlignment = NSTextAlignmentCenter;
  113 + tips.text = @"为了保证您的支付安全及个人信息隐私,请使用手机号码登录";
  114 + [self addSubview:tips];
  115 + self.tips = tips;
  116 +
103 117 UIButton *login = [UIButton buttonWithType:UIButtonTypeCustom];
104   - login.frame = CGRectMake(5, code.bottom+space, frame.size.width-10, rowHeight);
  118 + login.frame = CGRectMake(5, tips.bottom+space, frame.size.width-10, rowHeight);
105 119 [login setTitle:@"登录" forState:UIControlStateNormal];
106 120 [login setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
107 121 login.titleLabel.font = [UIFont systemFontOfSize:15.0];
... ... @@ -225,40 +239,44 @@ static NSInteger const space = 20;
225 239 return 60;
226 240 }
227 241  
228   -#pragma mark - XWCountdownButton Delegate
  242 +#pragma mark - CNLiveCountDownButton Delegate
229 243 // 倒计时按钮点击
230 244 - (void)countDownButtonDidClick:(CNLiveCountDownButton *)button {
231 245 //获取验证码
232   - __weak typeof(self) weakSelf = self;
233 246 if ([_account.text isEqualToString:@""]) {
234   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入手机号" view:nil];
  247 + [QMUITips showError:@"请输入手机号" inView:self.superview hideAfterDelay:timeValue];
235 248 return;
236 249 }
237 250 // 按钮点击后将enabled设置为NO
238 251 button.userInteractionEnabled = NO;
239 252  
240   -// [XWUserRequest verificationCodeWithType:XWCodeTypeShortcutLogin mobile:_account.text countryCode:_countryCode success:^(id _Nonnull result) {
241   -// __strong typeof(weakSelf) strongSelf = weakSelf;
242   -// if(!strongSelf) return;
243   -// // 获取的验证码
244   -// strongSelf->_verificationCode = @"666666";
245   -//
246   -// [XWAlertView alertSucceedViewWithTextMessage:@"获取成功" view:nil];
247   -// button.backgroundColor = HexColor(0xdedede);
248   -// button.frame = CGRectMake(self.frame.size.width-110, self.account.bottom+space+10, 110, rowHeight-10);
249   -// [button setImage:nil forState:UIControlStateNormal];
250   -// NSString *title = [NSString stringWithFormat:@"%d秒后重新发送", 60];
251   -// [button setTitle:title forState:UIControlStateNormal];
252   -// [button startCountDown];
253   -//
254   -// } failure:^(NSDictionary * _Nonnull errorDic) {
255   -// __strong typeof(weakSelf) strongSelf = weakSelf;
256   -// if(!strongSelf) return;
257   -// button.userInteractionEnabled = YES;
258   -// [XWAlertView alertErrorViewWithTextMessage:@"获取失败" view:nil];
259   -//
260   -// }];
261   -
  253 + __weak typeof(self) weakSelf = self;
  254 + [QMUITips showLoadingInView:self.superview];
  255 + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:_account.text countryCode:_countryCode success:^(id result) {
  256 + button.userInteractionEnabled = YES;
  257 + __strong typeof(weakSelf) strongSelf = weakSelf;
  258 + if(!strongSelf) return;
  259 + [QMUITips hideAllToastInView:strongSelf.superview animated:YES];
  260 + [QMUITips showSucceed:@"验证码已发送" inView:strongSelf.superview hideAfterDelay:timeValue];
  261 + button.backgroundColor = [UIColor colorWithRed:222/255.0 green:222/255.0 blue:222/255.0 alpha:1.0];
  262 + button.frame = CGRectMake(self.frame.size.width-110, self.account.bottom+space+10, 110, rowHeight-10);
  263 + [button setImage:nil forState:UIControlStateNormal];
  264 + NSString *title = [NSString stringWithFormat:@"%d秒后重新发送", 60];
  265 + [button setTitle:title forState:UIControlStateNormal];
  266 + [button startCountDown];
  267 +
  268 + } failure:^(NSDictionary *errorDic) {
  269 + button.userInteractionEnabled = YES;
  270 + __strong typeof(weakSelf) strongSelf = weakSelf;
  271 + if(!strongSelf) return;
  272 + [QMUITips hideAllToastInView:strongSelf.superview animated:YES];
  273 + if ([errorDic[@"errorCode"] integerValue] == 408) {
  274 + [QMUITips showError:@"请输入正确的手机号" inView:strongSelf.superview hideAfterDelay:timeValue];
  275 + }else{
  276 + [QMUITips showError:[errorDic objectForKey:@"errorMessage"] inView:strongSelf.superview hideAfterDelay:timeValue];
  277 + }
  278 +
  279 + }];
262 280  
263 281 }
264 282  
... ... @@ -287,45 +305,53 @@ static NSInteger const space = 20;
287 305 //登录
288 306 _verificationCode = @"666666";
289 307 if ([_account.text isEqualToString:@""]) {
290   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入手机号" view:self.superview];
  308 + [QMUITips showError:@"请输入手机号" inView:self.superview hideAfterDelay:timeValue];
291 309 return;
292 310 }
293 311 if ([_code.text isEqualToString:@""]) {
294   -// [XWAlertView alertViewWithFlexTextMessage:@"请输入验证码" view:self.superview];
  312 + [QMUITips showError:@"请输入验证码" inView:self.superview hideAfterDelay:timeValue];
295 313 return;
296 314 }
297 315 btn.userInteractionEnabled = NO;
298 316 // 隐藏键盘
299 317 [self.superview endEditing:YES];
  318 +
  319 + [QMUITips showLoading:@"登录中" inView:self.superview];
  320 +
300 321 __weak typeof(self) weakSelf = self;
301   -// [XWUserRequest shortcutLoginWithUserName:_account.text verificationCode:_verificationCode countryCode:_countryCode fromId:@"apple" success:^(id _Nonnull result) {
302   -// btn.userInteractionEnabled = YES;
303   -// __strong typeof(weakSelf) strongSelf = weakSelf;
304   -// if(!strongSelf) return;
305   -// [XWUserManager defaultConfiguration:result];
306   -// // YES 新用户 NO 老用户
307   -// BOOL isNewUser = YES;
308   -// if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(loginSuccess:isNewUser:result:)]) {
309   -// [strongSelf.delegate loginSuccess:strongSelf isNewUser:isNewUser result:result];
310   -// }
311   -//
312   -// } failure:^(NSDictionary * _Nonnull errorDic) {
313   -// btn.userInteractionEnabled = YES;
314   -// __strong typeof(weakSelf) strongSelf = weakSelf;
315   -// if(!strongSelf) return;
316   -//// [XWAlterView alertErrorViewWithTextMessage:@"登录失败" view:strongSelf.superview];
317   -//
318   -// // ------ 最后删除 ------
319   -// NSDictionary *dic = @{@"token":@"用户token",@"id":@"用户id",@"tel":@"17600922519",@"faceUrl":@"http://pic1.win4000.com/wallpaper/c/53cdd1f7c1f21.jpg",@"name":@"张璟熙",@"gender":@"0",@"address":@"北京市海淀区"};
320   -// [XWUserManager defaultConfiguration:dic];
321   -// BOOL isNewUser = YES;
322   -// if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(loginSuccess:isNewUser:result:)]) {
323   -// [strongSelf.delegate loginSuccess:strongSelf isNewUser:isNewUser result:errorDic];
324   -// }
325   -// // ------ 最后删除 ------
326   -//
327   -// }];
  322 + [CNLiveUserSystemCenter shortcutLoginWithUserName:_account.text countryCode:_countryCode verificationCode:_code.text frmId:@"apple" success:^(id result) {
  323 + btn.userInteractionEnabled = YES;
  324 + __strong typeof(weakSelf) strongSelf = weakSelf;
  325 + if(!strongSelf) return;
  326 + // 连接IM
  327 + [strongSelf connectionIM:result];
  328 +
  329 + } failure:^(NSDictionary *errorDic) {
  330 + btn.userInteractionEnabled = YES;
  331 + __strong typeof(weakSelf) strongSelf = weakSelf;
  332 + if(!strongSelf) return;
  333 + [QMUITips hideAllToastInView:strongSelf.superview animated:YES];
  334 + [QMUITips showError:[errorDic objectForKey:@"errorMessage"] inView:strongSelf.superview hideAfterDelay:timeValue];
  335 + }];
  336 +}
  337 +
  338 +#pragma mark - 连接IM
  339 +- (void)connectionIM:(id)result{
  340 +
  341 + NSMutableDictionary *resDic = [NSMutableDictionary dictionaryWithDictionary:result[@"data"]];
  342 + NSString *deFaceUrl = [resDic objectForKey:@"faceUrl"];
  343 + NSString *faceUrl = @"";
  344 + if ([deFaceUrl containsString:@"/mobile/images/mobilehead/default/"]) {
  345 + faceUrl = CNLiveNetAddDefaultHead;//网家家默认头像地址
  346 + [resDic setValue:faceUrl forKey:@"faceUrl"];
  347 + }
  348 + [CNUserInfoManager saveUserinfoDic:resDic];
328 349  
  350 + // YES 新用户 NO 老用户
  351 + BOOL isNewUser = YES;
  352 + if (self.delegate && [self.delegate respondsToSelector:@selector(loginSuccess:isNewUser:result:)]) {
  353 + [self.delegate loginSuccess:self isNewUser:isNewUser result:result];
  354 + }
329 355 }
330 356  
331 357 /**
... ...
Example/CNLiveLoginModule.xcodeproj/project.pbxproj
... ... @@ -208,6 +208,7 @@
208 208 6003F587195388D20070C39A /* Frameworks */,
209 209 6003F588195388D20070C39A /* Resources */,
210 210 CA7AE7B7AD9C2BF31675019E /* [CP] Embed Pods Frameworks */,
  211 + 52D60AE0F4D44D07B879A8CD /* [CP] Copy Pods Resources */,
211 212 );
212 213 buildRules = (
213 214 );
... ... @@ -247,6 +248,9 @@
247 248 LastUpgradeCheck = 0720;
248 249 ORGANIZATIONNAME = "153993236@qq.com";
249 250 TargetAttributes = {
  251 + 6003F589195388D20070C39A = {
  252 + DevelopmentTeam = 94X49GG3ZW;
  253 + };
250 254 6003F5AD195388D20070C39A = {
251 255 TestTargetID = 6003F589195388D20070C39A;
252 256 };
... ... @@ -317,6 +321,24 @@
317 321 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
318 322 showEnvVarsInLog = 0;
319 323 };
  324 + 52D60AE0F4D44D07B879A8CD /* [CP] Copy Pods Resources */ = {
  325 + isa = PBXShellScriptBuildPhase;
  326 + buildActionMask = 2147483647;
  327 + files = (
  328 + );
  329 + inputPaths = (
  330 + "${PODS_ROOT}/Target Support Files/Pods-CNLiveLoginModule_Example/Pods-CNLiveLoginModule_Example-resources.sh",
  331 + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveLoginModule/CNLiveLoginModule.bundle",
  332 + );
  333 + name = "[CP] Copy Pods Resources";
  334 + outputPaths = (
  335 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveLoginModule.bundle",
  336 + );
  337 + runOnlyForDeploymentPostprocessing = 0;
  338 + shellPath = /bin/sh;
  339 + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveLoginModule_Example/Pods-CNLiveLoginModule_Example-resources.sh\"\n";
  340 + showEnvVarsInLog = 0;
  341 + };
320 342 C744CFA8914B761288845DE6 /* [CP] Check Pods Manifest.lock */ = {
321 343 isa = PBXShellScriptBuildPhase;
322 344 buildActionMask = 2147483647;
... ... @@ -346,10 +368,14 @@
346 368 );
347 369 inputPaths = (
348 370 "${PODS_ROOT}/Target Support Files/Pods-CNLiveLoginModule_Example/Pods-CNLiveLoginModule_Example-frameworks.sh",
  371 + "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
349 372 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework",
350 373 "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework",
351   - "${BUILT_PRODUCTS_DIR}/CNLiveLoginModule/CNLiveLoginModule.framework",
  374 + "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
  375 + "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework",
  376 + "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework",
352 377 "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework",
  378 + "${BUILT_PRODUCTS_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.framework",
353 379 "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework",
354 380 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
355 381 "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
... ... @@ -359,10 +385,14 @@
359 385 );
360 386 name = "[CP] Embed Pods Frameworks";
361 387 outputPaths = (
  388 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
362 389 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework",
363 390 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework",
364   - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveLoginModule.framework",
  391 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
  392 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework",
  393 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework",
365 394 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework",
  395 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserAgreementManager.framework",
366 396 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework",
367 397 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
368 398 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
... ... @@ -512,6 +542,7 @@
512 542 baseConfigurationReference = C494A15D22758133566EFE1A /* Pods-CNLiveLoginModule_Example.debug.xcconfig */;
513 543 buildSettings = {
514 544 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  545 + DEVELOPMENT_TEAM = 94X49GG3ZW;
515 546 GCC_PRECOMPILE_PREFIX_HEADER = YES;
516 547 GCC_PREFIX_HEADER = "CNLiveLoginModule/CNLiveLoginModule-Prefix.pch";
517 548 INFOPLIST_FILE = "CNLiveLoginModule/CNLiveLoginModule-Info.plist";
... ... @@ -528,6 +559,7 @@
528 559 baseConfigurationReference = 11F04E11320E8360C5B3A0D7 /* Pods-CNLiveLoginModule_Example.release.xcconfig */;
529 560 buildSettings = {
530 561 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  562 + DEVELOPMENT_TEAM = 94X49GG3ZW;
531 563 GCC_PRECOMPILE_PREFIX_HEADER = YES;
532 564 GCC_PREFIX_HEADER = "CNLiveLoginModule/CNLiveLoginModule-Prefix.pch";
533 565 INFOPLIST_FILE = "CNLiveLoginModule/CNLiveLoginModule-Info.plist";
... ...
Example/CNLiveLoginModule/CNLIVEAppDelegate.m
... ... @@ -9,13 +9,48 @@
9 9 #import "CNLIVEAppDelegate.h"
10 10 #import "CNLiveLoginController.h"
11 11  
  12 +#import "CNUserInfoManager.h"
  13 +#import "CNLiveEnvironment.h"
  14 +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  15 +#import <CNLiveRequestBastKit/CNLiveNetworking.h>
  16 +
12 17 @implementation CNLIVEAppDelegate
13 18  
14 19 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
15 20 {
16 21 // Override point for customization after application launch.
17 22 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小
  23 +
  24 + [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
  25 + [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment];
  26 + if ([CNUserShareManager isLogin]) {
  27 + [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid];
  28 + }
  29 + [self networkParamAction];
  30 +
  31 +// [CNUserInfoManager saveUserinfoDic:@{
  32 +// @"bigFaceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697.jpg",
  33 +// @"countryCode":@"86",
  34 +// @"email":@"",
  35 +// @"extInfo":@"",
  36 +// @"faceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697_small.jpg",
  37 +// @"gender":@"m",
  38 +// @"hUid":@"",
  39 +// @"isNewUser":@"0",
  40 +// @"location":@"北京市海淀区",
  41 +// @"mobile":@"17600922519",
  42 +// @"nickName":@"金帝",
  43 +// @"platformId":@"769_jetj7bq525",
  44 +// @"qqUid":@"",
  45 +// @"renrenUid":@"",
  46 +// @"sinaUid":@"",
  47 +// @"token":@"RkFYeLkl/u5S7tW8UcOkT3rfLTP/Ua8NIkdEsKlcolvl/yxTMNbAYXmmJyhKGpkj",
  48 +// @"uid":@"10514405",
  49 +// @"wxUid":@""
  50 +// }];
  51 +
18 52 CNLiveLoginController *vc = [[CNLiveLoginController alloc] init];
  53 +// vc.isShowClose = YES;
19 54 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
20 55 self.window.rootViewController = nav;//设置根视图控制器
21 56 [self.window makeKeyAndVisible];//设置成为
... ... @@ -49,4 +84,22 @@
49 84 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
50 85 }
51 86  
  87 +- (void)networkParamAction{
  88 + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init];
  89 + [mDict setValue:@"10514405" forKey:@"loginSid"];
  90 +
  91 + [mDict setValue:BundleId forKey:@"platform_id"];
  92 +
  93 + [mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"];
  94 + [mDict setValue:@"i" forKey:@"plat"];
  95 + [mDict setValue:@"1.7.8.19.10.30.15"forKey:@"ver"];
  96 + [mDict setObject:AppId forKey:@"appId"];
  97 + [CNLiveNetworking setupDefaultParam:mDict];
  98 + [CNLiveNetworking setupShowResult:NO];
  99 + [CNLiveNetworking setupSignKey:APPKey];
  100 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  101 + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON];
  102 +
  103 +}
  104 +
52 105 @end
... ...