Commit 1a5ca5d1c7706add27bc6855f21b852eb9ee0555

Authored by zhangxiaowen
1 parent e3fb2103

no message

Showing 44 changed files with 4457 additions and 0 deletions
CNLiveLogin.podspec 0 → 100644
  1 +#
  2 +# Be sure to run `pod lib lint CNLiveLogin.podspec' to ensure this is a
  3 +# valid spec before submitting.
  4 +#
  5 +# Any lines starting with a # are optional, but their use is encouraged
  6 +# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
  7 +#
  8 +
  9 +Pod::Spec.new do |s|
  10 + s.name = 'CNLiveLogin'
  11 + s.version = '0.0.1'
  12 + s.summary = '网家家登录'
  13 +
  14 +# This description is used to generate tags and improve search results.
  15 +# * Think: What does it do? Why did you write it? What is the focus?
  16 +# * Try to keep it short, snappy and to the point.
  17 +# * Write the description between the DESC delimiters below.
  18 +# * Finally, don't worry about the indent, CocoaPods strips it!
  19 +
  20 + s.description = <<-DESC
  21 +TODO: Add long description of the pod here.
  22 + DESC
  23 +
  24 + s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveLogin'
  25 + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  26 + s.license = { :type => 'MIT', :file => 'LICENSE' }
  27 + s.author = { '153993236@qq.com' => 'zhangxiaowen@cnlive.com' }
  28 + s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveLogin.git', :tag => s.version.to_s }
  29 + # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
  30 +
  31 + s.ios.deployment_target = '9.0'
  32 +
  33 + s.source_files = 'CNLiveLogin/Classes/**/*'
  34 +
  35 + # s.resource_bundles = {
  36 + # 'CNLiveLogin' => ['CNLiveLogin/Assets/*.png']
  37 + # }
  38 +
  39 + # s.public_header_files = 'Pod/Classes/**/*.h'
  40 + s.frameworks = 'UIKit', 'Foundation'
  41 + s.dependency 'Masonry'
  42 + s.dependency 'MJRefresh'
  43 + s.dependency 'QMUIKit'
  44 + s.dependency 'CNLiveBaseKit'
  45 + s.dependency 'CNLiveUserManagement'
  46 + s.dependency 'MJExtension'
  47 + s.dependency 'CNLiveCommonClass'
  48 + s.dependency 'CNLiveCustomUI'
  49 + s.dependency 'WebViewJavascriptBridge'
  50 +
  51 +end
CNLiveLogin/Assets/.gitkeep 0 → 100644
CNLiveLogin/Classes/.gitkeep 0 → 100644
CNLiveLogin/Classes/Controller/CNGuideViewController.h 0 → 100644
  1 +//
  2 +// CNGuideViewController.h
  3 +// com.cnlive.pro.CNLiveNetAdd
  4 +//
  5 +// Created by 流诗语 on 2018/4/19.
  6 +// Copyright © 2018年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface CNGuideViewController : UIViewController
  12 +
  13 +@end
CNLiveLogin/Classes/Controller/CNGuideViewController.m 0 → 100644
  1 +
  2 +
  3 +//
  4 +// CNGuideViewController.m
  5 +// com.cnlive.pro.CNLiveNetAdd
  6 +//
  7 +// Created by 流诗语 on 2018/4/19.
  8 +// Copyright © 2018年 cnlive. All rights reserved.
  9 +//
  10 +
  11 +#import "CNGuideViewController.h"
  12 +@interface CNGuideViewController ()
  13 +@property (strong, nonatomic) UIScrollView * scrollView;
  14 +@property (strong, nonatomic) UIButton * btn;
  15 +@end
  16 +
  17 +@implementation CNGuideViewController
  18 +
  19 +- (void)viewDidLoad {
  20 + [super viewDidLoad];
  21 + // Do any additional setup after loading the view from its nib.
  22 + [self.view addSubview:self.scrollView];
  23 + MJWeakSelf
  24 + NSArray * array = @[@"Launch_Image01",@"Launch_Image02",@"Launch_Image03"];
  25 + for (int i=0; i<3; i++) {
  26 + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i*KScreenWidth, 0, KScreenWidth, KScreenHeight)];
  27 + imageView.userInteractionEnabled = YES;
  28 + imageView.image = [UIImage imageNamed:array[i]];
  29 + [self.scrollView addSubview:imageView];
  30 + imageView.tag = 100+i;
  31 +
  32 + if (i == 2) {
  33 + [imageView addSubview:self.btn];
  34 + [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
  35 + make.centerX.mas_equalTo(imageView);
  36 + make.bottom.mas_equalTo(weakSelf.view.mas_bottom).offset(-20);
  37 + make.height.mas_equalTo(30);
  38 + }];
  39 + }
  40 +
  41 +// UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchImageAction:)];
  42 +// [imageView addGestureRecognizer:tap];
  43 + }
  44 +}
  45 +-(void)touchExpeAction:(UIButton *)btn
  46 +{
  47 + NSString * version = [[NSString stringWithFormat:@"version%@",[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]] md5];
  48 +
  49 + [[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:version];
  50 +
  51 + if ([CNUserShareManager isLogin]) {
  52 +
  53 + [[AppDelegate sharedAppDelegate] enterConnectServerVC];
  54 + }else{
  55 + [[AppDelegate sharedAppDelegate] enterLoginUI];
  56 + }
  57 +}
  58 +-(void)touchImageAction:(UITapGestureRecognizer *)tap
  59 +{
  60 + CGPoint pt = [tap locationInView:self.scrollView];
  61 + NSLog(@"点击了====>%@",NSStringFromCGPoint(pt));
  62 + if (tap.view.tag-100 == 2 && pt.x<3*KScreenWidth-130 && pt.x>3*KScreenWidth-280 && pt.y <KScreenHeight && pt.y > KScreenHeight-60) {
  63 +
  64 + NSString * version = [[NSString stringWithFormat:@"version%@",[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]] md5];
  65 +
  66 + [[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:version];
  67 +
  68 + if ([CNUserShareManager isLogin]) {
  69 +
  70 + [[AppDelegate sharedAppDelegate] enterConnectServerVC];
  71 + }else{
  72 + [[AppDelegate sharedAppDelegate] enterLoginUI];
  73 + }
  74 +
  75 + NSLog(@"点击我了");
  76 + }
  77 +}
  78 +
  79 +- (void)didReceiveMemoryWarning {
  80 + [super didReceiveMemoryWarning];
  81 + // Dispose of any resources that can be recreated.
  82 +}
  83 +-(UIButton *)btn
  84 +{
  85 + if (!_btn) {
  86 + _btn = [UIButton buttonWithType:UIButtonTypeCustom];
  87 + [_btn setImage:UIImageMake(@"icon_guide_expe") forState:UIControlStateNormal];
  88 + [_btn setImage:UIImageMake(@"icon_guide_expe") forState:UIControlStateHighlighted];
  89 + _btn.backgroundColor = kWhiteColor;
  90 + [_btn addTarget:self action:@selector(touchExpeAction:) forControlEvents:UIControlEventTouchUpInside];
  91 + _btn.layer.masksToBounds = YES;
  92 + _btn.layer.cornerRadius = 15;
  93 + }
  94 + return _btn;
  95 +}
  96 +-(UIScrollView *)scrollView
  97 +{
  98 + if (!_scrollView) {
  99 + _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  100 + _scrollView.backgroundColor = kWhiteColor;
  101 + _scrollView.pagingEnabled = YES;
  102 + _scrollView.contentSize = CGSizeMake(3*KScreenWidth, KScreenHeight);
  103 + }
  104 + return _scrollView;
  105 +}
  106 +
  107 +@end
CNLiveLogin/Classes/Controller/CNLoginIUsernfoViewController.h 0 → 100644
  1 +//
  2 +// CNLoginIUsernfoViewController.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by 张旭 on 2018/1/19.
  6 +// Copyright © 2018年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNCommonViewController.h"
  10 +
  11 +@interface CNLoginIUsernfoViewController : CNCommonViewController
  12 +
  13 +@property (nonatomic ,copy) NSString *mobileStr;
  14 +
  15 +@end
CNLiveLogin/Classes/Controller/CNLoginIUsernfoViewController.m 0 → 100644
  1 +//
  2 +// CNLoginIUsernfoViewController.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by 张旭 on 2018/1/19.
  6 +// Copyright © 2018年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLoginIUsernfoViewController.h"
  10 +#import "CNLoginTextField.h"
  11 +
  12 +//游客登录
  13 +#import "CNTabBarViewController.h"
  14 +#import "CNTouristsLoginViewController.h"
  15 +#import "CNCategoryGetChannelModel.h"
  16 +#import "CNTouristsLoginTipsView.h"
  17 +#import "CNNavigationController.h"
  18 +#import "CNClassifySegmentController.h"//一级
  19 +#import "CNSubClassifySegmentController.h"//二级
  20 +#import "CNGetLiveDataHandle.h"//直播
  21 +#import "CNPlayDetailViewController.h"//点播
  22 +#import "CNClassifyWebController.h"//h5详情
  23 +#import "NSString+CNLiveExtension.h"
  24 +#import "TZImagePickerController.h"
  25 +#import "RSKImageCropViewController.h"
  26 +
  27 +#define MaxNickLength 15
  28 +
  29 +@interface CNLoginIUsernfoViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate,UITextFieldDelegate,TZImagePickerControllerDelegate, RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource,TouristsLoginTipsViewDelegate>{
  30 + BOOL _isSeleIcon;
  31 + UIImage *_icon;
  32 +
  33 + BOOL _isAllowCamera;
  34 + BOOL _isAllowPgotoLibrary;
  35 +}
  36 +@property (nonatomic, strong) UIImageView *bgView;
  37 +
  38 +@property (nonatomic ,strong) QMUILabel *titleLabel;
  39 +
  40 +@property (nonatomic, strong) UIImageView *iconView;
  41 +@property (nonatomic ,strong) QMUILabel *iconLabel;
  42 +
  43 +@property (nonatomic, strong) CNLoginTextField *nickTF;
  44 +@property (nonatomic ,strong) QMUILabel *tipsLabel;
  45 +
  46 +@property (nonatomic, strong) UIButton *nextBtn;
  47 +@property (nonatomic, strong) IMALoginParam *loginParam;
  48 +
  49 +@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
  50 +
  51 +@end
  52 +
  53 +@implementation CNLoginIUsernfoViewController
  54 +#pragma mark - Life Cycle
  55 +- (void)viewDidLoad {
  56 + [super viewDidLoad];
  57 + // Do any additional setup after loading the view.
  58 +
  59 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:UIApplicationWillTerminateNotification object:nil];
  60 + _isAllowCamera = NO;
  61 + _isAllowPgotoLibrary = NO;
  62 +
  63 + _loginParam = [[IMALoginParam alloc] init];
  64 +
  65 + self.view.backgroundColor = kWhiteColor;
  66 + [self setupUI];
  67 +
  68 +}
  69 +#pragma mark - UI
  70 +- (void)setupUI{
  71 + [self.view addSubview:self.titleLabel];
  72 + [self.view addSubview:self.iconView];
  73 + [self.view addSubview:self.iconLabel];
  74 +
  75 + [self.view addSubview:self.nickTF];
  76 + [self.view addSubview:self.tipsLabel];
  77 + [self.view addSubview:self.nextBtn];
  78 +
  79 + if (self.mobileStr.length > 0) {
  80 + self.nickTF.text = self.mobileStr;
  81 + _nextBtn.enabled = YES;
  82 + }
  83 +}
  84 +
  85 +- (void)dealloc {
  86 + [[NSNotificationCenter defaultCenter] removeObserver:self];
  87 +}
  88 +
  89 +#pragma mark - Data
  90 +- (void)setMobileStr:(NSString *)mobileStr {
  91 + _mobileStr = mobileStr;
  92 +}
  93 +
  94 +#pragma mark - Request
  95 +// 修改头像
  96 +- (void)modifyIcon {
  97 + if (_isSeleIcon) {
  98 + NSString *trimStr = [self.nickTF.text qmui_trim];
  99 + if (trimStr.length <= 0 ) {
  100 + [QMUITips showError:@"请填写昵称!" inView:self.view hideAfterDelay:1.5];
  101 + return;
  102 + }
  103 +
  104 + [QMUITips showLoading:@"修改中..." inView:self.view];
  105 + [CNLiveUserSystemCenter uploadIconWithUid:CNUserShareModel.uid icon:_icon success:^(id result) {
  106 + NSLog(@"result:%@",result);
  107 +
  108 + NSString *deFaceUrl = result[@"data"][@"faceUrl"];
  109 + NSString *faceUrl = @"";
  110 + if ([deFaceUrl containsString:@"/mobile/images/mobilehead/default/"]) {
  111 + faceUrl = CNLiveNetAddDefaultHead;
  112 + }else{
  113 + faceUrl = deFaceUrl;
  114 + }
  115 + CNUserShareModel.faceUrl = faceUrl;
  116 + [self modifyNickName];
  117 +
  118 + } failure:^(NSDictionary *errorDic) {
  119 + [QMUITips hideAllToastInView:self.view animated:YES];
  120 + [QMUITips showError:errorDic[@"errorMessage"] inView:self.view hideAfterDelay:1.5];
  121 + }];
  122 + } else {
  123 +
  124 + NSString *trimStr = [self.nickTF.text qmui_trim];
  125 + if (trimStr.length > 0 ) {
  126 +
  127 + [QMUITips showLoading:@"修改中..." inView:self.view];
  128 + [self modifyNickName];
  129 +
  130 + } else {
  131 + [QMUITips showError:@"请填写昵称!" inView:self.view hideAfterDelay:1.5];
  132 + }
  133 +
  134 + }
  135 +
  136 +}
  137 +// 修改名字
  138 +- (void)modifyNickName {
  139 + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeNickName uid:CNUserShareModel.uid modifyInfo:_nickTF.text success:^(id result) {
  140 +
  141 + [QMUITips hideAllToastInView:self.view animated:YES];
  142 + [QMUITips showLoading:@"正在连接服务器..." inView:self.view];
  143 + // [QMUITips showSucceed:@"设置成功" inView:self.view hideAfterDelay:1.5];
  144 + CNUserShareModel.nickname = self.nickTF.text;
  145 + [self syncIM];
  146 +
  147 + } failure:^(NSDictionary *errorDic) {
  148 +
  149 + [QMUITips hideAllToastInView:self.view animated:YES];
  150 + [QMUITips showError:[errorDic objectForKey:@"errorMessage"] inView:self.view hideAfterDelay:1.5];
  151 +
  152 + }];
  153 +
  154 +}
  155 +#pragma mark - 连接im服务器,进入主页面
  156 +// 连接im服务器
  157 +- (void)syncIM {
  158 + [_loginParam getTIMLoginToken:CNUserShareModel.uid successBlock:^(NSString *token) {
  159 +
  160 + _loginParam.identifier = CNUserShareModel.uid;
  161 + _loginParam.userSig = token;
  162 + _loginParam.tokenTime = [[NSDate date] timeIntervalSince1970];
  163 +
  164 + [[IMAPlatform sharedInstance] login:_loginParam succ:^{
  165 +// [CNTools setUserLogin:YES];
  166 + [QMUITips hideAllToastInView:self.view animated:YES];
  167 + [NBSAppAgent setUserIdentifier:[CNTools getSidIdfv]];
  168 + [_loginParam saveToLocal];
  169 + [[AppDelegate sharedAppDelegate] registNotification];
  170 + [[IMAPlatform sharedInstance] configHost:_loginParam];
  171 +
  172 + [[AppDelegate sharedAppDelegate] enterMainUI];
  173 +
  174 + //游客浏览后登陆
  175 + [self showTouristsLoginTipsView];
  176 +
  177 + [[IMAPlatform sharedInstance].host asyncSetAllowType:TIM_FRIEND_NEED_CONFIRM succ:^{
  178 + NSLog(@"asyncSetAllowType Suc");
  179 + [_loginParam saveToLocal];
  180 + } fail:^(int code, NSString *msg) {
  181 + NSLog(@"asyncSetAllowType failed : %@", msg);
  182 + }];
  183 +
  184 + } fail:^(int code, NSString *msg) {
  185 + NSLog(@"login failed : %@", msg);
  186 + [QMUITips hideAllToastInView:self.view animated:YES];
  187 + [QMUITips showError:msg inView:self.view hideAfterDelay:1.5];
  188 + }];
  189 +
  190 + } failedBlock:^(int code, NSString *errorMsg) {
  191 + NSLog(@"token code:%d error:%@", code, errorMsg);
  192 + [QMUITips hideAllToastInView:self.view animated:YES];
  193 + [QMUITips showError:errorMsg inView:self.view hideAfterDelay:1.5];
  194 + }];
  195 +
  196 +}
  197 +
  198 +#pragma mark - 通知
  199 +- (void)appWillTerminate:(NSNotification *)noti {
  200 + [CNUserInfoManager loginOut];
  201 +}
  202 +
  203 +#pragma mark - Delegate
  204 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  205 + [self.view endEditing:YES];
  206 +}
  207 +
  208 +#pragma mark - UITextFieldDelegate
  209 +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  210 + if (range.length == 1 && string.length == 0) {
  211 + return YES;
  212 + }else
  213 + {
  214 + NSString *textStr = [textField.text qmui_trimAllWhiteSpace];
  215 + if (textStr.length > MaxNickLength) {
  216 + textField.text = [textStr substringToIndex:MaxNickLength];
  217 + [QMUITips showWithText:[NSString stringWithFormat:@"昵称不超过%d个字符",MaxNickLength] inView:self.view hideAfterDelay:1];
  218 + return NO;
  219 + }else
  220 + {
  221 + if (textStr.length == MaxNickLength && range.location < MaxNickLength) {
  222 + return YES;
  223 + }
  224 + if (textStr.length + string.length > MaxNickLength) {
  225 + textStr = [textStr stringByAppendingString:string];
  226 + textField.text = [textStr substringToIndex:MaxNickLength];
  227 + [QMUITips showWithText:[NSString stringWithFormat:@"昵称不超过%d个字符",MaxNickLength] inView:self.view hideAfterDelay:1];
  228 + return NO;
  229 + }else
  230 + {
  231 + return YES;
  232 + }
  233 + }
  234 + }
  235 +}
  236 +- (void)textFieldDidChange:(UITextField *)textField {
  237 + if ([NSString isEmpty:textField.text]) {
  238 + _nextBtn.enabled = NO;
  239 +
  240 + } else {
  241 + _nextBtn.enabled = YES;
  242 + }
  243 +
  244 +}
  245 +
  246 +#pragma mark - UIImagePickerControllerDelegate
  247 +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
  248 + [picker dismissViewControllerAnimated:YES completion:NULL];
  249 + UIImage* image = [info objectForKey:UIImagePickerControllerEditedImage];
  250 + if ([image isKindOfClass:[UIImage class]]) {
  251 + _isSeleIcon = YES;
  252 + _iconView.image = image;
  253 + _icon = image;
  254 + if ([NSString isEmpty:_nickTF.text]) {
  255 + _nextBtn.enabled = NO;
  256 + } else {
  257 + _nextBtn.enabled = YES;
  258 + }
  259 +
  260 + } else {
  261 + _isSeleIcon = NO;
  262 + [QMUITips showError:@"获取图片失败" inView:self.view hideAfterDelay:1.5];
  263 + }
  264 +}
  265 +
  266 +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
  267 + [picker dismissViewControllerAnimated:YES completion:NULL];
  268 +}
  269 +#pragma mark - RSKImageCropViewControllerDelegate
  270 +- (void)imageCropViewController:(RSKImageCropViewController *)controller didCropImage:(UIImage *)croppedImage usingCropRect:(CGRect)cropRect rotationAngle:(CGFloat)rotationAngle {
  271 + NSLog(@"%@",croppedImage);
  272 + [self handleIconWithImage:croppedImage];
  273 + [self dismissViewControllerAnimated:YES completion:nil];
  274 +}
  275 +
  276 +- (void)imageCropViewControllerDidCancelCrop:(RSKImageCropViewController *)controller {
  277 + NSLog(@"取消");
  278 + [self dismissViewControllerAnimated:YES completion:nil];
  279 +}
  280 +- (void)handleIconWithImage:(UIImage *)image {
  281 + image = [image fixOrientation];//这个方法是UIImage+Extras.h中方法
  282 + //压缩图片质量
  283 + image = [self reduceImage:image percent:0.5];
  284 + if ([image isKindOfClass:[UIImage class]]) {
  285 + _isSeleIcon = YES;
  286 + _iconView.image = image;
  287 + _icon = image;
  288 + if ([NSString isEmpty:_nickTF.text]) {
  289 + _nextBtn.enabled = NO;
  290 + } else {
  291 + _nextBtn.enabled = YES;
  292 + }
  293 +
  294 + } else {
  295 + _isSeleIcon = NO;
  296 + [QMUITips showError:@"获取图片失败" inView:self.view hideAfterDelay:1.5];
  297 + }
  298 +}
  299 +//压缩图片质量
  300 +- (UIImage *)reduceImage:(UIImage *)image percent:(float)percent {
  301 + NSData *imageData = UIImageJPEGRepresentation(image, percent);
  302 + UIImage *newImage = [UIImage imageWithData:imageData];
  303 + return newImage;
  304 +}
  305 +#pragma mark - RSKImageCropViewControllerDataSource
  306 +- (CGRect)imageCropViewControllerCustomMaskRect:(RSKImageCropViewController *)controller{
  307 + //返回所截取图片的位置
  308 + return CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth);
  309 +}
  310 +
  311 +- (UIBezierPath *)imageCropViewControllerCustomMaskPath:(RSKImageCropViewController *)controller{
  312 + //返回裁剪框的位置
  313 + UIBezierPath *path=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth) cornerRadius:0];
  314 + return path;
  315 +}
  316 +
  317 +- (CGRect)imageCropViewControllerCustomMovementRect:(RSKImageCropViewController *)controller {
  318 + //返回图片可移动的框框大小
  319 + return CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth);
  320 +}
  321 +
  322 +#pragma mark - Action
  323 +// 下一步,发送请求,进入首页
  324 +- (void)nextBtnDidSelected:(UIButton *)sender {
  325 + [self.view endEditing:YES];
  326 + [self modifyIcon];
  327 +}
  328 +
  329 +// 拍照按钮点击事件
  330 +- (void)iconAction {
  331 + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
  332 + if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied) && kiOS7Later) {
  333 + // 无权限 做一个友好的提示
  334 + [self goPrivacySetting];
  335 +
  336 + } else if (authStatus == AVAuthorizationStatusNotDetermined) {
  337 + // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏
  338 + if (kiOS7Later) {
  339 + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
  340 + if (granted) {
  341 + dispatch_sync(dispatch_get_main_queue(), ^{
  342 + [self preImagePicker];
  343 + });
  344 + }
  345 + }];
  346 + } else {
  347 + [self preImagePicker];
  348 + }
  349 + } else {
  350 + [self preImagePicker];
  351 + }
  352 +}
  353 +//请去-> [设置 - 隐私 - 相机 - 网家家] 打开访问开关
  354 +- (void)goPrivacySetting {
  355 + dispatch_async(dispatch_get_main_queue(), ^{
  356 +
  357 + NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"];
  358 + if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"];
  359 + NSString *message = [NSString stringWithFormat:@"请去-> [设置 - 隐私 - 相机 - %@] 打开访问开关",appName];
  360 +
  361 + QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  362 +
  363 + }];
  364 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"警告" message:message preferredStyle:QMUIAlertControllerStyleAlert];
  365 + [alertController addAction:action1];
  366 + [alertController showWithAnimated:YES];
  367 + });
  368 +}
  369 +
  370 +- (void)preImagePicker {
  371 + //采用本项目统一的QMUIAlertController,其他项目可换成系统UIAlertController
  372 + QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  373 +
  374 + }];
  375 + QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  376 + UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
  377 + imagePicker.delegate = self;
  378 + imagePicker.allowsEditing = YES;
  379 + imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
  380 + [self presentViewController:imagePicker animated:YES completion:NULL];
  381 +
  382 + }];
  383 + QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"从相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  384 +// UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
  385 +// imagePicker.delegate = self;
  386 +// imagePicker.allowsEditing = YES;
  387 +// imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  388 +// [self presentViewController:imagePicker animated:YES completion:NULL];
  389 + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
  390 + imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮
  391 + imagePickerVc.allowPreview = NO;
  392 + imagePickerVc.allowPickingOriginalPhoto = NO;
  393 + imagePickerVc.allowPickingVideo = NO;
  394 +
  395 + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
  396 + UIImage *image = photos.firstObject;
  397 + RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image cropMode:RSKImageCropModeCustom];//传入图片与裁剪框的类型 RSKImageCropModeCustom RSKImageCropModeSquare
  398 + imageCropVC.delegate = self;
  399 + imageCropVC.dataSource = self;
  400 + imageCropVC.maskLayerStrokeColor = kWhiteColor;
  401 + imageCropVC.avoidEmptySpaceAroundImage = YES;
  402 + [self presentViewController:imageCropVC animated:YES completion:NULL];
  403 +
  404 + }];
  405 + [self presentViewController:imagePickerVc animated:YES completion:nil];
  406 + }];
  407 + QMUIAlertController *alertController = [[QMUIAlertController alloc] initWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
  408 + // NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.sheetTitleAttributes];
  409 + // titleAttributs[NSForegroundColorAttributeName] = kBlackColor;
  410 + // alertController.sheetTitleAttributes = titleAttributs;
  411 + // NSMutableDictionary *messageAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.sheetMessageAttributes];
  412 + // messageAttributs[NSForegroundColorAttributeName] = kBlackColor;
  413 + // alertController.sheetMessageAttributes = messageAttributs;
  414 + // alertController.sheetHeaderBackgroundColor = [CNThemeManager sharedInstance].currentTheme.themeTintColor;
  415 + // alertController.sheetSeperatorColor = alertController.sheetButtonBackgroundColor;
  416 +
  417 + NSMutableDictionary *buttonAttributes = [[NSMutableDictionary alloc] initWithDictionary:alertController.sheetButtonAttributes];
  418 + buttonAttributes[NSForegroundColorAttributeName] = kBlackColor;
  419 + alertController.sheetButtonAttributes = buttonAttributes;
  420 +
  421 + NSMutableDictionary *cancelButtonAttributes = [[NSMutableDictionary alloc] initWithDictionary:alertController.sheetCancelButtonAttributes];
  422 + cancelButtonAttributes[NSForegroundColorAttributeName] = buttonAttributes[NSForegroundColorAttributeName];
  423 + alertController.sheetCancelButtonAttributes = buttonAttributes;
  424 +
  425 + [alertController addAction:action1];
  426 + [alertController addAction:action2];
  427 + [alertController addAction:action3];
  428 + [alertController showWithAnimated:YES];
  429 +}
  430 +
  431 +- (void)backBtnAction {
  432 + [self dismissViewControllerAnimated:NO completion:NULL];
  433 +}
  434 +
  435 +- (void)didReceiveMemoryWarning {
  436 + [super didReceiveMemoryWarning];
  437 + // Dispose of any resources that can be recreated.
  438 +}
  439 +
  440 +/*
  441 +#pragma mark - Navigation
  442 +
  443 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  444 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  445 + // Get the new view controller using [segue destinationViewController].
  446 + // Pass the selected object to the new view controller.
  447 +}
  448 +*/
  449 +#pragma mark - Private
  450 +- (void)showTouristsLoginTipsView{
  451 + //游客浏览后登陆获取ChannelId
  452 + NSString *channelId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginChannelId"];
  453 + //首先判断是否有一级分类//
  454 + if(channelId && ![channelId isEqualToString:@""]){
  455 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  456 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  457 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  458 + tabbar.selectedIndex = 1;
  459 +
  460 + //一先处理分类的频道数据->保证本地有频道数据
  461 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  462 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  463 + [controller dataDivideIntoNormalAndOther];
  464 + }
  465 + //二判断我的频道是否存在游客浏览的频道
  466 + NSInteger selectChannelId = [self containsWithChannelId:channelId];
  467 + if(selectChannelId == -1){
  468 + //1我的频道中没有这个频道
  469 + //弹窗提示用户
  470 + [AppKeyWindow addSubview:self.fuzzyView];
  471 +
  472 + }else{
  473 + //2我的频道中有这个频道
  474 + //2.1选中一级分类
  475 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  476 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0/*延迟执行时间*/ * NSEC_PER_SEC));
  477 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  478 + [controller categoryView:controller.titleImageCategoryView didSelectedItemAtIndex:selectChannelId];
  479 + });
  480 +
  481 + }
  482 + //然后判断是否有二级分类//
  483 + NSString *classifyId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginClassifyId"];
  484 + if(classifyId && ![classifyId isEqualToString:@""]){
  485 + //2.2选中二级分类
  486 + NSInteger selectClassifyId = [self containsWithChannelIndex:selectChannelId classifyId:classifyId];
  487 + if(selectClassifyId != -1){
  488 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0/*延迟执行时间*/ * NSEC_PER_SEC));
  489 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  490 + //获取一级控制器
  491 + NSMutableArray *controllers = controller.vcArrayM;
  492 + //获取二级控制器
  493 + if ([controllers[selectChannelId] isKindOfClass:[CNSubClassifySegmentController class]]) {
  494 + CNSubClassifySegmentController *subController = controllers[selectChannelId];
  495 + [subController categoryView:subController.myCategoryView didSelectedItemAtIndex:selectClassifyId];
  496 + }
  497 + });
  498 + }
  499 + }
  500 + //最后判断是否有url//
  501 + NSString *url = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginUrl"];
  502 + if(url && ![url isEqualToString:@""]){
  503 +
  504 + [CNDSShopActionViewModel checkWithFunctionForShareURL:url];
  505 + /*
  506 + if ([url containsString:[NSString stringWithFormat:@"%@/cnShareVideo",WjjH5_Host]]) {//点播
  507 + CNPlayDetailViewController *pvc = [[CNPlayDetailViewController alloc] init];
  508 + pvc.detailInfoStr = url;
  509 + [[AppDelegate sharedAppDelegate] pushViewController:pvc];
  510 + return;
  511 + }
  512 + else if ([url containsString:@"cnlive.com/video"]) {//直播
  513 + [[CNGetLiveDataHandle sharedInstance] requsetrailerByUrl:url view:AppKeyWindow sourceType:PushIntoSourceNormal];
  514 + return;
  515 + }
  516 + else {
  517 + CNClassifyWebController *web = [[CNClassifyWebController alloc] initWithUrl:url];
  518 + [[AppDelegate sharedAppDelegate] pushViewController:web withBackTitle:@" "];
  519 + return;
  520 + }
  521 + */
  522 + }
  523 + }
  524 + }
  525 + }
  526 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  527 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  528 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  529 +
  530 +}
  531 +
  532 +- (CNClassifySegmentController *)getClassifySegmentController{
  533 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  534 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  535 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  536 + NSArray *controllers = tabbar.viewControllers;
  537 + if(controllers.count > 0){
  538 + CNNavigationController *nav = controllers[1];
  539 + CNClassifySegmentController *controller = nav.qmui_rootViewController;
  540 + return controller;
  541 + }
  542 +
  543 + }
  544 + return nil;
  545 +
  546 +}
  547 +
  548 +//游客登录判断是否有这个频道
  549 +- (NSInteger)containsWithChannelId:(NSString *)channelId {
  550 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  551 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  552 +
  553 + NSInteger i = 0;
  554 + for (NSString *str in channelArray) {
  555 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  556 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  557 + if ([model.id isEqualToString:channelId]) {
  558 + return i;
  559 + }
  560 + i++;
  561 + }
  562 + return -1;
  563 +
  564 +}
  565 +//游客登录判断有这个频道的分类在第几个
  566 +- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
  567 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  568 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  569 + NSInteger i = 0;
  570 +
  571 + if(channelArray.count > index){
  572 + NSString *modelStr = channelArray[index];
  573 + NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
  574 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  575 + for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
  576 + if ([subModel.id isEqualToString:classifyId]) {
  577 + return i;
  578 + }
  579 + if (CNLiveStringIsEmpty(subModel.pageType)) {
  580 + continue;
  581 + }else{
  582 + i++;
  583 + }
  584 + }
  585 + }
  586 + return -1;
  587 +
  588 +}
  589 +
  590 +#pragma mark - Lazy Loading
  591 +- (QMUILabel *)titleLabel
  592 +{
  593 + if (!_titleLabel)
  594 + {
  595 + _titleLabel = [[QMUILabel alloc] initWithFrame:CGRectMake(0, kStatusHeight, 100, 44)];
  596 + _titleLabel.centerX = self.view.centerX;
  597 + _titleLabel.textAlignment = NSTextAlignmentCenter;
  598 + _titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:18];
  599 + _titleLabel.textColor = UIColorMake(40, 40, 40);
  600 + _titleLabel.text = @"完善信息";
  601 + }
  602 + return _titleLabel;
  603 +}
  604 +
  605 +- (UIImageView *)iconView
  606 +{
  607 + if (!_iconView)
  608 + {
  609 + _iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom + 58, 96, 96)];
  610 + _iconView.userInteractionEnabled = YES;
  611 + [_iconView setImage:[UIImage imageNamed:@"dl_touxiang"]];
  612 + _iconView.centerX = self.view.centerX;
  613 + _iconView.layer.cornerRadius = _iconView.height/2;
  614 + _iconView.layer.masksToBounds = YES;
  615 + [_iconView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(iconAction)]];
  616 + }
  617 + return _iconView;
  618 +}
  619 +
  620 +- (QMUILabel *)iconLabel
  621 +{
  622 + if (!_iconLabel)
  623 + {
  624 + _iconLabel = [[QMUILabel alloc] initWithFrame:CGRectMake(0, self.iconView.bottom + 20, 100, 20)];
  625 + _iconLabel.centerX = self.view.centerX;
  626 + _iconLabel.textAlignment = NSTextAlignmentCenter;
  627 + _iconLabel.font = [UIFont fontWithName:@"PingFangSC" size:14];
  628 + _iconLabel.textColor = UIColorMake(138, 138, 138);
  629 + _iconLabel.text = @"上传头像";
  630 + }
  631 + return _iconLabel;
  632 +}
  633 +
  634 +- (CNLoginTextField *)nickTF
  635 +{
  636 + if (!_nickTF) {
  637 + _nickTF = [[CNLoginTextField alloc] initWithFrame:CGRectMake(30, self.iconLabel.bottom + 27, KScreenWidth - 60, 48)];
  638 + _nickTF.zx_placeholderColor = KGray195Color;
  639 + _nickTF.placeholder = @"请输入昵称(不支持表情符号)";
  640 + _nickTF.textColor = kBlackColor;
  641 + _nickTF.font = UIFontMake(15);
  642 + // _nickTF.textInsets = UIEdgeInsetsMake(0, 15, 0, 10);
  643 + _nickTF.clearButtonMode = UITextFieldViewModeAlways;
  644 + [_nickTF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  645 + _nickTF.delegate = self;
  646 + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, _nickTF.height-1, _nickTF.width, 0.5)];
  647 + line.backgroundColor = kLineGrayColor;
  648 + [_nickTF addSubview:line];
  649 + }
  650 + return _nickTF;
  651 +}
  652 +
  653 +- (QMUILabel *)tipsLabel
  654 +{
  655 + if (!_tipsLabel)
  656 + {
  657 + _tipsLabel = [[QMUILabel alloc] init];
  658 + _tipsLabel = [[QMUILabel alloc] initWithFrame:CGRectMake(30, _nickTF.bottom + 10, kScreenWidth - 60, 20)];
  659 + [_tipsLabel setFont:UIFontMake(12)];
  660 + _tipsLabel.textColor = UIColorMake(144, 144, 144);
  661 +// _tipsLabel.text = @"昵称只支持中英文、数字、横线和加号";
  662 + _tipsLabel.text = @"昵称只支持15字符";
  663 + }
  664 + return _tipsLabel;
  665 +}
  666 +
  667 +- (UIButton *)nextBtn
  668 +{
  669 + if (!_nextBtn) {
  670 + _nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  671 + _nextBtn.frame = CGRectMake(25, _tipsLabel.bottom+72, KScreenWidth-50, 45);
  672 + [_nextBtn setTitle:@"下一步" forState:UIControlStateNormal];
  673 + [_nextBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  674 + _nextBtn.titleLabel.font = UIFontMake(15);
  675 + [_nextBtn setBackgroundImage:CNLiveUIImageWithColor(RGB(173, 173, 173)) forState:UIControlStateDisabled];
  676 + [_nextBtn setBackgroundImage:CNLiveUIImageWithColor(RGB(33, 188, 35)) forState:UIControlStateNormal];
  677 + _nextBtn.layer.cornerRadius = 45/2.0;
  678 + _nextBtn.layer.masksToBounds = YES;
  679 + _nextBtn.enabled = NO;
  680 + [_nextBtn addTarget:self action:@selector(nextBtnDidSelected:) forControlEvents:UIControlEventTouchUpInside];
  681 + }
  682 + return _nextBtn;
  683 +}
  684 +- (CNTouristsLoginTipsView *)fuzzyView{
  685 + if (!_fuzzyView) {
  686 + _fuzzyView = [[CNTouristsLoginTipsView alloc] initWithFrame:AppKeyWindow.bounds];
  687 + _fuzzyView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
  688 + _fuzzyView.delegate = self;
  689 + }
  690 + return _fuzzyView;
  691 +
  692 +}
  693 +#pragma mark - TouristsLoginTipsViewDelegate
  694 +- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify{
  695 + if([isClassify isEqualToString:@"close"]){
  696 + //隐藏TouristsLoginTipsView
  697 + [self.fuzzyView removeFromSuperview];
  698 +
  699 + }else if([isClassify isEqualToString:@"jump"]){
  700 + //进入频道管理页面
  701 + [self.fuzzyView removeFromSuperview];
  702 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  703 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  704 + [controller customAction:nil];
  705 + }
  706 + }
  707 +
  708 +}
  709 +
  710 +@end
CNLiveLogin/Classes/Controller/CNLoginViewController.h 0 → 100644
  1 +//
  2 +// CNLoginViewController.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by iOS on 2018/1/10.
  6 +// Copyright © 2018年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNCommonViewController.h"
  10 +
  11 +@interface CNLoginViewController : CNCommonViewController
  12 +
  13 +@end
CNLiveLogin/Classes/Controller/CNLoginViewController.m 0 → 100644
  1 + //
  2 +// CNLoginViewController.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by iOS on 2018/1/10.
  6 +// Copyright © 2018年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLoginViewController.h"
  10 +#import "CNLoginTextField.h"
  11 +#import "CNLoginIUsernfoViewController.h"
  12 +#import "CNUserAgreementRequst.h"
  13 +#import "CNReportAndComplaintWebController.h"
  14 +#import "CNSelectCountriesViewController.h"
  15 +#import <DSCnliveShopSDK/DSCnliveShopSDK.h>
  16 +
  17 +//游客登录
  18 +#import "CNTabBarViewController.h"
  19 +#import "CNTouristsLoginViewController.h"
  20 +#import "CNCategoryGetChannelModel.h"
  21 +#import "CNTouristsLoginTipsView.h"
  22 +#import "CNNavigationController.h"
  23 +#import "CNClassifySegmentController.h"//一级
  24 +#import "CNSubClassifySegmentController.h"//二级
  25 +#import "CNGetLiveDataHandle.h"//直播
  26 +#import "CNPlayDetailViewController.h"//点播
  27 +#import "CNClassifyWebController.h"//h5详情
  28 +#import "NSString+CNLiveExtension.h"
  29 +#import "NSString+Category.h"
  30 +
  31 +#define Left_Space (KScreenWidth == 320 ? 30 : 60)
  32 +
  33 +@interface CNLoginViewController ()<UITextFieldDelegate,SelectCountriesDelegate,TouristsLoginDelegate,TouristsLoginTipsViewDelegate>{
  34 + dispatch_source_t _timer;
  35 + NSTimeInterval _keyboardAnimationDuration;
  36 + NSString * _codeStr;
  37 +
  38 +}
  39 +@property (nonatomic, strong) CNLoginTextField *accountTextF;
  40 +@property (nonatomic, strong) CNLoginTextField *passworkTextF;
  41 +@property (nonatomic, strong) QMUIButton *loginBtn;
  42 +@property (nonatomic, strong) UIButton *verificationBtn;
  43 +@property (nonatomic, strong) IMALoginParam *loginParam;
  44 +@property (nonatomic, strong) YYLabel *protocolLab;
  45 +//@property (nonatomic, strong) UIButton *agreeBtn;
  46 +@property (nonatomic ,strong) UIImageView *iconView;
  47 +@property (nonatomic ,strong) QMUILabel *mobileLocaLbl;
  48 +@property (nonatomic ,strong) QMUILabel *countryLbl;
  49 +@property (nonatomic, strong) UIButton *countryBtn;
  50 +
  51 +@property (nonatomic, strong) UIButton *touristsBtn;//游客登录
  52 +@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
  53 +
  54 +@end
  55 +
  56 +@implementation CNLoginViewController
  57 +#pragma mark - Life Cycle
  58 +- (void)viewWillAppear:(BOOL)animated {
  59 + [super viewWillAppear:animated];
  60 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:CNLiveLaunchWithFirsh];
  61 + [[NSUserDefaults standardUserDefaults] synchronize];
  62 +
  63 +}
  64 +- (void)viewDidLoad {
  65 + [super viewDidLoad];
  66 + // Do any additional setup after loading the view.
  67 + self.navigationItem.title = @"登 录";
  68 + self.view.backgroundColor = kWhiteColor;
  69 + _keyboardAnimationDuration = 0;
  70 + _codeStr = @"86";
  71 + // 添加观察
  72 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  73 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
  74 +
  75 + BOOL isAutoLogin = [IMAPlatform isAutoLogin];
  76 +
  77 + if (isAutoLogin) {
  78 + _loginParam = [IMALoginParam loadFromLocal];
  79 +
  80 + } else {
  81 + _loginParam = [[IMALoginParam alloc] init];
  82 +
  83 + }
  84 +
  85 + [IMAPlatform configWith:_loginParam.config];
  86 +
  87 + [self.view addSubview:self.iconView];
  88 + [self.view addSubview:self.mobileLocaLbl];
  89 + [self.view addSubview:self.countryLbl];
  90 + [self.view addSubview:self.countryBtn];
  91 +
  92 + [self.countryBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  93 + make.top.mas_equalTo(self.mobileLocaLbl.mas_top).mas_offset(0);
  94 + make.right.mas_equalTo(self.view.mas_right).mas_offset(-Left_Space);
  95 + make.height.mas_equalTo(15);
  96 + make.width.mas_equalTo(10);
  97 +
  98 + }];
  99 + [self.countryLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
  100 + make.top.mas_equalTo(self.mobileLocaLbl.mas_top).mas_offset(0);
  101 + make.right.mas_equalTo(self.countryBtn.mas_left).mas_offset(-5);
  102 + make.height.mas_equalTo(15);
  103 + }];
  104 +
  105 + [self.view addSubview:self.accountTextF];
  106 + [self.view addSubview:self.passworkTextF];
  107 + [self.view addSubview:self.verificationBtn];
  108 + [self.view addSubview:self.loginBtn];
  109 +
  110 + [self.view addSubview:self.touristsBtn];
  111 + [self.touristsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  112 + make.top.mas_equalTo(self.loginBtn.mas_bottom).mas_offset(15);
  113 + make.centerX.mas_equalTo(self.loginBtn.mas_centerX).mas_offset(0);
  114 + make.size.mas_equalTo(CGSizeMake(109, 30));
  115 + }];
  116 +
  117 + [self.view addSubview:self.protocolLab];
  118 + [self.protocolLab mas_makeConstraints:^(MASConstraintMaker *make) {
  119 + make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(-(18+kVerticalBottomSafeHeight));
  120 +// make.centerX.mas_equalTo(self.loginBtn.mas_centerX).mas_offset(0);
  121 +// make.width.mas_equalTo(KScreenWidth);
  122 + make.left.mas_equalTo(self.view.mas_left).mas_offset(0);
  123 + make.right.mas_equalTo(self.view.mas_right).mas_offset(-0);
  124 +
  125 + }];
  126 +
  127 +// [self.view addSubview:self.agreeBtn];
  128 +
  129 +// [self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  130 +// make.centerY.mas_equalTo(self.protocolLab.mas_centerY);
  131 +// make.right.mas_equalTo(self.protocolLab.mas_left).mas_offset(-5);
  132 +// make.size.mas_equalTo(CGSizeMake(15, 15));
  133 +// }];
  134 +
  135 +}
  136 +
  137 +- (void)dealloc {
  138 + [[NSNotificationCenter defaultCenter] removeObserver:self];
  139 +
  140 +}
  141 +
  142 +#pragma mark - Request
  143 +#pragma mark - 发送登录请求
  144 +- (void)loginBtnDidSelected:(UIButton *)sender {
  145 +
  146 + if ([_accountTextF.text isEqualToString:@""]) {
  147 + [QMUITips showWithText:@"请输入手机号" inView:self.view hideAfterDelay:1.5];
  148 + return;
  149 + }
  150 +
  151 + if ([_passworkTextF.text isEqualToString:@""]) {
  152 + [QMUITips showWithText:@"请输入验证码" inView:self.view hideAfterDelay:1.5];
  153 + return;
  154 + }
  155 +
  156 + [self.view endEditing:YES];
  157 + [self upDownSelfView:NO];
  158 + [QMUITips showLoading:@"登录中" inView:self.view];
  159 +
  160 + [CNLiveUserSystemCenter shortcutLoginWithUserName:_accountTextF.text countryCode:_codeStr verificationCode:_passworkTextF.text frmId:@"apple" success:^(id result) {
  161 + weakself
  162 + NSLog(@"result:%@",result);
  163 +
  164 + NSMutableDictionary *resDic = [NSMutableDictionary dictionaryWithDictionary:result[@"data"]];
  165 + NSString *deFaceUrl = [resDic objectForKey:@"faceUrl"];
  166 + NSString *faceUrl = @"";
  167 + if ([deFaceUrl containsString:@"/mobile/images/mobilehead/default/"]) {
  168 + faceUrl = CNLiveNetAddDefaultHead;//网家家默认头像地址
  169 + [resDic setValue:faceUrl forKey:@"faceUrl"];
  170 + }
  171 + [CNUserInfoManager saveUserinfoDic:resDic];
  172 + //连接IM
  173 + [_loginParam getTIMLoginToken:CNUserShareModel.uid successBlock:^(NSString *token) {
  174 +
  175 + _loginParam.identifier = CNUserShareModel.uid;
  176 + _loginParam.userSig = token;
  177 + _loginParam.tokenTime = [[NSDate date] timeIntervalSince1970];
  178 +
  179 + [[IMAPlatform sharedInstance] login:_loginParam succ:^{
  180 + [NBSAppAgent setUserIdentifier:[CNTools getSidIdfv]];
  181 + [QMUITips hideAllToastInView:self.view animated:YES];
  182 + [QMUITips showSucceed:@"登录成功" inView:self.view hideAfterDelay:1.5];
  183 + [_loginParam saveToLocal];
  184 + [[AppDelegate sharedAppDelegate] registNotification];
  185 + [[IMAPlatform sharedInstance] configHost:_loginParam];
  186 + [IMAPlatform sharedInstance].didConnectSuccess = YES;
  187 + //电商
  188 + NSString *userID = CNUserShareModel.uid;
  189 + [[DSCnliveShopSDKManager sharedManager] loginUser:userID];
  190 + //设置APP已活跃
  191 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"is_Active_Application"];
  192 + [[NSUserDefaults standardUserDefaults] synchronize];
  193 +
  194 + if ([result[@"data"][@"isNewUser"] intValue] == 0)
  195 + {//老用户
  196 +
  197 +// [CNTools setUserLogin:YES];
  198 + [[AppDelegate sharedAppDelegate] enterMainUI];
  199 + [[AppDelegate sharedAppDelegate] registNotification];
  200 +
  201 + //游客浏览后登陆
  202 + [self showTouristsLoginTipsView];
  203 +
  204 + } else {//新用户
  205 + CNLoginIUsernfoViewController *vc = [[CNLoginIUsernfoViewController alloc] init];
  206 + NSString *tel = _accountTextF.text;
  207 + if(_accountTextF.text.length == 11){
  208 + tel = [_accountTextF.text stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"XXXX"];
  209 + }
  210 + NSLog(@"tel:%@",tel);
  211 + vc.mobileStr = tel;
  212 + [self presentViewController:vc animated:NO completion:NULL];
  213 + }
  214 +
  215 + [[IMAPlatform sharedInstance].host asyncSetAllowType:TIM_FRIEND_NEED_CONFIRM succ:^{
  216 + NSLog(@"asyncSetAllowType Suc");
  217 + [_loginParam saveToLocal];
  218 +
  219 + } fail:^(int code, NSString *msg) {
  220 + NSLog(@"asyncSetAllowType failed : %@", msg);
  221 + }];
  222 +
  223 + } fail:^(int code, NSString *msg) {
  224 + NSLog(@"login failed : %@", msg);
  225 + if (code == 6208) {
  226 + //离线被踢下线重新登录
  227 + [weakSelf resumeLogin];
  228 + }
  229 + else
  230 + [QMUITips showError:msg inView:self.view hideAfterDelay:1.5];
  231 + [QMUITips hideAllToastInView:self.view animated:YES];
  232 + }];
  233 +
  234 + } failedBlock:^(int code, NSString *errorMsg) {
  235 + NSLog(@"token code:%d error:%@", code, errorMsg);
  236 + [QMUITips hideAllToastInView:self.view animated:YES];
  237 + // [QMUITips showError:errorMsg inView:self.view hideAfterDelay:1.5];
  238 + }];
  239 +
  240 + } failure:^(NSDictionary *errorDic) {
  241 + [QMUITips hideAllToastInView:self.view animated:YES];
  242 + [self showAlertWithTitle:[errorDic objectForKey:@"errorMessage"]];//@"短信验证码错误,请重试"
  243 + NSLog(@"error:%@",errorDic[@"errorMessage"]);
  244 + }];
  245 +
  246 +}
  247 +
  248 +//显示是提示框还是页面跳转逻辑
  249 +- (void)showTouristsLoginTipsView{
  250 + //游客浏览后登陆获取ChannelId
  251 + NSString *channelId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginChannelId"];
  252 + //首先判断是否有一级分类//
  253 + if(channelId && ![channelId isEqualToString:@""]){
  254 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  255 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  256 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  257 + tabbar.selectedIndex = 1;
  258 +
  259 + //一先处理分类的频道数据->保证本地有频道数据
  260 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  261 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  262 + [controller dataDivideIntoNormalAndOther];
  263 + }
  264 + //二判断我的频道是否存在游客浏览的频道
  265 + NSInteger selectChannelId = [self containsWithChannelId:channelId];
  266 + if(selectChannelId == -1){
  267 + //1我的频道中没有这个频道
  268 + //弹窗提示用户
  269 + [AppKeyWindow addSubview:self.fuzzyView];
  270 +
  271 + }else{
  272 + //2我的频道中有这个频道
  273 + //2.1选中一级分类
  274 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  275 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0/*延迟执行时间*/ * NSEC_PER_SEC));
  276 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  277 + [controller categoryView:controller.titleImageCategoryView didSelectedItemAtIndex:selectChannelId];
  278 + });
  279 +
  280 + }
  281 + //然后判断是否有二级分类//
  282 + NSString *classifyId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginClassifyId"];
  283 + if(classifyId && ![classifyId isEqualToString:@""]){
  284 + //2.2选中二级分类
  285 + NSInteger selectClassifyId = [self containsWithChannelIndex:selectChannelId classifyId:classifyId];
  286 + if(selectClassifyId != -1){
  287 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0/*延迟执行时间*/ * NSEC_PER_SEC));
  288 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  289 + //获取一级控制器
  290 + NSMutableArray *controllers = controller.vcArrayM;
  291 + //获取二级控制器
  292 + if ([controllers[selectChannelId] isKindOfClass:[CNSubClassifySegmentController class]]) {
  293 + CNSubClassifySegmentController *subController = controllers[selectChannelId];
  294 + [subController categoryView:subController.myCategoryView didSelectedItemAtIndex:selectClassifyId];
  295 + }
  296 + });
  297 + }
  298 + }
  299 + //最后判断是否有url//
  300 + NSString *url = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginUrl"];
  301 + if(url && ![url isEqualToString:@""]){
  302 +
  303 + [CNDSShopActionViewModel checkWithFunctionForShareURL:url];
  304 +
  305 + /*
  306 + if ([url containsString:[NSString stringWithFormat:@"%@/cnShareVideo",WjjH5_Host]]) {//点播
  307 + CNPlayDetailViewController *pvc = [[CNPlayDetailViewController alloc] init];
  308 + pvc.detailInfoStr = url;
  309 + [[AppDelegate sharedAppDelegate] pushViewController:pvc];
  310 + return;
  311 + }
  312 + else if ([url containsString:@"cnlive.com/video"]) {//直播
  313 + [[CNGetLiveDataHandle sharedInstance] requsetrailerByUrl:url view:AppKeyWindow sourceType:PushIntoSourceNormal];
  314 + return;
  315 + }
  316 + else {
  317 + CNClassifyWebController *web = [[CNClassifyWebController alloc] initWithUrl:url];
  318 + [[AppDelegate sharedAppDelegate] pushViewController:web withBackTitle:@" "];
  319 + return;
  320 + }
  321 + */
  322 + }
  323 + }
  324 + }
  325 + }
  326 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  327 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  328 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  329 +}
  330 +// 如果遇到离线被踢下线重新登录
  331 +- (void)resumeLogin {
  332 + weakself
  333 + [[IMAPlatform sharedInstance] login:_loginParam succ:^{
  334 + [NBSAppAgent setUserIdentifier:[CNTools getSidIdfv]];
  335 + [QMUITips hideAllToastInView:self.view animated:YES];
  336 + [QMUITips showSucceed:@"登录成功" inView:self.view hideAfterDelay:1.5];
  337 + [_loginParam saveToLocal];
  338 + [[AppDelegate sharedAppDelegate] registNotification];
  339 + [[IMAPlatform sharedInstance] configHost:_loginParam];
  340 + [IMAPlatform sharedInstance].didConnectSuccess = YES;
  341 +
  342 +// [CNTools setUserLogin:YES];
  343 + [[AppDelegate sharedAppDelegate] enterMainUI];
  344 + [[AppDelegate sharedAppDelegate] registNotification];
  345 +
  346 +
  347 + [[IMAPlatform sharedInstance].host asyncSetAllowType:TIM_FRIEND_NEED_CONFIRM succ:^{
  348 + NSLog(@"asyncSetAllowType Suc");
  349 + [_loginParam saveToLocal];
  350 +
  351 + } fail:^(int code, NSString *msg) {
  352 + NSLog(@"asyncSetAllowType failed : %@", msg);
  353 + }];
  354 +
  355 + } fail:^(int code, NSString *msg) {
  356 + NSLog(@"tokenCode login failed : %@", msg);
  357 + if (code == 6028) {
  358 + dispatch_async(dispatch_get_main_queue(), ^{
  359 + UIAlertController *alter = [UIAlertController alertControllerWithTitle:@"连接服务器失败,请点击重试" message:@"" preferredStyle:UIAlertControllerStyleAlert];
  360 + [alter addAction:[UIAlertAction actionWithTitle:@"重试" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  361 + [weakSelf resumeLogin];
  362 + }]];
  363 + [weakSelf presentViewController:alter animated:YES completion:nil];
  364 + });
  365 + }
  366 + }];
  367 +
  368 +}
  369 +
  370 +#pragma mark - 发送验证码请求
  371 +- (void)verificationBtnAction {
  372 +// _verificationBtn.selected = YES;
  373 +
  374 + if ([self.accountTextF.text isEqualToString:@""]) {
  375 + [self showAlertWithTitle:@"请输入手机号"];
  376 + [self cancelVerBtnChange];
  377 + return;
  378 + }
  379 +
  380 + [_passworkTextF becomeFirstResponder];
  381 + [self upDownSelfView:YES];
  382 + _passworkTextF.text = nil;
  383 +
  384 + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:_accountTextF.text countryCode:_codeStr success:^(id result) {
  385 + _verificationBtn.selected = YES;
  386 + [self startTimer];
  387 + [QMUITips showWithText:@"验证码已发送" inView:self.view hideAfterDelay:1.5];
  388 +
  389 + } failure:^(NSDictionary *errorDic) {
  390 + if ([errorDic[@"errorCode"] integerValue] == 408) {
  391 + [self showAlertWithTitle:@"请输入正确的手机号"];
  392 + }else{
  393 + [QMUITips showError:errorDic[@"errorMessage"] inView:self.view hideAfterDelay:1.5];
  394 + }
  395 + [self cancelVerBtnChange];
  396 +
  397 + }];
  398 +
  399 +}
  400 +
  401 +#pragma mark - 通知
  402 +- (void)keyboardWillShow:(NSNotification *)notification {
  403 +
  404 + // 获取通知的信息字典
  405 + NSDictionary *userInfo = [notification userInfo];
  406 +
  407 + // 获取键盘弹出后的rect
  408 +// NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
  409 +// CGRect keyboardRect = [aValue CGRectValue];
  410 +
  411 + // 获取键盘弹出动画时间
  412 + NSNumber *durationNumber = userInfo[UIKeyboardAnimationDurationUserInfoKey];
  413 + NSTimeInterval duration = durationNumber.doubleValue;
  414 +
  415 + _keyboardAnimationDuration = duration;
  416 + // do something...
  417 +}
  418 +
  419 +- (void)keyboardWillHide:(NSNotification *)notification {
  420 +
  421 + // 获取通知信息字典
  422 + NSDictionary* userInfo = [notification userInfo];
  423 +
  424 + // 获取键盘隐藏动画时间
  425 + NSNumber *durationNumber = userInfo[UIKeyboardAnimationDurationUserInfoKey];
  426 + NSTimeInterval duration = durationNumber.doubleValue;
  427 +
  428 + _keyboardAnimationDuration = duration;
  429 + // do something...
  430 + [self upDownSelfView:NO];
  431 +}
  432 +
  433 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  434 + [self.view endEditing:YES];
  435 + [self upDownSelfView:NO];
  436 +}
  437 +
  438 +#pragma mark - UITextFieldDelegate
  439 +- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
  440 + if ([textField isEqual:self.passworkTextF] || [textField isEqual:self.accountTextF]) {
  441 + [self upDownSelfView:YES];
  442 + return YES;
  443 +
  444 + }
  445 + else {
  446 + return YES;
  447 +
  448 + }
  449 +}
  450 +
  451 +- (void)textFieldDidChange:(UITextField *)textField {
  452 +
  453 + if (![NSString isEmpty:_passworkTextF.text] && ![NSString isEmpty:_accountTextF.text]) {
  454 + _loginBtn.enabled = YES;
  455 +
  456 + }
  457 + else {
  458 + _loginBtn.enabled = NO;
  459 +
  460 + }
  461 +
  462 +}
  463 +
  464 +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  465 + if ([textField isEqual:self.accountTextF]) {
  466 + NSInteger maxTextLength = 20;
  467 + if(string.length == 0) {
  468 + //判断是不是删除键
  469 + return YES;
  470 + }
  471 + else if(textField.text.length >= maxTextLength) {
  472 + //输入的字符个数大于11,则无法继续输入,返回NO表示禁止输入
  473 + NSLog(@"输入的字符个数大于20,忽略输入");
  474 + return NO;
  475 + }
  476 + else if (!CNLiveStringIsNumber(string)) {
  477 + //string复制的可能为特殊字符,过滤
  478 + return NO;
  479 + }
  480 + else if (textField.text.length + string.length > maxTextLength){
  481 + NSInteger length = textField.text.length;
  482 + NSInteger needLen = maxTextLength - length;
  483 + textField.text = [textField.text stringByAppendingString:[string substringToIndex:needLen]];
  484 + return NO;
  485 + }
  486 + else{
  487 + return YES;
  488 + }
  489 + }else if ([textField isEqual:self.passworkTextF]){
  490 +// NSInteger maxTextLength = 6;
  491 + if(string.length == 0) {
  492 + //判断是不是删除键
  493 + return YES;
  494 + }
  495 +// else if(textField.text.length >= maxTextLength) {
  496 +// //输入的字符个数大于11,则无法继续输入,返回NO表示禁止输入
  497 +// NSLog(@"输入的字符个数大于11,忽略输入");
  498 +// return NO;
  499 +// }
  500 + else if (!CNLiveStringIsNumber(string)) {
  501 + //string复制的可能为特殊字符,过滤
  502 + return NO;
  503 + }
  504 +// else if (textField.text.length + string.length > maxTextLength){
  505 +// //如果textF.text + string > 6 截取6位
  506 +//#warning 有个问题,光标没有及时更新到最后一位
  507 +// NSInteger length = textField.text.length;
  508 +// NSInteger needLen = maxTextLength - length;
  509 +// textField.text = [textField.text stringByAppendingString:[string substringToIndex:needLen]];
  510 +// return NO;
  511 +// }
  512 + else{
  513 + return YES;
  514 + }
  515 + }else
  516 + {
  517 + return YES;
  518 + }
  519 +}
  520 +
  521 +- (void)didReceiveMemoryWarning {
  522 + [super didReceiveMemoryWarning];
  523 + // Dispose of any resources that can be recreated.
  524 +}
  525 +
  526 +/*
  527 +#pragma mark - Navigation
  528 +
  529 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  530 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  531 + // Get the new view controller using [segue destinationViewController].
  532 + // Pass the selected object to the new view controller.
  533 +}
  534 +*/
  535 +#pragma mark - Action
  536 +//切换城市按钮
  537 +- (void)countryBtnDidSelected:(UIButton *)btn{
  538 + CNSelectCountriesViewController *vc = [[CNSelectCountriesViewController alloc]init];
  539 + vc.delegate = self;
  540 + vc.hidesBottomBarWhenPushed = YES;
  541 + [self presentViewController:vc animated:YES completion:nil];
  542 +
  543 +}
  544 +
  545 +//切换城市按钮
  546 +- (void)countryLblTap:(UITapGestureRecognizer *)tap{
  547 + CNSelectCountriesViewController *vc = [[CNSelectCountriesViewController alloc]init];
  548 + vc.delegate = self;
  549 + vc.hidesBottomBarWhenPushed = YES;
  550 + [self presentViewController:vc animated:YES completion:nil];
  551 +
  552 +}
  553 +
  554 +//浏览入口
  555 +- (void)touristsBtnDidSelected:(UIButton *)btn{
  556 + [_accountTextF resignFirstResponder];
  557 + [_passworkTextF resignFirstResponder];
  558 +
  559 + CNTouristsLoginViewController *vc = [[CNTouristsLoginViewController alloc]init];
  560 + vc.delegate = self;
  561 + vc.intercept = YES;
  562 + //测试
  563 +// vc.url = @"http://wjjh5test.cnlive.com/cnLogoutPreview.html";
  564 + //正式
  565 +// vc.url = @"http://wjjh5.cnlive.com/cnLogoutPreview.html";
  566 +
  567 + if(Environment_ON){
  568 + vc.url = [NSString stringWithFormat:@"http://wjjh5.cnlive.com/cnLogoutPreview.html?sid=&version=%@&plat=i",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
  569 +
  570 + }else{
  571 + vc.url = [NSString stringWithFormat:@"http://wjjh5test.cnlive.com/cnLogoutPreview.html?sid=&version=%@&plat=i",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
  572 + }
  573 +// vc.url = Environment_ON?@"http://wjjh5.cnlive.com/cnLogoutPreview.html?sid=&version=&plat=i":@"http://wjjh5test.cnlive.com/cnLogoutPreview.html?sid=&version=&plat=i";
  574 + vc.hidesBottomBarWhenPushed = YES;
  575 + CNNavigationController *nav = [[CNNavigationController alloc] initWithRootViewController:vc];
  576 + [self presentViewController:nav animated:YES completion:nil];
  577 +
  578 +}
  579 +
  580 +#pragma mark - Private
  581 +#pragma mark - 倒计时
  582 +//恢复原状
  583 +- (void)cancelVerBtnChange {
  584 + dispatch_async(dispatch_get_main_queue(), ^{
  585 + _verificationBtn.selected = NO;
  586 + [_verificationBtn setTitle:@"" forState:UIControlStateNormal];
  587 + [_verificationBtn setBackgroundImage:[UIImage imageNamed:@"dl_yzman"] forState:UIControlStateNormal];
  588 + //设置界面的按钮显示
  589 + _verificationBtn.layer.borderWidth = 0;
  590 + _verificationBtn.userInteractionEnabled = YES;
  591 + });
  592 + if (_timer) {
  593 + dispatch_source_cancel(_timer);//取消定时器
  594 + }
  595 +}
  596 +
  597 +//开始倒计时
  598 +- (void)startTimer {
  599 + __block int timeout = 60; //倒计时时间
  600 +
  601 + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
  602 +
  603 + _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);
  604 +
  605 + dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
  606 +
  607 + dispatch_source_set_event_handler(_timer, ^{
  608 +
  609 + if(timeout<=0){ //倒计时结束,关闭
  610 +
  611 + dispatch_source_cancel(_timer);
  612 +
  613 + dispatch_async(dispatch_get_main_queue(), ^{
  614 + _verificationBtn.selected = NO;
  615 + [_verificationBtn setTitle:@"" forState:UIControlStateNormal];
  616 + [_verificationBtn setBackgroundImage:[UIImage imageNamed:@"dl_yzman"] forState:UIControlStateNormal];
  617 + //设置界面的按钮显示 根据自己需求设置
  618 + self.verificationBtn.layer.borderWidth = 0;
  619 + self.verificationBtn.userInteractionEnabled = YES;
  620 +
  621 + });
  622 +
  623 + }else{
  624 +
  625 + int seconds = timeout % 60;
  626 + NSString *strTime = [NSString stringWithFormat:@"%.2d", seconds];
  627 +
  628 + if(seconds == 0)strTime = [NSString stringWithFormat:@"%d",timeout];
  629 + dispatch_async(dispatch_get_main_queue(), ^{
  630 + //设置界面的按钮显示 根据自己需求设置
  631 + self.verificationBtn.selected = YES;
  632 + [_verificationBtn setBackgroundImage:nil forState:UIControlStateNormal];
  633 + [self.verificationBtn setTitle:[NSString stringWithFormat:@"重新获取(%@s)",strTime] forState:UIControlStateSelected];
  634 + self.verificationBtn.layer.borderColor = UIColorMake(89, 210, 75).CGColor;
  635 + self.verificationBtn.layer.borderWidth = 1;
  636 + self.verificationBtn.layer.masksToBounds = YES;
  637 + self.verificationBtn.layer.cornerRadius = 14.0;
  638 + self.verificationBtn.userInteractionEnabled = NO;
  639 + });
  640 + timeout--;
  641 +
  642 + }
  643 + });
  644 +
  645 + dispatch_resume(_timer);
  646 +}
  647 +
  648 +//游客登录判断是否有这个频道
  649 +- (NSInteger)containsWithChannelId:(NSString *)channelId {
  650 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  651 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  652 +
  653 + NSInteger i = 0;
  654 + for (NSString *str in channelArray) {
  655 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  656 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  657 + if ([model.id isEqualToString:channelId]) {
  658 + return i;
  659 + }
  660 + i++;
  661 + }
  662 + return -1;
  663 +
  664 +}
  665 +//游客登录判断有这个频道的分类在第几个
  666 +- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
  667 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  668 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  669 + NSInteger i = 0;
  670 +
  671 + if(channelArray.count > index){
  672 + NSString *modelStr = channelArray[index];
  673 + NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
  674 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  675 + for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
  676 + if ([subModel.id isEqualToString:classifyId]) {
  677 + return i;
  678 + }
  679 + if (CNLiveStringIsEmpty(subModel.pageType)) {
  680 + continue;
  681 + }else{
  682 + i++;
  683 + }
  684 + }
  685 + }
  686 + return -1;
  687 +
  688 +}
  689 +
  690 +//展示提示框
  691 +- (void)showAlertWithTitle:(NSString *)title {
  692 + if (@available(iOS 8.0, *)) {
  693 + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
  694 + [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
  695 + [self presentViewController:alertController animated:YES completion:nil];
  696 +
  697 + }
  698 + else {
  699 + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
  700 + [alertView show];
  701 +
  702 + }
  703 +
  704 +}
  705 +
  706 +- (void)upDownSelfView:(BOOL)isUp{
  707 + if (isUp){
  708 + [UIView animateWithDuration:_keyboardAnimationDuration ? _keyboardAnimationDuration : 0.25 animations:^{
  709 + self.view.top = -200;
  710 + self.view.height = kScreenHeight + 200;
  711 + }];
  712 + }
  713 + else{
  714 + [UIView animateWithDuration:_keyboardAnimationDuration ? _keyboardAnimationDuration : 0.25 animations:^{
  715 + self.view.top = 0;
  716 + self.view.height = kScreenHeight;
  717 + }];
  718 + }
  719 +}
  720 +
  721 +//获取分类控制器
  722 +- (CNClassifySegmentController *)getClassifySegmentController{
  723 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  724 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  725 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  726 + NSArray *controllers = tabbar.viewControllers;
  727 + if(controllers.count > 0){
  728 + CNNavigationController *nav = controllers[1];
  729 + CNClassifySegmentController *controller = nav.qmui_rootViewController;
  730 + return controller;
  731 + }
  732 +
  733 + }
  734 + return nil;
  735 +
  736 +}
  737 +#pragma mark - SelectCountriesDelegate
  738 +- (void)selectViewController:(CNSelectCountriesViewController *)viewController countryName:(NSString *)name countryCode:(NSString *)code{
  739 + _countryLbl.text = [NSString stringWithFormat:@"+%@",code];
  740 + _codeStr = code;
  741 + NSLog(@"%@---%@",name,code);
  742 +
  743 +}
  744 +
  745 +#pragma mark - TouristsLoginDelegate
  746 +//游客登录模式的代理,是否隐藏浏览入口按钮
  747 +- (void)backViewController:(CNTouristsLoginViewController *)viewController isHidden:(BOOL)isHidden{
  748 + _touristsBtn.hidden = isHidden;
  749 +
  750 +}
  751 +
  752 +#pragma mark - TouristsLoginTipsViewDelegate
  753 +- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify{
  754 + if([isClassify isEqualToString:@"close"]){
  755 + //隐藏TouristsLoginTipsView
  756 + [self.fuzzyView removeFromSuperview];
  757 +
  758 + }else if([isClassify isEqualToString:@"jump"]){
  759 + //进入频道管理页面
  760 + [self.fuzzyView removeFromSuperview];
  761 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  762 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  763 + [controller customAction:nil];
  764 + }
  765 + }
  766 +
  767 +}
  768 +#pragma mark - Lazy Loading
  769 +- (UIImageView *)iconView
  770 +{
  771 + if (!_iconView)
  772 + {
  773 + _iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dl_logo"]];
  774 + _iconView.top = 80 + kStatusHeight;
  775 + _iconView.centerX = self.view.centerX;
  776 + }
  777 + return _iconView;
  778 +}
  779 +
  780 +- (QMUILabel *)mobileLocaLbl
  781 +{
  782 + if (!_mobileLocaLbl)
  783 + {
  784 + _mobileLocaLbl = [[QMUILabel alloc] initWithFrame:CGRectMake(Left_Space, _iconView.bottom + 27, 150, 15)];
  785 + [_mobileLocaLbl setFont:UIFontMake(14)];
  786 + _mobileLocaLbl.textColor = KGray173Color;
  787 + _mobileLocaLbl.text = @"手机号归属地";
  788 + }
  789 + return _mobileLocaLbl;
  790 +}
  791 +
  792 +- (QMUILabel *)countryLbl
  793 +{
  794 + if (!_countryLbl)
  795 + {
  796 + _countryLbl = [[QMUILabel alloc] initWithFrame:CGRectMake(kScreenWidth - Left_Space -100, self.mobileLocaLbl.top, 100, 15)];
  797 + [_countryLbl setFont:UIFontMake(15)];
  798 + _countryLbl.textColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1.0];
  799 + _countryLbl.text = @"+86";
  800 + _countryLbl.userInteractionEnabled = YES;
  801 + _countryLbl.textAlignment = NSTextAlignmentRight;
  802 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(countryLblTap:)];
  803 + [_countryLbl addGestureRecognizer:tap];
  804 + }
  805 + return _countryLbl;
  806 +}
  807 +
  808 +- (CNLoginTextField *)accountTextF
  809 +{
  810 + if (!_accountTextF) {
  811 +
  812 + _accountTextF = [[CNLoginTextField alloc] initWithFrame:CGRectMake(Left_Space, _mobileLocaLbl.bottom + 40, KScreenWidth - (2*Left_Space), 40)];
  813 + _accountTextF.zx_placeholderColor = KGray173Color;
  814 + _accountTextF.textColor = [UIColor blackColor];
  815 + _accountTextF.keyboardType = UIKeyboardTypeNumberPad;
  816 + _accountTextF.placeholder = @"请输入手机号号码";
  817 + _accountTextF.font = UIFontMake(14);
  818 + _accountTextF.clearButtonMode = UITextFieldViewModeAlways;
  819 + _accountTextF.textAlignment = NSTextAlignmentLeft;
  820 + [_accountTextF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  821 + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, _accountTextF.height-1, _accountTextF.width, 0.5)];
  822 + line.backgroundColor = kLineGrayColor;
  823 + [_accountTextF addSubview:line];
  824 + _accountTextF.delegate = self;
  825 + }
  826 + return _accountTextF;
  827 +}
  828 +
  829 +- (CNLoginTextField *)passworkTextF
  830 +{
  831 + if (!_passworkTextF) {
  832 + _passworkTextF = [[CNLoginTextField alloc] initWithFrame:CGRectMake(Left_Space, _accountTextF.bottom + 30, 100, 40)];
  833 + _passworkTextF.keyboardType = UIKeyboardTypeNumberPad;
  834 + _passworkTextF.placeholder = @"请输入验证码";
  835 + _passworkTextF.textColor = [UIColor blackColor];
  836 + _passworkTextF.zx_placeholderColor = KGray173Color;
  837 + _passworkTextF.font = UIFontMake(14);
  838 + _passworkTextF.textAlignment = NSTextAlignmentLeft;
  839 + [_passworkTextF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  840 + _passworkTextF.clearButtonMode = UITextFieldViewModeWhileEditing;
  841 + _passworkTextF.delegate = self;
  842 +
  843 + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, _passworkTextF.height-1, _passworkTextF.width, 0.5)];
  844 + line.backgroundColor = kLineGrayColor;
  845 + [_passworkTextF addSubview:line];
  846 + }
  847 + return _passworkTextF;
  848 +}
  849 +
  850 +- (UIButton *)verificationBtn
  851 +{
  852 + if (!_verificationBtn) {
  853 + _verificationBtn = [UIButton buttonWithTitle:@"" titleColor:UIColorMake(33, 188, 35) labelFontSize:10];
  854 + [_verificationBtn setFrame:CGRectMake(kScreenWidth - Left_Space - 73, self.passworkTextF.top , 73, 28)];
  855 + _verificationBtn.centerY = self.passworkTextF.centerY;
  856 +
  857 + [_verificationBtn setBackgroundImage:[UIImage imageNamed:@"dl_yzman"] forState:UIControlStateNormal];
  858 + [_verificationBtn setBackgroundImage:nil forState:UIControlStateSelected];
  859 + [_verificationBtn addTarget:self action:@selector(verificationBtnAction) forControlEvents:UIControlEventTouchUpInside];
  860 + [_verificationBtn setAdjustsImageWhenHighlighted:NO];
  861 +
  862 + }
  863 + return _verificationBtn;
  864 +}
  865 +
  866 +- (QMUIButton *)loginBtn
  867 +{
  868 + if (!_loginBtn) {
  869 + _loginBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  870 + _loginBtn.frame = CGRectMake(Left_Space, _passworkTextF.bottom+30, KScreenWidth-2*Left_Space, 45);
  871 + [_loginBtn setTitle:@"登录" forState:UIControlStateNormal];
  872 + [_loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  873 + _loginBtn.titleLabel.font = UIFontMake(15);
  874 + _loginBtn.backgroundColor = RGBOF(0x23d41e);
  875 + _loginBtn.layer.cornerRadius = 45/2.0;
  876 + _loginBtn.layer.masksToBounds = YES;
  877 + _loginBtn.enabled = NO;
  878 + [_loginBtn addTarget:self action:@selector(loginBtnDidSelected:) forControlEvents:UIControlEventTouchUpInside];
  879 + }
  880 + return _loginBtn;
  881 +}
  882 +
  883 +//- (UIButton *)agreeBtn
  884 +//{
  885 +// if (!_agreeBtn) {
  886 +// _agreeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  887 +// [_agreeBtn setBackgroundImage:[UIImage imageNamed:@"dl_yixuan"] forState:UIControlStateNormal];
  888 +// _agreeBtn.selected = YES;
  889 +// _agreeBtn.imageEdgeInsets = UIEdgeInsetsMake(3, 3, 3, 3);
  890 +// _agreeBtn.enabled = NO;
  891 +// }
  892 +// return _agreeBtn;
  893 +//}
  894 +
  895 +- (YYLabel *)protocolLab
  896 +{
  897 + if (!_protocolLab) {
  898 + _protocolLab = [[YYLabel alloc] init];
  899 + _protocolLab.textAlignment = NSTextAlignmentCenter;
  900 +
  901 + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"登录即代表阅读并同意《用户协议》及《隐私政策》"];
  902 + NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
  903 + style.alignment = NSTextAlignmentCenter;//对齐方式
  904 + [text addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)];
  905 +
  906 + text.color = UIColorMake(201, 202, 203);
  907 + text.font = UIFontMake(14*KScreenWidth/375.0);
  908 + [_protocolLab sizeToFit];
  909 +
  910 + MJWeakSelf
  911 + [text setTextHighlightRange:NSMakeRange(11, 4) color:RGBOF(0x23d41e) backgroundColor:kClearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  912 + [weakSelf.view endEditing:YES];
  913 + CNUserAgreementRequst *requst = [[CNUserAgreementRequst alloc] init];
  914 + [requst getAgreementH5WithType:CNAgreementUser success:^(NSString *h5, NSString *title) {
  915 +
  916 + CNReportAndComplaintWebController *webVC = [[CNReportAndComplaintWebController alloc] initWithUrl:h5 webType:CNFeedbackWebType pageTitle:title];
  917 + CNNavigationController *nav = [[CNNavigationController alloc] initWithRootViewController:webVC];
  918 + [weakSelf presentViewController:nav animated:NO completion:NULL];
  919 +
  920 + } failure:^(NSError *error) {
  921 + [QMUITips showError:error.localizedDescription inView:self.view hideAfterDelay:1.5];
  922 + }];
  923 +
  924 + }];
  925 +
  926 + [text setTextHighlightRange:NSMakeRange(text.length-5, 4) color:RGBOF(0x23d41e) backgroundColor:kClearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  927 + [weakSelf.view endEditing:YES];
  928 + CNUserAgreementRequst *requst = [[CNUserAgreementRequst alloc] init];
  929 + [requst getAgreementH5WithType:CNAgreementPrivacy success:^(NSString *h5, NSString *title) {
  930 + CNReportAndComplaintWebController *webVC = [[CNReportAndComplaintWebController alloc] initWithUrl:h5 webType:CNFeedbackWebType pageTitle:title];
  931 + CNNavigationController *nav = [[CNNavigationController alloc] initWithRootViewController:webVC];
  932 + [weakSelf presentViewController:nav animated:NO completion:NULL];
  933 +
  934 + } failure:^(NSError *error) {
  935 + [QMUITips showError:error.localizedDescription inView:weakSelf.view hideAfterDelay:1.5];
  936 + }];
  937 +
  938 + }];
  939 +
  940 + _protocolLab.attributedText = text;
  941 +
  942 + }
  943 +
  944 +
  945 + return _protocolLab;
  946 +}
  947 +- (UIButton *)countryBtn{
  948 + if (!_countryBtn) {
  949 + _countryBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  950 + [_countryBtn setImage:[UIImage imageNamed:@"dl_xl"] forState:UIControlStateNormal];
  951 + [_countryBtn addTarget:self action:@selector(countryBtnDidSelected:) forControlEvents:UIControlEventTouchUpInside];
  952 + _countryBtn.adjustsImageWhenHighlighted = NO;
  953 +
  954 + }
  955 + return _countryBtn;
  956 +
  957 +}
  958 +- (UIButton *)touristsBtn{
  959 + if (!_touristsBtn) {
  960 + _touristsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  961 + [_touristsBtn setImage:[UIImage imageNamed:@"index_entrance"] forState:UIControlStateNormal];
  962 + [_touristsBtn addTarget:self action:@selector(touristsBtnDidSelected:) forControlEvents:UIControlEventTouchUpInside];
  963 + _touristsBtn.adjustsImageWhenHighlighted = NO;
  964 +
  965 + }
  966 + return _touristsBtn;
  967 +
  968 +}
  969 +
  970 +- (CNTouristsLoginTipsView *)fuzzyView{
  971 + if (!_fuzzyView) {
  972 + _fuzzyView = [[CNTouristsLoginTipsView alloc] initWithFrame:AppKeyWindow.bounds];
  973 + _fuzzyView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
  974 + _fuzzyView.delegate = self;
  975 + }
  976 + return _fuzzyView;
  977 +
  978 +}
  979 +
  980 +@end
CNLiveLogin/Classes/Controller/CNSelectCountriesViewController.h 0 → 100644
  1 +//
  2 +// CNSelectCountriesViewController.h
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNSelectCountriesViewController;
  13 +@protocol SelectCountriesDelegate<NSObject>
  14 +- (void)selectViewController:(CNSelectCountriesViewController *)viewController countryName:(NSString *)name countryCode:(NSString *)code;
  15 +
  16 +@end
  17 +@interface CNSelectCountriesViewController : UIViewController
  18 +@property (nonatomic, weak) id<SelectCountriesDelegate> delegate;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/Controller/CNSelectCountriesViewController.m 0 → 100644
  1 +//
  2 +// CNSelectCountriesViewController.m
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNSelectCountriesViewController.h"
  10 +#import "CNSelectCountries.h"
  11 +#import "CNSelectCountriesTableViewCell.h"
  12 +#import "CNSelectCountriesHeadView.h"
  13 +#define MainScreenWidth [[UIScreen mainScreen] bounds].size.width
  14 +#define MainScreenHeight [[UIScreen mainScreen] bounds].size.height
  15 +
  16 +#define kMainScale MainScreenWidth/375.f
  17 +#define kMainHScale MainScreenHeight/667.f
  18 +
  19 +@interface CNSelectCountriesViewController ()<UITableViewDelegate, UITableViewDataSource,SelectCountriesHeadViewDelegate>
  20 +@property (nonatomic, strong) NSMutableArray *contactArray;//联系人一维数组
  21 +@property (nonatomic, strong) NSMutableArray *sortedArray;//排序后的联系人二维数组
  22 +@property (nonatomic, strong) NSMutableArray *letterArray;//需要显示的字母数组
  23 +
  24 +@property (nonatomic, strong) UITableView *tableView;
  25 +@property (nonatomic, weak) MJRefreshAutoNormalFooter *footer;
  26 +
  27 +@property (nonatomic, strong) UILocalizedIndexedCollation *collation;
  28 +
  29 +@end
  30 +
  31 +@implementation CNSelectCountriesViewController
  32 +#pragma mark - Data
  33 +- (void)getData{
  34 +
  35 + //获取所有字母A-Z
  36 + self.collation = [UILocalizedIndexedCollation currentCollation];
  37 +
  38 + //创建存放相同首字母名字对象的二维数组
  39 + //@[@[],@[],@[],@[]....]
  40 + for (int i = 0; i < self.collation.sectionTitles.count; i++) {
  41 + NSMutableArray *mutArray = [NSMutableArray array];
  42 + [self.sortedArray addObject:mutArray];
  43 + }
  44 + //把各个联系人对象取出来,放到对应的数组中
  45 + for (CNSelectCountries *contact in self.contactArray) {
  46 + NSInteger position = [self.collation sectionForObject:contact collationStringSelector:@selector(name)];
  47 + [self.sortedArray[position] addObject:contact];
  48 + }
  49 + //再把存放着各个相同首字母名字对象的数组取出来,将其中的联系人对象按照名称进行排序
  50 + [self.sortedArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  51 + NSArray *array = [self.collation sortedArrayFromArray:obj collationStringSelector:@selector(name)];
  52 + self.sortedArray[idx] = array;
  53 + }];
  54 +
  55 + //获取所有字母A-Z
  56 + __block NSMutableArray *letters = [NSMutableArray arrayWithArray:self.collation.sectionTitles];
  57 + //在二维数组中删除没有联系人的数组
  58 + [self.sortedArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  59 + NSArray *arr = (NSArray *)obj;
  60 + if(arr.count == 0){
  61 + [letters replaceObjectAtIndex:idx withObject:@"1"];
  62 + }
  63 + }];
  64 + [letters removeObject:@"1"];
  65 + //用于显示分组
  66 + self.letterArray = letters;
  67 +
  68 +}
  69 +//- (void)viewWillAppear:(BOOL)animated{
  70 +// [super viewWillAppear:animated];
  71 +// self.navigationController.navigationBarHidden = YES;
  72 +//}
  73 +- (void)viewDidLoad {
  74 + [super viewDidLoad];
  75 + // Do any additional setup after loading the view.
  76 + [self getData];
  77 + [self setupNavigationBar];
  78 + [self.view addSubview:self.tableView];
  79 +
  80 + NSArray *arr = @[@{@"name":@"中国",@"code":@"86"}, @{@"name":@"中国(台湾)",@"code":@"886"}, @{@"name":@"中国(香港)",@"code":@"852"}, @{@"name":@"中国(澳门)",@"code":@"853"}];
  81 + NSArray *contact = [CNSelectCountries mj_objectArrayWithKeyValuesArray:arr];
  82 + CNSelectCountriesHeadView *view = [[CNSelectCountriesHeadView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 45*kMainScale*contact.count+30*kMainHScale)];
  83 + view.data = contact;
  84 + view.delegate = self;
  85 + self.tableView.tableHeaderView = view;
  86 +
  87 + [_footer setTitle:[NSString stringWithFormat:@"%lu个地区",(unsigned long)self.contactArray.count] forState:MJRefreshStateNoMoreData];
  88 +
  89 +}
  90 +//- (void)viewWillDisappear:(BOOL)animated{
  91 +// [super viewWillDisappear:animated];
  92 +// self.navigationController.navigationBarHidden = NO;
  93 +//}
  94 +- (void)dealloc {
  95 + NSLog(@"CNLiveAddressBookViewController - dealloc");
  96 +
  97 +}
  98 +- (void)setupNavigationBar {
  99 + // 隐藏系统导航栏
  100 + CGFloat stateHeight = Device_Is_iPhoneX?44:20;
  101 + // 创建假的导航栏
  102 + UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, stateHeight, [UIScreen mainScreen].bounds.size.width, 44)];
  103 + navView.backgroundColor = [UIColor clearColor];
  104 + [self.view bringSubviewToFront:navView];
  105 + [self.view addSubview:navView];
  106 +
  107 + UIButton *left= [UIButton buttonWithType:UIButtonTypeSystem];
  108 + left.frame = CGRectMake(0, 0, 44, 44);
  109 + [left setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  110 + left.titleLabel.font = [UIFont systemFontOfSize:16];
  111 + [left setImage:[[UIImage imageNamed:@"web_close"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  112 + [left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
  113 + [navView addSubview:left];
  114 +
  115 + UILabel *titleLbl = [[UILabel alloc] initWithFrame:CGRectMake((KScreenWidth - 150)/2.0, stateHeight, 150, 44)];
  116 + [titleLbl setFont:UIFontMake(16)];
  117 + titleLbl.textColor = UIColorMake(49, 49, 49);
  118 + titleLbl.text = @"选择国家或地区";
  119 + titleLbl.textAlignment = NSTextAlignmentCenter;
  120 + [self.view addSubview:titleLbl];
  121 +
  122 +}
  123 +- (void)didReceiveMemoryWarning {
  124 + [super didReceiveMemoryWarning];
  125 + // Dispose of any resources that can be recreated.
  126 +}
  127 +#pragma mark - UITableViewDelegate
  128 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  129 + return 45*kMainScale;
  130 +
  131 +}
  132 +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  133 + NSArray *arr = self.sortedArray[section];
  134 + if (arr.count != 0) {
  135 + return 30*kMainHScale;
  136 +
  137 + } else {
  138 + return 0.00000001f;
  139 + }
  140 +
  141 +}
  142 +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  143 + return 0.00000001f;
  144 +
  145 +}
  146 +#pragma mark - UITableViewDataSource
  147 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  148 + return self.collation.sectionTitles.count;
  149 +}
  150 +
  151 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  152 + NSArray *arr = self.sortedArray[section];
  153 + return arr.count;
  154 +}
  155 +
  156 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  157 + CNSelectCountriesTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CNSelectCountriesTableViewCell"];
  158 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  159 + CNSelectCountries *contact = self.sortedArray[indexPath.section][indexPath.row];
  160 + cell.model = contact;
  161 + cell.isPadding = NO;
  162 + return cell;
  163 +}
  164 +
  165 +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  166 + NSArray *arr = self.sortedArray[section];
  167 + if (arr.count != 0) {
  168 + return self.collation.sectionTitles[section];
  169 +
  170 + } else {
  171 + return nil;
  172 + }
  173 +}
  174 +
  175 +- (NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView {
  176 + return self.letterArray;
  177 +
  178 +}
  179 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  180 + CNSelectCountries *contact = self.sortedArray[indexPath.section][indexPath.row];
  181 + if (self.delegate && [self.delegate respondsToSelector:@selector(selectViewController:countryName:countryCode:)]) {
  182 + [self goBack];
  183 + [self.delegate selectViewController:self countryName:contact.name countryCode:contact.code];
  184 + }
  185 +
  186 +}
  187 +#pragma mark - SelectCountriesHeadViewDelegate
  188 +- (void)selectHeadView:(CNSelectCountriesHeadView *)view countryName:(NSString *)name countryCode:(NSString *)code{
  189 + if (self.delegate && [self.delegate respondsToSelector:@selector(selectViewController:countryName:countryCode:)]) {
  190 + [self goBack];
  191 + [self.delegate selectViewController:self countryName:name countryCode:code];
  192 + }
  193 +
  194 +}
  195 +/*
  196 + #pragma mark - Navigation
  197 +
  198 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  199 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  200 + // Get the new view controller using [segue destinationViewController].
  201 + // Pass the selected object to the new view controller.
  202 + }
  203 + */
  204 +#pragma mark - Lazy Laoding
  205 +- (NSMutableArray *)contactArray {
  206 + if (!_contactArray) {
  207 + _contactArray = [NSMutableArray array];
  208 + NSArray *array = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"countries" ofType:@"plist"]];
  209 + for (NSDictionary *dic in array) {
  210 + CNSelectCountries *contact = [CNSelectCountries mj_objectWithKeyValues:dic];
  211 + [_contactArray addObject:contact];
  212 + }
  213 + }
  214 + return _contactArray;
  215 +}
  216 +
  217 +- (NSMutableArray *)sortedArray {
  218 + if (!_sortedArray) {
  219 + _sortedArray = [NSMutableArray array];
  220 +
  221 + }
  222 + return _sortedArray;
  223 +}
  224 +- (NSMutableArray *)letterArray {
  225 + if (!_letterArray) {
  226 + _letterArray = [NSMutableArray array];
  227 +
  228 + }
  229 + return _letterArray;
  230 +}
  231 +
  232 +- (UITableView *)tableView{
  233 + if(!_tableView){
  234 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, KScreenWidth, KScreenHeight-kNavigationBarHeight) style:UITableViewStylePlain];
  235 + _tableView.delegate = self;
  236 + _tableView.dataSource = self;
  237 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  238 + _tableView.backgroundColor = [UIColor whiteColor];
  239 + _tableView.estimatedRowHeight = 0;
  240 + _tableView.estimatedSectionHeaderHeight = 0;
  241 + _tableView.estimatedSectionFooterHeight = 0;
  242 + [_tableView registerClass:[CNSelectCountriesTableViewCell class] forCellReuseIdentifier:@"CNSelectCountriesTableViewCell"];
  243 + // 设置下拉刷新
  244 + MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
  245 + [footer setState:MJRefreshStateNoMoreData];
  246 +
  247 + }
  248 + return _tableView;
  249 +}
  250 +
  251 +- (void)loadMoreData{
  252 +
  253 +}
  254 +#pragma mark - Action
  255 +- (void)goBack {
  256 + [self dismissViewControllerAnimated:YES completion:nil];
  257 +
  258 +}
  259 +@end
CNLiveLogin/Classes/Controller/CNTouristsLoginViewController.h 0 → 100644
  1 +//
  2 +// CNTouristsLoginViewController.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/1/10.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNCommonViewController.h"
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNTouristsLoginViewController;
  13 +@protocol TouristsLoginDelegate<NSObject>
  14 +- (void)backViewController:(CNTouristsLoginViewController *)viewController isHidden:(BOOL)isHidden;
  15 +
  16 +@end
  17 +@interface CNTouristsLoginViewController : CNCommonViewController
  18 +@property (nonatomic, weak) id<TouristsLoginDelegate> delegate;
  19 +
  20 +@property (nonatomic, copy) NSString *url;
  21 +@property (nonatomic, assign) BOOL intercept; //跳转拦截
  22 +
  23 +@end
  24 +
  25 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/Controller/CNTouristsLoginViewController.m 0 → 100644
  1 +//
  2 +// CNTouristsLoginViewController.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/1/10.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNTouristsLoginViewController.h"
  10 +#import <WebKit/WebKit.h>
  11 +#import "WebViewJavascriptBridge.h"
  12 +//#import "CNGetLiveDataHandle.h"
  13 +//#import <CNLiveStat/CNLiveStat.h>
  14 +//#import "CNWebRedirectHandle.h"
  15 +
  16 +@interface CNTouristsLoginViewController ()<WKUIDelegate,WKNavigationDelegate>
  17 +@property (nonatomic, strong) WKWebView *webView;
  18 +@property (nonatomic, strong) WebViewJavascriptBridge *bridge;
  19 +
  20 +@end
  21 +
  22 +@implementation CNTouristsLoginViewController
  23 +#pragma mark - 网络监听
  24 +- (void)cn_noNetworking {
  25 + [QMUITips showError:@"您似乎断开与互联网的连接" inView:AppKeyWindow hideAfterDelay:1.5];
  26 +
  27 +}
  28 +- (void)cn_wifiOrWWANNetworking{
  29 + [self hideEmptyView];
  30 + [self refreshData];
  31 +
  32 +}
  33 +
  34 +#pragma mark - Life Cycle
  35 +- (void)viewWillAppear:(BOOL)animated {
  36 + [super viewWillAppear:animated];
  37 + self.navigationController.navigationBarHidden = YES;
  38 +
  39 +}
  40 +- (void)viewDidLoad {
  41 + [super viewDidLoad];
  42 + // Do any additional setup after loading the view.
  43 +
  44 + if (@available(iOS 11, *)) {
  45 + self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
  46 + }
  47 +
  48 + UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
  49 + statusBar.backgroundColor = [UIColor whiteColor];
  50 +
  51 + UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 40)];
  52 + backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;// 水平左对齐
  53 + [backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  54 + [backButton addTarget:self action:@selector(clickedBackButton:) forControlEvents:UIControlEventTouchUpInside];
  55 + UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithCustomView:backButton];
  56 + self.navigationItem.leftBarButtonItem = item1;
  57 +
  58 + //初始化子视图
  59 + [self initWithSubViews];
  60 +
  61 + //注册方法
  62 + [self interaction];
  63 +
  64 + //加载webview页面
  65 + [self refreshData];
  66 +
  67 +}
  68 +
  69 +- (void)dealloc {
  70 + [_webView stopLoading];
  71 + _webView.UIDelegate = nil;
  72 + _webView.navigationDelegate = nil;
  73 + _webView = nil;
  74 +
  75 + [self clearWKCache];
  76 + NSLog(@"WKWebView dealloc");
  77 +
  78 +}
  79 +- (void)viewWillDisappear:(BOOL)animated {
  80 + [super viewWillDisappear:animated];
  81 + self.navigationController.navigationBarHidden = NO;
  82 + UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
  83 + statusBar.backgroundColor = [UIColor clearColor];
  84 +}
  85 +
  86 +#pragma mark - UI
  87 +- (void)initWithSubViews{
  88 + [self.view addSubview:self.webView];
  89 + [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
  90 + make.top.equalTo(self.view.mas_top).with.offset(0);
  91 + make.left.equalTo(self.view.mas_left).with.offset(0);
  92 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  93 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0);
  94 +
  95 + }];
  96 +}
  97 +#pragma mark - WebView交互
  98 +- (void)interaction {
  99 + [WebViewJavascriptBridge enableLogging];
  100 + self.bridge = [WebViewJavascriptBridge bridgeForWebView:self.webView];
  101 + [self.bridge setWebViewDelegate:self];
  102 + weakself
  103 + //退出游客模式(显示按钮)
  104 + [self.bridge registerHandler:wjjHtmlPreviewHide handler:^(id data, WVJBResponseCallback responseCallback) {
  105 + NSLog(@"ObjC Echo called with: %@", data);
  106 + [weakSelf goBackNotHidden];
  107 + responseCallback(data);
  108 +
  109 + }];
  110 +
  111 + //交互->正式登录(隐藏按钮)
  112 + [self.bridge registerHandler:wjjClientLogin handler:^(id data, WVJBResponseCallback responseCallback) {
  113 + NSLog(@"ObjC Echo called with: %@", data);
  114 + if ([data isKindOfClass:[NSDictionary class]]) {
  115 + NSDictionary *dic = (NSDictionary *)data;
  116 + [weakSelf goBackIsHiddenWithChannelId:dic[@"oneTabColumnId"] classifyId:dic[@"twoTabColumnId"] url:dic[@"url"]];
  117 +
  118 + }else{
  119 + [weakSelf goBackNotHidden];
  120 +
  121 + }
  122 + responseCallback(data);
  123 +
  124 + }];
  125 +
  126 +}
  127 +
  128 +#pragma mark - Action
  129 +// 断网的刷新 -> 重试
  130 +- (void)noNetworkingRetry {
  131 + [self hideEmptyView];
  132 + [self refreshData];
  133 +
  134 +}
  135 +
  136 +// 未断网的刷新
  137 +- (void)normalRetry {
  138 + [self hideEmptyView];
  139 + [self refreshData];
  140 +
  141 +}
  142 +
  143 +#pragma mark - Private
  144 +//数据刷新
  145 +- (void)refreshData {
  146 +
  147 + if (CNLiveStringIsEmpty(_url)) {
  148 + //@""
  149 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:@"请求的数据为空" detailText:@"别紧张,稍后再来试试~" buttonTitle:@" 重试 " buttonAction:@selector(noNetworkingRetry)];
  150 + self.emptyView.backgroundColor = kWhiteColor;
  151 + [self setCNAPIErrorEmptyView];
  152 +
  153 + }
  154 + else if ([_url hasPrefix:@"http"]) {
  155 + [QMUITips showLoadingInView:AppKeyWindow];
  156 +
  157 + // 拼签名后的参数
  158 + NSURL *url = [NSURL URLWithString:_url];
  159 + NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0];
  160 + [self.webView loadRequest:theRequest];
  161 +
  162 + }
  163 + else {
  164 + [self.webView loadHTMLString:_url baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
  165 +
  166 + }
  167 +
  168 +}
  169 +
  170 +//清除缓存
  171 +- (void)clearWKCache {
  172 + // 清除部分,可以自己设置
  173 + NSArray *types = @[WKWebsiteDataTypeDiskCache,WKWebsiteDataTypeOfflineWebApplicationCache,WKWebsiteDataTypeMemoryCache,WKWebsiteDataTypeIndexedDBDatabases,WKWebsiteDataTypeWebSQLDatabases];
  174 + NSSet *websiteDataTypes = [NSSet setWithArray:types];
  175 +
  176 + // Date from
  177 + NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
  178 +
  179 + // Execute
  180 + [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
  181 + // Done
  182 + NSLog(@"清楚缓存完毕");
  183 + }];
  184 +
  185 +}
  186 +
  187 +#pragma mark - WKNavigationDelegate
  188 +// 在发送请求之前,决定是否跳转
  189 +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{
  190 +
  191 + [self hideEmptyView];
  192 + //允许跳转
  193 + decisionHandler(WKNavigationActionPolicyAllow);
  194 +
  195 +}
  196 +
  197 +// 页面开始加载时调用
  198 +- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
  199 +
  200 +}
  201 +
  202 +// 在收到响应后,决定是否跳转
  203 +- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler{
  204 + if (((NSHTTPURLResponse *)navigationResponse.response).statusCode == 200) {
  205 + //允许跳转
  206 + decisionHandler (WKNavigationResponsePolicyAllow);
  207 + }
  208 + else if (((NSHTTPURLResponse *)navigationResponse.response).statusCode == 404) {
  209 + // 不允许跳转
  210 + decisionHandler (WKNavigationResponsePolicyCancel);
  211 + }
  212 + else {
  213 + //不允许跳转
  214 + decisionHandler(WKNavigationResponsePolicyCancel);
  215 + }
  216 +}
  217 +
  218 +// 当内容开始返回时调用
  219 +- (void)webView:(WKWebView *)webView didCommitNavigation:(null_unspecified WKNavigation *)navigation {
  220 +
  221 +}
  222 +
  223 +// 页面加载完成之后调用
  224 +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
  225 + [QMUITips hideAllTipsInView:AppKeyWindow];
  226 + if ([self.webView canGoBack]) {
  227 + self.navigationController.navigationBarHidden = NO;
  228 + [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
  229 + make.top.equalTo(self.view.mas_top).with.offset(kNavigationBarHeight);
  230 + make.left.equalTo(self.view.mas_left).with.offset(0);
  231 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  232 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0);
  233 +
  234 + }];
  235 + }else{
  236 + self.navigationController.navigationBarHidden = YES;
  237 + [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
  238 + make.top.equalTo(self.view.mas_top).with.offset(0);
  239 + make.left.equalTo(self.view.mas_left).with.offset(0);
  240 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  241 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0);
  242 +
  243 + }];
  244 +
  245 + }
  246 +}
  247 +
  248 +// 页面加载失败时调用
  249 +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(nonnull NSError *)error{
  250 + [QMUITips hideAllTipsInView:AppKeyWindow];
  251 + if ([self.webView canGoBack]) {
  252 + self.navigationController.navigationBarHidden = NO;
  253 + }else{
  254 + self.navigationController.navigationBarHidden = YES;
  255 +
  256 + }
  257 + NSString *errorMsg = @"接口请求失败,请稍后再试!";
  258 + //404->102->返回按钮
  259 + if (error.code==-1009||error.code==102) {
  260 + errorMsg = @"网络连接失败,请稍后再试!";
  261 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:errorMsg detailText:@" " buttonTitle:@" 返回 " buttonAction:@selector(goBackNotHidden)];
  262 + self.emptyView.backgroundColor = kWhiteColor;
  263 +
  264 + } else {
  265 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:errorMsg detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(noNetworkingRetry)];
  266 + self.emptyView.backgroundColor = kWhiteColor;
  267 +
  268 + }
  269 + [self setCNAPIErrorEmptyView];
  270 +
  271 +}
  272 +
  273 +// 接收到服务器跳转请求之后调用(重定向)
  274 +- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{
  275 +
  276 +}
  277 +
  278 +#pragma mark - Lazy Loading
  279 +- (WKWebView *)webView{
  280 + if(!_webView){
  281 + NSMutableString *javascript = [NSMutableString string];
  282 + [javascript appendString:@"document.documentElement.style.webkitTouchCallout='none';"];//禁止长按
  283 + [javascript appendString:@"document.documentElement.style.webkitUserSelect='none';"];//禁止选择
  284 + WKUserScript *noneSelectScript = [[WKUserScript alloc] initWithSource:javascript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
  285 + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
  286 + config.allowsInlineMediaPlayback = YES;
  287 + WKPreferences *preferences = [WKPreferences new];
  288 + preferences.javaScriptCanOpenWindowsAutomatically = YES;
  289 + config.preferences = preferences;
  290 + _webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
  291 + [_webView.configuration.userContentController addUserScript:noneSelectScript];
  292 + _webView.allowsLinkPreview = NO;
  293 + _webView.UIDelegate = self;
  294 + _webView.navigationDelegate = self;
  295 + _webView.contentMode = UIViewContentModeScaleAspectFit;
  296 + _webView.scrollView.showsVerticalScrollIndicator = NO;
  297 + _webView.scrollView.showsHorizontalScrollIndicator = NO;
  298 + _webView.allowsBackForwardNavigationGestures = NO;//关闭返回手势
  299 + }
  300 + return _webView;
  301 +}
  302 +
  303 +/*
  304 +#pragma mark - Navigation
  305 +
  306 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  307 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  308 + // Get the new view controller using [segue destinationViewController].
  309 + // Pass the selected object to the new view controller.
  310 +}
  311 +*/
  312 +#pragma mark - Private
  313 +//点击h5页面的交互调用方法 -> 隐藏浏览入口按钮
  314 +- (void)goBackIsHiddenWithChannelId:(NSString *)channelId classifyId:(NSString *)classifyId url:(NSString *)url{
  315 + if (self.delegate && [self.delegate respondsToSelector:@selector(backViewController:isHidden:)]) {
  316 + [self dismissViewControllerAnimated:YES completion:nil];
  317 + //游客模式存入浏览的一级分类(ChannelId)\二级分类(ClassifyId)\跳转链接(url)
  318 + [[NSUserDefaults standardUserDefaults] setObject:channelId forKey:@"TouristsLoginChannelId"];
  319 + [[NSUserDefaults standardUserDefaults] setObject:classifyId forKey:@"TouristsLoginClassifyId"];
  320 + [[NSUserDefaults standardUserDefaults] setObject:url forKey:@"TouristsLoginUrl"];
  321 +
  322 + //游客模式回调代理方法
  323 + [self.delegate backViewController:self isHidden:NO];
  324 +
  325 + }
  326 +}
  327 +//点击返回✘的调用方法 -> 不隐藏浏览入口按钮
  328 +- (void)goBackNotHidden {
  329 + if (self.delegate && [self.delegate respondsToSelector:@selector(backViewController:isHidden:)]) {
  330 + [self dismissViewControllerAnimated:YES completion:nil];
  331 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  332 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  333 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  334 +
  335 + //游客模式回调代理方法
  336 + [self.delegate backViewController:self isHidden:NO];
  337 +
  338 + }
  339 +}
  340 +
  341 +//回退goback
  342 +- (void)clickedBackButton:(UIButton *)btn {
  343 + if ([self.webView canGoBack]) {
  344 + [self.webView goBack];
  345 + self.navigationController.navigationBarHidden = YES;
  346 + [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
  347 + make.top.equalTo(self.view.mas_top).with.offset(0);
  348 + make.left.equalTo(self.view.mas_left).with.offset(0);
  349 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  350 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0);
  351 +
  352 + }];
  353 + }
  354 +
  355 +}
  356 +
  357 +@end
CNLiveLogin/Classes/Model/CNSelectCountries.h 0 → 100644
  1 +//
  2 +// CNSelectCountries.h
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNSelectCountries : NSObject
  14 +@property (nonatomic, copy) NSString *name;
  15 +@property (nonatomic, copy) NSString *code;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/Model/CNSelectCountries.m 0 → 100644
  1 +//
  2 +// CNSelectCountries.m
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNSelectCountries.h"
  10 +
  11 +@implementation CNSelectCountries
  12 +
  13 +@end
CNLiveLogin/Classes/Model/CNTouristsLoginManager.h 0 → 100644
  1 +//
  2 +// CNTouristsLoginManager.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/27.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNTouristsLoginManager : NSObject
  14 ++ (instancetype)manager;
  15 +- (void)showTouristsLogin;
  16 +
  17 +- (void)jumpCategoryChannelWithFirstChannelId:(NSString *)firstChannelId secondChannelId:(NSString *)secondChannelId;
  18 +
  19 +@end
  20 +
  21 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/Model/CNTouristsLoginManager.m 0 → 100644
  1 +//
  2 +// CNTouristsLoginManager.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/27.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +//游客登录
  10 +#import "CNTouristsLoginManager.h"
  11 +#import "CNTabBarViewController.h"
  12 +#import "CNClassifySegmentController.h"
  13 +#import "CNTouristsLoginTipsView.h"
  14 +#import "CNNavigationController.h"
  15 +
  16 +@interface CNTouristsLoginManager ()<TouristsLoginTipsViewDelegate>
  17 +@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
  18 +
  19 +@end
  20 +
  21 +@implementation CNTouristsLoginManager
  22 +#pragma mark - 单例
  23 ++ (instancetype)manager {
  24 + static CNTouristsLoginManager *_singleton = nil;
  25 + static dispatch_once_t onceToken;
  26 + dispatch_once(&onceToken, ^{
  27 + //不能再使用alloc方法
  28 + //因为已经重写了allocWithZone方法,所以这里要调用父类的分配空间的方法
  29 + _singleton = [[super allocWithZone:NULL] init];
  30 + });
  31 + return _singleton;
  32 +
  33 +}
  34 +
  35 +// 防止外部调用alloc 或者 new
  36 ++ (instancetype)allocWithZone:(struct _NSZone *)zone {
  37 + return [CNTouristsLoginManager manager];
  38 +
  39 +}
  40 +
  41 +// 防止外部调用copy
  42 +- (id)copyWithZone:(nullable NSZone *)zone {
  43 + return [CNTouristsLoginManager manager];
  44 +
  45 +}
  46 +
  47 +// 防止外部调用mutableCopy
  48 +- (id)mutableCopyWithZone:(nullable NSZone *)zone {
  49 + return [CNTouristsLoginManager manager];
  50 +
  51 +}
  52 +
  53 +#pragma mark - TouristsLoginTipsViewDelegate
  54 +- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify{
  55 + if([isClassify isEqualToString:@"close"]){
  56 + //隐藏TouristsLoginTipsView
  57 + [self.fuzzyView removeFromSuperview];
  58 +
  59 + }else if([isClassify isEqualToString:@"jump"]){
  60 + //进入频道管理页面
  61 + [self.fuzzyView removeFromSuperview];
  62 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  63 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  64 + [controller customAction:nil];
  65 + }
  66 + }
  67 +
  68 +}
  69 +
  70 +#pragma mark - 工具方法
  71 +#pragma mark - 游客浏览后登陆
  72 +//显示是提示框还是页面跳转逻辑
  73 +- (void)showTouristsLogin{
  74 + CNTouristsLoginManager *manager = [CNTouristsLoginManager manager];
  75 +
  76 + //游客浏览后登陆获取ChannelId
  77 + NSString *channelId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginChannelId"];
  78 + //首先判断是否有一级分类//
  79 + if(channelId && ![channelId isEqualToString:@""]){
  80 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  81 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  82 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  83 + tabbar.selectedIndex = 1;
  84 +
  85 + //一先处理分类的频道数据->保证本地有频道数据
  86 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  87 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  88 + [controller dataDivideIntoNormalAndOther];
  89 + }
  90 + //二判断我的频道是否存在游客浏览的频道
  91 + NSInteger selectChannelId = [self containsWithChannelId:channelId];
  92 + if(selectChannelId == -1){
  93 + //1我的频道中没有这个频道
  94 + //弹窗提示用户
  95 + self.fuzzyView.delegate = manager;
  96 + [AppKeyWindow addSubview:self.fuzzyView];
  97 +
  98 + }else{
  99 + //2我的频道中有这个频道
  100 + //2.1选中一级分类
  101 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  102 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0/*延迟执行时间*/ * NSEC_PER_SEC));
  103 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  104 + [controller categoryView:controller.titleImageCategoryView didSelectedItemAtIndex:selectChannelId];
  105 + });
  106 +
  107 + }
  108 + //然后判断是否有二级分类//
  109 + NSString *classifyId = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginClassifyId"];
  110 + if(classifyId && ![classifyId isEqualToString:@""]){
  111 + //2.2选中二级分类
  112 + NSInteger selectClassifyId = [self containsWithChannelIndex:selectChannelId classifyId:classifyId];
  113 + if(selectClassifyId != -1){
  114 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0/*延迟执行时间*/ * NSEC_PER_SEC));
  115 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  116 + //获取一级控制器
  117 + NSMutableArray *controllers = controller.vcArrayM;
  118 + //获取二级控制器
  119 + if ([controllers[selectChannelId] isKindOfClass:[CNSubClassifySegmentController class]]) {
  120 + CNSubClassifySegmentController *subController = controllers[selectChannelId];
  121 + [subController categoryView:subController.myCategoryView didSelectedItemAtIndex:selectClassifyId];
  122 + }
  123 + });
  124 + }
  125 + }
  126 + //最后判断是否有url//
  127 + NSString *url = [[NSUserDefaults standardUserDefaults] valueForKey:@"TouristsLoginUrl"];
  128 + if(url && ![url isEqualToString:@""]){
  129 +
  130 + [CNDSShopActionViewModel checkWithFunctionForShareURL:url];
  131 +
  132 + }
  133 + }
  134 + }
  135 + }
  136 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  137 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  138 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  139 +}
  140 +
  141 +- (CNClassifySegmentController *)getClassifySegmentController{
  142 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  143 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  144 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  145 + NSArray *controllers = tabbar.viewControllers;
  146 + if(controllers.count > 0){
  147 + CNNavigationController *nav = controllers[1];
  148 + CNClassifySegmentController *controller = nav.qmui_rootViewController;
  149 + return controller;
  150 + }
  151 +
  152 + }
  153 + return nil;
  154 +
  155 +}
  156 +
  157 +//游客登录判断是否有这个频道
  158 +- (NSInteger)containsWithChannelId:(NSString *)channelId {
  159 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,[UserInformationModel manager].uid];
  160 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  161 +
  162 + NSInteger i = 0;
  163 + for (NSString *str in channelArray) {
  164 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  165 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  166 + if ([model.id isEqualToString:channelId]) {
  167 + return i;
  168 + }
  169 + i++;
  170 + }
  171 + return -1;
  172 +
  173 +}
  174 +
  175 +//游客登录判断有这个频道的分类在第几个
  176 +- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
  177 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,[UserInformationModel manager].uid];
  178 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  179 + NSInteger i = 0;
  180 +
  181 + if(channelArray.count > index){
  182 + NSString *modelStr = channelArray[index];
  183 + NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
  184 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  185 + for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
  186 + if ([subModel.id isEqualToString:classifyId]) {
  187 + return i;
  188 + }
  189 + if (CNLiveStringIsEmpty(subModel.pageType)) {
  190 + continue;
  191 + }else{
  192 + i++;
  193 + }
  194 + }
  195 + }
  196 + return -1;
  197 +
  198 +}
  199 +
  200 +#pragma mark - Lazy loading
  201 +- (CNTouristsLoginTipsView *)fuzzyView{
  202 + if (!_fuzzyView) {
  203 + _fuzzyView = [[CNTouristsLoginTipsView alloc] initWithFrame:AppKeyWindow.bounds];
  204 + _fuzzyView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
  205 + _fuzzyView.delegate = self;
  206 + }
  207 + return _fuzzyView;
  208 +
  209 +}
  210 +
  211 +#pragma mark - 目击者(参与汉服活动跳转相应频道junbo)
  212 +- (void)jumpCategoryChannelWithFirstChannelId:(NSString *)firstChannelId secondChannelId:(NSString *)secondChannelId {
  213 +
  214 + CNTouristsLoginManager *manager = [CNTouristsLoginManager manager];
  215 +
  216 + //首先判断是否有一级分类//
  217 + if(!CNLiveStringIsEmpty(firstChannelId)){
  218 + UIViewController *tabbarController = [[UIApplication sharedApplication] keyWindow].rootViewController;
  219 + if ([tabbarController isKindOfClass:[CNTabBarViewController class]]) {
  220 + CNTabBarViewController *tabbar = (CNTabBarViewController *)tabbarController;
  221 + tabbar.selectedIndex = 1;
  222 +
  223 + //一先处理分类的频道数据->保证本地有频道数据
  224 + CNClassifySegmentController *controller = [self getClassifySegmentController];
  225 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  226 + [controller dataDivideIntoNormalAndOther];
  227 + }
  228 + //二判断我的频道是否存在游客浏览的频道
  229 + NSInteger selectChannelId = [self containsWithChannelId:firstChannelId];
  230 + if(selectChannelId == -1){
  231 + //1我的频道中没有这个频道
  232 + //弹窗提示用户
  233 + self.fuzzyView.delegate = manager;
  234 + [AppKeyWindow addSubview:self.fuzzyView];
  235 +
  236 + }else{
  237 + //2我的频道中有这个频道
  238 + //2.1选中一级分类
  239 + if ([controller isKindOfClass:[CNClassifySegmentController class]]) {
  240 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0/*延迟执行时间*/ * NSEC_PER_SEC));
  241 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  242 + [controller categoryView:controller.titleImageCategoryView didSelectedItemAtIndex:selectChannelId];
  243 + });
  244 +
  245 + }
  246 + //然后判断是否有二级分类//
  247 + if(!CNLiveStringIsEmpty(secondChannelId)){
  248 + //2.2选中二级分类
  249 + NSInteger selectClassifyId = [self containsWithChannelIndex:selectChannelId classifyId:secondChannelId];
  250 + if(selectClassifyId != -1){
  251 + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0/*延迟执行时间*/ * NSEC_PER_SEC));
  252 + dispatch_after(delayTime, dispatch_get_main_queue(), ^{
  253 + //获取一级控制器
  254 + NSMutableArray *controllers = controller.vcArrayM;
  255 + //获取二级控制器
  256 + if ([controllers[selectChannelId] isKindOfClass:[CNSubClassifySegmentController class]]) {
  257 + CNSubClassifySegmentController *subController = controllers[selectChannelId];
  258 + [subController categoryView:subController.myCategoryView didSelectedItemAtIndex:selectClassifyId];
  259 + }
  260 + });
  261 + }
  262 + }
  263 + }
  264 + }
  265 +
  266 + }
  267 +}
  268 +
  269 +@end
CNLiveLogin/Classes/View/CNSelectCountriesHeadView.h 0 → 100644
  1 +//
  2 +// CNSelectCountriesHeadView.h
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNSelectCountriesHeadView;
  13 +@protocol SelectCountriesHeadViewDelegate<NSObject>
  14 +- (void)selectHeadView:(CNSelectCountriesHeadView *)view countryName:(NSString *)name countryCode:(NSString *)code;
  15 +
  16 +@end
  17 +@interface CNSelectCountriesHeadView : UIView
  18 +@property (nonatomic, strong) NSArray *data;
  19 +@property (nonatomic, weak) id<SelectCountriesHeadViewDelegate> delegate;
  20 +
  21 +@end
  22 +
  23 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/View/CNSelectCountriesHeadView.m 0 → 100644
  1 +//
  2 +// CNSelectCountriesHeadView.m
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNSelectCountriesHeadView.h"
  10 +#import "CNSelectCountriesTableViewCell.h"
  11 +#import "CNSelectCountries.h"
  12 +#define xMainScreenWidth [[UIScreen mainScreen] bounds].size.width
  13 +#define xMainScreenHeight [[UIScreen mainScreen] bounds].size.height
  14 +
  15 +#define kMainScale xMainScreenWidth/375.f
  16 +#define kMainHScale xMainScreenHeight/667.f
  17 +
  18 +@interface CNSelectCountriesHeadView()<UITableViewDelegate, UITableViewDataSource>
  19 +@property (nonatomic, strong) UITableView *tableView;
  20 +
  21 +@end
  22 +
  23 +@implementation CNSelectCountriesHeadView
  24 +#pragma mark - 入口
  25 +- (instancetype)initWithFrame:(CGRect)frame{
  26 + self = [super initWithFrame:frame];
  27 + if (self){
  28 + self.backgroundColor = [UIColor whiteColor];
  29 + [self initUI];
  30 + }
  31 + return self;
  32 +}
  33 +- (void)initUI{
  34 + [self addSubview:self.tableView];
  35 +
  36 +}
  37 +- (void)setData:(NSArray *)data{
  38 + _data = data;
  39 + [self.tableView reloadData];
  40 +
  41 +}
  42 +- (void)dealloc {
  43 + NSLog(@"CNLiveAddressBookViewController - dealloc");
  44 +
  45 +}
  46 +
  47 +#pragma mark - UITableViewDelegate
  48 +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  49 + return 30*kMainHScale;
  50 +
  51 +}
  52 +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  53 + return 0.00000001f;
  54 +
  55 +}
  56 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  57 + return 45*kMainScale;
  58 +
  59 +}
  60 +
  61 +#pragma mark - UITableViewDataSource
  62 +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  63 + UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 30*kMainHScale)];
  64 + headerView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  65 + UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, KScreenWidth-10, 30*kMainHScale)];
  66 + titleLabel.textColor = [UIColor blackColor];
  67 + titleLabel.font = [UIFont boldSystemFontOfSize:14*kMainHScale];
  68 + titleLabel.text = @"常用国家或地区";
  69 + [headerView addSubview:titleLabel];
  70 + return headerView;
  71 +
  72 +}
  73 +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  74 + UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 0.00000001f)];
  75 + footerView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  76 + return footerView;
  77 +
  78 +}
  79 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  80 + return self.data.count;
  81 +}
  82 +
  83 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  84 + CNSelectCountriesTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CNSelectCountriesTableViewCell"];
  85 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  86 + CNSelectCountries *contact = self.data[indexPath.row];
  87 + cell.model = contact;
  88 + cell.isPadding = YES;
  89 + return cell;
  90 +}
  91 +
  92 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  93 + CNSelectCountries *contact = self.data[indexPath.row];
  94 + if (self.delegate && [self.delegate respondsToSelector:@selector(selectHeadView:countryName:countryCode:)]) {
  95 + [self.delegate selectHeadView:self countryName:contact.name countryCode:contact.code];
  96 + }
  97 +}
  98 +/*
  99 + #pragma mark - Navigation
  100 +
  101 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  102 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  103 + // Get the new view controller using [segue destinationViewController].
  104 + // Pass the selected object to the new view controller.
  105 + }
  106 + */
  107 +#pragma mark - Lazy Laoding
  108 +- (UITableView *)tableView{
  109 + if(!_tableView){
  110 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, self.size.height) style:UITableViewStylePlain];
  111 +// _tableView.scroll = NO;
  112 + _tableView.delegate = self;
  113 + _tableView.dataSource = self;
  114 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  115 + _tableView.backgroundColor = [UIColor whiteColor];
  116 + _tableView.estimatedRowHeight = 0;
  117 + _tableView.estimatedSectionHeaderHeight = 0;
  118 + _tableView.estimatedSectionFooterHeight = 0;
  119 + [_tableView registerClass:[CNSelectCountriesTableViewCell class] forCellReuseIdentifier:@"CNSelectCountriesTableViewCell"];
  120 + }
  121 + return _tableView;
  122 +}
  123 +
  124 +@end
CNLiveLogin/Classes/View/CNSelectCountriesTableViewCell.h 0 → 100644
  1 +//
  2 +// CNSelectCountriesTableViewCell.h
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNSelectCountries;
  13 +@interface CNSelectCountriesTableViewCell : UITableViewCell
  14 +@property (nonatomic, strong) CNSelectCountries *model;
  15 +@property (nonatomic, assign) BOOL isPadding;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/View/CNSelectCountriesTableViewCell.m 0 → 100644
  1 +//
  2 +// CNSelectCountriesTableViewCell.m
  3 +// CNLiveNetAddApp
  4 +//
  5 +// Created by CNLive-zxw on 2018/11/20.
  6 +// Copyright © 2018年 CNLive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNSelectCountriesTableViewCell.h"
  10 +#import "CNSelectCountries.h"
  11 +
  12 +@interface CNSelectCountriesTableViewCell()
  13 +@property (nonatomic, strong) UILabel *titleLabel;
  14 +@property (nonatomic, strong) UILabel *codeLabel;
  15 +@property (nonatomic, strong) UIImageView *line;
  16 +
  17 +@end
  18 +
  19 +@implementation CNSelectCountriesTableViewCell
  20 +static const NSInteger margin = 10;
  21 +
  22 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  23 +{
  24 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  25 + if (self) {
  26 + self.contentView.backgroundColor = [UIColor whiteColor];
  27 +
  28 + _titleLabel = [[UILabel alloc] init];
  29 + _titleLabel.numberOfLines = 1;
  30 + _titleLabel.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  31 + _titleLabel.font = [UIFont systemFontOfSize:15];
  32 + [self.contentView addSubview:_titleLabel];
  33 +
  34 + _codeLabel = [[UILabel alloc] init];
  35 + _codeLabel.numberOfLines = 1;
  36 + _codeLabel.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
  37 + _codeLabel.font = [UIFont systemFontOfSize:14];
  38 + [self.contentView addSubview:_codeLabel];
  39 +
  40 + _line = [[UIImageView alloc] init];
  41 + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0];
  42 + [self.contentView addSubview:_line];
  43 +
  44 + }
  45 + return self;
  46 +}
  47 +- (void)setModel:(CNSelectCountries *)model{
  48 + _model = model;
  49 + _titleLabel.text = model.name;
  50 + _codeLabel.text = [NSString stringWithFormat:@"+%@",model.code];
  51 +
  52 +}
  53 +-(void)setIsPadding:(BOOL)isPadding{
  54 + _isPadding = isPadding;
  55 +}
  56 +- (void)layoutSubviews{
  57 + [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  58 + make.left.equalTo(self.contentView.mas_left).with.offset(margin);
  59 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  60 + make.height.offset(CGRectGetHeight(self.bounds));
  61 +
  62 + }];
  63 +
  64 + [_codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  65 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  66 + make.right.equalTo(self.contentView.mas_right).with.offset(_isPadding?-15:0);
  67 + make.height.offset(CGRectGetHeight(self.bounds));
  68 +
  69 + }];
  70 +
  71 + [_line mas_makeConstraints:^(MASConstraintMaker *make) {
  72 + make.left.equalTo(self.contentView.mas_left).with.offset(margin);
  73 + make.right.equalTo(self.contentView.mas_right).with.offset(0);
  74 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  75 + make.height.offset(0.5);
  76 +
  77 + }];
  78 +
  79 +}
  80 +- (void)awakeFromNib {
  81 + [super awakeFromNib];
  82 + // Initialization code
  83 +}
  84 +
  85 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  86 + [super setSelected:selected animated:animated];
  87 +
  88 + // Configure the view for the selected state
  89 +}
  90 +
  91 +@end
CNLiveLogin/Classes/View/CNTouristsLoginTipsView.h 0 → 100644
  1 +//
  2 +// CNTouristsLoginTipsView.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/1/11.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNTouristsLoginTipsView;
  13 +@protocol TouristsLoginTipsViewDelegate<NSObject>
  14 +- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify;
  15 +
  16 +@end
  17 +@interface CNTouristsLoginTipsView : UIView
  18 +@property (nonatomic, weak) id<TouristsLoginTipsViewDelegate> delegate;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
CNLiveLogin/Classes/View/CNTouristsLoginTipsView.m 0 → 100644
  1 +//
  2 +// CNTouristsLoginTipsView.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by CNLive-zxw on 2019/1/11.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNTouristsLoginTipsView.h"
  10 +@interface CNTouristsLoginTipsView()
  11 +//@property (nonatomic, strong) UIView *whiteView;
  12 +//@property (nonatomic, strong) UIButton *close;
  13 +//@property (nonatomic, strong) UIImageView *tipsImage;
  14 +//@property (nonatomic, strong) UILabel *tipsLabel;
  15 +//@property (nonatomic, strong) UIButton *jump;
  16 +
  17 +@end
  18 +
  19 +@implementation CNTouristsLoginTipsView
  20 +#pragma mark - Init
  21 +- (instancetype)initWithFrame:(CGRect)frame{
  22 + if(self = [super initWithFrame:frame]){
  23 + [self setUpUI];
  24 +
  25 + }
  26 + return self;
  27 +
  28 +}
  29 +#pragma mark - UI
  30 +- (void)setUpUI{
  31 + UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 270, 291)];
  32 + whiteView.center = self.center;
  33 + whiteView.backgroundColor = [UIColor whiteColor];
  34 + [self addSubview:whiteView];
  35 +
  36 + UIButton *close = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(whiteView.frame)-25, CGRectGetMinY(whiteView.frame)-25-10, 25, 25)];
  37 + [close setImage:[UIImage imageNamed:@"login_index_close_slices"] forState:UIControlStateNormal];
  38 + [close addTarget:self action:@selector(closeBtn:) forControlEvents:UIControlEventTouchUpInside];
  39 + [self addSubview:close];
  40 +
  41 + UIImageView *tipsImage = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMinX(whiteView.frame)+(270-98)/2.0, CGRectGetMinY(whiteView.frame)+20, 98, 98)];
  42 + tipsImage.image = [UIImage imageNamed:@"login_index_tip"];
  43 + [self addSubview:tipsImage];
  44 +
  45 + UILabel *tipsLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(whiteView.frame)+27, CGRectGetMaxY(tipsImage.frame)+20, 270-27*2, 45)];
  46 + tipsLabel.text = @"请您进入频道管理重新自定义频道";
  47 + tipsLabel.textAlignment = NSTextAlignmentCenter;
  48 + tipsLabel.textColor = RGBOF(0x333333);
  49 + tipsLabel.numberOfLines = 0;
  50 + tipsLabel.font = [UIFont systemFontOfSize:17];
  51 + tipsLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  52 + [self addSubview:tipsLabel];
  53 +
  54 + UIButton *jump = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMinX(whiteView.frame)+(270-190)/2.0, CGRectGetMaxY(whiteView.frame)-36-20, 190, 36)];
  55 + [jump setTitle:@"进入管理频道" forState:UIControlStateNormal];
  56 + [jump setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  57 + jump.backgroundColor = RGBOF(0x23d41e);
  58 + jump.titleLabel.font = [UIFont systemFontOfSize:16];
  59 + jump.layer.cornerRadius = 18;
  60 + jump.layer.masksToBounds = YES;
  61 + [jump addTarget:self action:@selector(jumpBtn:) forControlEvents:UIControlEventTouchUpInside];
  62 + [self addSubview:jump];
  63 +
  64 +}
  65 +
  66 +/*
  67 +// Only override drawRect: if you perform custom drawing.
  68 +// An empty implementation adversely affects performance during animation.
  69 +- (void)drawRect:(CGRect)rect {
  70 + // Drawing code
  71 +}
  72 +*/
  73 +#pragma mark - Action
  74 +//点击✘按钮调用方法
  75 +- (void)closeBtn:(UIButton *)btn {
  76 + if (self.delegate && [self.delegate respondsToSelector:@selector(touristsLoginTipsView:isClassify:)]) {
  77 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  78 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  79 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  80 + [self.delegate touristsLoginTipsView:self isClassify:@"close"];
  81 + }
  82 +}
  83 +//点击进入管理频道按钮调用方法
  84 +- (void)jumpBtn:(UIButton *)btn {
  85 + if (self.delegate && [self.delegate respondsToSelector:@selector(touristsLoginTipsView:isClassify:)]) {
  86 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginChannelId"];
  87 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginClassifyId"];
  88 + [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"TouristsLoginUrl"];
  89 + [self.delegate touristsLoginTipsView:self isClassify:@"jump"];
  90 + }
  91 +}
  92 +
  93 +@end
Example/CNLiveLogin.xcodeproj/project.pbxproj 0 → 100644
  1 +// !$*UTF8*$!
  2 +{
  3 + archiveVersion = 1;
  4 + classes = {
  5 + };
  6 + objectVersion = 46;
  7 + objects = {
  8 +
  9 +/* Begin PBXBuildFile section */
  10 + 378FAF431E70E00799AAAC45 /* Pods_CNLiveLogin_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9735ECF785DF4CFB37BBCF9B /* Pods_CNLiveLogin_Example.framework */; };
  11 + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
  12 + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
  13 + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
  14 + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; };
  15 + 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; };
  16 + 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */; };
  17 + 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* CNLiveViewController.m */; };
  18 + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
  19 + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
  20 + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
  21 + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
  22 + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
  23 + 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
  24 + 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
  25 + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
  26 + BDA5081F81D4BB95C949818D /* Pods_CNLiveLogin_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAF8B9BAC71A863804054BBD /* Pods_CNLiveLogin_Tests.framework */; };
  27 +/* End PBXBuildFile section */
  28 +
  29 +/* Begin PBXContainerItemProxy section */
  30 + 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = {
  31 + isa = PBXContainerItemProxy;
  32 + containerPortal = 6003F582195388D10070C39A /* Project object */;
  33 + proxyType = 1;
  34 + remoteGlobalIDString = 6003F589195388D20070C39A;
  35 + remoteInfo = CNLiveLogin;
  36 + };
  37 +/* End PBXContainerItemProxy section */
  38 +
  39 +/* Begin PBXFileReference section */
  40 + 435946363F44A15B14EBE7FC /* Pods-CNLiveLogin_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveLogin_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveLogin_Example/Pods-CNLiveLogin_Example.release.xcconfig"; sourceTree = "<group>"; };
  41 + 59E218ADCCE77B3DDFFB67EF /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
  42 + 6003F58A195388D20070C39A /* CNLiveLogin_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveLogin_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
  43 + 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
  44 + 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
  45 + 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
  46 + 6003F595195388D20070C39A /* CNLiveLogin-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CNLiveLogin-Info.plist"; sourceTree = "<group>"; };
  47 + 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
  48 + 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
  49 + 6003F59B195388D20070C39A /* CNLiveLogin-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CNLiveLogin-Prefix.pch"; sourceTree = "<group>"; };
  50 + 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveAppDelegate.h; sourceTree = "<group>"; };
  51 + 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveAppDelegate.m; sourceTree = "<group>"; };
  52 + 6003F5A5195388D20070C39A /* CNLiveViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveViewController.h; sourceTree = "<group>"; };
  53 + 6003F5A6195388D20070C39A /* CNLiveViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveViewController.m; sourceTree = "<group>"; };
  54 + 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
  55 + 6003F5AE195388D20070C39A /* CNLiveLogin_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CNLiveLogin_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
  56 + 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
  57 + 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
  58 + 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
  59 + 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
  60 + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
  61 + 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
  62 + 749BC4BC452E2AE985AA30E8 /* Pods-CNLiveLogin_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveLogin_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveLogin_Tests/Pods-CNLiveLogin_Tests.debug.xcconfig"; sourceTree = "<group>"; };
  63 + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
  64 + 9735ECF785DF4CFB37BBCF9B /* Pods_CNLiveLogin_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveLogin_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
  65 + A08609CEEFA47C103335A5E9 /* Pods-CNLiveLogin_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveLogin_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveLogin_Example/Pods-CNLiveLogin_Example.debug.xcconfig"; sourceTree = "<group>"; };
  66 + AAF8B9BAC71A863804054BBD /* Pods_CNLiveLogin_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveLogin_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
  67 + B09A4A95669C2116EE1AA142 /* CNLiveLogin.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveLogin.podspec; path = ../CNLiveLogin.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
  68 + E516CF3B9687CED75E4AF346 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
  69 + E6D491216176822BB549D569 /* Pods-CNLiveLogin_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveLogin_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveLogin_Tests/Pods-CNLiveLogin_Tests.release.xcconfig"; sourceTree = "<group>"; };
  70 +/* End PBXFileReference section */
  71 +
  72 +/* Begin PBXFrameworksBuildPhase section */
  73 + 6003F587195388D20070C39A /* Frameworks */ = {
  74 + isa = PBXFrameworksBuildPhase;
  75 + buildActionMask = 2147483647;
  76 + files = (
  77 + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */,
  78 + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */,
  79 + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */,
  80 + 378FAF431E70E00799AAAC45 /* Pods_CNLiveLogin_Example.framework in Frameworks */,
  81 + );
  82 + runOnlyForDeploymentPostprocessing = 0;
  83 + };
  84 + 6003F5AB195388D20070C39A /* Frameworks */ = {
  85 + isa = PBXFrameworksBuildPhase;
  86 + buildActionMask = 2147483647;
  87 + files = (
  88 + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
  89 + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
  90 + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
  91 + BDA5081F81D4BB95C949818D /* Pods_CNLiveLogin_Tests.framework in Frameworks */,
  92 + );
  93 + runOnlyForDeploymentPostprocessing = 0;
  94 + };
  95 +/* End PBXFrameworksBuildPhase section */
  96 +
  97 +/* Begin PBXGroup section */
  98 + 5E0616032C4E8B763768234C /* Pods */ = {
  99 + isa = PBXGroup;
  100 + children = (
  101 + A08609CEEFA47C103335A5E9 /* Pods-CNLiveLogin_Example.debug.xcconfig */,
  102 + 435946363F44A15B14EBE7FC /* Pods-CNLiveLogin_Example.release.xcconfig */,
  103 + 749BC4BC452E2AE985AA30E8 /* Pods-CNLiveLogin_Tests.debug.xcconfig */,
  104 + E6D491216176822BB549D569 /* Pods-CNLiveLogin_Tests.release.xcconfig */,
  105 + );
  106 + name = Pods;
  107 + sourceTree = "<group>";
  108 + };
  109 + 6003F581195388D10070C39A = {
  110 + isa = PBXGroup;
  111 + children = (
  112 + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
  113 + 6003F593195388D20070C39A /* Example for CNLiveLogin */,
  114 + 6003F5B5195388D20070C39A /* Tests */,
  115 + 6003F58C195388D20070C39A /* Frameworks */,
  116 + 6003F58B195388D20070C39A /* Products */,
  117 + 5E0616032C4E8B763768234C /* Pods */,
  118 + );
  119 + sourceTree = "<group>";
  120 + };
  121 + 6003F58B195388D20070C39A /* Products */ = {
  122 + isa = PBXGroup;
  123 + children = (
  124 + 6003F58A195388D20070C39A /* CNLiveLogin_Example.app */,
  125 + 6003F5AE195388D20070C39A /* CNLiveLogin_Tests.xctest */,
  126 + );
  127 + name = Products;
  128 + sourceTree = "<group>";
  129 + };
  130 + 6003F58C195388D20070C39A /* Frameworks */ = {
  131 + isa = PBXGroup;
  132 + children = (
  133 + 6003F58D195388D20070C39A /* Foundation.framework */,
  134 + 6003F58F195388D20070C39A /* CoreGraphics.framework */,
  135 + 6003F591195388D20070C39A /* UIKit.framework */,
  136 + 6003F5AF195388D20070C39A /* XCTest.framework */,
  137 + 9735ECF785DF4CFB37BBCF9B /* Pods_CNLiveLogin_Example.framework */,
  138 + AAF8B9BAC71A863804054BBD /* Pods_CNLiveLogin_Tests.framework */,
  139 + );
  140 + name = Frameworks;
  141 + sourceTree = "<group>";
  142 + };
  143 + 6003F593195388D20070C39A /* Example for CNLiveLogin */ = {
  144 + isa = PBXGroup;
  145 + children = (
  146 + 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */,
  147 + 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */,
  148 + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
  149 + 6003F5A5195388D20070C39A /* CNLiveViewController.h */,
  150 + 6003F5A6195388D20070C39A /* CNLiveViewController.m */,
  151 + 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
  152 + 6003F5A8195388D20070C39A /* Images.xcassets */,
  153 + 6003F594195388D20070C39A /* Supporting Files */,
  154 + );
  155 + name = "Example for CNLiveLogin";
  156 + path = CNLiveLogin;
  157 + sourceTree = "<group>";
  158 + };
  159 + 6003F594195388D20070C39A /* Supporting Files */ = {
  160 + isa = PBXGroup;
  161 + children = (
  162 + 6003F595195388D20070C39A /* CNLiveLogin-Info.plist */,
  163 + 6003F596195388D20070C39A /* InfoPlist.strings */,
  164 + 6003F599195388D20070C39A /* main.m */,
  165 + 6003F59B195388D20070C39A /* CNLiveLogin-Prefix.pch */,
  166 + );
  167 + name = "Supporting Files";
  168 + sourceTree = "<group>";
  169 + };
  170 + 6003F5B5195388D20070C39A /* Tests */ = {
  171 + isa = PBXGroup;
  172 + children = (
  173 + 6003F5BB195388D20070C39A /* Tests.m */,
  174 + 6003F5B6195388D20070C39A /* Supporting Files */,
  175 + );
  176 + path = Tests;
  177 + sourceTree = "<group>";
  178 + };
  179 + 6003F5B6195388D20070C39A /* Supporting Files */ = {
  180 + isa = PBXGroup;
  181 + children = (
  182 + 6003F5B7195388D20070C39A /* Tests-Info.plist */,
  183 + 6003F5B8195388D20070C39A /* InfoPlist.strings */,
  184 + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */,
  185 + );
  186 + name = "Supporting Files";
  187 + sourceTree = "<group>";
  188 + };
  189 + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = {
  190 + isa = PBXGroup;
  191 + children = (
  192 + B09A4A95669C2116EE1AA142 /* CNLiveLogin.podspec */,
  193 + E516CF3B9687CED75E4AF346 /* README.md */,
  194 + 59E218ADCCE77B3DDFFB67EF /* LICENSE */,
  195 + );
  196 + name = "Podspec Metadata";
  197 + sourceTree = "<group>";
  198 + };
  199 +/* End PBXGroup section */
  200 +
  201 +/* Begin PBXNativeTarget section */
  202 + 6003F589195388D20070C39A /* CNLiveLogin_Example */ = {
  203 + isa = PBXNativeTarget;
  204 + buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveLogin_Example" */;
  205 + buildPhases = (
  206 + 94D3D5D1D8B589AD429FC505 /* [CP] Check Pods Manifest.lock */,
  207 + 6003F586195388D20070C39A /* Sources */,
  208 + 6003F587195388D20070C39A /* Frameworks */,
  209 + 6003F588195388D20070C39A /* Resources */,
  210 + 72E22998D3E9F8D461CB0A3D /* [CP] Embed Pods Frameworks */,
  211 + );
  212 + buildRules = (
  213 + );
  214 + dependencies = (
  215 + );
  216 + name = CNLiveLogin_Example;
  217 + productName = CNLiveLogin;
  218 + productReference = 6003F58A195388D20070C39A /* CNLiveLogin_Example.app */;
  219 + productType = "com.apple.product-type.application";
  220 + };
  221 + 6003F5AD195388D20070C39A /* CNLiveLogin_Tests */ = {
  222 + isa = PBXNativeTarget;
  223 + buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveLogin_Tests" */;
  224 + buildPhases = (
  225 + 8DCC649A95223A196CB01560 /* [CP] Check Pods Manifest.lock */,
  226 + 6003F5AA195388D20070C39A /* Sources */,
  227 + 6003F5AB195388D20070C39A /* Frameworks */,
  228 + 6003F5AC195388D20070C39A /* Resources */,
  229 + );
  230 + buildRules = (
  231 + );
  232 + dependencies = (
  233 + 6003F5B4195388D20070C39A /* PBXTargetDependency */,
  234 + );
  235 + name = CNLiveLogin_Tests;
  236 + productName = CNLiveLoginTests;
  237 + productReference = 6003F5AE195388D20070C39A /* CNLiveLogin_Tests.xctest */;
  238 + productType = "com.apple.product-type.bundle.unit-test";
  239 + };
  240 +/* End PBXNativeTarget section */
  241 +
  242 +/* Begin PBXProject section */
  243 + 6003F582195388D10070C39A /* Project object */ = {
  244 + isa = PBXProject;
  245 + attributes = {
  246 + CLASSPREFIX = CNLive;
  247 + LastUpgradeCheck = 0720;
  248 + ORGANIZATIONNAME = "153993236@qq.com";
  249 + TargetAttributes = {
  250 + 6003F589195388D20070C39A = {
  251 + DevelopmentTeam = 94X49GG3ZW;
  252 + };
  253 + 6003F5AD195388D20070C39A = {
  254 + TestTargetID = 6003F589195388D20070C39A;
  255 + };
  256 + };
  257 + };
  258 + buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNLiveLogin" */;
  259 + compatibilityVersion = "Xcode 3.2";
  260 + developmentRegion = English;
  261 + hasScannedForEncodings = 0;
  262 + knownRegions = (
  263 + en,
  264 + Base,
  265 + );
  266 + mainGroup = 6003F581195388D10070C39A;
  267 + productRefGroup = 6003F58B195388D20070C39A /* Products */;
  268 + projectDirPath = "";
  269 + projectRoot = "";
  270 + targets = (
  271 + 6003F589195388D20070C39A /* CNLiveLogin_Example */,
  272 + 6003F5AD195388D20070C39A /* CNLiveLogin_Tests */,
  273 + );
  274 + };
  275 +/* End PBXProject section */
  276 +
  277 +/* Begin PBXResourcesBuildPhase section */
  278 + 6003F588195388D20070C39A /* Resources */ = {
  279 + isa = PBXResourcesBuildPhase;
  280 + buildActionMask = 2147483647;
  281 + files = (
  282 + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
  283 + 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */,
  284 + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
  285 + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
  286 + );
  287 + runOnlyForDeploymentPostprocessing = 0;
  288 + };
  289 + 6003F5AC195388D20070C39A /* Resources */ = {
  290 + isa = PBXResourcesBuildPhase;
  291 + buildActionMask = 2147483647;
  292 + files = (
  293 + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */,
  294 + );
  295 + runOnlyForDeploymentPostprocessing = 0;
  296 + };
  297 +/* End PBXResourcesBuildPhase section */
  298 +
  299 +/* Begin PBXShellScriptBuildPhase section */
  300 + 72E22998D3E9F8D461CB0A3D /* [CP] Embed Pods Frameworks */ = {
  301 + isa = PBXShellScriptBuildPhase;
  302 + buildActionMask = 2147483647;
  303 + files = (
  304 + );
  305 + inputFileListPaths = (
  306 + );
  307 + inputPaths = (
  308 + "${SRCROOT}/Pods/Target Support Files/Pods-CNLiveLogin_Example/Pods-CNLiveLogin_Example-frameworks.sh",
  309 + "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
  310 + "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework",
  311 + "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework",
  312 + "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework",
  313 + "${BUILT_PRODUCTS_DIR}/CNLiveLogin/CNLiveLogin.framework",
  314 + "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework",
  315 + "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework",
  316 + "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
  317 + "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework",
  318 + "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
  319 + "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
  320 + "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
  321 + "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework",
  322 + "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework",
  323 + );
  324 + name = "[CP] Embed Pods Frameworks";
  325 + outputFileListPaths = (
  326 + );
  327 + outputPaths = (
  328 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
  329 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework",
  330 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework",
  331 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework",
  332 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveLogin.framework",
  333 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework",
  334 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework",
  335 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
  336 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework",
  337 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
  338 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
  339 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
  340 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebViewJavascriptBridge.framework",
  341 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework",
  342 + );
  343 + runOnlyForDeploymentPostprocessing = 0;
  344 + shellPath = /bin/sh;
  345 + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNLiveLogin_Example/Pods-CNLiveLogin_Example-frameworks.sh\"\n";
  346 + showEnvVarsInLog = 0;
  347 + };
  348 + 8DCC649A95223A196CB01560 /* [CP] Check Pods Manifest.lock */ = {
  349 + isa = PBXShellScriptBuildPhase;
  350 + buildActionMask = 2147483647;
  351 + files = (
  352 + );
  353 + inputFileListPaths = (
  354 + );
  355 + inputPaths = (
  356 + "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
  357 + "${PODS_ROOT}/Manifest.lock",
  358 + );
  359 + name = "[CP] Check Pods Manifest.lock";
  360 + outputFileListPaths = (
  361 + );
  362 + outputPaths = (
  363 + "$(DERIVED_FILE_DIR)/Pods-CNLiveLogin_Tests-checkManifestLockResult.txt",
  364 + );
  365 + runOnlyForDeploymentPostprocessing = 0;
  366 + shellPath = /bin/sh;
  367 + 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";
  368 + showEnvVarsInLog = 0;
  369 + };
  370 + 94D3D5D1D8B589AD429FC505 /* [CP] Check Pods Manifest.lock */ = {
  371 + isa = PBXShellScriptBuildPhase;
  372 + buildActionMask = 2147483647;
  373 + files = (
  374 + );
  375 + inputFileListPaths = (
  376 + );
  377 + inputPaths = (
  378 + "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
  379 + "${PODS_ROOT}/Manifest.lock",
  380 + );
  381 + name = "[CP] Check Pods Manifest.lock";
  382 + outputFileListPaths = (
  383 + );
  384 + outputPaths = (
  385 + "$(DERIVED_FILE_DIR)/Pods-CNLiveLogin_Example-checkManifestLockResult.txt",
  386 + );
  387 + runOnlyForDeploymentPostprocessing = 0;
  388 + shellPath = /bin/sh;
  389 + 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";
  390 + showEnvVarsInLog = 0;
  391 + };
  392 +/* End PBXShellScriptBuildPhase section */
  393 +
  394 +/* Begin PBXSourcesBuildPhase section */
  395 + 6003F586195388D20070C39A /* Sources */ = {
  396 + isa = PBXSourcesBuildPhase;
  397 + buildActionMask = 2147483647;
  398 + files = (
  399 + 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */,
  400 + 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */,
  401 + 6003F59A195388D20070C39A /* main.m in Sources */,
  402 + );
  403 + runOnlyForDeploymentPostprocessing = 0;
  404 + };
  405 + 6003F5AA195388D20070C39A /* Sources */ = {
  406 + isa = PBXSourcesBuildPhase;
  407 + buildActionMask = 2147483647;
  408 + files = (
  409 + 6003F5BC195388D20070C39A /* Tests.m in Sources */,
  410 + );
  411 + runOnlyForDeploymentPostprocessing = 0;
  412 + };
  413 +/* End PBXSourcesBuildPhase section */
  414 +
  415 +/* Begin PBXTargetDependency section */
  416 + 6003F5B4195388D20070C39A /* PBXTargetDependency */ = {
  417 + isa = PBXTargetDependency;
  418 + target = 6003F589195388D20070C39A /* CNLiveLogin_Example */;
  419 + targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */;
  420 + };
  421 +/* End PBXTargetDependency section */
  422 +
  423 +/* Begin PBXVariantGroup section */
  424 + 6003F596195388D20070C39A /* InfoPlist.strings */ = {
  425 + isa = PBXVariantGroup;
  426 + children = (
  427 + 6003F597195388D20070C39A /* en */,
  428 + );
  429 + name = InfoPlist.strings;
  430 + sourceTree = "<group>";
  431 + };
  432 + 6003F5B8195388D20070C39A /* InfoPlist.strings */ = {
  433 + isa = PBXVariantGroup;
  434 + children = (
  435 + 6003F5B9195388D20070C39A /* en */,
  436 + );
  437 + name = InfoPlist.strings;
  438 + sourceTree = "<group>";
  439 + };
  440 + 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = {
  441 + isa = PBXVariantGroup;
  442 + children = (
  443 + 71719F9E1E33DC2100824A3D /* Base */,
  444 + );
  445 + name = LaunchScreen.storyboard;
  446 + sourceTree = "<group>";
  447 + };
  448 +/* End PBXVariantGroup section */
  449 +
  450 +/* Begin XCBuildConfiguration section */
  451 + 6003F5BD195388D20070C39A /* Debug */ = {
  452 + isa = XCBuildConfiguration;
  453 + buildSettings = {
  454 + ALWAYS_SEARCH_USER_PATHS = NO;
  455 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
  456 + CLANG_CXX_LIBRARY = "libc++";
  457 + CLANG_ENABLE_MODULES = YES;
  458 + CLANG_ENABLE_OBJC_ARC = YES;
  459 + CLANG_WARN_BOOL_CONVERSION = YES;
  460 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  461 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  462 + CLANG_WARN_EMPTY_BODY = YES;
  463 + CLANG_WARN_ENUM_CONVERSION = YES;
  464 + CLANG_WARN_INT_CONVERSION = YES;
  465 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  466 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  467 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  468 + COPY_PHASE_STRIP = NO;
  469 + ENABLE_TESTABILITY = YES;
  470 + GCC_C_LANGUAGE_STANDARD = gnu99;
  471 + GCC_DYNAMIC_NO_PIC = NO;
  472 + GCC_OPTIMIZATION_LEVEL = 0;
  473 + GCC_PREPROCESSOR_DEFINITIONS = (
  474 + "DEBUG=1",
  475 + "$(inherited)",
  476 + );
  477 + GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  478 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  479 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  480 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  481 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  482 + GCC_WARN_UNUSED_FUNCTION = YES;
  483 + GCC_WARN_UNUSED_VARIABLE = YES;
  484 + IPHONEOS_DEPLOYMENT_TARGET = 9.3;
  485 + ONLY_ACTIVE_ARCH = YES;
  486 + SDKROOT = iphoneos;
  487 + TARGETED_DEVICE_FAMILY = "1,2";
  488 + };
  489 + name = Debug;
  490 + };
  491 + 6003F5BE195388D20070C39A /* Release */ = {
  492 + isa = XCBuildConfiguration;
  493 + buildSettings = {
  494 + ALWAYS_SEARCH_USER_PATHS = NO;
  495 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
  496 + CLANG_CXX_LIBRARY = "libc++";
  497 + CLANG_ENABLE_MODULES = YES;
  498 + CLANG_ENABLE_OBJC_ARC = YES;
  499 + CLANG_WARN_BOOL_CONVERSION = YES;
  500 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  501 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  502 + CLANG_WARN_EMPTY_BODY = YES;
  503 + CLANG_WARN_ENUM_CONVERSION = YES;
  504 + CLANG_WARN_INT_CONVERSION = YES;
  505 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  506 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  507 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  508 + COPY_PHASE_STRIP = YES;
  509 + ENABLE_NS_ASSERTIONS = NO;
  510 + GCC_C_LANGUAGE_STANDARD = gnu99;
  511 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  512 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  513 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  514 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  515 + GCC_WARN_UNUSED_FUNCTION = YES;
  516 + GCC_WARN_UNUSED_VARIABLE = YES;
  517 + IPHONEOS_DEPLOYMENT_TARGET = 9.3;
  518 + SDKROOT = iphoneos;
  519 + TARGETED_DEVICE_FAMILY = "1,2";
  520 + VALIDATE_PRODUCT = YES;
  521 + };
  522 + name = Release;
  523 + };
  524 + 6003F5C0195388D20070C39A /* Debug */ = {
  525 + isa = XCBuildConfiguration;
  526 + baseConfigurationReference = A08609CEEFA47C103335A5E9 /* Pods-CNLiveLogin_Example.debug.xcconfig */;
  527 + buildSettings = {
  528 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  529 + DEVELOPMENT_TEAM = 94X49GG3ZW;
  530 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  531 + GCC_PREFIX_HEADER = "CNLiveLogin/CNLiveLogin-Prefix.pch";
  532 + INFOPLIST_FILE = "CNLiveLogin/CNLiveLogin-Info.plist";
  533 + MODULE_NAME = ExampleApp;
  534 + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
  535 + PRODUCT_NAME = "$(TARGET_NAME)";
  536 + WRAPPER_EXTENSION = app;
  537 + };
  538 + name = Debug;
  539 + };
  540 + 6003F5C1195388D20070C39A /* Release */ = {
  541 + isa = XCBuildConfiguration;
  542 + baseConfigurationReference = 435946363F44A15B14EBE7FC /* Pods-CNLiveLogin_Example.release.xcconfig */;
  543 + buildSettings = {
  544 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  545 + DEVELOPMENT_TEAM = 94X49GG3ZW;
  546 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  547 + GCC_PREFIX_HEADER = "CNLiveLogin/CNLiveLogin-Prefix.pch";
  548 + INFOPLIST_FILE = "CNLiveLogin/CNLiveLogin-Info.plist";
  549 + MODULE_NAME = ExampleApp;
  550 + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
  551 + PRODUCT_NAME = "$(TARGET_NAME)";
  552 + WRAPPER_EXTENSION = app;
  553 + };
  554 + name = Release;
  555 + };
  556 + 6003F5C3195388D20070C39A /* Debug */ = {
  557 + isa = XCBuildConfiguration;
  558 + baseConfigurationReference = 749BC4BC452E2AE985AA30E8 /* Pods-CNLiveLogin_Tests.debug.xcconfig */;
  559 + buildSettings = {
  560 + BUNDLE_LOADER = "$(TEST_HOST)";
  561 + FRAMEWORK_SEARCH_PATHS = (
  562 + "$(SDKROOT)/Developer/Library/Frameworks",
  563 + "$(inherited)",
  564 + "$(DEVELOPER_FRAMEWORKS_DIR)",
  565 + );
  566 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  567 + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
  568 + GCC_PREPROCESSOR_DEFINITIONS = (
  569 + "DEBUG=1",
  570 + "$(inherited)",
  571 + );
  572 + INFOPLIST_FILE = "Tests/Tests-Info.plist";
  573 + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
  574 + PRODUCT_NAME = "$(TARGET_NAME)";
  575 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNLiveLogin_Example.app/CNLiveLogin_Example";
  576 + WRAPPER_EXTENSION = xctest;
  577 + };
  578 + name = Debug;
  579 + };
  580 + 6003F5C4195388D20070C39A /* Release */ = {
  581 + isa = XCBuildConfiguration;
  582 + baseConfigurationReference = E6D491216176822BB549D569 /* Pods-CNLiveLogin_Tests.release.xcconfig */;
  583 + buildSettings = {
  584 + BUNDLE_LOADER = "$(TEST_HOST)";
  585 + FRAMEWORK_SEARCH_PATHS = (
  586 + "$(SDKROOT)/Developer/Library/Frameworks",
  587 + "$(inherited)",
  588 + "$(DEVELOPER_FRAMEWORKS_DIR)",
  589 + );
  590 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  591 + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
  592 + INFOPLIST_FILE = "Tests/Tests-Info.plist";
  593 + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
  594 + PRODUCT_NAME = "$(TARGET_NAME)";
  595 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNLiveLogin_Example.app/CNLiveLogin_Example";
  596 + WRAPPER_EXTENSION = xctest;
  597 + };
  598 + name = Release;
  599 + };
  600 +/* End XCBuildConfiguration section */
  601 +
  602 +/* Begin XCConfigurationList section */
  603 + 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNLiveLogin" */ = {
  604 + isa = XCConfigurationList;
  605 + buildConfigurations = (
  606 + 6003F5BD195388D20070C39A /* Debug */,
  607 + 6003F5BE195388D20070C39A /* Release */,
  608 + );
  609 + defaultConfigurationIsVisible = 0;
  610 + defaultConfigurationName = Release;
  611 + };
  612 + 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveLogin_Example" */ = {
  613 + isa = XCConfigurationList;
  614 + buildConfigurations = (
  615 + 6003F5C0195388D20070C39A /* Debug */,
  616 + 6003F5C1195388D20070C39A /* Release */,
  617 + );
  618 + defaultConfigurationIsVisible = 0;
  619 + defaultConfigurationName = Release;
  620 + };
  621 + 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveLogin_Tests" */ = {
  622 + isa = XCConfigurationList;
  623 + buildConfigurations = (
  624 + 6003F5C3195388D20070C39A /* Debug */,
  625 + 6003F5C4195388D20070C39A /* Release */,
  626 + );
  627 + defaultConfigurationIsVisible = 0;
  628 + defaultConfigurationName = Release;
  629 + };
  630 +/* End XCConfigurationList section */
  631 + };
  632 + rootObject = 6003F582195388D10070C39A /* Project object */;
  633 +}
Example/CNLiveLogin.xcodeproj/xcshareddata/xcschemes/CNLiveLogin-Example.xcscheme 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Scheme
  3 + LastUpgradeVersion = "0720"
  4 + version = "1.3">
  5 + <BuildAction
  6 + parallelizeBuildables = "YES"
  7 + buildImplicitDependencies = "YES">
  8 + <BuildActionEntries>
  9 + <BuildActionEntry
  10 + buildForTesting = "YES"
  11 + buildForRunning = "YES"
  12 + buildForProfiling = "YES"
  13 + buildForArchiving = "YES"
  14 + buildForAnalyzing = "YES">
  15 + <BuildableReference
  16 + BuildableIdentifier = "primary"
  17 + BlueprintIdentifier = "6003F589195388D20070C39A"
  18 + BuildableName = "CNLiveLogin_Example.app"
  19 + BlueprintName = "CNLiveLogin_Example"
  20 + ReferencedContainer = "container:CNLiveLogin.xcodeproj">
  21 + </BuildableReference>
  22 + </BuildActionEntry>
  23 + </BuildActionEntries>
  24 + </BuildAction>
  25 + <TestAction
  26 + buildConfiguration = "Debug"
  27 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  28 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  29 + shouldUseLaunchSchemeArgsEnv = "YES">
  30 + <Testables>
  31 + <TestableReference
  32 + skipped = "NO">
  33 + <BuildableReference
  34 + BuildableIdentifier = "primary"
  35 + BlueprintIdentifier = "6003F5AD195388D20070C39A"
  36 + BuildableName = "CNLiveLogin_Tests.xctest"
  37 + BlueprintName = "CNLiveLogin_Tests"
  38 + ReferencedContainer = "container:CNLiveLogin.xcodeproj">
  39 + </BuildableReference>
  40 + </TestableReference>
  41 + </Testables>
  42 + <MacroExpansion>
  43 + <BuildableReference
  44 + BuildableIdentifier = "primary"
  45 + BlueprintIdentifier = "6003F589195388D20070C39A"
  46 + BuildableName = "CNLiveLogin_Example.app"
  47 + BlueprintName = "CNLiveLogin_Example"
  48 + ReferencedContainer = "container:CNLiveLogin.xcodeproj">
  49 + </BuildableReference>
  50 + </MacroExpansion>
  51 + <AdditionalOptions>
  52 + </AdditionalOptions>
  53 + </TestAction>
  54 + <LaunchAction
  55 + buildConfiguration = "Debug"
  56 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  57 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  58 + launchStyle = "0"
  59 + useCustomWorkingDirectory = "NO"
  60 + ignoresPersistentStateOnLaunch = "NO"
  61 + debugDocumentVersioning = "YES"
  62 + debugServiceExtension = "internal"
  63 + allowLocationSimulation = "YES">
  64 + <BuildableProductRunnable
  65 + runnableDebuggingMode = "0">
  66 + <BuildableReference
  67 + BuildableIdentifier = "primary"
  68 + BlueprintIdentifier = "6003F589195388D20070C39A"
  69 + BuildableName = "CNLiveLogin_Example.app"
  70 + BlueprintName = "CNLiveLogin_Example"
  71 + ReferencedContainer = "container:CNLiveLogin.xcodeproj">
  72 + </BuildableReference>
  73 + </BuildableProductRunnable>
  74 + <AdditionalOptions>
  75 + </AdditionalOptions>
  76 + </LaunchAction>
  77 + <ProfileAction
  78 + buildConfiguration = "Release"
  79 + shouldUseLaunchSchemeArgsEnv = "YES"
  80 + savedToolIdentifier = ""
  81 + useCustomWorkingDirectory = "NO"
  82 + debugDocumentVersioning = "YES">
  83 + <BuildableProductRunnable
  84 + runnableDebuggingMode = "0">
  85 + <BuildableReference
  86 + BuildableIdentifier = "primary"
  87 + BlueprintIdentifier = "6003F589195388D20070C39A"
  88 + BuildableName = "CNLiveLogin_Example.app"
  89 + BlueprintName = "CNLiveLogin_Example"
  90 + ReferencedContainer = "container:CNLiveLogin.xcodeproj">
  91 + </BuildableReference>
  92 + </BuildableProductRunnable>
  93 + </ProfileAction>
  94 + <AnalyzeAction
  95 + buildConfiguration = "Debug">
  96 + </AnalyzeAction>
  97 + <ArchiveAction
  98 + buildConfiguration = "Release"
  99 + revealArchiveInOrganizer = "YES">
  100 + </ArchiveAction>
  101 +</Scheme>
Example/CNLiveLogin/Base.lproj/LaunchScreen.storyboard 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
  3 + <device id="retina4_7" orientation="portrait">
  4 + <adaptation id="fullscreen"/>
  5 + </device>
  6 + <dependencies>
  7 + <deployment identifier="iOS"/>
  8 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
  9 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
  10 + </dependencies>
  11 + <scenes>
  12 + <!--View Controller-->
  13 + <scene sceneID="EHf-IW-A2E">
  14 + <objects>
  15 + <viewController id="01J-lp-oVM" sceneMemberID="viewController">
  16 + <layoutGuides>
  17 + <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
  18 + <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
  19 + </layoutGuides>
  20 + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
  21 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  22 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  23 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  24 + </view>
  25 + </viewController>
  26 + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
  27 + </objects>
  28 + <point key="canvasLocation" x="53" y="375"/>
  29 + </scene>
  30 + </scenes>
  31 +</document>
Example/CNLiveLogin/Base.lproj/Main.storyboard 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="whP-gf-Uak">
  3 + <device id="retina4_7" orientation="portrait">
  4 + <adaptation id="fullscreen"/>
  5 + </device>
  6 + <dependencies>
  7 + <deployment identifier="iOS"/>
  8 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
  9 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
  10 + </dependencies>
  11 + <scenes>
  12 + <!--View Controller-->
  13 + <scene sceneID="wQg-tq-qST">
  14 + <objects>
  15 + <viewController id="whP-gf-Uak" customClass="CNLiveViewController" sceneMemberID="viewController">
  16 + <layoutGuides>
  17 + <viewControllerLayoutGuide type="top" id="uEw-UM-LJ8"/>
  18 + <viewControllerLayoutGuide type="bottom" id="Mvr-aV-6Um"/>
  19 + </layoutGuides>
  20 + <view key="view" contentMode="scaleToFill" id="TpU-gO-2f1">
  21 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  22 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  23 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  24 + </view>
  25 + </viewController>
  26 + <placeholder placeholderIdentifier="IBFirstResponder" id="tc2-Qw-aMS" userLabel="First Responder" sceneMemberID="firstResponder"/>
  27 + </objects>
  28 + <point key="canvasLocation" x="305" y="433"/>
  29 + </scene>
  30 + </scenes>
  31 +</document>
Example/CNLiveLogin/CNLiveAppDelegate.h 0 → 100644
  1 +//
  2 +// CNLiveAppDelegate.h
  3 +// CNLiveLogin
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +@import UIKit;
  10 +
  11 +@interface CNLiveAppDelegate : UIResponder <UIApplicationDelegate>
  12 +
  13 +@property (strong, nonatomic) UIWindow *window;
  14 +
  15 +@end
Example/CNLiveLogin/CNLiveAppDelegate.m 0 → 100644
  1 +//
  2 +// CNLiveAppDelegate.m
  3 +// CNLiveLogin
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveAppDelegate.h"
  10 +
  11 +@implementation CNLiveAppDelegate
  12 +
  13 +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  14 +{
  15 + // Override point for customization after application launch.
  16 + return YES;
  17 +}
  18 +
  19 +- (void)applicationWillResignActive:(UIApplication *)application
  20 +{
  21 + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  22 + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
  23 +}
  24 +
  25 +- (void)applicationDidEnterBackground:(UIApplication *)application
  26 +{
  27 + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  28 + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  29 +}
  30 +
  31 +- (void)applicationWillEnterForeground:(UIApplication *)application
  32 +{
  33 + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
  34 +}
  35 +
  36 +- (void)applicationDidBecomeActive:(UIApplication *)application
  37 +{
  38 + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  39 +}
  40 +
  41 +- (void)applicationWillTerminate:(UIApplication *)application
  42 +{
  43 + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  44 +}
  45 +
  46 +@end
Example/CNLiveLogin/CNLiveLogin-Info.plist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>en</string>
  7 + <key>CFBundleDisplayName</key>
  8 + <string>${PRODUCT_NAME}</string>
  9 + <key>CFBundleExecutable</key>
  10 + <string>${EXECUTABLE_NAME}</string>
  11 + <key>CFBundleIdentifier</key>
  12 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
  13 + <key>CFBundleInfoDictionaryVersion</key>
  14 + <string>6.0</string>
  15 + <key>CFBundleName</key>
  16 + <string>${PRODUCT_NAME}</string>
  17 + <key>CFBundlePackageType</key>
  18 + <string>APPL</string>
  19 + <key>CFBundleShortVersionString</key>
  20 + <string>1.0</string>
  21 + <key>CFBundleSignature</key>
  22 + <string>????</string>
  23 + <key>CFBundleVersion</key>
  24 + <string>1.0</string>
  25 + <key>LSRequiresIPhoneOS</key>
  26 + <true/>
  27 + <key>UILaunchStoryboardName</key>
  28 + <string>LaunchScreen</string>
  29 + <key>UIMainStoryboardFile</key>
  30 + <string>Main</string>
  31 + <key>UIRequiredDeviceCapabilities</key>
  32 + <array>
  33 + <string>armv7</string>
  34 + </array>
  35 + <key>UISupportedInterfaceOrientations</key>
  36 + <array>
  37 + <string>UIInterfaceOrientationPortrait</string>
  38 + <string>UIInterfaceOrientationLandscapeLeft</string>
  39 + <string>UIInterfaceOrientationLandscapeRight</string>
  40 + </array>
  41 + <key>UISupportedInterfaceOrientations~ipad</key>
  42 + <array>
  43 + <string>UIInterfaceOrientationPortrait</string>
  44 + <string>UIInterfaceOrientationPortraitUpsideDown</string>
  45 + <string>UIInterfaceOrientationLandscapeLeft</string>
  46 + <string>UIInterfaceOrientationLandscapeRight</string>
  47 + </array>
  48 +</dict>
  49 +</plist>
Example/CNLiveLogin/CNLiveLogin-Prefix.pch 0 → 100644
  1 +//
  2 +// Prefix header
  3 +//
  4 +// The contents of this file are implicitly included at the beginning of every source file.
  5 +//
  6 +
  7 +#import <Availability.h>
  8 +
  9 +#ifndef __IPHONE_5_0
  10 +#warning "This project uses features only available in iOS SDK 5.0 and later."
  11 +#endif
  12 +
  13 +#ifdef __OBJC__
  14 + @import UIKit;
  15 + @import Foundation;
  16 +#endif
Example/CNLiveLogin/CNLiveViewController.h 0 → 100644
  1 +//
  2 +// CNLiveViewController.h
  3 +// CNLiveLogin
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +@import UIKit;
  10 +
  11 +@interface CNLiveViewController : UIViewController
  12 +
  13 +@end
Example/CNLiveLogin/CNLiveViewController.m 0 → 100644
  1 +//
  2 +// CNLiveViewController.m
  3 +// CNLiveLogin
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveViewController.h"
  10 +
  11 +@interface CNLiveViewController ()
  12 +
  13 +@end
  14 +
  15 +@implementation CNLiveViewController
  16 +
  17 +- (void)viewDidLoad
  18 +{
  19 + [super viewDidLoad];
  20 + // Do any additional setup after loading the view, typically from a nib.
  21 +}
  22 +
  23 +- (void)didReceiveMemoryWarning
  24 +{
  25 + [super didReceiveMemoryWarning];
  26 + // Dispose of any resources that can be recreated.
  27 +}
  28 +
  29 +@end
Example/CNLiveLogin/Images.xcassets/AppIcon.appiconset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "iphone",
  5 + "size" : "20x20",
  6 + "scale" : "2x"
  7 + },
  8 + {
  9 + "idiom" : "iphone",
  10 + "size" : "20x20",
  11 + "scale" : "3x"
  12 + },
  13 + {
  14 + "idiom" : "iphone",
  15 + "size" : "29x29",
  16 + "scale" : "2x"
  17 + },
  18 + {
  19 + "idiom" : "iphone",
  20 + "size" : "29x29",
  21 + "scale" : "3x"
  22 + },
  23 + {
  24 + "idiom" : "iphone",
  25 + "size" : "40x40",
  26 + "scale" : "2x"
  27 + },
  28 + {
  29 + "idiom" : "iphone",
  30 + "size" : "40x40",
  31 + "scale" : "3x"
  32 + },
  33 + {
  34 + "idiom" : "iphone",
  35 + "size" : "60x60",
  36 + "scale" : "2x"
  37 + },
  38 + {
  39 + "idiom" : "iphone",
  40 + "size" : "60x60",
  41 + "scale" : "3x"
  42 + },
  43 + {
  44 + "idiom" : "ipad",
  45 + "size" : "20x20",
  46 + "scale" : "1x"
  47 + },
  48 + {
  49 + "idiom" : "ipad",
  50 + "size" : "20x20",
  51 + "scale" : "2x"
  52 + },
  53 + {
  54 + "idiom" : "ipad",
  55 + "size" : "29x29",
  56 + "scale" : "1x"
  57 + },
  58 + {
  59 + "idiom" : "ipad",
  60 + "size" : "29x29",
  61 + "scale" : "2x"
  62 + },
  63 + {
  64 + "idiom" : "ipad",
  65 + "size" : "40x40",
  66 + "scale" : "1x"
  67 + },
  68 + {
  69 + "idiom" : "ipad",
  70 + "size" : "40x40",
  71 + "scale" : "2x"
  72 + },
  73 + {
  74 + "idiom" : "ipad",
  75 + "size" : "76x76",
  76 + "scale" : "1x"
  77 + },
  78 + {
  79 + "idiom" : "ipad",
  80 + "size" : "76x76",
  81 + "scale" : "2x"
  82 + },
  83 + {
  84 + "idiom" : "ipad",
  85 + "size" : "83.5x83.5",
  86 + "scale" : "2x"
  87 + },
  88 + {
  89 + "idiom" : "ios-marketing",
  90 + "size" : "1024x1024",
  91 + "scale" : "1x"
  92 + }
  93 + ],
  94 + "info" : {
  95 + "version" : 1,
  96 + "author" : "xcode"
  97 + }
  98 +}
Example/CNLiveLogin/en.lproj/InfoPlist.strings 0 → 100644
  1 +/* Localized versions of Info.plist keys */
  2 +
Example/CNLiveLogin/main.m 0 → 100644
  1 +//
  2 +// main.m
  3 +// CNLiveLogin
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +@import UIKit;
  10 +#import "CNLiveAppDelegate.h"
  11 +
  12 +int main(int argc, char * argv[])
  13 +{
  14 + @autoreleasepool {
  15 + return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLiveAppDelegate class]));
  16 + }
  17 +}
Example/Podfile 0 → 100644
  1 +source 'https://github.com/CocoaPods/Specs.git'
  2 +source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git'
  3 +use_frameworks!
  4 +
  5 +platform :ios, '9.0'
  6 +
  7 +target 'CNLiveLogin_Example' do
  8 + pod 'CNLiveLogin', :path => '../'
  9 +
  10 + target 'CNLiveLogin_Tests' do
  11 + inherit! :search_paths
  12 +
  13 +
  14 + end
  15 +end
Example/Tests/Tests-Info.plist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>en</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>${EXECUTABLE_NAME}</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundlePackageType</key>
  14 + <string>BNDL</string>
  15 + <key>CFBundleShortVersionString</key>
  16 + <string>1.0</string>
  17 + <key>CFBundleSignature</key>
  18 + <string>????</string>
  19 + <key>CFBundleVersion</key>
  20 + <string>1</string>
  21 +</dict>
  22 +</plist>
Example/Tests/Tests-Prefix.pch 0 → 100644
  1 +// The contents of this file are implicitly included at the beginning of every test case source file.
  2 +
  3 +#ifdef __OBJC__
  4 +
  5 +
  6 +
  7 +#endif
Example/Tests/Tests.m 0 → 100644
  1 +//
  2 +// CNLiveLoginTests.m
  3 +// CNLiveLoginTests
  4 +//
  5 +// Created by 153993236@qq.com on 05/06/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +@import XCTest;
  10 +
  11 +@interface Tests : XCTestCase
  12 +
  13 +@end
  14 +
  15 +@implementation Tests
  16 +
  17 +- (void)setUp
  18 +{
  19 + [super setUp];
  20 + // Put setup code here. This method is called before the invocation of each test method in the class.
  21 +}
  22 +
  23 +- (void)tearDown
  24 +{
  25 + // Put teardown code here. This method is called after the invocation of each test method in the class.
  26 + [super tearDown];
  27 +}
  28 +
  29 +- (void)testExample
  30 +{
  31 + XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
  32 +}
  33 +
  34 +@end
  35 +
Example/Tests/en.lproj/InfoPlist.strings 0 → 100644
  1 +/* Localized versions of Info.plist keys */
  2 +
  1 +Copyright (c) 2019 153993236@qq.com <zhangxiaowen@cnlive.com>
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is
  8 +furnished to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in
  11 +all copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19 +THE SOFTWARE.
README.md
  1 +# CNLiveLogin
  2 +
  3 +[![CI Status](https://img.shields.io/travis/153993236@qq.com/CNLiveLogin.svg?style=flat)](https://travis-ci.org/153993236@qq.com/CNLiveLogin)
  4 +[![Version](https://img.shields.io/cocoapods/v/CNLiveLogin.svg?style=flat)](https://cocoapods.org/pods/CNLiveLogin)
  5 +[![License](https://img.shields.io/cocoapods/l/CNLiveLogin.svg?style=flat)](https://cocoapods.org/pods/CNLiveLogin)
  6 +[![Platform](https://img.shields.io/cocoapods/p/CNLiveLogin.svg?style=flat)](https://cocoapods.org/pods/CNLiveLogin)
  7 +
  8 +## Example
  9 +
  10 +To run the example project, clone the repo, and run `pod install` from the Example directory first.
  11 +
  12 +## Requirements
  13 +
  14 +## Installation
  15 +
  16 +CNLiveLogin is available through [CocoaPods](https://cocoapods.org). To install
  17 +it, simply add the following line to your Podfile:
  18 +
  19 +```ruby
  20 +pod 'CNLiveLogin'
  21 +```
  22 +
  23 +## Author
  24 +
  25 +153993236@qq.com, zhangxiaowen@cnlive.com
  26 +
  27 +## License
  28 +
  29 +CNLiveLogin is available under the MIT license. See the LICENSE file for more info.
_Pods.xcodeproj 0 → 120000
  1 +Example/Pods/Pods.xcodeproj
0 \ No newline at end of file 2 \ No newline at end of file