Commit 14e4263e81800144f7d2bc19313cb5aa72e0681e
1 parent
27d85431
no message
Showing
4 changed files
with
113 additions
and
103 deletions
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageController.h
| @@ -6,11 +6,11 @@ | @@ -6,11 +6,11 @@ | ||
| 6 | // Copyright © 2019 cnlive. All rights reserved. | 6 | // Copyright © 2019 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | // 绑定管理 | 8 | // 绑定管理 |
| 9 | -#import "CNCommonViewController.h" | 9 | +#import <UIKit/UIKit.h> |
| 10 | 10 | ||
| 11 | NS_ASSUME_NONNULL_BEGIN | 11 | NS_ASSUME_NONNULL_BEGIN |
| 12 | 12 | ||
| 13 | -@interface CNLiveBindingManageController : CNCommonViewController | 13 | +@interface CNLiveBindingManageController : UIViewController |
| 14 | 14 | ||
| 15 | @end | 15 | @end |
| 16 | 16 |
CNLiveLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.m
| @@ -86,7 +86,7 @@ static const NSInteger timeValue = 1.5; | @@ -86,7 +86,7 @@ static const NSInteger timeValue = 1.5; | ||
| 86 | countDown.dataSource = self; | 86 | countDown.dataSource = self; |
| 87 | countDown.delegate = self; | 87 | countDown.delegate = self; |
| 88 | countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10); | 88 | countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10); |
| 89 | - UIImage *image2 = [self getImageWithImageName:Business?@"login_get_code_b":@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | 89 | + UIImage *image2 = [self getImageWithImageName:BusinessLive?@"login_get_code_b":@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; |
| 90 | [countDown setImage:image2 forState:UIControlStateNormal]; | 90 | [countDown setImage:image2 forState:UIControlStateNormal]; |
| 91 | countDown.adjustsImageWhenHighlighted = NO; | 91 | countDown.adjustsImageWhenHighlighted = NO; |
| 92 | [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 92 | [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
CNLiveLoginModule/Classes/ThreeLogin/CNLiveThreeLoginView.m
| @@ -9,106 +9,118 @@ | @@ -9,106 +9,118 @@ | ||
| 9 | #import "CNLiveThreeLoginView.h" | 9 | #import "CNLiveThreeLoginView.h" |
| 10 | #import "YYKit.h" | 10 | #import "YYKit.h" |
| 11 | #import "CNLiveCategory.h" | 11 | #import "CNLiveCategory.h" |
| 12 | -//#import "CNLiveShareManager.h" | ||
| 13 | -//#import "WXApi.h" | 12 | +#import "CNLiveShareManager.h" |
| 13 | +#import "WXApi.h" | ||
| 14 | +#import <AuthenticationServices/AuthenticationServices.h> | ||
| 14 | 15 | ||
| 15 | @interface CNLiveThreeLoginView() | 16 | @interface CNLiveThreeLoginView() |
| 16 | 17 | ||
| 17 | @end | 18 | @end |
| 18 | @implementation CNLiveThreeLoginView | 19 | @implementation CNLiveThreeLoginView |
| 19 | static NSInteger const rowHeight = 60; | 20 | static NSInteger const rowHeight = 60; |
| 20 | -//- (instancetype)initWithFrame:(CGRect)frame{ | ||
| 21 | -// self = [super initWithFrame:frame]; | ||
| 22 | -// if (self) { | ||
| 23 | -// [self createSubviews:frame]; | ||
| 24 | -// | ||
| 25 | -// } | ||
| 26 | -// return self; | ||
| 27 | -// | ||
| 28 | -//} | ||
| 29 | -//- (void)createSubviews:(CGRect)frame{ | ||
| 30 | -// CGFloat width = frame.size.width; | ||
| 31 | -// CGFloat nameWidth = width/3.0; | ||
| 32 | -// CGFloat lineLeft = 15; | ||
| 33 | -// CGFloat lineWidth = nameWidth - lineLeft*2; | ||
| 34 | -// | ||
| 35 | -// UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(lineLeft, (rowHeight/3.0-1)/2.0, lineWidth, 1)]; | ||
| 36 | -// leftLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 37 | -// [self addSubview:leftLine]; | ||
| 38 | -// | ||
| 39 | -// UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(nameWidth, 0, nameWidth, rowHeight/3.0)]; | ||
| 40 | -// name.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 41 | -// name.font = [UIFont systemFontOfSize:14]; | ||
| 42 | -// name.textAlignment = NSTextAlignmentCenter; | ||
| 43 | -// name.text = @"第三方账号登录"; | ||
| 44 | -// [self addSubview:name]; | ||
| 45 | -// | ||
| 46 | -// UILabel *rightLine = [[UILabel alloc] initWithFrame:CGRectMake(name.right+15, leftLine.top, leftLine.width, 1)]; | ||
| 47 | -// rightLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 48 | -// [self addSubview:rightLine]; | ||
| 49 | -// | ||
| 50 | -// NSMutableArray *pics = [NSMutableArray arrayWithArray:@[@"login_qq",@"login_weibo"]]; | ||
| 51 | -// if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 52 | -// [pics insertObject:@"login_wechat" atIndex:0]; | ||
| 53 | -// } | ||
| 54 | -// NSUInteger number = pics.count; | ||
| 55 | -// if (@available(iOS 13, *)) { | ||
| 56 | -// [pics addObject:@"login_apple"]; | ||
| 57 | -// number = pics.count + 1; | ||
| 58 | -// } | ||
| 59 | -// CGFloat btnWidth = width/number*1.0; | ||
| 60 | -// | ||
| 61 | -// for(int i = 0; i < pics.count; i++){ | ||
| 62 | -// UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 63 | -// btn.tag = 10000+i; | ||
| 64 | -// btn.frame = CGRectMake(btnWidth*i, name.bottom, btnWidth, rowHeight); | ||
| 65 | -// if (@available(iOS 13, *)) { | ||
| 66 | -// if (i == pics.count-1) { | ||
| 67 | -// btn.frame = CGRectMake(btnWidth*i, name.bottom, 2*btnWidth, rowHeight); | ||
| 68 | -// } | ||
| 69 | -// } | ||
| 70 | -// UIImage *image = [self getImageWithImageName:pics[i] bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | ||
| 71 | -// [btn setImage:image forState:UIControlStateNormal]; | ||
| 72 | -// btn.adjustsImageWhenHighlighted = NO; | ||
| 73 | -// [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 74 | -// [self addSubview:btn]; | ||
| 75 | -// | ||
| 76 | -// } | ||
| 77 | -// | ||
| 78 | -//} | ||
| 79 | -//- (void)btnDidClicked:(UIButton *)btn{ | ||
| 80 | -// if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 81 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 82 | -// if(btn.tag == 10000){ | ||
| 83 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWX]; | ||
| 84 | -// | ||
| 85 | -// }else if (btn.tag == 10001){ | ||
| 86 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 87 | -// | ||
| 88 | -// }else if(btn.tag == 10002){ | ||
| 89 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 90 | -// | ||
| 91 | -// }else if(btn.tag == 10003){ | ||
| 92 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 93 | -// | ||
| 94 | -// } | ||
| 95 | -// } | ||
| 96 | -// }else{ | ||
| 97 | -// if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 98 | -// if(btn.tag == 10000){ | ||
| 99 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 100 | -// | ||
| 101 | -// }else if(btn.tag == 10001){ | ||
| 102 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 103 | -// | ||
| 104 | -// }else if(btn.tag == 10002){ | ||
| 105 | -// [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 106 | -// | ||
| 107 | -// } | ||
| 108 | -// } | ||
| 109 | -// } | ||
| 110 | -// | ||
| 111 | -//} | 21 | +- (instancetype)initWithFrame:(CGRect)frame{ |
| 22 | + self = [super initWithFrame:frame]; | ||
| 23 | + if (self) { | ||
| 24 | + [self createSubviews:frame]; | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + return self; | ||
| 28 | + | ||
| 29 | +} | ||
| 30 | +- (void)createSubviews:(CGRect)frame{ | ||
| 31 | + CGFloat width = frame.size.width; | ||
| 32 | + CGFloat nameWidth = width/3.0; | ||
| 33 | + CGFloat lineLeft = 15; | ||
| 34 | + CGFloat lineWidth = nameWidth - lineLeft*2; | ||
| 35 | + | ||
| 36 | + UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(lineLeft, (rowHeight/3.0-1)/2.0, lineWidth, 1)]; | ||
| 37 | + leftLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 38 | + [self addSubview:leftLine]; | ||
| 39 | + | ||
| 40 | + UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(nameWidth, 0, nameWidth, rowHeight/3.0)]; | ||
| 41 | + name.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 42 | + name.font = [UIFont systemFontOfSize:14]; | ||
| 43 | + name.textAlignment = NSTextAlignmentCenter; | ||
| 44 | + name.text = @"第三方账号登录"; | ||
| 45 | + [self addSubview:name]; | ||
| 46 | + | ||
| 47 | + UILabel *rightLine = [[UILabel alloc] initWithFrame:CGRectMake(name.right+15, leftLine.top, leftLine.width, 1)]; | ||
| 48 | + rightLine.backgroundColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | ||
| 49 | + [self addSubview:rightLine]; | ||
| 50 | + | ||
| 51 | + NSMutableArray *pics = [NSMutableArray arrayWithArray:@[@"login_qq",@"login_weibo"]]; | ||
| 52 | + if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 53 | + [pics insertObject:@"login_wechat" atIndex:0]; | ||
| 54 | + } | ||
| 55 | + NSUInteger number = pics.count; | ||
| 56 | + if (@available(iOS 13, *)) { | ||
| 57 | + [pics addObject:@"login_apple"]; | ||
| 58 | + number = pics.count + 1; | ||
| 59 | + } | ||
| 60 | + CGFloat btnWidth = width/number*1.0; | ||
| 61 | + | ||
| 62 | + for(int i = 0; i < pics.count; i++){ | ||
| 63 | + // 苹果登录在最后一个 | ||
| 64 | + if (i == pics.count-1) { | ||
| 65 | + if (@available(iOS 13, *)) { | ||
| 66 | + ASAuthorizationAppleIDButton *btn = [ASAuthorizationAppleIDButton buttonWithType:ASAuthorizationAppleIDButtonTypeDefault style:ASAuthorizationAppleIDButtonStyleWhite]; | ||
| 67 | + btn.tag = 10000+i; | ||
| 68 | + btn.layer.masksToBounds = YES; | ||
| 69 | + btn.layer.cornerRadius = 18.0; | ||
| 70 | + btn.layer.borderWidth = 1.0; | ||
| 71 | + btn.layer.borderColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0].CGColor; | ||
| 72 | + btn.frame = CGRectMake(btnWidth*i, name.bottom+12, 2*btnWidth, 36); | ||
| 73 | + [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 74 | + [self addSubview:btn]; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + }else { | ||
| 78 | + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 79 | + btn.tag = 10000+i; | ||
| 80 | + btn.frame = CGRectMake(btnWidth*i, name.bottom, btnWidth, rowHeight); | ||
| 81 | + UIImage *image = [self getImageWithImageName:pics[i] bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | ||
| 82 | + [btn setImage:image forState:UIControlStateNormal]; | ||
| 83 | + btn.adjustsImageWhenHighlighted = NO; | ||
| 84 | + [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 85 | + [self addSubview:btn]; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | +} | ||
| 91 | +- (void)btnDidClicked:(UIButton *)btn{ | ||
| 92 | + if([WXApi isWXAppInstalled]||[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]]){ | ||
| 93 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 94 | + if(btn.tag == 10000){ | ||
| 95 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWX]; | ||
| 96 | + | ||
| 97 | + }else if (btn.tag == 10001){ | ||
| 98 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 99 | + | ||
| 100 | + }else if(btn.tag == 10002){ | ||
| 101 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 102 | + | ||
| 103 | + }else if(btn.tag == 10003){ | ||
| 104 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 105 | + | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + }else{ | ||
| 109 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedButton:type:)]) { | ||
| 110 | + if(btn.tag == 10000){ | ||
| 111 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespQQ]; | ||
| 112 | + | ||
| 113 | + }else if(btn.tag == 10001){ | ||
| 114 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespWB]; | ||
| 115 | + | ||
| 116 | + }else if(btn.tag == 10002){ | ||
| 117 | + [self.delegate clickedButton:self type:CNLiveSendAuthRespApple]; | ||
| 118 | + | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | +} | ||
| 112 | 124 | ||
| 113 | /* | 125 | /* |
| 114 | // Only override drawRect: if you perform custom drawing. | 126 | // Only override drawRect: if you perform custom drawing. |
Example/CNLiveLoginModule.xcodeproj/project.pbxproj
| @@ -199,8 +199,8 @@ | @@ -199,8 +199,8 @@ | ||
| 199 | 6003F586195388D20070C39A /* Sources */, | 199 | 6003F586195388D20070C39A /* Sources */, |
| 200 | 6003F587195388D20070C39A /* Frameworks */, | 200 | 6003F587195388D20070C39A /* Frameworks */, |
| 201 | 6003F588195388D20070C39A /* Resources */, | 201 | 6003F588195388D20070C39A /* Resources */, |
| 202 | - 44B31241C1F55E9F61B32BA2 /* [CP] Embed Pods Frameworks */, | ||
| 203 | - 00C9B333E974D90048CC8A26 /* [CP] Copy Pods Resources */, | 202 | + A4B98F6DD99D396CE59BCF21 /* [CP] Embed Pods Frameworks */, |
| 203 | + 720B5D77AB658C3B6CD9CEAB /* [CP] Copy Pods Resources */, | ||
| 204 | ); | 204 | ); |
| 205 | buildRules = ( | 205 | buildRules = ( |
| 206 | ); | 206 | ); |
| @@ -290,7 +290,7 @@ | @@ -290,7 +290,7 @@ | ||
| 290 | /* End PBXResourcesBuildPhase section */ | 290 | /* End PBXResourcesBuildPhase section */ |
| 291 | 291 | ||
| 292 | /* Begin PBXShellScriptBuildPhase section */ | 292 | /* Begin PBXShellScriptBuildPhase section */ |
| 293 | - 00C9B333E974D90048CC8A26 /* [CP] Copy Pods Resources */ = { | 293 | + 720B5D77AB658C3B6CD9CEAB /* [CP] Copy Pods Resources */ = { |
| 294 | isa = PBXShellScriptBuildPhase; | 294 | isa = PBXShellScriptBuildPhase; |
| 295 | buildActionMask = 2147483647; | 295 | buildActionMask = 2147483647; |
| 296 | files = ( | 296 | files = ( |
| @@ -310,7 +310,7 @@ | @@ -310,7 +310,7 @@ | ||
| 310 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveLoginModule_Example/Pods-CNLiveLoginModule_Example-resources.sh\"\n"; | 310 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveLoginModule_Example/Pods-CNLiveLoginModule_Example-resources.sh\"\n"; |
| 311 | showEnvVarsInLog = 0; | 311 | showEnvVarsInLog = 0; |
| 312 | }; | 312 | }; |
| 313 | - 44B31241C1F55E9F61B32BA2 /* [CP] Embed Pods Frameworks */ = { | 313 | + A4B98F6DD99D396CE59BCF21 /* [CP] Embed Pods Frameworks */ = { |
| 314 | isa = PBXShellScriptBuildPhase; | 314 | isa = PBXShellScriptBuildPhase; |
| 315 | buildActionMask = 2147483647; | 315 | buildActionMask = 2147483647; |
| 316 | files = ( | 316 | files = ( |
| @@ -323,7 +323,6 @@ | @@ -323,7 +323,6 @@ | ||
| 323 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", | 323 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", |
| 324 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", | 324 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", |
| 325 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", | 325 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 326 | - "${BUILT_PRODUCTS_DIR}/CNLiveBusinessBaseModule/CNLiveBusinessBaseModule.framework", | ||
| 327 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", | 326 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", |
| 328 | "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework", | 327 | "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework", |
| 329 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", | 328 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", |
| @@ -357,7 +356,6 @@ | @@ -357,7 +356,6 @@ | ||
| 357 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", | 356 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", |
| 358 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", | 357 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", |
| 359 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", | 358 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 360 | - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessBaseModule.framework", | ||
| 361 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", | 359 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", |
| 362 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework", | 360 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework", |
| 363 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", | 361 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", |