Commit ba2ee1dffa6cbc457c7c0b8f9458675b50d9c4c4
1 parent
356a6557
no message
Showing
27 changed files
with
501 additions
and
1074 deletions
CNLiveBLoginModule.podspec
| @@ -62,10 +62,6 @@ TODO: 网家家-登录模块. | @@ -62,10 +62,6 @@ TODO: 网家家-登录模块. | ||
| 62 | ss.dependency 'CNLiveBLoginModule/View' | 62 | ss.dependency 'CNLiveBLoginModule/View' |
| 63 | end | 63 | end |
| 64 | 64 | ||
| 65 | - s.subspec 'BindingManage' do |ss| | ||
| 66 | - ss.source_files = 'CNLiveBLoginModule/Classes/BindingManage/*.{h,m}' | ||
| 67 | - end | ||
| 68 | - | ||
| 69 | s.resource_bundles = { | 65 | s.resource_bundles = { |
| 70 | 'CNLiveBLoginModule' => ['CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets'] | 66 | 'CNLiveBLoginModule' => ['CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets'] |
| 71 | } | 67 | } |
| @@ -80,6 +76,7 @@ TODO: 网家家-登录模块. | @@ -80,6 +76,7 @@ TODO: 网家家-登录模块. | ||
| 80 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' | 76 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' |
| 81 | s.dependency 'CNLiveTripartiteManagement/Masonry' | 77 | s.dependency 'CNLiveTripartiteManagement/Masonry' |
| 82 | s.dependency 'CNLiveTripartiteManagement/MJExtension' | 78 | s.dependency 'CNLiveTripartiteManagement/MJExtension' |
| 79 | + s.dependency 'CNLiveTripartiteManagement/AFNetworking', '0.1.6' | ||
| 83 | 80 | ||
| 84 | # 服务层 | 81 | # 服务层 |
| 85 | s.dependency 'CNLiveServices' | 82 | s.dependency 'CNLiveServices' |
| @@ -91,10 +88,10 @@ TODO: 网家家-登录模块. | @@ -91,10 +88,10 @@ TODO: 网家家-登录模块. | ||
| 91 | s.dependency 'CNLiveUserManagement' | 88 | s.dependency 'CNLiveUserManagement' |
| 92 | 89 | ||
| 93 | # 环境库 | 90 | # 环境库 |
| 94 | - s.dependency 'CNLiveEnvironment' | 91 | + s.dependency 'CNLiveBEnvironment' |
| 95 | 92 | ||
| 96 | # 数据请求 | 93 | # 数据请求 |
| 97 | - s.dependency 'CNLiveRequestBastKit' | 94 | + s.dependency 'CNLiveRequestBastKit', '0.2.4.2' |
| 98 | 95 | ||
| 99 | # 用户协议 | 96 | # 用户协议 |
| 100 | s.dependency 'CNLiveUserAgreementManager' | 97 | s.dependency 'CNLiveUserAgreementManager' |
| @@ -114,7 +111,7 @@ TODO: 网家家-登录模块. | @@ -114,7 +111,7 @@ TODO: 网家家-登录模块. | ||
| 114 | s.dependency 'tingyunApp', '~>2.14.0' | 111 | s.dependency 'tingyunApp', '~>2.14.0' |
| 115 | 112 | ||
| 116 | # 分享 | 113 | # 分享 |
| 117 | -# s.dependency 'CNLiveShareToolKit' | 114 | + s.dependency 'CNLiveShareToolKit' |
| 118 | 115 | ||
| 119 | # 类别 | 116 | # 类别 |
| 120 | s.dependency 'CNLiveCategory' | 117 | s.dependency 'CNLiveCategory' |
| @@ -122,8 +119,11 @@ TODO: 网家家-登录模块. | @@ -122,8 +119,11 @@ TODO: 网家家-登录模块. | ||
| 122 | # 自定义控件 | 119 | # 自定义控件 |
| 123 | s.dependency 'CNLiveCustomControl' | 120 | s.dependency 'CNLiveCustomControl' |
| 124 | 121 | ||
| 122 | + # 基础库 | ||
| 125 | s.dependency 'CNLiveBusinessBaseModule' | 123 | s.dependency 'CNLiveBusinessBaseModule' |
| 126 | 124 | ||
| 127 | s.static_framework = true | 125 | s.static_framework = true |
| 128 | 126 | ||
| 127 | + s.xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' } | ||
| 128 | + | ||
| 129 | end | 129 | end |
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_apple.imageset/Contents.json
| @@ -5,18 +5,18 @@ | @@ -5,18 +5,18 @@ | ||
| 5 | "scale" : "1x" | 5 | "scale" : "1x" |
| 6 | }, | 6 | }, |
| 7 | { | 7 | { |
| 8 | - "idiom" : "universal", | ||
| 9 | "filename" : "login_apple@2x.png", | 8 | "filename" : "login_apple@2x.png", |
| 9 | + "idiom" : "universal", | ||
| 10 | "scale" : "2x" | 10 | "scale" : "2x" |
| 11 | }, | 11 | }, |
| 12 | { | 12 | { |
| 13 | - "idiom" : "universal", | ||
| 14 | "filename" : "login_apple@3x.png", | 13 | "filename" : "login_apple@3x.png", |
| 14 | + "idiom" : "universal", | ||
| 15 | "scale" : "3x" | 15 | "scale" : "3x" |
| 16 | } | 16 | } |
| 17 | ], | 17 | ], |
| 18 | "info" : { | 18 | "info" : { |
| 19 | - "version" : 1, | ||
| 20 | - "author" : "xcode" | 19 | + "author" : "xcode", |
| 20 | + "version" : 1 | ||
| 21 | } | 21 | } |
| 22 | -} | ||
| 23 | \ No newline at end of file | 22 | \ No newline at end of file |
| 23 | +} |
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_apple.imageset/login_apple@2x.png
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_apple.imageset/login_apple@3x.png
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageCell.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageCell.h | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | -@class CNLiveBindingManageModel; | ||
| 13 | -#define kCNLiveBindingManageCell @"CNLiveBindingManageCell" | ||
| 14 | - | ||
| 15 | -@class CNLiveBindingManageCell; | ||
| 16 | -@protocol CNLiveBindingManageCellDelegate <NSObject> | ||
| 17 | -//isBinding YES 绑定操作 NO 解除绑定操作 | ||
| 18 | -- (void)clickedBindingButton:(CNLiveBindingManageCell *)cell isBinding:(BOOL)isBinding; | ||
| 19 | - | ||
| 20 | -@end | ||
| 21 | - | ||
| 22 | -@interface CNLiveBindingManageCell : UITableViewCell | ||
| 23 | -@property (nonatomic, strong) CNLiveBindingManageModel *model; | ||
| 24 | -@property (nonatomic, weak) id<CNLiveBindingManageCellDelegate> delegate; | ||
| 25 | - | ||
| 26 | -@end | ||
| 27 | - | ||
| 28 | -NS_ASSUME_NONNULL_END |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageCell.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageCell.m | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBindingManageCell.h" | ||
| 10 | -#import <Masonry/Masonry.h> | ||
| 11 | -#import "QMUIKit.h" | ||
| 12 | -#import "CNLiveBaseKit.h" | ||
| 13 | -#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 14 | - | ||
| 15 | -#import "CNLiveBindingManageModel.h" | ||
| 16 | -#import "CNLiveBindingManageRequest.h" | ||
| 17 | - | ||
| 18 | -@interface CNLiveBindingManageCell() | ||
| 19 | -@property (nonatomic, strong) UIImageView *icon; | ||
| 20 | -@property (nonatomic, strong) UILabel *title; | ||
| 21 | -@property (nonatomic, strong) UILabel *desc; | ||
| 22 | -@property (nonatomic, strong) UIButton *manage; | ||
| 23 | -@property (nonatomic, strong) UIView *line; | ||
| 24 | - | ||
| 25 | -@end | ||
| 26 | -@implementation CNLiveBindingManageCell | ||
| 27 | -static NSInteger const margin = 15; | ||
| 28 | - | ||
| 29 | -- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | ||
| 30 | - self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 31 | - if (self) { | ||
| 32 | - self.contentView.backgroundColor = [UIColor whiteColor]; | ||
| 33 | - [self createSubViews]; | ||
| 34 | - } | ||
| 35 | - return self; | ||
| 36 | -} | ||
| 37 | -- (void)setModel:(CNLiveBindingManageModel *)model{ | ||
| 38 | - _model = model; | ||
| 39 | - _icon.image = [UIImage imageNamed:model.image]; | ||
| 40 | - _title.text = model.title; | ||
| 41 | - _desc.text = model.desc; | ||
| 42 | - if([model.isBinding isEqualToString:@"1"]){ | ||
| 43 | - _manage.backgroundColor = RGBOF(0xd9d9d9); | ||
| 44 | - [_manage setTitle:@"已绑定" forState:UIControlStateNormal]; | ||
| 45 | - | ||
| 46 | - }else{ | ||
| 47 | - _manage.backgroundColor = RGBOF(0x23d41e); | ||
| 48 | - [_manage setTitle:@"未绑定" forState:UIControlStateNormal]; | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | -} | ||
| 53 | -#pragma mark - setupUI | ||
| 54 | -- (void)createSubViews { | ||
| 55 | - [self.contentView addSubview:self.icon]; | ||
| 56 | - [self.contentView addSubview:self.title]; | ||
| 57 | - [self.contentView addSubview:self.desc]; | ||
| 58 | - [self.contentView addSubview:self.manage]; | ||
| 59 | - [self.contentView addSubview:self.line]; | ||
| 60 | - | ||
| 61 | -} | ||
| 62 | - | ||
| 63 | -- (void)layoutSubviews { | ||
| 64 | - [self.icon mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 65 | - make.centerY.equalTo(self.contentView); | ||
| 66 | - make.left.equalTo(self.contentView).offset(margin); | ||
| 67 | - make.width.mas_equalTo(50); | ||
| 68 | - make.height.mas_equalTo(50); | ||
| 69 | - }]; | ||
| 70 | - | ||
| 71 | - [self.manage mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 72 | - make.centerY.equalTo(self.contentView); | ||
| 73 | - make.right.equalTo(self.contentView.mas_right).offset(-margin); | ||
| 74 | - make.width.mas_equalTo(70); | ||
| 75 | - make.height.mas_equalTo(30); | ||
| 76 | - }]; | ||
| 77 | - | ||
| 78 | - [self.title mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 79 | - make.top.equalTo(self.icon.mas_top); | ||
| 80 | - make.left.equalTo(self.icon.mas_right).offset(margin); | ||
| 81 | - make.right.equalTo(self.manage.mas_left).offset(-margin); | ||
| 82 | - make.height.mas_equalTo(25); | ||
| 83 | - }]; | ||
| 84 | - | ||
| 85 | - [self.desc mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 86 | - make.top.equalTo(self.title.mas_bottom); | ||
| 87 | - make.left.equalTo(self.title.mas_left); | ||
| 88 | - make.right.equalTo(self.title.mas_right); | ||
| 89 | - make.height.mas_equalTo(25); | ||
| 90 | - }]; | ||
| 91 | - [self.line mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 92 | - make.bottom.equalTo(self.contentView.mas_bottom).offset(-0.5); | ||
| 93 | - make.left.equalTo(self.contentView.mas_left); | ||
| 94 | - make.right.equalTo(self.contentView.mas_right); | ||
| 95 | - make.height.mas_equalTo(0.5); | ||
| 96 | - }]; | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -- (void)awakeFromNib { | ||
| 100 | - [super awakeFromNib]; | ||
| 101 | - // Initialization code | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 105 | - [super setSelected:selected animated:animated]; | ||
| 106 | - | ||
| 107 | - // Configure the view for the selected state | ||
| 108 | -} | ||
| 109 | - | ||
| 110 | -#pragma mark - Lazy Loading | ||
| 111 | -- (UIImageView *)icon { | ||
| 112 | - if (!_icon) { | ||
| 113 | - _icon = [[UIImageView alloc] init]; | ||
| 114 | - _icon.contentMode = UIViewContentModeScaleAspectFill; | ||
| 115 | - _icon.layer.cornerRadius = 25; | ||
| 116 | - _icon.layer.masksToBounds = YES; | ||
| 117 | - } | ||
| 118 | - return _icon; | ||
| 119 | -} | ||
| 120 | -- (UILabel *)title { | ||
| 121 | - if (!_title) { | ||
| 122 | - _title = [[UILabel alloc] init]; | ||
| 123 | - _title.textColor = RGBOF(0x333333); | ||
| 124 | - _title.font = UIFontCNMake(16);//[UIFont fontWithName:@"PingFangSC-Regular" size:15]; | ||
| 125 | - _title.numberOfLines = 0; | ||
| 126 | - } | ||
| 127 | - return _title; | ||
| 128 | -} | ||
| 129 | -- (UILabel *)desc { | ||
| 130 | - if (!_desc) { | ||
| 131 | - _desc = [[UILabel alloc] init]; | ||
| 132 | - _desc.textColor = RGBOF(0x999999); | ||
| 133 | - _desc.font = UIFontCNMake(12);//[UIFont fontWithName:@"PingFangSC-Regular" size:15]; | ||
| 134 | - _desc.numberOfLines = 0; | ||
| 135 | - } | ||
| 136 | - return _desc; | ||
| 137 | -} | ||
| 138 | -- (UIButton *)manage { | ||
| 139 | - if (!_manage) { | ||
| 140 | - _manage = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 141 | - _manage.backgroundColor = RGBOF(0xd9d9d9); | ||
| 142 | - [_manage setTitle:@"已绑定" forState:UIControlStateNormal]; | ||
| 143 | - [_manage setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | ||
| 144 | - _manage.titleLabel.font = UIFontCNMake(14); | ||
| 145 | - _manage.layer.cornerRadius = 15; | ||
| 146 | - _manage.layer.masksToBounds = YES; | ||
| 147 | - [_manage addTarget:self action:@selector(manageDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 148 | - } | ||
| 149 | - return _manage; | ||
| 150 | -} | ||
| 151 | - | ||
| 152 | -- (UIView *)line { | ||
| 153 | - if (!_line) { | ||
| 154 | - _line = [[UIView alloc] init]; | ||
| 155 | - _line.backgroundColor = RGBOF(0xeeeeee); | ||
| 156 | - } | ||
| 157 | - return _line; | ||
| 158 | -} | ||
| 159 | - | ||
| 160 | -#pragma mark - Action | ||
| 161 | -- (void)manageDidClicked:(UIButton *)btn{ | ||
| 162 | - if([self.model.thirdPartyPlat isEqualToString:@"10"]){ | ||
| 163 | - return; | ||
| 164 | - } | ||
| 165 | - if(![CNLiveNetworking isNetworking]){ | ||
| 166 | - [QMUITips showError:@"无法连接网络" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; | ||
| 167 | - return ; | ||
| 168 | - } | ||
| 169 | - btn.userInteractionEnabled = NO; | ||
| 170 | - if (self.delegate && [self.delegate respondsToSelector:@selector(clickedBindingButton:isBinding:)]) { | ||
| 171 | - [self.delegate clickedBindingButton:self isBinding:![self.model.isBinding isEqualToString:@"1"]]; | ||
| 172 | - btn.userInteractionEnabled = YES; | ||
| 173 | - | ||
| 174 | - } | ||
| 175 | -} | ||
| 176 | - | ||
| 177 | - | ||
| 178 | -@end |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageController.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageController.h | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | -// 绑定管理 | ||
| 9 | -#import "CNCommonViewController.h" | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | - | ||
| 13 | -@interface CNLiveBindingManageController : CNCommonViewController | ||
| 14 | - | ||
| 15 | -@end | ||
| 16 | - | ||
| 17 | -NS_ASSUME_NONNULL_END |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageController.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageController.m | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBindingManageController.h" | ||
| 10 | -#import <Masonry/Masonry.h> | ||
| 11 | -#import "CNLiveBaseKit.h" | ||
| 12 | - | ||
| 13 | -#import "CNLiveBindingManageHeaderView.h" | ||
| 14 | -#import "CNLiveBindingManageCell.h" | ||
| 15 | -#import "CNLiveBindingManageModel.h" | ||
| 16 | -#import "CNLiveBindingManageRequest.h" | ||
| 17 | - | ||
| 18 | -@interface CNLiveBindingManageController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBindingManageCellDelegate> | ||
| 19 | -@property (nonatomic, strong) UITableView *tableView; | ||
| 20 | -@property (nonatomic, strong) NSArray *bindingData; | ||
| 21 | -@property (nonatomic, strong) NSArray *unBindingData; | ||
| 22 | - | ||
| 23 | -@end | ||
| 24 | - | ||
| 25 | -@implementation CNLiveBindingManageController | ||
| 26 | -#pragma mark - CNLiveBindingManageCellDelegate | ||
| 27 | -- (void)clickedBindingButton:(CNLiveBindingManageCell *)cell isBinding:(BOOL)isBinding{ | ||
| 28 | - if(isBinding){ | ||
| 29 | - //绑定操作 | ||
| 30 | - [self requestBindingManage:cell.model]; | ||
| 31 | - | ||
| 32 | - }else{ | ||
| 33 | - //解除绑定操作 | ||
| 34 | - UIAlertController *actionAlert1 = [UIAlertController alertControllerWithTitle:@"确定解除绑定?" message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 35 | - | ||
| 36 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:NULL]; | ||
| 37 | - __weak typeof(self) weakSelf = self; | ||
| 38 | - UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 39 | - __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 40 | - if(!strongSelf) return; | ||
| 41 | - [strongSelf requestBindingManage:cell.model]; | ||
| 42 | - | ||
| 43 | - }]; | ||
| 44 | - [action1 setValue:RGBOF(0x23D41E) forKey:@"_titleTextColor"]; | ||
| 45 | - [action2 setValue:RGBOF(0x23D41E) forKey:@"_titleTextColor"]; | ||
| 46 | - | ||
| 47 | - [actionAlert1 addAction:action1]; | ||
| 48 | - [actionAlert1 addAction:action2]; | ||
| 49 | - [self presentViewController:actionAlert1 animated:YES completion:nil]; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | -} | ||
| 53 | -- (void)requestBindingManage:(CNLiveBindingManageModel *)model{ | ||
| 54 | -// switch (model.type) { | ||
| 55 | -// case CNLiveSendAuthRespWX: | ||
| 56 | -// { | ||
| 57 | -// if(![WXApi isWXAppInstalled]){ | ||
| 58 | -// [QMUITips showWithText:@"未安装微信" inView:self.view hideAfterDelay:1.5]; | ||
| 59 | -// return; | ||
| 60 | -// } | ||
| 61 | -// } | ||
| 62 | -// break; | ||
| 63 | -// case CNLiveSendAuthRespQQ: | ||
| 64 | -// { | ||
| 65 | -// if(![TencentOAuth iphoneQQInstalled]){ | ||
| 66 | -// [QMUITips showWithText:@"未安装QQ" inView:self.view hideAfterDelay:1.5]; | ||
| 67 | -// return; | ||
| 68 | -// } | ||
| 69 | -// } | ||
| 70 | -// break; | ||
| 71 | -// case CNLiveSendAuthRespWB: | ||
| 72 | -// { | ||
| 73 | -// if(![WeiboSDK isWeiboAppInstalled]){ | ||
| 74 | -// [QMUITips showWithText:@"未安装微博" inView:self.view hideAfterDelay:1.5]; | ||
| 75 | -// return; | ||
| 76 | -// } | ||
| 77 | -// } | ||
| 78 | -// break; | ||
| 79 | -// case CNLiveSendAuthRespApple: | ||
| 80 | -// { | ||
| 81 | -// } | ||
| 82 | -// break; | ||
| 83 | -// } | ||
| 84 | - __weak typeof(self) weakSelf = self; | ||
| 85 | - [CNLiveBindingManageRequest requestModel:model block:^(BOOL isSuccess, CNLiveBindingManageModel * _Nullable model, BOOL isBinding) { | ||
| 86 | - __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 87 | - if(!strongSelf) return; | ||
| 88 | - if(isSuccess){ | ||
| 89 | - [strongSelf loadData]; | ||
| 90 | - | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - }]; | ||
| 94 | -} | ||
| 95 | -#pragma mark - Data | ||
| 96 | -- (void)loadData{ | ||
| 97 | - __weak typeof(self) weakSelf = self; | ||
| 98 | - [CNLiveBindingManageRequest requestModels:^(NSArray * _Nullable bindingData, NSArray * _Nullable unBindingData) { | ||
| 99 | - __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 100 | - if(!strongSelf) return; | ||
| 101 | - strongSelf.bindingData = bindingData; | ||
| 102 | - strongSelf.unBindingData = unBindingData; | ||
| 103 | - [strongSelf.tableView reloadData]; | ||
| 104 | - }]; | ||
| 105 | - | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -- (void)viewDidLoad { | ||
| 109 | - [super viewDidLoad]; | ||
| 110 | - // Do any additional setup after loading the view. | ||
| 111 | - self.view.backgroundColor = RGBOF(0xf4f4f4); | ||
| 112 | - self.title = @"绑定管理"; | ||
| 113 | - if (@available(iOS 11.0, *)) { | ||
| 114 | - self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; | ||
| 115 | - } else { | ||
| 116 | - self.automaticallyAdjustsScrollViewInsets = NO; | ||
| 117 | - } | ||
| 118 | - [self loadData]; | ||
| 119 | - [self createUI]; | ||
| 120 | - | ||
| 121 | -} | ||
| 122 | - | ||
| 123 | -- (void)createUI{ | ||
| 124 | - [self.view addSubview:self.tableView]; | ||
| 125 | - | ||
| 126 | -} | ||
| 127 | - | ||
| 128 | -- (void)viewDidLayoutSubviews { | ||
| 129 | - [super viewDidLayoutSubviews]; | ||
| 130 | - [_tableView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 131 | - make.top.equalTo(self.view.mas_top).with.offset(kVerticalStatusHeight+44); | ||
| 132 | - make.left.equalTo(self.view.mas_left).with.offset(0); | ||
| 133 | - make.right.equalTo(self.view.mas_right).with.offset(-0); | ||
| 134 | - make.bottom.equalTo(self.view.mas_bottom).with.offset(-0); | ||
| 135 | - | ||
| 136 | - }]; | ||
| 137 | - | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -#pragma mark - UITableViewDataSource | ||
| 141 | -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | ||
| 142 | - return 2; | ||
| 143 | - | ||
| 144 | -} | ||
| 145 | - | ||
| 146 | -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 147 | - if(section == 0){ | ||
| 148 | - return self.bindingData.count; | ||
| 149 | - | ||
| 150 | - }else if(section == 1){ | ||
| 151 | - return self.unBindingData.count; | ||
| 152 | - | ||
| 153 | - }else{ | ||
| 154 | - return 0; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | -} | ||
| 158 | - | ||
| 159 | -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 160 | - return 80; | ||
| 161 | - | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 165 | - CNLiveBindingManageCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveBindingManageCell forIndexPath:indexPath]; | ||
| 166 | - cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 167 | - cell.delegate = self; | ||
| 168 | - if(indexPath.section == 0){ | ||
| 169 | - if(self.bindingData.count > 0){ | ||
| 170 | - cell.model = self.bindingData[indexPath.row]; | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - }else if(indexPath.section == 1){ | ||
| 174 | - if(self.unBindingData.count > 0){ | ||
| 175 | - cell.model = self.unBindingData[indexPath.row]; | ||
| 176 | - } | ||
| 177 | - } | ||
| 178 | - return cell; | ||
| 179 | - | ||
| 180 | -} | ||
| 181 | - | ||
| 182 | -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | ||
| 183 | - return 40.0; | ||
| 184 | - | ||
| 185 | -} | ||
| 186 | -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | ||
| 187 | - return 0.0000001f; | ||
| 188 | - | ||
| 189 | -} | ||
| 190 | - | ||
| 191 | -- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | ||
| 192 | - NSArray *array = @[@"您已绑定网家家手机号账号", @"其他绑定方式"]; | ||
| 193 | - CNLiveBindingManageHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNLiveBindingManageHeaderView]; | ||
| 194 | - header.text = array[section]; | ||
| 195 | - return header; | ||
| 196 | - | ||
| 197 | -} | ||
| 198 | - | ||
| 199 | -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 200 | - | ||
| 201 | - | ||
| 202 | -} | ||
| 203 | - | ||
| 204 | -/* | ||
| 205 | - #pragma mark - Navigation | ||
| 206 | - | ||
| 207 | - // In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 208 | - - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 209 | - // Get the new view controller using [segue destinationViewController]. | ||
| 210 | - // Pass the selected object to the new view controller. | ||
| 211 | - } | ||
| 212 | - */ | ||
| 213 | - | ||
| 214 | -#pragma mark - Lazy loading | ||
| 215 | -- (UITableView *)tableView { | ||
| 216 | - if (!_tableView) { | ||
| 217 | - _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; | ||
| 218 | - _tableView.backgroundColor = RGBOF(0xf4f4f4); | ||
| 219 | - _tableView.delegate = self; | ||
| 220 | - _tableView.dataSource = self; | ||
| 221 | - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 222 | - _tableView.showsVerticalScrollIndicator = NO; | ||
| 223 | - _tableView.showsHorizontalScrollIndicator = NO; | ||
| 224 | - _tableView.estimatedRowHeight = 0; | ||
| 225 | - _tableView.estimatedSectionFooterHeight = 0; | ||
| 226 | - _tableView.estimatedSectionHeaderHeight = 0; | ||
| 227 | - [_tableView registerClass:[CNLiveBindingManageCell class] forCellReuseIdentifier:kCNLiveBindingManageCell]; | ||
| 228 | - [_tableView registerClass:[CNLiveBindingManageHeaderView class] forHeaderFooterViewReuseIdentifier:kCNLiveBindingManageHeaderView]; | ||
| 229 | - | ||
| 230 | - } | ||
| 231 | - return _tableView; | ||
| 232 | -} | ||
| 233 | - | ||
| 234 | -@end |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageHeaderView.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageHeaderView.h | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | -#define kCNLiveBindingManageHeaderView @"CNLiveBindingManageHeaderView" | ||
| 13 | - | ||
| 14 | -@interface CNLiveBindingManageHeaderView : UITableViewHeaderFooterView | ||
| 15 | -@property (nonatomic, copy) NSString *text; | ||
| 16 | - | ||
| 17 | -@end | ||
| 18 | - | ||
| 19 | -NS_ASSUME_NONNULL_END |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageHeaderView.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageHeaderView.m | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBindingManageHeaderView.h" | ||
| 10 | -#import <Masonry/Masonry.h> | ||
| 11 | - | ||
| 12 | -@interface CNLiveBindingManageHeaderView() | ||
| 13 | -@property (nonatomic, strong) UILabel *title; | ||
| 14 | - | ||
| 15 | -@end | ||
| 16 | -@implementation CNLiveBindingManageHeaderView | ||
| 17 | -static NSInteger const margin = 15; | ||
| 18 | - | ||
| 19 | -- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier { | ||
| 20 | - if (self = [super initWithReuseIdentifier:reuseIdentifier]) { | ||
| 21 | - //在这里向contentView添加控件 | ||
| 22 | - self.backgroundColor = [UIColor colorWithRed:244/255.0 green:244/255.0 blue:244/255.0 alpha:1.0]; | ||
| 23 | - [self createSubviews]; | ||
| 24 | - [self xw_layoutSubviews]; | ||
| 25 | - | ||
| 26 | - } | ||
| 27 | - return self; | ||
| 28 | -} | ||
| 29 | -- (void)setText:(NSString *)text{ | ||
| 30 | - _text = text; | ||
| 31 | - _title.text = text; | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | -#pragma mark - setupUI | ||
| 35 | -- (void)createSubviews { | ||
| 36 | - [self.contentView addSubview:self.title]; | ||
| 37 | - | ||
| 38 | -} | ||
| 39 | - | ||
| 40 | -- (void)xw_layoutSubviews { | ||
| 41 | - [self.title mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 42 | - make.top.equalTo(self.contentView); | ||
| 43 | - make.left.equalTo(self.contentView.mas_left).offset(margin); | ||
| 44 | - make.right.equalTo(self.contentView.mas_right).offset(-margin); | ||
| 45 | - make.bottom.equalTo(self.contentView.mas_bottom); | ||
| 46 | - | ||
| 47 | - }]; | ||
| 48 | - | ||
| 49 | -} | ||
| 50 | - | ||
| 51 | -/* | ||
| 52 | -// Only override drawRect: if you perform custom drawing. | ||
| 53 | -// An empty implementation adversely affects performance during animation. | ||
| 54 | -- (void)drawRect:(CGRect)rect { | ||
| 55 | - // Drawing code | ||
| 56 | -} | ||
| 57 | -*/ | ||
| 58 | - | ||
| 59 | -#pragma mark - Lazy Loading | ||
| 60 | -- (UILabel *)title { | ||
| 61 | - if (!_title) { | ||
| 62 | - _title = [[UILabel alloc] init]; | ||
| 63 | - _title.textColor = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0]; | ||
| 64 | - _title.font = [UIFont systemFontOfSize:14]; | ||
| 65 | - _title.numberOfLines = 0; | ||
| 66 | - } | ||
| 67 | - return _title; | ||
| 68 | -} | ||
| 69 | - | ||
| 70 | -@end |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageModel.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageModel.h | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <Foundation/Foundation.h> | ||
| 10 | -//#import "CNLiveShareImageManager.h" | ||
| 11 | - | ||
| 12 | -NS_ASSUME_NONNULL_BEGIN | ||
| 13 | - | ||
| 14 | -@interface CNLiveBindingManageModel : NSObject | ||
| 15 | -@property (nonatomic, copy) NSString *title; | ||
| 16 | -@property (nonatomic, copy) NSString *desc; | ||
| 17 | -@property (nonatomic, copy) NSString *image; | ||
| 18 | -@property (nonatomic, copy) NSString *isBinding;//是否绑定 | ||
| 19 | - | ||
| 20 | -@property (nonatomic, copy) NSString *thirdPartyPlat; | ||
| 21 | -@property (nonatomic, copy) NSString *thirdPartyId; | ||
| 22 | -//@property (nonatomic, assign) CNLiveSendAuthResp type; | ||
| 23 | - | ||
| 24 | - | ||
| 25 | -@end | ||
| 26 | - | ||
| 27 | -NS_ASSUME_NONNULL_END |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageModel.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageModel.m | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBindingManageModel.h" | ||
| 10 | - | ||
| 11 | -@implementation CNLiveBindingManageModel | ||
| 12 | -//- (CNLiveSendAuthResp)type{ | ||
| 13 | -// CNLiveSendAuthResp type = CNLiveSendAuthRespWX; | ||
| 14 | -// | ||
| 15 | -// if([self.thirdPartyPlat isEqualToString:@"1"]){ | ||
| 16 | -// type = CNLiveSendAuthRespWB; | ||
| 17 | -// | ||
| 18 | -// }else if ([self.thirdPartyPlat isEqualToString:@"2"]){ | ||
| 19 | -// type = CNLiveSendAuthRespQQ; | ||
| 20 | -// | ||
| 21 | -// }else if([self.thirdPartyPlat isEqualToString:@"3"]){ | ||
| 22 | -// type = CNLiveSendAuthRespWX; | ||
| 23 | -// | ||
| 24 | -// }else if([self.thirdPartyPlat isEqualToString:@"5"]){ | ||
| 25 | -// type = CNLiveSendAuthRespApple; | ||
| 26 | -// | ||
| 27 | -// } | ||
| 28 | -// return type; | ||
| 29 | -// | ||
| 30 | -//} | ||
| 31 | - | ||
| 32 | -@end |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageRequest.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveBindingManageRequest.m | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | -// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBindingManageRequest.h" | ||
| 10 | -#import "QMUIKit.h" | ||
| 11 | -#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 12 | -#import "CNUserInfoManager.h" | ||
| 13 | - | ||
| 14 | -#import "CNLiveBindingManageModel.h" | ||
| 15 | - | ||
| 16 | -//#import "CNThreeLoginModel.h" | ||
| 17 | -//#import "CNLiveShareImageManager.h" | ||
| 18 | - | ||
| 19 | -@implementation CNLiveBindingManageRequest | ||
| 20 | -+ (void)requestModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block{ | ||
| 21 | - if([model.isBinding isEqualToString:@"1"]){ | ||
| 22 | - //解除绑定操作 | ||
| 23 | - [CNLiveBindingManageRequest requestUnBindingModel:model block:^(BOOL isSuccess, CNLiveBindingManageModel * _Nullable model, BOOL isBinding) { | ||
| 24 | - block?block(isSuccess, model, isBinding):@""; | ||
| 25 | - }]; | ||
| 26 | - } | ||
| 27 | - else{ | ||
| 28 | - //绑定操作 | ||
| 29 | - [CNLiveBindingManageRequest requestBindingModel:model block:^(BOOL isSuccess, CNLiveBindingManageModel * _Nullable model, BOOL isBinding) { | ||
| 30 | - block?block(isSuccess, model, isBinding):@""; | ||
| 31 | - }]; | ||
| 32 | - } | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -//绑定操作 | ||
| 36 | -+ (void)requestBindingModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block{ | ||
| 37 | - __weak typeof(self) weakSelf = self; | ||
| 38 | - // 获取第三方id | ||
| 39 | -// [CNLiveShareImageManager send:model.type authRespBlock:^(CNLiveSendAuthResp type, CNLiveThirdPartyModel *userInfo, NSError *error) { | ||
| 40 | -// __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 41 | -// if(!strongSelf) return; | ||
| 42 | -// if(error){ | ||
| 43 | -// if(error.code == 10000){ | ||
| 44 | -// //用户取消 | ||
| 45 | -// }else{ | ||
| 46 | -// [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 47 | -// } | ||
| 48 | -// return ; | ||
| 49 | -// } | ||
| 50 | -// if(userInfo.thirdPartyId&&![userInfo.thirdPartyId isEqualToString:@""]){ | ||
| 51 | -// // 发起绑定请求 | ||
| 52 | -// model.thirdPartyId = userInfo.thirdPartyId; | ||
| 53 | -// [strongSelf sendBindingModel:model block:block]; | ||
| 54 | -// | ||
| 55 | -// }else{ | ||
| 56 | -// [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 57 | -// | ||
| 58 | -// } | ||
| 59 | -// | ||
| 60 | -// }]; | ||
| 61 | - | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | -+ (void)sendBindingModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block{ | ||
| 65 | -// NSDictionary *params = @{ | ||
| 66 | -// @"uid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 67 | -// @"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | ||
| 68 | -// @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | ||
| 69 | -// @"token":CNUserShareModel.token?CNUserShareModel.token:@"", | ||
| 70 | -// @"clientPlat":@"i"}; | ||
| 71 | -// [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 72 | -// [CNLiveNetworking setupShowDataResult:NO]; | ||
| 73 | -// | ||
| 74 | -// __weak typeof(self) weakSelf = self; | ||
| 75 | -// [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginBind3rdUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 76 | -// __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 77 | -// if(!strongSelf) return; | ||
| 78 | -// | ||
| 79 | -// if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | ||
| 80 | -// //绑定,并更新本地数据 | ||
| 81 | -// CNBindingManageModel *bindingModel = [strongSelf updateBindingModel:model isBinding:@"1"]; | ||
| 82 | -// block?block(YES, bindingModel, YES):@""; | ||
| 83 | -// } | ||
| 84 | -// else if([responseObject isKindOfClass:[NSDictionary class]]) { | ||
| 85 | -// [QMUITips showWithText:responseObject[@"errorMessage"] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 86 | -// block?block(NO, nil, NO):@""; | ||
| 87 | -// } | ||
| 88 | -// else{ | ||
| 89 | -// [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 90 | -// block?block(NO, nil, NO):@""; | ||
| 91 | -// } | ||
| 92 | -// | ||
| 93 | -// }]; | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | -//解除绑定操作 | ||
| 97 | -+ (void)requestUnBindingModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block{ | ||
| 98 | -// NSDictionary *params = @{ | ||
| 99 | -// @"uid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 100 | -// @"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | ||
| 101 | -// @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | ||
| 102 | -// @"token":CNUserShareModel.token?CNUserShareModel.token:@"", | ||
| 103 | -// @"clientPlat":@"i"}; | ||
| 104 | -// | ||
| 105 | -// [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 106 | -// [CNLiveNetworking setupShowDataResult:NO]; | ||
| 107 | -// | ||
| 108 | -// __weak typeof(self) weakSelf = self; | ||
| 109 | -// [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginUnBind3rdUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 110 | -// __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 111 | -// if(!strongSelf) return; | ||
| 112 | -// | ||
| 113 | -// if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | ||
| 114 | -// //解除绑定,并更新本地数据 | ||
| 115 | -// CNBindingManageModel *unbindingModel = [strongSelf updateBindingModel:model isBinding:@"0"]; | ||
| 116 | -// block?block(YES, unbindingModel, NO):@""; | ||
| 117 | -// } | ||
| 118 | -// else if ([responseObject isKindOfClass:[NSDictionary class]]) { | ||
| 119 | -// [QMUITips showWithText:responseObject[@"errorMessage"] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 120 | -// block?block(NO, nil, NO):@""; | ||
| 121 | -// } | ||
| 122 | -// else{ | ||
| 123 | -// [QMUITips showWithText:@"解除绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 124 | -// block?block(NO, nil, NO):@""; | ||
| 125 | -// } | ||
| 126 | -// | ||
| 127 | -// }]; | ||
| 128 | - | ||
| 129 | -} | ||
| 130 | - | ||
| 131 | -//改变绑定数据 | ||
| 132 | -+ (CNLiveBindingManageModel *)updateBindingModel:(CNLiveBindingManageModel *)model isBinding:(NSString *)isBinding{ | ||
| 133 | - if([isBinding isEqualToString:@"0"]){ | ||
| 134 | - //解除绑定 | ||
| 135 | - model.isBinding = @"0"; | ||
| 136 | - //微博 | ||
| 137 | - if([model.thirdPartyPlat isEqualToString:@"1"]){ | ||
| 138 | - CNUserShareModel.sinaUid = @""; | ||
| 139 | - | ||
| 140 | - } | ||
| 141 | |||
| 142 | - else if([model.thirdPartyPlat isEqualToString:@"2"]){ | ||
| 143 | - CNUserShareModel.qqUid = @""; | ||
| 144 | - | ||
| 145 | - } | ||
| 146 | - //微信 | ||
| 147 | - else if([model.thirdPartyPlat isEqualToString:@"3"]){ | ||
| 148 | - CNUserShareModel.wxUid = @""; | ||
| 149 | - | ||
| 150 | - } | ||
| 151 | - //苹果 | ||
| 152 | - else if([model.thirdPartyPlat isEqualToString:@"5"]){ | ||
| 153 | - CNUserShareModel.appleUid = @""; | ||
| 154 | - | ||
| 155 | - } | ||
| 156 | - [QMUITips showWithText:@"解除绑定成功" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; | ||
| 157 | - return model; | ||
| 158 | - } | ||
| 159 | - else if ([isBinding isEqualToString:@"1"]){ | ||
| 160 | - //添加绑定 | ||
| 161 | - model.isBinding = @"1"; | ||
| 162 | - //微博 | ||
| 163 | - if([model.thirdPartyPlat isEqualToString:@"1"]){ | ||
| 164 | - CNUserShareModel.sinaUid = model.thirdPartyId; | ||
| 165 | - | ||
| 166 | - } | ||
| 167 | |||
| 168 | - else if([model.thirdPartyPlat isEqualToString:@"2"]){ | ||
| 169 | - CNUserShareModel.qqUid = model.thirdPartyId; | ||
| 170 | - | ||
| 171 | - } | ||
| 172 | - //微信 | ||
| 173 | - else if([model.thirdPartyPlat isEqualToString:@"3"]){ | ||
| 174 | - CNUserShareModel.wxUid = model.thirdPartyId; | ||
| 175 | - | ||
| 176 | - } | ||
| 177 | - //苹果 | ||
| 178 | - else if([model.thirdPartyPlat isEqualToString:@"5"]){ | ||
| 179 | - CNUserShareModel.appleUid = model.thirdPartyId; | ||
| 180 | - | ||
| 181 | - } | ||
| 182 | - [QMUITips showWithText:@"绑定成功" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; | ||
| 183 | - return model; | ||
| 184 | - | ||
| 185 | - } | ||
| 186 | - return nil; | ||
| 187 | - | ||
| 188 | -} | ||
| 189 | - | ||
| 190 | -//请求绑定数据 | ||
| 191 | -+ (void)requestModels:(CNLiveBindingArrayBlock)block{ | ||
| 192 | - NSMutableArray *bindingData = [[NSMutableArray alloc] init]; | ||
| 193 | - NSMutableArray *unBindingData = [[NSMutableArray alloc] init]; | ||
| 194 | - CNLiveBindingManageModel *tmodel = [[CNLiveBindingManageModel alloc]init]; | ||
| 195 | - tmodel.title = @"手机号"; | ||
| 196 | - tmodel.image = @"login_telephone"; | ||
| 197 | - NSString *mobile = [CNUserShareModel.mobile stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"]; | ||
| 198 | - tmodel.desc = mobile; | ||
| 199 | - tmodel.isBinding = @"1"; | ||
| 200 | - tmodel.thirdPartyPlat = @"10"; | ||
| 201 | - tmodel.thirdPartyId = CNUserShareModel.uid; | ||
| 202 | - [bindingData addObject:tmodel]; | ||
| 203 | - | ||
| 204 | - CNLiveBindingManageModel *wmodel = [[CNLiveBindingManageModel alloc]init]; | ||
| 205 | - wmodel.title = @"微信"; | ||
| 206 | - wmodel.image = @"login_wechat"; | ||
| 207 | - wmodel.thirdPartyPlat = @"3"; | ||
| 208 | - | ||
| 209 | - if(CNUserShareModel.wxUid&&![CNUserShareModel.wxUid isEqualToString:@""]){ | ||
| 210 | - wmodel.desc = @"已绑定微信"; | ||
| 211 | - wmodel.thirdPartyId = CNUserShareModel.wxUid; | ||
| 212 | - wmodel.isBinding = @"1"; | ||
| 213 | - }else{ | ||
| 214 | - wmodel.desc = @"未绑定微信"; | ||
| 215 | - wmodel.isBinding = @"0"; | ||
| 216 | - } | ||
| 217 | - [unBindingData addObject:wmodel]; | ||
| 218 | - | ||
| 219 | - CNLiveBindingManageModel *qmodel = [[CNLiveBindingManageModel alloc]init]; | ||
| 220 | - qmodel.title = @"QQ"; | ||
| 221 | - qmodel.image = @"login_qq"; | ||
| 222 | - qmodel.thirdPartyPlat = @"2"; | ||
| 223 | - if(CNUserShareModel.qqUid&&![CNUserShareModel.qqUid isEqualToString:@""]){ | ||
| 224 | - qmodel.desc = @"已绑定QQ"; | ||
| 225 | - qmodel.thirdPartyId = CNUserShareModel.qqUid; | ||
| 226 | - qmodel.isBinding = @"1"; | ||
| 227 | - }else{ | ||
| 228 | - qmodel.desc = @"未绑定QQ"; | ||
| 229 | - qmodel.isBinding = @"0"; | ||
| 230 | - } | ||
| 231 | - [unBindingData addObject:qmodel]; | ||
| 232 | - | ||
| 233 | - CNLiveBindingManageModel *smodel = [[CNLiveBindingManageModel alloc]init]; | ||
| 234 | - smodel.title = @"微博"; | ||
| 235 | - smodel.image = @"login_weibo"; | ||
| 236 | - smodel.thirdPartyPlat = @"1"; | ||
| 237 | - if(CNUserShareModel.sinaUid&&![CNUserShareModel.sinaUid isEqualToString:@""]){ | ||
| 238 | - smodel.desc = @"已绑定微博"; | ||
| 239 | - smodel.thirdPartyId = CNUserShareModel.sinaUid; | ||
| 240 | - smodel.isBinding = @"1"; | ||
| 241 | - }else{ | ||
| 242 | - smodel.desc = @"未绑定微博"; | ||
| 243 | - smodel.isBinding = @"0"; | ||
| 244 | - } | ||
| 245 | - [unBindingData addObject:smodel]; | ||
| 246 | - | ||
| 247 | - CNLiveBindingManageModel *amodel = [[CNLiveBindingManageModel alloc]init]; | ||
| 248 | - amodel.title = @"苹果账号"; | ||
| 249 | - amodel.image = @"login_apple_icon"; | ||
| 250 | - amodel.thirdPartyPlat = @"5"; | ||
| 251 | - if(CNUserShareModel.appleUid&&![CNUserShareModel.appleUid isEqualToString:@""]){ | ||
| 252 | - amodel.desc = @"已绑定苹果账号"; | ||
| 253 | - amodel.thirdPartyId = CNUserShareModel.appleUid; | ||
| 254 | - amodel.isBinding = @"1"; | ||
| 255 | - }else{ | ||
| 256 | - amodel.desc = @"未绑定苹果账号"; | ||
| 257 | - amodel.isBinding = @"0"; | ||
| 258 | - } | ||
| 259 | - [unBindingData addObject:amodel]; | ||
| 260 | - | ||
| 261 | - block?block(bindingData,unBindingData):@""; | ||
| 262 | -} | ||
| 263 | - | ||
| 264 | -//三方登录 | ||
| 265 | -//+ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNThreeLoginModel *)model block:(CNLoginResponseBlock)block{ | ||
| 266 | -// NSDictionary *params = @{@"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | ||
| 267 | -// @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | ||
| 268 | -// @"frmId":model.frmId?model.frmId:@"", | ||
| 269 | -// @"clientPlat":@"i"}; | ||
| 270 | -// [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 271 | -// [CNLiveNetworking setupShowDataResult:NO]; | ||
| 272 | -// | ||
| 273 | -// [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginIn3rdForWJJUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 274 | -// block?block(requestTask, responseObject, error):@""; | ||
| 275 | -// | ||
| 276 | -// }]; | ||
| 277 | -// | ||
| 278 | -// | ||
| 279 | -//} | ||
| 280 | - | ||
| 281 | -@end |
CNLiveBLoginModule/Classes/Controller/CNLiveLoginController.m
| @@ -16,12 +16,15 @@ | @@ -16,12 +16,15 @@ | ||
| 16 | #import "CNLiveCategory.h" | 16 | #import "CNLiveCategory.h" |
| 17 | #import "CNUserInfoManager.h" | 17 | #import "CNUserInfoManager.h" |
| 18 | #import "CNLiveEnvironment.h" | 18 | #import "CNLiveEnvironment.h" |
| 19 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 19 | 20 | ||
| 20 | #import "CNLiveLoginView.h" | 21 | #import "CNLiveLoginView.h" |
| 21 | #import "CNLiveThreeLoginView.h" | 22 | #import "CNLiveThreeLoginView.h" |
| 22 | #import "CNLiveBindingTelController.h"//绑定手机号 | 23 | #import "CNLiveBindingTelController.h"//绑定手机号 |
| 23 | #import "CNLiveCompleteInfoController.h"//修改昵称 | 24 | #import "CNLiveCompleteInfoController.h"//修改昵称 |
| 24 | #import "CNLiveLoginRequest.h" | 25 | #import "CNLiveLoginRequest.h" |
| 26 | +#import "CNLiveThreeLoginModel.h" | ||
| 27 | +#import "CNLiveThreeLoginRequest.h" | ||
| 25 | 28 | ||
| 26 | @interface CNLiveLoginController()<CNLiveLoginViewDelegate, CNLiveThreeLoginViewDelegate> | 29 | @interface CNLiveLoginController()<CNLiveLoginViewDelegate, CNLiveThreeLoginViewDelegate> |
| 27 | @property (nonatomic, weak) CNLiveLoginView *loginView; | 30 | @property (nonatomic, weak) CNLiveLoginView *loginView; |
| @@ -94,7 +97,7 @@ | @@ -94,7 +97,7 @@ | ||
| 94 | 97 | ||
| 95 | #pragma mark - CNLiveLoginViewDelegate | 98 | #pragma mark - CNLiveLoginViewDelegate |
| 96 | - (void)loginSuccess:(CNLiveLoginView *)view isNewUser:(BOOL)isNewUser result:(id _Nonnull)result{ | 99 | - (void)loginSuccess:(CNLiveLoginView *)view isNewUser:(BOOL)isNewUser result:(id _Nonnull)result{ |
| 97 | - if (!isNewUser) { | 100 | + if (isNewUser) { |
| 98 | // 新用户 -> 设置昵称和头像 | 101 | // 新用户 -> 设置昵称和头像 |
| 99 | CNLiveCompleteInfoController *vc = [[CNLiveCompleteInfoController alloc]init]; | 102 | CNLiveCompleteInfoController *vc = [[CNLiveCompleteInfoController alloc]init]; |
| 100 | vc.hidesBottomBarWhenPushed = YES; | 103 | vc.hidesBottomBarWhenPushed = YES; |
| @@ -115,18 +118,124 @@ | @@ -115,18 +118,124 @@ | ||
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | #pragma mark - CNLiveThreeLoginViewDelegate | 120 | #pragma mark - CNLiveThreeLoginViewDelegate |
| 118 | -- (void)clickedButton:(CNLiveThreeLoginView *)view type:(CNLiveThreeLoginType)type{ | 121 | +- (void)clickedButton:(CNLiveThreeLoginView *)view type:(CNLiveSendAuthResp)type{ |
| 119 | // 1.请求三方平台 | 122 | // 1.请求三方平台 |
| 120 | - | ||
| 121 | - // 2.绑定手机号 | ||
| 122 | - [self jumpToBindingTelController:type]; | 123 | + if(![CNLiveNetworking isNetworking]){ |
| 124 | + [QMUITips showError:@"无法连接网络" inView:self.view hideAfterDelay:1.5]; | ||
| 125 | + return ; | ||
| 126 | + } | ||
| 127 | + [self.view endEditing:YES]; | ||
| 128 | + [QMUITips showLoadingInView:self.view]; | ||
| 129 | + __weak typeof(self) weakSelf = self; | ||
| 130 | + [CNLiveShareImageManager send:type authRespBlock:^(CNLiveSendAuthResp type, CNLiveThirdPartyModel *userInfo, NSError *error) { | ||
| 131 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 132 | + if(!strongSelf) return; | ||
| 133 | + [QMUITips hideAllToastInView:strongSelf.view animated:YES]; | ||
| 134 | + if(error){ | ||
| 135 | + if (type == CNLiveSendAuthRespApple && error.code == 1001) { | ||
| 136 | + [QMUITips showError:@"取消登录" inView:strongSelf.view hideAfterDelay:1.5]; | ||
| 137 | + return; | ||
| 138 | + } | ||
| 139 | + if(error.code == 10000){ | ||
| 140 | + //用户取消 | ||
| 141 | + [QMUITips showError:@"取消登录" inView:strongSelf.view hideAfterDelay:1.5]; | ||
| 142 | + }else{ | ||
| 143 | + [QMUITips showError:@"登录失败" inView:strongSelf.view hideAfterDelay:1.5]; | ||
| 144 | + } | ||
| 145 | + return ; | ||
| 146 | + } | ||
| 147 | + CNLiveThreeLoginModel *model = [[CNLiveThreeLoginModel alloc]init]; | ||
| 148 | + model.nickName = userInfo.nickName; | ||
| 149 | + model.gender = userInfo.gender; | ||
| 150 | + model.location = userInfo.location; | ||
| 151 | + model.faceUrl = userInfo.faceUrl; | ||
| 152 | + model.thirdPartyId = userInfo.thirdPartyId; | ||
| 153 | + | ||
| 154 | +// model.countryName = strongSelf->_countryStr; | ||
| 155 | +// model.countryCode = strongSelf->_codeStr; | ||
| 156 | +// model.frmId = [CNTools getFrmId]; | ||
| 157 | + switch (type) { | ||
| 158 | + case CNLiveSendAuthRespApple: | ||
| 159 | + { | ||
| 160 | + model.thirdPartyPlat = @"5"; | ||
| 161 | + } | ||
| 162 | + break; | ||
| 163 | + case CNLiveSendAuthRespWX: | ||
| 164 | + { | ||
| 165 | + model.thirdPartyPlat = @"3"; | ||
| 166 | + } | ||
| 167 | + break; | ||
| 168 | + case CNLiveSendAuthRespQQ: | ||
| 169 | + { | ||
| 170 | + model.thirdPartyPlat = @"2"; | ||
| 171 | + } | ||
| 172 | + break; | ||
| 173 | + case CNLiveSendAuthRespWB: | ||
| 174 | + { | ||
| 175 | + model.thirdPartyPlat = @"1"; | ||
| 176 | + } | ||
| 177 | + break; | ||
| 178 | + } | ||
| 179 | + [strongSelf thirdPartyLoginWithType:type model:model]; | ||
| 180 | + | ||
| 181 | + }]; | ||
| 123 | 182 | ||
| 124 | } | 183 | } |
| 125 | 184 | ||
| 126 | -- (void)jumpToBindingTelController:(CNLiveThreeLoginType)type{ | ||
| 127 | - CNLiveBindingTelController *vc = [[CNLiveBindingTelController alloc]initWithType:type]; | ||
| 128 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 129 | - | 185 | +- (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNLiveThreeLoginModel *)model{ |
| 186 | + [QMUITips showLoadingInView:self.view]; | ||
| 187 | + __weak typeof(self) weakSelf = self; | ||
| 188 | + [CNLiveThreeLoginRequest thirdPartyLoginWithType:type model:model block:^(NSURLSessionTask * _Nonnull requestTask, id _Nonnull responseObject, NSError * _Nonnull error) { | ||
| 189 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 190 | + if(!strongSelf) return; | ||
| 191 | + [QMUITips hideAllToastInView:strongSelf.view animated:YES]; | ||
| 192 | + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"42013"]) { | ||
| 193 | + //未注册 | ||
| 194 | + CNLiveBindingTelController *vc = [[CNLiveBindingTelController alloc]initWithModel:model]; | ||
| 195 | + __weak typeof(strongSelf) weakSelf = strongSelf; | ||
| 196 | + vc.block = ^(NSString * _Nonnull countryName, NSString * _Nonnull countryCode) { | ||
| 197 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 198 | + if(!strongSelf) return; | ||
| 199 | +// strongSelf->_mobileLocaLbl.text = countryName; | ||
| 200 | +// strongSelf->_countryStr = countryName; | ||
| 201 | +// strongSelf->_countryLbl.text = [NSString stringWithFormat:@"+%@",countryCode]; | ||
| 202 | +// strongSelf->_codeStr = countryCode; | ||
| 203 | + }; | ||
| 204 | + vc.hidesBottomBarWhenPushed = YES; | ||
| 205 | + [strongSelf presentViewController:vc animated:YES completion:nil]; | ||
| 206 | + | ||
| 207 | + } | ||
| 208 | + else if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | ||
| 209 | + // 登录成功 | ||
| 210 | + // 给用户库使用 | ||
| 211 | + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | ||
| 212 | + [userDefaults setObject:responseObject[@"data"][@"token"] forKey:@"CNLiveAuthToken"]; | ||
| 213 | + [userDefaults setObject:responseObject[@"data"][@"uid"] forKey:@"CNLiveUserSid"]; | ||
| 214 | + [userDefaults synchronize]; | ||
| 215 | + | ||
| 216 | + // 连接IM | ||
| 217 | + __weak typeof(strongSelf) weakSelf = strongSelf; | ||
| 218 | + [[CNLiveLoginRequest manager] loginTIM:CNUserShareModel.uid success:^{ | ||
| 219 | + // 进入tabbar | ||
| 220 | + | ||
| 221 | + } failed:^(int code, NSString * _Nonnull msg) { | ||
| 222 | + // 错误逻辑 | ||
| 223 | + __strong typeof(weakSelf) strongSelf = weakSelf; | ||
| 224 | + if(!strongSelf) return; | ||
| 225 | + | ||
| 226 | + }]; | ||
| 227 | + | ||
| 228 | + } | ||
| 229 | + else if ([responseObject isKindOfClass:[NSDictionary class]] ) { | ||
| 230 | + [QMUITips showWithText:responseObject[@"errorMessage"] inView:strongSelf.view hideAfterDelay:1.5]; | ||
| 231 | + } | ||
| 232 | + else{ | ||
| 233 | + [QMUITips hideAllToastInView:strongSelf.view animated:YES]; | ||
| 234 | + [QMUITips showError:@"登录失败" inView:strongSelf.view hideAfterDelay:1.5]; | ||
| 235 | + | ||
| 236 | + } | ||
| 237 | + }]; | ||
| 238 | + | ||
| 130 | } | 239 | } |
| 131 | 240 | ||
| 132 | /* | 241 | /* |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelController.h
| 1 | // | 1 | // |
| 2 | // CNLiveBindingTelController.h | 2 | // CNLiveBindingTelController.h |
| 3 | -// CNLiveLoginModule | 3 | +// CNLiveBLoginModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/9/9. | 5 | // Created by CNLive-zxw on 2019/9/9. |
| 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. | 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. |
| @@ -10,9 +10,15 @@ | @@ -10,9 +10,15 @@ | ||
| 10 | #import "CNLiveThreeLoginType.h" | 10 | #import "CNLiveThreeLoginType.h" |
| 11 | 11 | ||
| 12 | NS_ASSUME_NONNULL_BEGIN | 12 | NS_ASSUME_NONNULL_BEGIN |
| 13 | +@class CNLiveThreeLoginModel; | ||
| 14 | + | ||
| 15 | +typedef void (^CNLiveBindingTelBlock) (NSString *countryName, NSString *countryCode); | ||
| 13 | 16 | ||
| 14 | @interface CNLiveBindingTelController : UIViewController | 17 | @interface CNLiveBindingTelController : UIViewController |
| 15 | -- (instancetype)initWithType:(CNLiveThreeLoginType)type; | 18 | +@property (nonatomic, strong) CNLiveThreeLoginModel *model; |
| 19 | +@property (nonatomic, copy) CNLiveBindingTelBlock block; | ||
| 20 | + | ||
| 21 | +- (instancetype)initWithModel:(CNLiveThreeLoginModel *)model; | ||
| 16 | 22 | ||
| 17 | 23 | ||
| 18 | @end | 24 | @end |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelController.m
| 1 | // | 1 | // |
| 2 | // CNLiveBindingTelController.m | 2 | // CNLiveBindingTelController.m |
| 3 | -// CNLiveLoginModule | 3 | +// CNLiveBLoginModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/9/9. | 5 | // Created by CNLive-zxw on 2019/9/9. |
| 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. | 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. |
| @@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
| 27 | @end | 27 | @end |
| 28 | 28 | ||
| 29 | @implementation CNLiveBindingTelController | 29 | @implementation CNLiveBindingTelController |
| 30 | -- (instancetype)initWithType:(CNLiveThreeLoginType)type{ | 30 | +- (instancetype)initWithModel:(CNLiveThreeLoginModel *)model { |
| 31 | self = [super init]; | 31 | self = [super init]; |
| 32 | if (self) { | 32 | if (self) { |
| 33 | - self.type = type; | 33 | + self.model = model; |
| 34 | } | 34 | } |
| 35 | return self; | 35 | return self; |
| 36 | 36 | ||
| @@ -53,12 +53,10 @@ | @@ -53,12 +53,10 @@ | ||
| 53 | [self.view addSubview:self.navigationBar]; | 53 | [self.view addSubview:self.navigationBar]; |
| 54 | [self.view addSubview:self.bindingTelView]; | 54 | [self.view addSubview:self.bindingTelView]; |
| 55 | [self.view addSubview:self.protocol]; | 55 | [self.view addSubview:self.protocol]; |
| 56 | - | ||
| 57 | } | 56 | } |
| 58 | 57 | ||
| 59 | - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { | 58 | - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { |
| 60 | [self.view endEditing:YES]; | 59 | [self.view endEditing:YES]; |
| 61 | - | ||
| 62 | } | 60 | } |
| 63 | 61 | ||
| 64 | #pragma mark - CNLiveBindingTelViewDelegate | 62 | #pragma mark - CNLiveBindingTelViewDelegate |
| @@ -75,6 +73,7 @@ | @@ -75,6 +73,7 @@ | ||
| 75 | // Pass the selected object to the new view controller. | 73 | // Pass the selected object to the new view controller. |
| 76 | } | 74 | } |
| 77 | */ | 75 | */ |
| 76 | + | ||
| 78 | #pragma mark - 懒加载 | 77 | #pragma mark - 懒加载 |
| 79 | - (CNLiveNavigationBar *)navigationBar { | 78 | - (CNLiveNavigationBar *)navigationBar { |
| 80 | if (!_navigationBar) { | 79 | if (!_navigationBar) { |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.h
| 1 | // | 1 | // |
| 2 | // CNLiveBindingTelView.h | 2 | // CNLiveBindingTelView.h |
| 3 | -// CNLiveLoginModule | 3 | +// CNLiveBLoginModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/9/6. | 5 | // Created by CNLive-zxw on 2019/9/6. |
| 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. | 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.m
| 1 | // | 1 | // |
| 2 | // CNLiveBindingTelView.m | 2 | // CNLiveBindingTelView.m |
| 3 | -// CNLiveLoginModule | 3 | +// CNLiveBLoginModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/9/6. | 5 | // Created by CNLive-zxw on 2019/9/6. |
| 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. | 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginModel.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveThreeLoginModel.h | ||
| 3 | +// CNLiveBLoginModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | +#import "CNLiveShareImageManager.h" | ||
| 11 | + | ||
| 12 | +NS_ASSUME_NONNULL_BEGIN | ||
| 13 | + | ||
| 14 | +@interface CNLiveThreeLoginModel : NSObject | ||
| 15 | +/* | ||
| 16 | + mobile true string 手机号 | ||
| 17 | + countryCode true string 手机号国家码;中国为86 | ||
| 18 | + verificationCode true string 手机验证码 | ||
| 19 | + thirdPartyPlat true int 第三方平台编号 [platform : 1:sina 2:qq 3:weixin 4:renren] | ||
| 20 | + thirdPartyId true string 第三方用户ID | ||
| 21 | + [qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr]; | ||
| 22 | + 注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同 | ||
| 23 | + | ||
| 24 | + frmId true string 渠道ID | ||
| 25 | + clientPlat true string 客户端平台[i:IOS客户端,a:Android客户端, w: 网页] | ||
| 26 | + nickName true string 用户昵称 | ||
| 27 | + gender false string 性别,m:男、f:女、n:未知 | ||
| 28 | + location false string 用户所在地 | ||
| 29 | + faceUrl false string 头像,约100*100 | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +@property (nonatomic, copy) NSString *countryName; | ||
| 33 | +@property (nonatomic, copy) NSString *countryCode; | ||
| 34 | +@property (nonatomic, copy) NSString *thirdPartyPlat; | ||
| 35 | +@property (nonatomic, copy) NSString *thirdPartyId; | ||
| 36 | +@property (nonatomic, copy) NSString *frmId; | ||
| 37 | + | ||
| 38 | +@property (nonatomic, copy) NSString *nickName; | ||
| 39 | +@property (nonatomic, copy) NSString *gender; | ||
| 40 | +@property (nonatomic, copy) NSString *location; | ||
| 41 | +@property (nonatomic, copy) NSString *faceUrl; | ||
| 42 | + | ||
| 43 | +@property (nonatomic, assign) CNLiveSendAuthResp type; | ||
| 44 | + | ||
| 45 | +@end | ||
| 46 | + | ||
| 47 | +NS_ASSUME_NONNULL_END |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginModel.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveThreeLoginModel.m | ||
| 3 | +// CNLiveBLoginModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveThreeLoginModel.h" | ||
| 10 | + | ||
| 11 | +@implementation CNLiveThreeLoginModel | ||
| 12 | + | ||
| 13 | +- (CNLiveSendAuthResp)type{ | ||
| 14 | + CNLiveSendAuthResp type = CNLiveSendAuthRespWX; | ||
| 15 | + | ||
| 16 | + if([self.thirdPartyPlat isEqualToString:@"1"]){ | ||
| 17 | + type = CNLiveSendAuthRespWB; | ||
| 18 | + | ||
| 19 | + }else if ([self.thirdPartyPlat isEqualToString:@"2"]){ | ||
| 20 | + type = CNLiveSendAuthRespQQ; | ||
| 21 | + | ||
| 22 | + }else if([self.thirdPartyPlat isEqualToString:@"3"]){ | ||
| 23 | + type = CNLiveSendAuthRespWX; | ||
| 24 | + | ||
| 25 | + }else if([self.thirdPartyPlat isEqualToString:@"5"]){ | ||
| 26 | + type = CNLiveSendAuthRespApple; | ||
| 27 | + | ||
| 28 | + } | ||
| 29 | + return type; | ||
| 30 | + | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +@end |
CNLiveBLoginModule/Classes/BindingManage/CNLiveBindingManageRequest.h renamed to CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginRequest.h
| 1 | // | 1 | // |
| 2 | -// CNLiveBindingManageRequest.h | ||
| 3 | -// CNLiveNetAdd | 2 | +// CNLiveThreeLoginRequest.h |
| 3 | +// CNLiveBLoginModule | ||
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/9/10. | 5 | // Created by CNLive-zxw on 2019/9/10. |
| 6 | // Copyright © 2019 cnlive. All rights reserved. | 6 | // Copyright © 2019 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | -//#import "CNLiveShareImageManager.h" | 10 | +#import "CNLiveShareImageManager.h" |
| 11 | 11 | ||
| 12 | NS_ASSUME_NONNULL_BEGIN | 12 | NS_ASSUME_NONNULL_BEGIN |
| 13 | -@class CNLiveBindingManageModel; | ||
| 14 | -@class CNThreeLoginModel; | 13 | +@class CNLiveThreeLoginModel; |
| 15 | 14 | ||
| 16 | -typedef void (^CNLiveBindingResponseBlock)(BOOL isSuccess, CNLiveBindingManageModel * _Nullable model, BOOL isBinding); | ||
| 17 | -typedef void (^CNLiveBindingArrayBlock)(NSArray * _Nullable bindingData, NSArray * _Nullable unBindingData); | ||
| 18 | typedef void (^CNLiveLoginResponseBlock)(NSURLSessionTask *requestTask, id responseObject, NSError *error); | 15 | typedef void (^CNLiveLoginResponseBlock)(NSURLSessionTask *requestTask, id responseObject, NSError *error); |
| 19 | 16 | ||
| 20 | -@interface CNLiveBindingManageRequest : NSObject | ||
| 21 | -/** | ||
| 22 | - * @abstract 绑定/解除绑定 | ||
| 23 | - * | ||
| 24 | - * @param model 模型 | ||
| 25 | - * @param block 回调 | ||
| 26 | - */ | ||
| 27 | -+ (void)requestModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block; | ||
| 28 | - | ||
| 29 | -/** | ||
| 30 | - * @abstract 获取绑定数据 | ||
| 31 | - * | ||
| 32 | - * @param block 回调 | ||
| 33 | - */ | ||
| 34 | -+ (void)requestModels:(CNLiveBindingArrayBlock)block; | 17 | +@interface CNLiveThreeLoginRequest : NSObject |
| 35 | 18 | ||
| 36 | /** | 19 | /** |
| 37 | * @abstract 三方登录 | 20 | * @abstract 三方登录 |
| @@ -40,7 +23,7 @@ typedef void (^CNLiveLoginResponseBlock)(NSURLSessionTask *requestTask, id respo | @@ -40,7 +23,7 @@ typedef void (^CNLiveLoginResponseBlock)(NSURLSessionTask *requestTask, id respo | ||
| 40 | * @param model 模型 | 23 | * @param model 模型 |
| 41 | * @param block 回调 | 24 | * @param block 回调 |
| 42 | */ | 25 | */ |
| 43 | -//+ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNThreeLoginModel *)model block:(CNLoginResponseBlock)block; | 26 | ++ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNLiveThreeLoginModel *)model block:(CNLiveLoginResponseBlock)block; |
| 44 | 27 | ||
| 45 | @end | 28 | @end |
| 46 | 29 |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginRequest.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveThreeLoginRequest.m | ||
| 3 | +// CNLiveBLoginModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/9/10. | ||
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveThreeLoginRequest.h" | ||
| 10 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 11 | +#import "CNLiveThreeLoginModel.h" | ||
| 12 | +#import "CNLiveShareImageManager.h" | ||
| 13 | + | ||
| 14 | +@implementation CNLiveThreeLoginRequest | ||
| 15 | + | ||
| 16 | +// 三方登录 | ||
| 17 | ++ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNLiveThreeLoginModel *)model block:(CNLiveLoginResponseBlock)block { | ||
| 18 | + NSDictionary *params = @{@"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | ||
| 19 | + @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | ||
| 20 | + @"frmId":model.frmId?model.frmId:@"", | ||
| 21 | + @"clientPlat":@"i"}; | ||
| 22 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 23 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 24 | + | ||
| 25 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginIn3rdForWJJUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 26 | + block?block(requestTask, responseObject, error):@""; | ||
| 27 | + }]; | ||
| 28 | + | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +@end |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginView.h
| @@ -7,13 +7,13 @@ | @@ -7,13 +7,13 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | -//#import "CNLiveShareImageManager.h" | 10 | +#import "CNLiveShareImageManager.h" |
| 11 | 11 | ||
| 12 | NS_ASSUME_NONNULL_BEGIN | 12 | NS_ASSUME_NONNULL_BEGIN |
| 13 | 13 | ||
| 14 | @class CNLiveThreeLoginView; | 14 | @class CNLiveThreeLoginView; |
| 15 | @protocol CNLiveThreeLoginViewDelegate <NSObject> | 15 | @protocol CNLiveThreeLoginViewDelegate <NSObject> |
| 16 | -//- (void)clickedButton:(CNLiveThreeLoginView *)view type:(CNLiveSendAuthResp)type; | 16 | +- (void)clickedButton:(CNLiveThreeLoginView *)view type:(CNLiveSendAuthResp)type; |
| 17 | 17 | ||
| 18 | @end | 18 | @end |
| 19 | @interface CNLiveThreeLoginView : UIView | 19 | @interface CNLiveThreeLoginView : UIView |
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveThreeLoginView.m
| @@ -9,106 +9,105 @@ | @@ -9,106 +9,105 @@ | ||
| 9 | #import "CNLiveThreeLoginView.h" | 9 | #import "CNLiveThreeLoginView.h" |
| 10 | #import "YYKit.h" | 10 | #import "YYKit.h" |
| 11 | #import "CNLiveCategory.h" | 11 | #import "CNLiveCategory.h" |
| 12 | -//#import "CNLiveShareManager.h" | ||
| 13 | -//#import "WXApi.h" | 12 | +#import "CNLiveShareImageManager.h" |
| 13 | +#import "WXApi.h" | ||
| 14 | 14 | ||
| 15 | @interface CNLiveThreeLoginView() | 15 | @interface CNLiveThreeLoginView() |
| 16 | 16 | ||
| 17 | @end | 17 | @end |
| 18 | @implementation CNLiveThreeLoginView | 18 | @implementation CNLiveThreeLoginView |
| 19 | static NSInteger const rowHeight = 60; | 19 | static NSInteger const rowHeight = 60; |
| 20 | -//- (instancetype)initWithFrame:(CGRect)frame{ | ||
| 21 | -// self = [super initWithFrame:frame]; | ||
| 22 | -// if (self) { | ||
| 23 | -// [self createSubviews:frame]; | ||
| 24 | -// | ||
| 25 | -// } | ||
| 26 | -// return self; | ||
| 27 | -// | ||
| 28 | -//} | ||
| 29 | -//- (void)createSubviews:(CGRect)frame{ | ||
| 30 | -// CGFloat width = frame.size.width; | ||
| 31 | -// CGFloat nameWidth = width/3.0; | ||
| 32 | -// CGFloat lineLeft = 15; | ||
| 33 | -// CGFloat lineWidth = nameWidth - lineLeft*2; | ||
| 34 | -// | ||
| 35 | -// UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(lineLeft, (rowHeight/3.0-1)/2.0, lineWidth, 1)]; | ||
| 36 | -// leftLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 37 | -// [self addSubview:leftLine]; | ||
| 38 | -// | ||
| 39 | -// UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(nameWidth, 0, nameWidth, rowHeight/3.0)]; | ||
| 40 | -// name.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 41 | -// name.font = [UIFont systemFontOfSize:14]; | ||
| 42 | -// name.textAlignment = NSTextAlignmentCenter; | ||
| 43 | -// name.text = @"第三方账号登录"; | ||
| 44 | -// [self addSubview:name]; | ||
| 45 | -// | ||
| 46 | -// UILabel *rightLine = [[UILabel alloc] initWithFrame:CGRectMake(name.right+15, leftLine.top, leftLine.width, 1)]; | ||
| 47 | -// rightLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 48 | -// [self addSubview:rightLine]; | ||
| 49 | -// | ||
| 50 | -// NSMutableArray *pics = [NSMutableArray arrayWithArray:@[@"login_qq",@"login_weibo"]]; | ||
| 51 | -// if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 52 | -// [pics insertObject:@"login_wechat" atIndex:0]; | ||
| 53 | -// } | ||
| 54 | -// NSUInteger number = pics.count; | ||
| 55 | -// if (@available(iOS 13, *)) { | ||
| 56 | -// [pics addObject:@"login_apple"]; | ||
| 57 | -// number = pics.count + 1; | ||
| 58 | -// } | ||
| 59 | -// CGFloat btnWidth = width/number*1.0; | ||
| 60 | -// | ||
| 61 | -// for(int i = 0; i < pics.count; i++){ | ||
| 62 | -// UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 63 | -// btn.tag = 10000+i; | ||
| 64 | -// btn.frame = CGRectMake(btnWidth*i, name.bottom, btnWidth, rowHeight); | ||
| 65 | -// if (@available(iOS 13, *)) { | ||
| 66 | -// if (i == pics.count-1) { | ||
| 67 | -// btn.frame = CGRectMake(btnWidth*i, name.bottom, 2*btnWidth, rowHeight); | ||
| 68 | -// } | ||
| 69 | -// } | ||
| 70 | -// UIImage *image = [self getImageWithImageName:pics[i] bundleName:@"CNLiveBLoginModule" targetClass:[self class]]; | ||
| 71 | -// [btn setImage:image forState:UIControlStateNormal]; | ||
| 72 | -// btn.adjustsImageWhenHighlighted = NO; | ||
| 73 | -// [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 74 | -// [self addSubview:btn]; | ||
| 75 | -// | ||
| 76 | -// } | ||
| 77 | -// | ||
| 78 | -//} | ||
| 79 | -//- (void)btnDidClicked:(UIButton *)btn{ | ||
| 80 | -// if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 81 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 82 | -// if(btn.tag == 10000){ | ||
| 83 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWX]; | ||
| 84 | -// | ||
| 85 | -// }else if (btn.tag == 10001){ | ||
| 86 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 87 | -// | ||
| 88 | -// }else if(btn.tag == 10002){ | ||
| 89 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 90 | -// | ||
| 91 | -// }else if(btn.tag == 10003){ | ||
| 92 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 93 | -// | ||
| 94 | -// } | ||
| 95 | -// } | ||
| 96 | -// }else{ | ||
| 97 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 98 | -// if(btn.tag == 10000){ | ||
| 99 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 100 | -// | ||
| 101 | -// }else if(btn.tag == 10001){ | ||
| 102 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 103 | -// | ||
| 104 | -// }else if(btn.tag == 10002){ | ||
| 105 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 106 | -// | ||
| 107 | -// } | ||
| 108 | -// } | ||
| 109 | -// } | ||
| 110 | -// | ||
| 111 | -//} | 20 | +- (instancetype)initWithFrame:(CGRect)frame{ |
| 21 | + self = [super initWithFrame:frame]; | ||
| 22 | + if (self) { | ||
| 23 | + [self createSubviews:frame]; | ||
| 24 | + } | ||
| 25 | + return self; | ||
| 26 | + | ||
| 27 | +} | ||
| 28 | +- (void)createSubviews:(CGRect)frame{ | ||
| 29 | + CGFloat width = frame.size.width; | ||
| 30 | + CGFloat nameWidth = width/3.0; | ||
| 31 | + CGFloat lineLeft = 15; | ||
| 32 | + CGFloat lineWidth = nameWidth - lineLeft*2; | ||
| 33 | + | ||
| 34 | + UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(lineLeft, (rowHeight/3.0-1)/2.0, lineWidth, 1)]; | ||
| 35 | + leftLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 36 | + [self addSubview:leftLine]; | ||
| 37 | + | ||
| 38 | + UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(nameWidth, 0, nameWidth, rowHeight/3.0)]; | ||
| 39 | + name.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 40 | + name.font = [UIFont systemFontOfSize:14]; | ||
| 41 | + name.textAlignment = NSTextAlignmentCenter; | ||
| 42 | + name.text = @"第三方账号登录"; | ||
| 43 | + [self addSubview:name]; | ||
| 44 | + | ||
| 45 | + UILabel *rightLine = [[UILabel alloc] initWithFrame:CGRectMake(name.right+15, leftLine.top, leftLine.width, 1)]; | ||
| 46 | + rightLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 47 | + [self addSubview:rightLine]; | ||
| 48 | + | ||
| 49 | + NSMutableArray *pics = [NSMutableArray arrayWithArray:@[@"login_qq",@"login_weibo"]]; | ||
| 50 | + if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 51 | + [pics insertObject:@"login_wechat" atIndex:0]; | ||
| 52 | + } | ||
| 53 | + NSUInteger number = pics.count; | ||
| 54 | + if (@available(iOS 13, *)) { | ||
| 55 | + [pics addObject:@"login_apple"]; | ||
| 56 | + number = pics.count + 1; | ||
| 57 | + } | ||
| 58 | + CGFloat btnWidth = width/number*1.0; | ||
| 59 | + | ||
| 60 | + for(int i = 0; i < pics.count; i++){ | ||
| 61 | + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 62 | + btn.tag = 10000+i; | ||
| 63 | + btn.frame = CGRectMake(btnWidth*i, name.bottom, btnWidth, rowHeight); | ||
| 64 | + if (@available(iOS 13, *)) { | ||
| 65 | + if (i == pics.count-1) { | ||
| 66 | + btn.frame = CGRectMake(btnWidth*i, name.bottom, 2*btnWidth, rowHeight); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + UIImage *image = [self getImageWithImageName:pics[i] bundleName:@"CNLiveBLoginModule" targetClass:[self class]]; | ||
| 70 | + [btn setImage:image forState:UIControlStateNormal]; | ||
| 71 | + btn.adjustsImageWhenHighlighted = NO; | ||
| 72 | + [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 73 | + [self addSubview:btn]; | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +} | ||
| 78 | +- (void)btnDidClicked:(UIButton *)btn{ | ||
| 79 | + if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 80 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 81 | + if(btn.tag == 10000){ | ||
| 82 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWX]; | ||
| 83 | + | ||
| 84 | + }else if (btn.tag == 10001){ | ||
| 85 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 86 | + | ||
| 87 | + }else if(btn.tag == 10002){ | ||
| 88 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 89 | + | ||
| 90 | + }else if(btn.tag == 10003){ | ||
| 91 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 92 | + | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + }else{ | ||
| 96 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 97 | + if(btn.tag == 10000){ | ||
| 98 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 99 | + | ||
| 100 | + }else if(btn.tag == 10001){ | ||
| 101 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 102 | + | ||
| 103 | + }else if(btn.tag == 10002){ | ||
| 104 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 105 | + | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | +} | ||
| 112 | 111 | ||
| 113 | /* | 112 | /* |
| 114 | // Only override drawRect: if you perform custom drawing. | 113 | // Only override drawRect: if you perform custom drawing. |
Example/CNLiveBLoginModule.xcodeproj/project.pbxproj
| @@ -207,8 +207,8 @@ | @@ -207,8 +207,8 @@ | ||
| 207 | 6003F586195388D20070C39A /* Sources */, | 207 | 6003F586195388D20070C39A /* Sources */, |
| 208 | 6003F587195388D20070C39A /* Frameworks */, | 208 | 6003F587195388D20070C39A /* Frameworks */, |
| 209 | 6003F588195388D20070C39A /* Resources */, | 209 | 6003F588195388D20070C39A /* Resources */, |
| 210 | - BBC1C2A08E24C56EDE49DF37 /* [CP] Embed Pods Frameworks */, | ||
| 211 | - 15A7BE01FD10924E4F61D6AF /* [CP] Copy Pods Resources */, | 210 | + 819DA7EE2304C4CDBD93DEFD /* [CP] Embed Pods Frameworks */, |
| 211 | + D7ABAB38E741C83F2E6FB9FB /* [CP] Copy Pods Resources */, | ||
| 212 | ); | 212 | ); |
| 213 | buildRules = ( | 213 | buildRules = ( |
| 214 | ); | 214 | ); |
| @@ -299,26 +299,6 @@ | @@ -299,26 +299,6 @@ | ||
| 299 | /* End PBXResourcesBuildPhase section */ | 299 | /* End PBXResourcesBuildPhase section */ |
| 300 | 300 | ||
| 301 | /* Begin PBXShellScriptBuildPhase section */ | 301 | /* Begin PBXShellScriptBuildPhase section */ |
| 302 | - 15A7BE01FD10924E4F61D6AF /* [CP] Copy Pods Resources */ = { | ||
| 303 | - isa = PBXShellScriptBuildPhase; | ||
| 304 | - buildActionMask = 2147483647; | ||
| 305 | - files = ( | ||
| 306 | - ); | ||
| 307 | - inputPaths = ( | ||
| 308 | - "${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-resources.sh", | ||
| 309 | - "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveBLoginModule/CNLiveBLoginModule.bundle", | ||
| 310 | - "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.bundle", | ||
| 311 | - ); | ||
| 312 | - name = "[CP] Copy Pods Resources"; | ||
| 313 | - outputPaths = ( | ||
| 314 | - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveBLoginModule.bundle", | ||
| 315 | - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveUserAgreementManager.bundle", | ||
| 316 | - ); | ||
| 317 | - runOnlyForDeploymentPostprocessing = 0; | ||
| 318 | - shellPath = /bin/sh; | ||
| 319 | - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-resources.sh\"\n"; | ||
| 320 | - showEnvVarsInLog = 0; | ||
| 321 | - }; | ||
| 322 | 6F4CF912241B66B2163C0256 /* [CP] Check Pods Manifest.lock */ = { | 302 | 6F4CF912241B66B2163C0256 /* [CP] Check Pods Manifest.lock */ = { |
| 323 | isa = PBXShellScriptBuildPhase; | 303 | isa = PBXShellScriptBuildPhase; |
| 324 | buildActionMask = 2147483647; | 304 | buildActionMask = 2147483647; |
| @@ -341,7 +321,7 @@ | @@ -341,7 +321,7 @@ | ||
| 341 | 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"; | 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"; |
| 342 | showEnvVarsInLog = 0; | 322 | showEnvVarsInLog = 0; |
| 343 | }; | 323 | }; |
| 344 | - BBC1C2A08E24C56EDE49DF37 /* [CP] Embed Pods Frameworks */ = { | 324 | + 819DA7EE2304C4CDBD93DEFD /* [CP] Embed Pods Frameworks */ = { |
| 345 | isa = PBXShellScriptBuildPhase; | 325 | isa = PBXShellScriptBuildPhase; |
| 346 | buildActionMask = 2147483647; | 326 | buildActionMask = 2147483647; |
| 347 | files = ( | 327 | files = ( |
| @@ -419,6 +399,30 @@ | @@ -419,6 +399,30 @@ | ||
| 419 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-frameworks.sh\"\n"; | 399 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-frameworks.sh\"\n"; |
| 420 | showEnvVarsInLog = 0; | 400 | showEnvVarsInLog = 0; |
| 421 | }; | 401 | }; |
| 402 | + D7ABAB38E741C83F2E6FB9FB /* [CP] Copy Pods Resources */ = { | ||
| 403 | + isa = PBXShellScriptBuildPhase; | ||
| 404 | + buildActionMask = 2147483647; | ||
| 405 | + files = ( | ||
| 406 | + ); | ||
| 407 | + inputPaths = ( | ||
| 408 | + "${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-resources.sh", | ||
| 409 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveBLoginModule/CNLiveBLoginModule.bundle", | ||
| 410 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveShareToolKit/CNLiveShareToolKit.bundle", | ||
| 411 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.bundle", | ||
| 412 | + "${PODS_ROOT}/WeiboSDK/libWeiboSDK/WeiboSDK.bundle", | ||
| 413 | + ); | ||
| 414 | + name = "[CP] Copy Pods Resources"; | ||
| 415 | + outputPaths = ( | ||
| 416 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveBLoginModule.bundle", | ||
| 417 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveShareToolKit.bundle", | ||
| 418 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveUserAgreementManager.bundle", | ||
| 419 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/WeiboSDK.bundle", | ||
| 420 | + ); | ||
| 421 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 422 | + shellPath = /bin/sh; | ||
| 423 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveBLoginModule_Example/Pods-CNLiveBLoginModule_Example-resources.sh\"\n"; | ||
| 424 | + showEnvVarsInLog = 0; | ||
| 425 | + }; | ||
| 422 | FB82CB4346E92958307849D9 /* [CP] Check Pods Manifest.lock */ = { | 426 | FB82CB4346E92958307849D9 /* [CP] Check Pods Manifest.lock */ = { |
| 423 | isa = PBXShellScriptBuildPhase; | 427 | isa = PBXShellScriptBuildPhase; |
| 424 | buildActionMask = 2147483647; | 428 | buildActionMask = 2147483647; |
| @@ -586,6 +590,7 @@ | @@ -586,6 +590,7 @@ | ||
| 586 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd; | 590 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd; |
| 587 | PRODUCT_NAME = "$(TARGET_NAME)"; | 591 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 588 | SWIFT_VERSION = 4.0; | 592 | SWIFT_VERSION = 4.0; |
| 593 | + TARGETED_DEVICE_FAMILY = 1; | ||
| 589 | WRAPPER_EXTENSION = app; | 594 | WRAPPER_EXTENSION = app; |
| 590 | }; | 595 | }; |
| 591 | name = Debug; | 596 | name = Debug; |
| @@ -603,6 +608,7 @@ | @@ -603,6 +608,7 @@ | ||
| 603 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd; | 608 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd; |
| 604 | PRODUCT_NAME = "$(TARGET_NAME)"; | 609 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 605 | SWIFT_VERSION = 4.0; | 610 | SWIFT_VERSION = 4.0; |
| 611 | + TARGETED_DEVICE_FAMILY = 1; | ||
| 606 | WRAPPER_EXTENSION = app; | 612 | WRAPPER_EXTENSION = app; |
| 607 | }; | 613 | }; |
| 608 | name = Release; | 614 | name = Release; |
Example/CNLiveBLoginModule/CNLIVEAppDelegate.m
| @@ -19,18 +19,19 @@ | @@ -19,18 +19,19 @@ | ||
| 19 | { | 19 | { |
| 20 | // Override point for customization after application launch. | 20 | // Override point for customization after application launch. |
| 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小 | 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小 |
| 22 | - [CNLiveEnvironmentManager setAppType:CNLiveAppTypeBusiness environmentType:CNLiveProductionAppStore]; | ||
| 23 | - [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment]; | ||
| 24 | - if ([CNUserShareManager isLogin]) { | ||
| 25 | - [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid]; | ||
| 26 | - } | ||
| 27 | - [self networkParamAction]; | 22 | + [CNLiveEnvironmentManager setAppType:CNLiveAppTypeBusiness environmentType:CNLiveProductionAppStore]; |
| 23 | + [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment]; | ||
| 24 | + | ||
| 25 | + if ([CNUserShareManager isLogin]) { | ||
| 26 | + [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid]; | ||
| 27 | + } | ||
| 28 | + [self networkParamAction]; | ||
| 28 | 29 | ||
| 29 | - CNLiveLoginController *vc = [[CNLiveLoginController alloc] init]; | ||
| 30 | - vc.isShowClose = NO; | ||
| 31 | - UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; | ||
| 32 | - self.window.rootViewController = nav;//设置根视图控制器 | ||
| 33 | - [self.window makeKeyAndVisible];//设置成为 | 30 | + CNLiveLoginController *vc = [[CNLiveLoginController alloc] init]; |
| 31 | + vc.isShowClose = NO; | ||
| 32 | + UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; | ||
| 33 | + self.window.rootViewController = nav; | ||
| 34 | + [self.window makeKeyAndVisible]; | ||
| 34 | return YES; | 35 | return YES; |
| 35 | } | 36 | } |
| 36 | 37 |
Example/CNLiveBLoginModule/CNLiveBLoginModule-Info.plist
| @@ -2,11 +2,6 @@ | @@ -2,11 +2,6 @@ | ||
| 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>NSAppTransportSecurity</key> | ||
| 6 | - <dict> | ||
| 7 | - <key>NSAllowsArbitraryLoads</key> | ||
| 8 | - <true/> | ||
| 9 | - </dict> | ||
| 10 | <key>CFBundleDevelopmentRegion</key> | 5 | <key>CFBundleDevelopmentRegion</key> |
| 11 | <string>en</string> | 6 | <string>en</string> |
| 12 | <key>CFBundleDisplayName</key> | 7 | <key>CFBundleDisplayName</key> |
| @@ -25,10 +20,114 @@ | @@ -25,10 +20,114 @@ | ||
| 25 | <string>1.0</string> | 20 | <string>1.0</string> |
| 26 | <key>CFBundleSignature</key> | 21 | <key>CFBundleSignature</key> |
| 27 | <string>????</string> | 22 | <string>????</string> |
| 23 | + <key>CFBundleURLTypes</key> | ||
| 24 | + <array> | ||
| 25 | + <dict> | ||
| 26 | + <key>CFBundleTypeRole</key> | ||
| 27 | + <string>Editor</string> | ||
| 28 | + <key>CFBundleURLName</key> | ||
| 29 | + <string>微信正式</string> | ||
| 30 | + <key>CFBundleURLSchemes</key> | ||
| 31 | + <array> | ||
| 32 | + <string>wxed528fc749b7ee88</string> | ||
| 33 | + </array> | ||
| 34 | + </dict> | ||
| 35 | + <dict> | ||
| 36 | + <key>CFBundleTypeRole</key> | ||
| 37 | + <string>Editor</string> | ||
| 38 | + <key>CFBundleURLName</key> | ||
| 39 | + <string>QQ正式个人</string> | ||
| 40 | + <key>CFBundleURLSchemes</key> | ||
| 41 | + <array> | ||
| 42 | + <string>tencent1106691520</string> | ||
| 43 | + </array> | ||
| 44 | + </dict> | ||
| 45 | + <dict> | ||
| 46 | + <key>CFBundleTypeRole</key> | ||
| 47 | + <string>Editor</string> | ||
| 48 | + <key>CFBundleURLName</key> | ||
| 49 | + <string>QQ正式个人</string> | ||
| 50 | + <key>CFBundleURLSchemes</key> | ||
| 51 | + <array> | ||
| 52 | + <string>QQ41F6C5C0</string> | ||
| 53 | + </array> | ||
| 54 | + </dict> | ||
| 55 | + <dict> | ||
| 56 | + <key>CFBundleTypeRole</key> | ||
| 57 | + <string>Editor</string> | ||
| 58 | + <key>CFBundleURLName</key> | ||
| 59 | + <string>QQ正式企业</string> | ||
| 60 | + <key>CFBundleURLSchemes</key> | ||
| 61 | + <array> | ||
| 62 | + <string>QQ41FF0268</string> | ||
| 63 | + </array> | ||
| 64 | + </dict> | ||
| 65 | + <dict> | ||
| 66 | + <key>CFBundleTypeRole</key> | ||
| 67 | + <string>Editor</string> | ||
| 68 | + <key>CFBundleURLName</key> | ||
| 69 | + <string>微信测试</string> | ||
| 70 | + <key>CFBundleURLSchemes</key> | ||
| 71 | + <array> | ||
| 72 | + <string>wx9b7f9443a8ccf15a</string> | ||
| 73 | + </array> | ||
| 74 | + </dict> | ||
| 75 | + <dict> | ||
| 76 | + <key>CFBundleTypeRole</key> | ||
| 77 | + <string>Editor</string> | ||
| 78 | + <key>CFBundleURLName</key> | ||
| 79 | + <string>QQ测试个人</string> | ||
| 80 | + <key>CFBundleURLSchemes</key> | ||
| 81 | + <array> | ||
| 82 | + <string>QQ41FB075B</string> | ||
| 83 | + </array> | ||
| 84 | + </dict> | ||
| 85 | + <dict> | ||
| 86 | + <key>CFBundleTypeRole</key> | ||
| 87 | + <string>Editor</string> | ||
| 88 | + <key>CFBundleURLName</key> | ||
| 89 | + <string>QQ测试企业</string> | ||
| 90 | + <key>CFBundleURLSchemes</key> | ||
| 91 | + <array> | ||
| 92 | + <string>QQ41FB074D</string> | ||
| 93 | + </array> | ||
| 94 | + </dict> | ||
| 95 | + <dict> | ||
| 96 | + <key>CFBundleTypeRole</key> | ||
| 97 | + <string>Editor</string> | ||
| 98 | + <key>CFBundleURLName</key> | ||
| 99 | + <string>QQ测试企业</string> | ||
| 100 | + <key>CFBundleURLSchemes</key> | ||
| 101 | + <array> | ||
| 102 | + <string>tencent1106970445</string> | ||
| 103 | + </array> | ||
| 104 | + </dict> | ||
| 105 | + <dict> | ||
| 106 | + <key>CFBundleTypeRole</key> | ||
| 107 | + <string>Editor</string> | ||
| 108 | + <key>CFBundleURLName</key> | ||
| 109 | + <string>微博分享</string> | ||
| 110 | + <key>CFBundleURLSchemes</key> | ||
| 111 | + <array> | ||
| 112 | + <string>wb3884700821</string> | ||
| 113 | + </array> | ||
| 114 | + </dict> | ||
| 115 | + </array> | ||
| 28 | <key>CFBundleVersion</key> | 116 | <key>CFBundleVersion</key> |
| 29 | <string>1.0</string> | 117 | <string>1.0</string> |
| 30 | <key>LSRequiresIPhoneOS</key> | 118 | <key>LSRequiresIPhoneOS</key> |
| 31 | <true/> | 119 | <true/> |
| 120 | + <key>NSAppTransportSecurity</key> | ||
| 121 | + <dict> | ||
| 122 | + <key>NSAllowsArbitraryLoads</key> | ||
| 123 | + <true/> | ||
| 124 | + </dict> | ||
| 125 | + <key>NSCameraUsageDescription</key> | ||
| 126 | + <string>需要允许开启相机才能在发布生活圈或聊天时使用录制视频和拍照功能</string> | ||
| 127 | + <key>NSPhotoLibraryAddUsageDescription</key> | ||
| 128 | + <string>需要允许打开相册才能访问相册照片和保存照片</string> | ||
| 129 | + <key>NSPhotoLibraryUsageDescription</key> | ||
| 130 | + <string>需要允许打开相册才能访问相册照片和保存照片</string> | ||
| 32 | <key>UILaunchStoryboardName</key> | 131 | <key>UILaunchStoryboardName</key> |
| 33 | <string>LaunchScreen</string> | 132 | <string>LaunchScreen</string> |
| 34 | <key>UIMainStoryboardFile</key> | 133 | <key>UIMainStoryboardFile</key> |