Commit f9d4f95c87e9cca9050cb75af5d8cfe68b333120
1 parent
9c211396
no message
Showing
21 changed files
with
531 additions
and
118 deletions
CNLiveUserSystemDemo.xcodeproj/project.pbxproj
| @@ -61,6 +61,8 @@ | @@ -61,6 +61,8 @@ | ||
| 61 | 812642DF1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642DE1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m */; }; | 61 | 812642DF1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642DE1D86A7A800B402CA /* CNLiveUserSystemDemoTests.m */; }; |
| 62 | 812642EA1D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642E91D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m */; }; | 62 | 812642EA1D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642E91D86A7A800B402CA /* CNLiveUserSystemDemoUITests.m */; }; |
| 63 | 812642FA1D86A83100B402CA /* CNLiveUserSystemCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */; }; | 63 | 812642FA1D86A83100B402CA /* CNLiveUserSystemCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */; }; |
| 64 | + 81661FCA1DDEA9C300E3C65A /* ThirdPartyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */; }; | ||
| 65 | + 81661FCC1DDED9DD00E3C65A /* cancel.png in Resources */ = {isa = PBXBuildFile; fileRef = 81661FCB1DDED9DD00E3C65A /* cancel.png */; }; | ||
| 64 | 817C6EC31D90D60E0016F211 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 817C6EC21D90D60E0016F211 /* ImageIO.framework */; }; | 66 | 817C6EC31D90D60E0016F211 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 817C6EC21D90D60E0016F211 /* ImageIO.framework */; }; |
| 65 | 8187A8EF1D8E6394007FAFB6 /* Tools.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8EE1D8E6394007FAFB6 /* Tools.m */; }; | 67 | 8187A8EF1D8E6394007FAFB6 /* Tools.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8EE1D8E6394007FAFB6 /* Tools.m */; }; |
| 66 | 8187A8F61D8E6486007FAFB6 /* NSObject+UserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8F11D8E6486007FAFB6 /* NSObject+UserModel.m */; }; | 68 | 8187A8F61D8E6486007FAFB6 /* NSObject+UserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8187A8F11D8E6486007FAFB6 /* NSObject+UserModel.m */; }; |
| @@ -206,6 +208,9 @@ | @@ -206,6 +208,9 @@ | ||
| 206 | 812642F81D86A83100B402CA /* CNLiveUserSystemCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemCenter.h; sourceTree = "<group>"; }; | 208 | 812642F81D86A83100B402CA /* CNLiveUserSystemCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemCenter.h; sourceTree = "<group>"; }; |
| 207 | 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveUserSystemCenter.m; sourceTree = "<group>"; }; | 209 | 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveUserSystemCenter.m; sourceTree = "<group>"; }; |
| 208 | 812642FB1D86AFE600B402CA /* CNLiveUserSystemTypeDef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemTypeDef.h; sourceTree = "<group>"; }; | 210 | 812642FB1D86AFE600B402CA /* CNLiveUserSystemTypeDef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveUserSystemTypeDef.h; sourceTree = "<group>"; }; |
| 211 | + 81661FC81DDEA9C300E3C65A /* ThirdPartyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThirdPartyView.h; sourceTree = "<group>"; }; | ||
| 212 | + 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThirdPartyView.m; sourceTree = "<group>"; }; | ||
| 213 | + 81661FCB1DDED9DD00E3C65A /* cancel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cancel.png; sourceTree = "<group>"; }; | ||
| 209 | 817C6EC21D90D60E0016F211 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; | 214 | 817C6EC21D90D60E0016F211 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; |
| 210 | 818735211DA8FD2700046D84 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; }; | 215 | 818735211DA8FD2700046D84 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; }; |
| 211 | 8187A8ED1D8E6394007FAFB6 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tools.h; sourceTree = "<group>"; }; | 216 | 8187A8ED1D8E6394007FAFB6 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tools.h; sourceTree = "<group>"; }; |
| @@ -392,6 +397,8 @@ | @@ -392,6 +397,8 @@ | ||
| 392 | children = ( | 397 | children = ( |
| 393 | 8116F8E21D8916250084FE49 /* IdAndPwdView.h */, | 398 | 8116F8E21D8916250084FE49 /* IdAndPwdView.h */, |
| 394 | 8116F8E31D8916250084FE49 /* IdAndPwdView.m */, | 399 | 8116F8E31D8916250084FE49 /* IdAndPwdView.m */, |
| 400 | + 81661FC81DDEA9C300E3C65A /* ThirdPartyView.h */, | ||
| 401 | + 81661FC91DDEA9C300E3C65A /* ThirdPartyView.m */, | ||
| 395 | 8116F8EF1D891BCD0084FE49 /* RegistBasicInformationView.h */, | 402 | 8116F8EF1D891BCD0084FE49 /* RegistBasicInformationView.h */, |
| 396 | 8116F8F01D891BCD0084FE49 /* RegistBasicInformationView.m */, | 403 | 8116F8F01D891BCD0084FE49 /* RegistBasicInformationView.m */, |
| 397 | B6B54BE81D8D009800089C9C /* UserInfoHeaderImageTableViewCell.h */, | 404 | B6B54BE81D8D009800089C9C /* UserInfoHeaderImageTableViewCell.h */, |
| @@ -443,6 +450,7 @@ | @@ -443,6 +450,7 @@ | ||
| 443 | 812642C31D86A7A800B402CA /* CNLiveUserSystemDemo */ = { | 450 | 812642C31D86A7A800B402CA /* CNLiveUserSystemDemo */ = { |
| 444 | isa = PBXGroup; | 451 | isa = PBXGroup; |
| 445 | children = ( | 452 | children = ( |
| 453 | + 81661FCB1DDED9DD00E3C65A /* cancel.png */, | ||
| 446 | 812642C71D86A7A800B402CA /* AppDelegate.h */, | 454 | 812642C71D86A7A800B402CA /* AppDelegate.h */, |
| 447 | 812642C81D86A7A800B402CA /* AppDelegate.m */, | 455 | 812642C81D86A7A800B402CA /* AppDelegate.m */, |
| 448 | 8187A8EC1D8E6385007FAFB6 /* Tools */, | 456 | 8187A8EC1D8E6385007FAFB6 /* Tools */, |
| @@ -685,6 +693,7 @@ | @@ -685,6 +693,7 @@ | ||
| 685 | 812642D41D86A7A800B402CA /* LaunchScreen.storyboard in Resources */, | 693 | 812642D41D86A7A800B402CA /* LaunchScreen.storyboard in Resources */, |
| 686 | 812642D11D86A7A800B402CA /* Assets.xcassets in Resources */, | 694 | 812642D11D86A7A800B402CA /* Assets.xcassets in Resources */, |
| 687 | 812642CF1D86A7A800B402CA /* Main.storyboard in Resources */, | 695 | 812642CF1D86A7A800B402CA /* Main.storyboard in Resources */, |
| 696 | + 81661FCC1DDED9DD00E3C65A /* cancel.png in Resources */, | ||
| 688 | 810D9B661D8FB70600B7A776 /* TencentOpenApi_IOS_Bundle.bundle in Resources */, | 697 | 810D9B661D8FB70600B7A776 /* TencentOpenApi_IOS_Bundle.bundle in Resources */, |
| 689 | 8187A90D1D8E9A7B007FAFB6 /* SVProgressHUD.bundle in Resources */, | 698 | 8187A90D1D8E9A7B007FAFB6 /* SVProgressHUD.bundle in Resources */, |
| 690 | 810D9B681D8FB70600B7A776 /* WeiboSDK.bundle in Resources */, | 699 | 810D9B681D8FB70600B7A776 /* WeiboSDK.bundle in Resources */, |
| @@ -750,6 +759,7 @@ | @@ -750,6 +759,7 @@ | ||
| 750 | 811600EE1D927E7E003CAE7D /* MKAnnotationView+WebCache.m in Sources */, | 759 | 811600EE1D927E7E003CAE7D /* MKAnnotationView+WebCache.m in Sources */, |
| 751 | 811600F91D927E7E003CAE7D /* UIImage+MultiFormat.m in Sources */, | 760 | 811600F91D927E7E003CAE7D /* UIImage+MultiFormat.m in Sources */, |
| 752 | B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */, | 761 | B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */, |
| 762 | + 81661FCA1DDEA9C300E3C65A /* ThirdPartyView.m in Sources */, | ||
| 753 | 8187A8F81D8E6486007FAFB6 /* UserInfoSava.m in Sources */, | 763 | 8187A8F81D8E6486007FAFB6 /* UserInfoSava.m in Sources */, |
| 754 | 811600EF1D927E7E003CAE7D /* NSData+ImageContentType.m in Sources */, | 764 | 811600EF1D927E7E003CAE7D /* NSData+ImageContentType.m in Sources */, |
| 755 | 812642C61D86A7A800B402CA /* main.m in Sources */, | 765 | 812642C61D86A7A800B402CA /* main.m in Sources */, |
CNLiveUserSystemDemo.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemDemo.xcodeproj/xcuserdata/iOS.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
| @@ -51,14 +51,46 @@ | @@ -51,14 +51,46 @@ | ||
| 51 | shouldBeEnabled = "Yes" | 51 | shouldBeEnabled = "Yes" |
| 52 | ignoreCount = "0" | 52 | ignoreCount = "0" |
| 53 | continueAfterRunningActions = "No" | 53 | continueAfterRunningActions = "No" |
| 54 | - filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m" | ||
| 55 | - timestampString = "501062337.466231" | 54 | + filePath = "CNLiveUserSystemDemo/Conreollers/ViewController.m" |
| 55 | + timestampString = "501142248.547315" | ||
| 56 | startingColumnNumber = "9223372036854775807" | 56 | startingColumnNumber = "9223372036854775807" |
| 57 | endingColumnNumber = "9223372036854775807" | 57 | endingColumnNumber = "9223372036854775807" |
| 58 | - startingLineNumber = "63" | ||
| 59 | - endingLineNumber = "63" | ||
| 60 | - landmarkName = "-saveBtnAction" | 58 | + startingLineNumber = "73" |
| 59 | + endingLineNumber = "73" | ||
| 60 | + landmarkName = "-tapGesturedDetected:" | ||
| 61 | landmarkType = "7"> | 61 | landmarkType = "7"> |
| 62 | + <Locations> | ||
| 63 | + <Location | ||
| 64 | + shouldBeEnabled = "Yes" | ||
| 65 | + ignoreCount = "0" | ||
| 66 | + continueAfterRunningActions = "No" | ||
| 67 | + symbolName = "-[ViewController tapGesturedDetected:]" | ||
| 68 | + moduleName = "CNLiveUserSystemDemo" | ||
| 69 | + usesParentBreakpointCondition = "Yes" | ||
| 70 | + urlString = "file:///Users/android/Git/CNLiveUserSystemSDK/CNLiveUserSystemDemo/Conreollers/ViewController.m" | ||
| 71 | + timestampString = "501648183.675403" | ||
| 72 | + startingColumnNumber = "9223372036854775807" | ||
| 73 | + endingColumnNumber = "9223372036854775807" | ||
| 74 | + startingLineNumber = "73" | ||
| 75 | + endingLineNumber = "73" | ||
| 76 | + offsetFromSymbolStart = "64"> | ||
| 77 | + </Location> | ||
| 78 | + <Location | ||
| 79 | + shouldBeEnabled = "Yes" | ||
| 80 | + ignoreCount = "0" | ||
| 81 | + continueAfterRunningActions = "No" | ||
| 82 | + symbolName = "__38-[ViewController tapGesturedDetected:]_block_invoke" | ||
| 83 | + moduleName = "CNLiveUserSystemDemo" | ||
| 84 | + usesParentBreakpointCondition = "Yes" | ||
| 85 | + urlString = "file:///Users/android/Git/CNLiveUserSystemSDK/CNLiveUserSystemDemo/Conreollers/ViewController.m" | ||
| 86 | + timestampString = "501648183.677109" | ||
| 87 | + startingColumnNumber = "9223372036854775807" | ||
| 88 | + endingColumnNumber = "9223372036854775807" | ||
| 89 | + startingLineNumber = "73" | ||
| 90 | + endingLineNumber = "73" | ||
| 91 | + offsetFromSymbolStart = "15"> | ||
| 92 | + </Location> | ||
| 93 | + </Locations> | ||
| 62 | </BreakpointContent> | 94 | </BreakpointContent> |
| 63 | </BreakpointProxy> | 95 | </BreakpointProxy> |
| 64 | <BreakpointProxy | 96 | <BreakpointProxy |
| @@ -67,13 +99,29 @@ | @@ -67,13 +99,29 @@ | ||
| 67 | shouldBeEnabled = "Yes" | 99 | shouldBeEnabled = "Yes" |
| 68 | ignoreCount = "0" | 100 | ignoreCount = "0" |
| 69 | continueAfterRunningActions = "No" | 101 | continueAfterRunningActions = "No" |
| 70 | - filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m" | ||
| 71 | - timestampString = "501062339.330438" | 102 | + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m" |
| 103 | + timestampString = "501385209.643505" | ||
| 104 | + startingColumnNumber = "9223372036854775807" | ||
| 105 | + endingColumnNumber = "9223372036854775807" | ||
| 106 | + startingLineNumber = "89" | ||
| 107 | + endingLineNumber = "89" | ||
| 108 | + landmarkName = "-loginBtnAction" | ||
| 109 | + landmarkType = "7"> | ||
| 110 | + </BreakpointContent> | ||
| 111 | + </BreakpointProxy> | ||
| 112 | + <BreakpointProxy | ||
| 113 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 114 | + <BreakpointContent | ||
| 115 | + shouldBeEnabled = "Yes" | ||
| 116 | + ignoreCount = "0" | ||
| 117 | + continueAfterRunningActions = "No" | ||
| 118 | + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m" | ||
| 119 | + timestampString = "501385209.643505" | ||
| 72 | startingColumnNumber = "9223372036854775807" | 120 | startingColumnNumber = "9223372036854775807" |
| 73 | endingColumnNumber = "9223372036854775807" | 121 | endingColumnNumber = "9223372036854775807" |
| 74 | - startingLineNumber = "67" | ||
| 75 | - endingLineNumber = "67" | ||
| 76 | - landmarkName = "-saveBtnAction" | 122 | + startingLineNumber = "95" |
| 123 | + endingLineNumber = "95" | ||
| 124 | + landmarkName = "-loginBtnAction" | ||
| 77 | landmarkType = "7"> | 125 | landmarkType = "7"> |
| 78 | </BreakpointContent> | 126 | </BreakpointContent> |
| 79 | </BreakpointProxy> | 127 | </BreakpointProxy> |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.h
| @@ -17,6 +17,11 @@ | @@ -17,6 +17,11 @@ | ||
| 17 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 17 | - (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | + * 绑定第三方账号 | ||
| 21 | + */ | ||
| 22 | +- (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | ||
| 23 | + | ||
| 24 | +/** | ||
| 20 | * 查询用户信息 | 25 | * 查询用户信息 |
| 21 | */ | 26 | */ |
| 22 | - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 27 | - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.m
| @@ -12,19 +12,23 @@ | @@ -12,19 +12,23 @@ | ||
| 12 | #import "NSDictionary+Safety.h" | 12 | #import "NSDictionary+Safety.h" |
| 13 | 13 | ||
| 14 | //更新手机号 | 14 | //更新手机号 |
| 15 | -static NSString *updateMobileURL = @"https://api.cnlive.com/open/api2/user/updateMobileById"; | 15 | +static NSString *updateMobileURL = @"https://api.cnlive.com/open/api2/user/updateMobileById"; |
| 16 | 16 | ||
| 17 | //查询用户信息 | 17 | //查询用户信息 |
| 18 | -static NSString *queryUserInfoURL = @"https://api.cnlive.com/open/api2/user/readUserById"; | 18 | +static NSString *queryUserInfoURL = @"https://api.cnlive.com/open/api2/user/readUserById"; |
| 19 | 19 | ||
| 20 | //修改用户单项信息 | 20 | //修改用户单项信息 |
| 21 | -static NSString *updateUserByIdURL = @"https://api.cnlive.com/open/api2/user/updateUserById"; | 21 | +static NSString *updateUserByIdURL = @"https://api.cnlive.com/open/api2/user/updateUserById"; |
| 22 | 22 | ||
| 23 | //更新用户附加信息 | 23 | //更新用户附加信息 |
| 24 | -static NSString *updateOtherInfoURL = @"https://api.cnlive.com/open/api2/user/updateUserExtInfo"; | 24 | +static NSString *updateOtherInfoURL = @"https://api.cnlive.com/open/api2/user/updateUserExtInfo"; |
| 25 | 25 | ||
| 26 | //修改密码 | 26 | //修改密码 |
| 27 | -static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updatePwdByMobile"; | 27 | +static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updatePwdByMobile"; |
| 28 | + | ||
| 29 | +//绑定第三方账号 | ||
| 30 | +static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/user/bind3rd"; | ||
| 31 | + | ||
| 28 | 32 | ||
| 29 | @implementation CNLiveUserInfo | 33 | @implementation CNLiveUserInfo |
| 30 | 34 | ||
| @@ -56,6 +60,32 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -56,6 +60,32 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 56 | } | 60 | } |
| 57 | 61 | ||
| 58 | /** | 62 | /** |
| 63 | + * 绑定第三方账号 | ||
| 64 | + */ | ||
| 65 | +- (void)bindingThirdPartyWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId token:(NSString *)token success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | ||
| 66 | +{ | ||
| 67 | + NSDate *date = [NSDate date]; | ||
| 68 | + NSInteger time = [date timeIntervalSince1970]; | ||
| 69 | + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time]; | ||
| 70 | + | ||
| 71 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 72 | + @"uid":[CNLiveUserSystemTools verify:uid], | ||
| 73 | + @"thirdPartyPlat":[CNLiveUserSystemTools verify:plat], | ||
| 74 | + @"thirdPartyId":[CNLiveUserSystemTools verify:thirdPartyId], | ||
| 75 | + @"token":[CNLiveUserSystemTools verify:token], | ||
| 76 | + @"clientPlat":@"i", | ||
| 77 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier, | ||
| 78 | + @"timestamp": timeString}; | ||
| 79 | + | ||
| 80 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 81 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 82 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 83 | + | ||
| 84 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 85 | + [self requestWithURL:BindingThirdURL parameter:parameter success:success failure:failure]; | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +/** | ||
| 59 | * 查询用户信息 | 89 | * 查询用户信息 |
| 60 | */ | 90 | */ |
| 61 | - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure | 91 | - (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| @@ -71,9 +101,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -71,9 +101,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 71 | @"token":[CNLiveUserSystemTools verify:token], | 101 | @"token":[CNLiveUserSystemTools verify:token], |
| 72 | @"platform_id":[NSBundle mainBundle].bundleIdentifier, | 102 | @"platform_id":[NSBundle mainBundle].bundleIdentifier, |
| 73 | @"timestamp": timeString}; | 103 | @"timestamp": timeString}; |
| 74 | - | ||
| 75 | - NSLog(@"查询参数-----------%@",params); | ||
| 76 | - | 104 | + |
| 77 | NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | 105 | NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; |
| 78 | NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | 106 | NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; |
| 79 | NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | 107 | NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; |
| @@ -168,7 +196,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -168,7 +196,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 168 | { | 196 | { |
| 169 | 197 | ||
| 170 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 198 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| 171 | - | 199 | + |
| 200 | + | ||
| 172 | responseObject = [responseObject validatedDictionary]; | 201 | responseObject = [responseObject validatedDictionary]; |
| 173 | 202 | ||
| 174 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 203 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | */ | 22 | */ |
| 23 | + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; | 23 | + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; |
| 24 | 24 | ||
| 25 | + | ||
| 25 | /** | 26 | /** |
| 26 | @abstract 注册 | 27 | @abstract 注册 |
| 27 | @param userName 邮箱或手机 | 28 | @param userName 邮箱或手机 |
| @@ -34,9 +35,10 @@ | @@ -34,9 +35,10 @@ | ||
| 34 | */ | 35 | */ |
| 35 | + (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 36 | + (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 36 | 37 | ||
| 38 | + | ||
| 37 | /** | 39 | /** |
| 38 | @abstract 第三方登录 | 40 | @abstract 第三方登录 |
| 39 | - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq weibo 3:weixin 4:renren 注:如qq登录,plat=@"2") | 41 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") |
| 40 | @param thirdPartyId 第三方用户ID | 42 | @param thirdPartyId 第三方用户ID |
| 41 | @param nickName 用户昵称 | 43 | @param nickName 用户昵称 |
| 42 | @param gender 性别,m:男、f:女、n:未知(非必填) | 44 | @param gender 性别,m:男、f:女、n:未知(非必填) |
| @@ -48,6 +50,7 @@ | @@ -48,6 +50,7 @@ | ||
| 48 | */ | 50 | */ |
| 49 | + (void)thirdPartyLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 51 | + (void)thirdPartyLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 50 | 52 | ||
| 53 | + | ||
| 51 | /** | 54 | /** |
| 52 | @abstract 快捷登录 | 55 | @abstract 快捷登录 |
| 53 | @param userName 手机号 | 56 | @param userName 手机号 |
| @@ -58,6 +61,7 @@ | @@ -58,6 +61,7 @@ | ||
| 58 | */ | 61 | */ |
| 59 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 62 | + (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 60 | 63 | ||
| 64 | + | ||
| 61 | /** | 65 | /** |
| 62 | @abstract 登录 | 66 | @abstract 登录 |
| 63 | @param userName 手机号或邮箱 | 67 | @param userName 手机号或邮箱 |
| @@ -68,6 +72,7 @@ | @@ -68,6 +72,7 @@ | ||
| 68 | */ | 72 | */ |
| 69 | + (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 73 | + (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 70 | 74 | ||
| 75 | + | ||
| 71 | /** | 76 | /** |
| 72 | @abstract 发送验证码 | 77 | @abstract 发送验证码 |
| 73 | @param mobile 手机号 | 78 | @param mobile 手机号 |
| @@ -77,6 +82,7 @@ | @@ -77,6 +82,7 @@ | ||
| 77 | */ | 82 | */ |
| 78 | + (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 83 | + (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 79 | 84 | ||
| 85 | + | ||
| 80 | /** | 86 | /** |
| 81 | @abstract 更新用户附加信息 | 87 | @abstract 更新用户附加信息 |
| 82 | @param uid 用户ID | 88 | @param uid 用户ID |
| @@ -86,6 +92,7 @@ | @@ -86,6 +92,7 @@ | ||
| 86 | */ | 92 | */ |
| 87 | + (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 93 | + (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 88 | 94 | ||
| 95 | + | ||
| 89 | /** | 96 | /** |
| 90 | @abstract 修改用户单项信息 | 97 | @abstract 修改用户单项信息 |
| 91 | @param type 修改类型(nickName-昵称,gender-性别,email-邮箱, location-联系方式(地址)) | 98 | @param type 修改类型(nickName-昵称,gender-性别,email-邮箱, location-联系方式(地址)) |
| @@ -96,6 +103,7 @@ | @@ -96,6 +103,7 @@ | ||
| 96 | */ | 103 | */ |
| 97 | + (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 104 | + (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 98 | 105 | ||
| 106 | + | ||
| 99 | /** | 107 | /** |
| 100 | @abstract 更新手机号 | 108 | @abstract 更新手机号 |
| 101 | @param uid 用户ID | 109 | @param uid 用户ID |
| @@ -106,6 +114,18 @@ | @@ -106,6 +114,18 @@ | ||
| 106 | */ | 114 | */ |
| 107 | + (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 115 | + (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 108 | 116 | ||
| 117 | + | ||
| 118 | +/** | ||
| 119 | + @abstract 绑定第三方账号 | ||
| 120 | + @param uid 用户ID | ||
| 121 | + @param plat 第三方平台编号(如platform: 1:sina weibo 2:qq 3:weixin 4:renren 注:如绑定qq,thirdPartyPlat = @"2") | ||
| 122 | + @param thirdPartyId 第三方用户ID | ||
| 123 | + @param success 成功回调 | ||
| 124 | + @param failure 失败回调 | ||
| 125 | + */ | ||
| 126 | ++ (void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | ||
| 127 | + | ||
| 128 | + | ||
| 109 | /** | 129 | /** |
| 110 | @abstract 修改密码(通过手机号修改) | 130 | @abstract 修改密码(通过手机号修改) |
| 111 | @param mobile 手机号 | 131 | @param mobile 手机号 |
| @@ -116,6 +136,7 @@ | @@ -116,6 +136,7 @@ | ||
| 116 | */ | 136 | */ |
| 117 | + (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 137 | + (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 118 | 138 | ||
| 139 | + | ||
| 119 | /** | 140 | /** |
| 120 | @abstract 上传头像 | 141 | @abstract 上传头像 |
| 121 | @param uid 用户ID | 142 | @param uid 用户ID |
| @@ -125,6 +146,7 @@ | @@ -125,6 +146,7 @@ | ||
| 125 | */ | 146 | */ |
| 126 | + (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 147 | + (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 127 | 148 | ||
| 149 | + | ||
| 128 | /** | 150 | /** |
| 129 | @abstract 查询用户信息 | 151 | @abstract 查询用户信息 |
| 130 | @param uid 用户ID | 152 | @param uid 用户ID |
| @@ -134,6 +156,7 @@ | @@ -134,6 +156,7 @@ | ||
| 134 | */ | 156 | */ |
| 135 | + (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 157 | + (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 136 | 158 | ||
| 159 | + | ||
| 137 | /** | 160 | /** |
| 138 | @abstract 用户反馈 | 161 | @abstract 用户反馈 |
| 139 | @param contentId 举报内容ID | 162 | @param contentId 举报内容ID |
| @@ -143,6 +166,7 @@ | @@ -143,6 +166,7 @@ | ||
| 143 | */ | 166 | */ |
| 144 | + (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | 167 | + (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 145 | 168 | ||
| 169 | + | ||
| 146 | /** | 170 | /** |
| 147 | * 获取SDK版本号 | 171 | * 获取SDK版本号 |
| 148 | */ | 172 | */ |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
| @@ -110,6 +110,16 @@ | @@ -110,6 +110,16 @@ | ||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | + * 绑定第三方账号 | ||
| 114 | + */ | ||
| 115 | ++(void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | ||
| 116 | +{ | ||
| 117 | + CNLiveUserInfo *bindingThird = [[CNLiveUserInfo alloc] init]; | ||
| 118 | + | ||
| 119 | + [bindingThird bindingThirdPartyWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey uid:uid thirdPartyPlatType:plat thirdPartyId:thirdPartyId token:[[self class] getToken] success:success failure:failure]; | ||
| 120 | +} | ||
| 121 | + | ||
| 122 | +/** | ||
| 113 | * 修改密码 | 123 | * 修改密码 |
| 114 | */ | 124 | */ |
| 115 | +(void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure | 125 | +(void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
CNLiveUserSystemDemo/Conreollers/LoginViewController.m
| @@ -84,17 +84,17 @@ | @@ -84,17 +84,17 @@ | ||
| 84 | 84 | ||
| 85 | - (void)weChatBtnAction | 85 | - (void)weChatBtnAction |
| 86 | { | 86 | { |
| 87 | - [[CNLiveThirdLoginManager manager] weChatLogin]; | 87 | + [[CNLiveThirdLoginManager manager] weChatLoginIsBindingThirdParty:NO]; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | - (void)sinaBtnAction | 90 | - (void)sinaBtnAction |
| 91 | { | 91 | { |
| 92 | - [[CNLiveThirdLoginManager manager] sinaLogin]; | 92 | + [[CNLiveThirdLoginManager manager] sinaLoginIsBindingThirdParty:NO]; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | - (void)qqBtnAction | 95 | - (void)qqBtnAction |
| 96 | { | 96 | { |
| 97 | - [[CNLiveThirdLoginManager manager] qqLogin]; | 97 | + [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:NO]; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | - (void)loginSuccess | 100 | - (void)loginSuccess |
CNLiveUserSystemDemo/Conreollers/RegisterViewController.m
| @@ -85,6 +85,7 @@ | @@ -85,6 +85,7 @@ | ||
| 85 | 85 | ||
| 86 | [CNLiveUserSystemCenter registerWithUserName:_registBasicInformationView.phoneTF.text password:_registBasicInformationView.setPwdTF.text verificationCode:_registBasicInformationView.verificationTF.text invitationCode:nil frmId:nil success:^(id result) { | 86 | [CNLiveUserSystemCenter registerWithUserName:_registBasicInformationView.phoneTF.text password:_registBasicInformationView.setPwdTF.text verificationCode:_registBasicInformationView.verificationTF.text invitationCode:nil frmId:nil success:^(id result) { |
| 87 | 87 | ||
| 88 | + NSLog(@"result --- %@",result); | ||
| 88 | [Tools setUserLogin:YES]; | 89 | [Tools setUserLogin:YES]; |
| 89 | [SVProgressHUD showSuccessWithStatus:@"成功"]; | 90 | [SVProgressHUD showSuccessWithStatus:@"成功"]; |
| 90 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 91 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
CNLiveUserSystemDemo/Conreollers/ViewController.m
| @@ -12,13 +12,16 @@ | @@ -12,13 +12,16 @@ | ||
| 12 | #import "UserInfoViewController.h" | 12 | #import "UserInfoViewController.h" |
| 13 | #import "CNLiveLogout.h" | 13 | #import "CNLiveLogout.h" |
| 14 | #import "UserInfoSava.h" | 14 | #import "UserInfoSava.h" |
| 15 | +#import "ThirdPartyView.h" | ||
| 16 | +#import "CNLiveThirdLoginManager.h" | ||
| 15 | 17 | ||
| 16 | -@interface ViewController ()<UITableViewDelegate,UITableViewDataSource> | 18 | +@interface ViewController ()<UITableViewDelegate,UITableViewDataSource,ThirdPartyViewDelegate,UIGestureRecognizerDelegate> |
| 17 | { | 19 | { |
| 18 | NSArray *_dataArr; | 20 | NSArray *_dataArr; |
| 19 | } | 21 | } |
| 20 | 22 | ||
| 21 | @property (nonatomic, strong) UITableView *tableView; | 23 | @property (nonatomic, strong) UITableView *tableView; |
| 24 | +@property (nonatomic, strong) ThirdPartyView *thirPartydView; | ||
| 22 | @property (nonatomic, strong) UIButton *loginBtn; | 25 | @property (nonatomic, strong) UIButton *loginBtn; |
| 23 | @end | 26 | @end |
| 24 | 27 | ||
| @@ -30,9 +33,14 @@ | @@ -30,9 +33,14 @@ | ||
| 30 | self.view.backgroundColor = [UIColor whiteColor]; | 33 | self.view.backgroundColor = [UIColor whiteColor]; |
| 31 | 34 | ||
| 32 | [self.view addSubview:self.tableView]; | 35 | [self.view addSubview:self.tableView]; |
| 33 | - [self.tableView addSubview:self.loginBtn]; | ||
| 34 | - | ||
| 35 | - _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"反馈"]; | 36 | + [self.view addSubview:self.loginBtn]; |
| 37 | + [self.view addSubview:self.thirPartydView]; | ||
| 38 | + | ||
| 39 | +// UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesturedDetected:)]; // 手势类型随你喜欢。 | ||
| 40 | +// tapGesture.delegate = self; | ||
| 41 | +// [self.view addGestureRecognizer:tapGesture]; | ||
| 42 | + | ||
| 43 | + _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"反馈",@"绑定第三方账号"]; | ||
| 36 | } | 44 | } |
| 37 | 45 | ||
| 38 | - (void)viewWillAppear:(BOOL)animated | 46 | - (void)viewWillAppear:(BOOL)animated |
| @@ -60,6 +68,36 @@ | @@ -60,6 +68,36 @@ | ||
| 60 | } | 68 | } |
| 61 | } | 69 | } |
| 62 | 70 | ||
| 71 | +- (void)tapGesturedDetected:(UITapGestureRecognizer *)recognizer | ||
| 72 | +{ | ||
| 73 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 74 | + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160); | ||
| 75 | + }]; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +#pragma mark - ThirdPartyViewDelegate | ||
| 79 | +- (void)thirdPartyBtnAction:(NSString *)title | ||
| 80 | +{ | ||
| 81 | + if ([title isEqualToString:@"微信"]) { | ||
| 82 | + [[CNLiveThirdLoginManager manager] weChatLoginIsBindingThirdParty:YES]; | ||
| 83 | + } else if ([title isEqualToString:@"微博"]) { | ||
| 84 | + [[CNLiveThirdLoginManager manager] sinaLoginIsBindingThirdParty:YES]; | ||
| 85 | + } else { | ||
| 86 | + [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:YES]; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 90 | + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160); | ||
| 91 | + }]; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +- (void)cancelThirdView | ||
| 95 | +{ | ||
| 96 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 97 | + _thirPartydView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160); | ||
| 98 | + }]; | ||
| 99 | +} | ||
| 100 | + | ||
| 63 | #pragma mark - UITableView | 101 | #pragma mark - UITableView |
| 64 | 102 | ||
| 65 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | 103 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
| @@ -171,6 +209,13 @@ | @@ -171,6 +209,13 @@ | ||
| 171 | [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | 209 | [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; |
| 172 | }]; | 210 | }]; |
| 173 | } | 211 | } |
| 212 | + | ||
| 213 | + if (indexPath.row == 6) { | ||
| 214 | + | ||
| 215 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 216 | + _thirPartydView.frame = CGRectMake(0, KScreenHeight-160, KScreenWidth, 160); | ||
| 217 | + }]; | ||
| 218 | + } | ||
| 174 | } | 219 | } |
| 175 | 220 | ||
| 176 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | 221 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath |
| @@ -186,7 +231,7 @@ | @@ -186,7 +231,7 @@ | ||
| 186 | - (UITableView *)tableView | 231 | - (UITableView *)tableView |
| 187 | { | 232 | { |
| 188 | if (!_tableView) { | 233 | if (!_tableView) { |
| 189 | - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain]; | 234 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight -80) style:UITableViewStylePlain]; |
| 190 | _tableView.backgroundColor = [UIColor whiteColor]; | 235 | _tableView.backgroundColor = [UIColor whiteColor]; |
| 191 | _tableView.tableFooterView = [[UIView alloc] init]; | 236 | _tableView.tableFooterView = [[UIView alloc] init]; |
| 192 | _tableView.delegate = self; | 237 | _tableView.delegate = self; |
| @@ -194,12 +239,20 @@ | @@ -194,12 +239,20 @@ | ||
| 194 | } | 239 | } |
| 195 | return _tableView; | 240 | return _tableView; |
| 196 | } | 241 | } |
| 242 | +- (ThirdPartyView *)thirPartydView | ||
| 243 | +{ | ||
| 244 | + if (!_thirPartydView) { | ||
| 245 | + _thirPartydView = [[ThirdPartyView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, 160) binding:YES]; | ||
| 246 | + _thirPartydView.delegate = self; | ||
| 247 | + } | ||
| 248 | + return _thirPartydView; | ||
| 249 | +} | ||
| 197 | 250 | ||
| 198 | - (UIButton *)loginBtn | 251 | - (UIButton *)loginBtn |
| 199 | { | 252 | { |
| 200 | if (!_loginBtn) { | 253 | if (!_loginBtn) { |
| 201 | _loginBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 254 | _loginBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 202 | - _loginBtn.frame = CGRectMake(20, 53*5+63+12+80, KScreenWidth-40, 40); | 255 | + _loginBtn.frame = CGRectMake(20, KScreenHeight-60, KScreenWidth-40, 40); |
| 203 | [_loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 256 | [_loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 204 | [_loginBtn setBackgroundColor:[UIColor orangeColor]]; | 257 | [_loginBtn setBackgroundColor:[UIColor orangeColor]]; |
| 205 | _loginBtn.titleLabel.font = [UIFont systemFontOfSize:17]; | 258 | _loginBtn.titleLabel.font = [UIFont systemFontOfSize:17]; |
| @@ -210,6 +263,11 @@ | @@ -210,6 +263,11 @@ | ||
| 210 | return _loginBtn; | 263 | return _loginBtn; |
| 211 | } | 264 | } |
| 212 | 265 | ||
| 266 | +- (void)dealloc | ||
| 267 | +{ | ||
| 268 | + _thirPartydView.delegate = nil; | ||
| 269 | +} | ||
| 270 | + | ||
| 213 | - (void)didReceiveMemoryWarning { | 271 | - (void)didReceiveMemoryWarning { |
| 214 | [super didReceiveMemoryWarning]; | 272 | [super didReceiveMemoryWarning]; |
| 215 | // Dispose of any resources that can be recreated. | 273 | // Dispose of any resources that can be recreated. |
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.h
| @@ -14,10 +14,10 @@ | @@ -14,10 +14,10 @@ | ||
| 14 | 14 | ||
| 15 | - (BOOL)handleOpenURL:(NSURL *)url; | 15 | - (BOOL)handleOpenURL:(NSURL *)url; |
| 16 | 16 | ||
| 17 | -- (void)qqLogin; | 17 | +- (void)qqLoginIsBindingThirdParty:(BOOL)Binding; |
| 18 | 18 | ||
| 19 | -- (void)weChatLogin; | 19 | +- (void)weChatLoginIsBindingThirdParty:(BOOL)Binding; |
| 20 | 20 | ||
| 21 | -- (void)sinaLogin; | 21 | +- (void)sinaLoginIsBindingThirdParty:(BOOL)Binding; |
| 22 | 22 | ||
| 23 | @end | 23 | @end |
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.m
| @@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
| 16 | @interface CNLiveThirdLoginManager ()<WXApiDelegate,TencentSessionDelegate,TencentLoginDelegate,WBHttpRequestDelegate,WeiboSDKDelegate> | 16 | @interface CNLiveThirdLoginManager ()<WXApiDelegate,TencentSessionDelegate,TencentLoginDelegate,WBHttpRequestDelegate,WeiboSDKDelegate> |
| 17 | { | 17 | { |
| 18 | TencentOAuth *tencentOAuth; | 18 | TencentOAuth *tencentOAuth; |
| 19 | + BOOL _isBindingThird; | ||
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | @property (nonatomic, copy)NSString *appCode; | 22 | @property (nonatomic, copy)NSString *appCode; |
| @@ -62,16 +63,28 @@ | @@ -62,16 +63,28 @@ | ||
| 62 | } | 63 | } |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | --(void)qqLogin | 66 | +-(void)qqLoginIsBindingThirdParty:(BOOL)Binding |
| 66 | { | 67 | { |
| 68 | + if (Binding) { | ||
| 69 | + _isBindingThird = YES; | ||
| 70 | + } else { | ||
| 71 | + _isBindingThird = NO; | ||
| 72 | + } | ||
| 73 | + | ||
| 67 | tencentOAuth = [[TencentOAuth alloc] initWithAppId:QQAppKey andDelegate:self]; | 74 | tencentOAuth = [[TencentOAuth alloc] initWithAppId:QQAppKey andDelegate:self]; |
| 68 | NSArray *permissions = [NSArray arrayWithObjects:kOPEN_PERMISSION_GET_VIP_INFO, kOPEN_PERMISSION_GET_USER_INFO, kOPEN_PERMISSION_GET_SIMPLE_USER_INFO, nil]; | 75 | NSArray *permissions = [NSArray arrayWithObjects:kOPEN_PERMISSION_GET_VIP_INFO, kOPEN_PERMISSION_GET_USER_INFO, kOPEN_PERMISSION_GET_SIMPLE_USER_INFO, nil]; |
| 69 | [tencentOAuth authorize:permissions inSafari:NO]; | 76 | [tencentOAuth authorize:permissions inSafari:NO]; |
| 70 | 77 | ||
| 71 | } | 78 | } |
| 72 | 79 | ||
| 73 | -- (void)weChatLogin | 80 | +- (void)weChatLoginIsBindingThirdParty:(BOOL)Binding |
| 74 | { | 81 | { |
| 82 | + if (Binding) { | ||
| 83 | + _isBindingThird = YES; | ||
| 84 | + } else { | ||
| 85 | + _isBindingThird = NO; | ||
| 86 | + } | ||
| 87 | + | ||
| 75 | if ([WXApi isWXAppInstalled]) { | 88 | if ([WXApi isWXAppInstalled]) { |
| 76 | SendAuthReq* req = [[SendAuthReq alloc] init]; | 89 | SendAuthReq* req = [[SendAuthReq alloc] init]; |
| 77 | req.scope = @"snsapi_userinfo"; | 90 | req.scope = @"snsapi_userinfo"; |
| @@ -83,9 +96,15 @@ | @@ -83,9 +96,15 @@ | ||
| 83 | } | 96 | } |
| 84 | } | 97 | } |
| 85 | 98 | ||
| 86 | -- (void)sinaLogin | 99 | +- (void)sinaLoginIsBindingThirdParty:(BOOL)Binding |
| 87 | { | 100 | { |
| 88 | 101 | ||
| 102 | + if (Binding) { | ||
| 103 | + _isBindingThird = YES; | ||
| 104 | + } else { | ||
| 105 | + _isBindingThird = NO; | ||
| 106 | + } | ||
| 107 | + | ||
| 89 | WBAuthorizeRequest *request = [WBAuthorizeRequest request]; | 108 | WBAuthorizeRequest *request = [WBAuthorizeRequest request]; |
| 90 | request.redirectURI = kSinaRedirectURI; | 109 | request.redirectURI = kSinaRedirectURI; |
| 91 | request.scope = @"all"; | 110 | request.scope = @"all"; |
| @@ -111,26 +130,38 @@ | @@ -111,26 +130,38 @@ | ||
| 111 | 130 | ||
| 112 | NSDictionary *result = response.jsonResponse; | 131 | NSDictionary *result = response.jsonResponse; |
| 113 | 132 | ||
| 114 | - NSString *gender; | ||
| 115 | - if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) { | ||
| 116 | - gender = @"f"; | ||
| 117 | - } else if ([[result objectForKey:@"gender"] isEqualToString:@"男"]) { | ||
| 118 | - gender = @"m"; | 133 | + if (_isBindingThird) { |
| 134 | + | ||
| 135 | + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]]; | ||
| 136 | + | ||
| 137 | + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] success:^(id result) { | ||
| 138 | + NSLog(@"绑定成功----%@",result); | ||
| 139 | + } failure:^(NSDictionary *errorDic) { | ||
| 140 | + NSLog(@"绑定失败----%@",errorDic); | ||
| 141 | + }]; | ||
| 142 | + | ||
| 119 | } else { | 143 | } else { |
| 120 | - gender = @"n"; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) { | ||
| 124 | - NSLog(@"qq登录------%@",result); | 144 | + NSString *gender; |
| 145 | + if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) { | ||
| 146 | + gender = @"f"; | ||
| 147 | + } else if ([[result objectForKey:@"gender"] isEqualToString:@"男"]) { | ||
| 148 | + gender = @"m"; | ||
| 149 | + } else { | ||
| 150 | + gender = @"n"; | ||
| 151 | + } | ||
| 125 | 152 | ||
| 126 | - [Tools setUserLogin:YES]; | ||
| 127 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 128 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 129 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 130 | - | ||
| 131 | - } failure:^(NSDictionary *errorDic) { | ||
| 132 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 133 | - }]; | 153 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) { |
| 154 | + NSLog(@"qq登录------%@",result); | ||
| 155 | + | ||
| 156 | + [Tools setUserLogin:YES]; | ||
| 157 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 158 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 159 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 160 | + | ||
| 161 | + } failure:^(NSDictionary *errorDic) { | ||
| 162 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 163 | + }]; | ||
| 164 | + } | ||
| 134 | } | 165 | } |
| 135 | 166 | ||
| 136 | //非网络错误导致登录失败: | 167 | //非网络错误导致登录失败: |
| @@ -217,44 +248,55 @@ | @@ -217,44 +248,55 @@ | ||
| 217 | if (data) { | 248 | if (data) { |
| 218 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; | 249 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; |
| 219 | 250 | ||
| 220 | - if ([[dic allKeys] containsObject:@"errcode"]) { | 251 | + if (_isBindingThird) { |
| 252 | + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]]; | ||
| 253 | + | ||
| 254 | + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"3" thirdPartyId:dic[@"openid"] success:^(id result) { | ||
| 255 | + NSLog(@"绑定成功----%@",result); | ||
| 256 | + } failure:^(NSDictionary *errorDic) { | ||
| 257 | + NSLog(@"绑定失败----%@",errorDic); | ||
| 258 | + }]; | ||
| 221 | 259 | ||
| 222 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 223 | } else { | 260 | } else { |
| 224 | - | ||
| 225 | - NSString *getGender = [dic objectForKey:@"sex"]; | ||
| 226 | - NSString *gender; | ||
| 227 | - switch ([getGender intValue]) { | ||
| 228 | - case 0: | ||
| 229 | - { | ||
| 230 | - gender = @"n"; | ||
| 231 | - } | ||
| 232 | - break; | ||
| 233 | - case 1: | ||
| 234 | - { | ||
| 235 | - gender = @"m"; | ||
| 236 | - } | ||
| 237 | - break; | ||
| 238 | - case 2: | ||
| 239 | - { | ||
| 240 | - gender = @"f"; | ||
| 241 | - } | ||
| 242 | - break; | ||
| 243 | - default: | ||
| 244 | - break; | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) { | ||
| 248 | - NSLog(@"微信登录------%@",result); | 261 | + if ([[dic allKeys] containsObject:@"errcode"]) { |
| 249 | 262 | ||
| 250 | - [Tools setUserLogin:YES]; | ||
| 251 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 252 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 253 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 254 | - | ||
| 255 | - } failure:^(NSDictionary *errorDic) { | ||
| 256 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | 263 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; |
| 257 | - }]; | 264 | + } else { |
| 265 | + | ||
| 266 | + NSString *getGender = [dic objectForKey:@"sex"]; | ||
| 267 | + NSString *gender; | ||
| 268 | + switch ([getGender intValue]) { | ||
| 269 | + case 0: | ||
| 270 | + { | ||
| 271 | + gender = @"n"; | ||
| 272 | + } | ||
| 273 | + break; | ||
| 274 | + case 1: | ||
| 275 | + { | ||
| 276 | + gender = @"m"; | ||
| 277 | + } | ||
| 278 | + break; | ||
| 279 | + case 2: | ||
| 280 | + { | ||
| 281 | + gender = @"f"; | ||
| 282 | + } | ||
| 283 | + break; | ||
| 284 | + default: | ||
| 285 | + break; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) { | ||
| 289 | + NSLog(@"微信登录------%@",result); | ||
| 290 | + | ||
| 291 | + [Tools setUserLogin:YES]; | ||
| 292 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 293 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 294 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 295 | + | ||
| 296 | + } failure:^(NSDictionary *errorDic) { | ||
| 297 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 298 | + }]; | ||
| 299 | + } | ||
| 258 | } | 300 | } |
| 259 | } | 301 | } |
| 260 | }); | 302 | }); |
| @@ -262,7 +304,7 @@ | @@ -262,7 +304,7 @@ | ||
| 262 | }); | 304 | }); |
| 263 | } | 305 | } |
| 264 | 306 | ||
| 265 | -#pragma mark - <#mark#> | 307 | +#pragma mark - sinaDelegate |
| 266 | - (void)didReceiveWeiboRequest:(WBBaseRequest *)request | 308 | - (void)didReceiveWeiboRequest:(WBBaseRequest *)request |
| 267 | { | 309 | { |
| 268 | 310 | ||
| @@ -293,24 +335,37 @@ | @@ -293,24 +335,37 @@ | ||
| 293 | if ([request.tag isEqualToString:@"userinfo"]) { | 335 | if ([request.tag isEqualToString:@"userinfo"]) { |
| 294 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; | 336 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; |
| 295 | 337 | ||
| 296 | - NSString *gender; | ||
| 297 | - if ([dic objectForKey:@"gender"]) { | ||
| 298 | - gender = [dic objectForKey:@"gender"]; | 338 | + if (_isBindingThird) { |
| 339 | + | ||
| 340 | + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]]; | ||
| 341 | + | ||
| 342 | + [CNLiveUserSystemCenter bindingThirdPartyWithUid:model.uid thirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] success:^(id result) { | ||
| 343 | + NSLog(@"绑定成功----%@",result); | ||
| 344 | + } failure:^(NSDictionary *errorDic) { | ||
| 345 | + NSLog(@"绑定失败----%@",errorDic); | ||
| 346 | + }]; | ||
| 347 | + | ||
| 299 | } else { | 348 | } else { |
| 300 | - gender = @"n"; | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) { | ||
| 304 | - NSLog(@"微博登录------%@",result); | ||
| 305 | 349 | ||
| 306 | - [Tools setUserLogin:YES]; | ||
| 307 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 308 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 309 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 310 | - | ||
| 311 | - } failure:^(NSDictionary *errorDic) { | ||
| 312 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 313 | - }]; | 350 | + NSString *gender; |
| 351 | + if ([dic objectForKey:@"gender"]) { | ||
| 352 | + gender = [dic objectForKey:@"gender"]; | ||
| 353 | + } else { | ||
| 354 | + gender = @"n"; | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) { | ||
| 358 | + NSLog(@"微博登录------%@",result); | ||
| 359 | + | ||
| 360 | + [Tools setUserLogin:YES]; | ||
| 361 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 362 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 363 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 364 | + | ||
| 365 | + } failure:^(NSDictionary *errorDic) { | ||
| 366 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 367 | + }]; | ||
| 368 | + } | ||
| 314 | } | 369 | } |
| 315 | } | 370 | } |
| 316 | 371 |
CNLiveUserSystemDemo/Views/ThirdPartyView.h
0 → 100644
| 1 | +// | ||
| 2 | +// ThirdPartyView.h | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/11/18. | ||
| 6 | +// Copyright © 2016年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +@protocol ThirdPartyViewDelegate <NSObject> | ||
| 12 | + | ||
| 13 | +- (void)thirdPartyBtnAction:(NSString *)title; | ||
| 14 | + | ||
| 15 | +@optional | ||
| 16 | +- (void)cancelThirdView; | ||
| 17 | + | ||
| 18 | +@end | ||
| 19 | + | ||
| 20 | +@interface ThirdPartyView : UIView | ||
| 21 | + | ||
| 22 | +@property (nonatomic, assign) id<ThirdPartyViewDelegate> delegate; | ||
| 23 | + | ||
| 24 | +- (instancetype)initWithFrame:(CGRect)frame binding:(BOOL)binding; | ||
| 25 | + | ||
| 26 | +@end |
CNLiveUserSystemDemo/Views/ThirdPartyView.m
0 → 100644
| 1 | +// | ||
| 2 | +// ThirdPartyView.m | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/11/18. | ||
| 6 | +// Copyright © 2016年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "ThirdPartyView.h" | ||
| 10 | + | ||
| 11 | +#define SpaceWidth (KScreenWidth-80*3)/4 | ||
| 12 | +@interface ThirdPartyView () | ||
| 13 | + | ||
| 14 | +@property (nonatomic, strong) UIButton *weChatBtn; | ||
| 15 | +@property (nonatomic, strong) UIButton *sinaBtn; | ||
| 16 | +@property (nonatomic, strong) UIButton *qqBtn; | ||
| 17 | +@property (nonatomic, strong) UILabel *thirdpartyLoginLbl; | ||
| 18 | +@property (nonatomic, strong) UIButton *cancelBtn; | ||
| 19 | + | ||
| 20 | +@end | ||
| 21 | + | ||
| 22 | +@implementation ThirdPartyView | ||
| 23 | + | ||
| 24 | +- (instancetype)initWithFrame:(CGRect)frame binding:(BOOL)binding | ||
| 25 | +{ | ||
| 26 | + self = [super initWithFrame:frame]; | ||
| 27 | + if (self) { | ||
| 28 | + self.backgroundColor = [UIColor blackColor]; | ||
| 29 | + [self addSubview:self.sinaBtn]; | ||
| 30 | + [self addSubview:self.qqBtn]; | ||
| 31 | + [self addSubview:self.weChatBtn]; | ||
| 32 | + [self addSubview:self.thirdpartyLoginLbl]; | ||
| 33 | + | ||
| 34 | + if (binding) { | ||
| 35 | + [self addSubview:self.cancelBtn]; | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return self; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +#pragma mark - ****************action****** | ||
| 42 | +- (void)thirdPartyBtnAction:(UIButton *)button | ||
| 43 | +{ | ||
| 44 | + if (self.delegate && [self.delegate respondsToSelector:@selector(thirdPartyBtnAction:)]) { | ||
| 45 | + [self.delegate thirdPartyBtnAction:button.titleLabel.text]; | ||
| 46 | + } | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +- (void)cancelBtnAction | ||
| 50 | +{ | ||
| 51 | + if (self.delegate && [self.delegate respondsToSelector:@selector(cancelThirdView)]) { | ||
| 52 | + [self.delegate cancelThirdView]; | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +#pragma mark - ****************getter****** | ||
| 57 | + | ||
| 58 | +- (UILabel *)thirdpartyLoginLbl | ||
| 59 | +{ | ||
| 60 | + if (!_thirdpartyLoginLbl) { | ||
| 61 | + _thirdpartyLoginLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, KScreenWidth, 15)]; | ||
| 62 | + _thirdpartyLoginLbl.textAlignment = NSTextAlignmentCenter; | ||
| 63 | + _thirdpartyLoginLbl.textColor = [UIColor orangeColor]; | ||
| 64 | + _thirdpartyLoginLbl.text = @"第三方平台"; | ||
| 65 | + _thirdpartyLoginLbl.font = [UIFont systemFontOfSize:15]; | ||
| 66 | + } | ||
| 67 | + return _thirdpartyLoginLbl; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +- (UIButton *)weChatBtn | ||
| 71 | +{ | ||
| 72 | + if (!_weChatBtn) { | ||
| 73 | + _weChatBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 74 | + _weChatBtn.backgroundColor = [UIColor orangeColor]; | ||
| 75 | + [_weChatBtn setFrame:CGRectMake(SpaceWidth, 70, 80, 40)]; | ||
| 76 | + _weChatBtn.layer.cornerRadius = 20; | ||
| 77 | + _weChatBtn.layer.masksToBounds = YES; | ||
| 78 | + [_weChatBtn setTitle:@"微信" forState:UIControlStateNormal]; | ||
| 79 | + [_weChatBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 80 | + } | ||
| 81 | + return _weChatBtn; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +- (UIButton *)sinaBtn | ||
| 85 | +{ | ||
| 86 | + if (!_sinaBtn) { | ||
| 87 | + _sinaBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 88 | + _sinaBtn.backgroundColor = [UIColor orangeColor]; | ||
| 89 | + [_sinaBtn setFrame:CGRectMake(SpaceWidth*2+80, 70, 80, 40)]; | ||
| 90 | + _sinaBtn.layer.cornerRadius = 20; | ||
| 91 | + _sinaBtn.layer.masksToBounds = YES; | ||
| 92 | + [_sinaBtn setTitle:@"微博" forState:UIControlStateNormal]; | ||
| 93 | + [_sinaBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 94 | + } | ||
| 95 | + return _sinaBtn; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +- (UIButton *)qqBtn | ||
| 99 | +{ | ||
| 100 | + if (!_qqBtn) { | ||
| 101 | + _qqBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 102 | + _qqBtn.backgroundColor = [UIColor orangeColor]; | ||
| 103 | + [_qqBtn setFrame:CGRectMake(SpaceWidth*3+80*2, 70, 80, 40)]; | ||
| 104 | + _qqBtn.layer.cornerRadius = 20; | ||
| 105 | + _qqBtn.layer.masksToBounds = YES; | ||
| 106 | + [_qqBtn setTitle:@"QQ" forState:UIControlStateNormal]; | ||
| 107 | + [_qqBtn addTarget:self action:@selector(thirdPartyBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 108 | + } | ||
| 109 | + return _qqBtn; | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +- (UIButton *)cancelBtn | ||
| 113 | +{ | ||
| 114 | + if (!_cancelBtn) { | ||
| 115 | + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 116 | + _cancelBtn.frame = CGRectMake(self.bounds.size.width-30, 10, 20, 20); | ||
| 117 | + [_cancelBtn setBackgroundImage:[UIImage imageNamed:@"cancel"] forState:UIControlStateNormal]; | ||
| 118 | + [_cancelBtn addTarget:self action:@selector(cancelBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 119 | + } | ||
| 120 | + return _cancelBtn; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +@end |
CNLiveUserSystemDemo/cancel.png
0 → 100644
5.67 KB
CNLiveUserSystemSDK.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemSDK/Info.plist
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | <key>CFBundleShortVersionString</key> | 17 | <key>CFBundleShortVersionString</key> |
| 18 | <string>1.1.2</string> | 18 | <string>1.1.2</string> |
| 19 | <key>CFBundleVersion</key> | 19 | <key>CFBundleVersion</key> |
| 20 | - <string>1.1.12.111714</string> | 20 | + <string>1.1.2.112110</string> |
| 21 | <key>NSPrincipalClass</key> | 21 | <key>NSPrincipalClass</key> |
| 22 | <string></string> | 22 | <string></string> |
| 23 | </dict> | 23 | </dict> |
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemCenter.h
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | */ | 22 | */ |
| 23 | + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; | 23 | + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; |
| 24 | 24 | ||
| 25 | + | ||
| 25 | /** | 26 | /** |
| 26 | @abstract 注册 | 27 | @abstract 注册 |
| 27 | @param userName 邮箱或手机 | 28 | @param userName 邮箱或手机 |
| @@ -32,11 +33,12 @@ | @@ -32,11 +33,12 @@ | ||
| 32 | @param success 成功回调 | 33 | @param success 成功回调 |
| 33 | @param failure 失败回调 | 34 | @param failure 失败回调 |
| 34 | */ | 35 | */ |
| 35 | -+ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 36 | ++ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 37 | + | ||
| 36 | 38 | ||
| 37 | /** | 39 | /** |
| 38 | @abstract 第三方登录 | 40 | @abstract 第三方登录 |
| 39 | - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq weibo 3:weixin 4:renren 注:如qq登录,plat=@"2") | 41 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") |
| 40 | @param thirdPartyId 第三方用户ID | 42 | @param thirdPartyId 第三方用户ID |
| 41 | @param nickName 用户昵称 | 43 | @param nickName 用户昵称 |
| 42 | @param gender 性别,m:男、f:女、n:未知(非必填) | 44 | @param gender 性别,m:男、f:女、n:未知(非必填) |
| @@ -46,7 +48,8 @@ | @@ -46,7 +48,8 @@ | ||
| 46 | @param success 成功回调 | 48 | @param success 成功回调 |
| 47 | @param failure 失败回调 | 49 | @param failure 失败回调 |
| 48 | */ | 50 | */ |
| 49 | -+ (void)thirdPartyLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 51 | ++ (void)thirdPartyLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 52 | + | ||
| 50 | 53 | ||
| 51 | /** | 54 | /** |
| 52 | @abstract 快捷登录 | 55 | @abstract 快捷登录 |
| @@ -56,7 +59,8 @@ | @@ -56,7 +59,8 @@ | ||
| 56 | @param success 成功回调 | 59 | @param success 成功回调 |
| 57 | @param failure 失败回调 | 60 | @param failure 失败回调 |
| 58 | */ | 61 | */ |
| 59 | -+ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 62 | ++ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 63 | + | ||
| 60 | 64 | ||
| 61 | /** | 65 | /** |
| 62 | @abstract 登录 | 66 | @abstract 登录 |
| @@ -66,7 +70,8 @@ | @@ -66,7 +70,8 @@ | ||
| 66 | @param success 成功回调 | 70 | @param success 成功回调 |
| 67 | @param failure 失败回调 | 71 | @param failure 失败回调 |
| 68 | */ | 72 | */ |
| 69 | -+ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 73 | ++ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 74 | + | ||
| 70 | 75 | ||
| 71 | /** | 76 | /** |
| 72 | @abstract 发送验证码 | 77 | @abstract 发送验证码 |
| @@ -75,7 +80,8 @@ | @@ -75,7 +80,8 @@ | ||
| 75 | @param success 成功回调 | 80 | @param success 成功回调 |
| 76 | @param failure 失败回调 | 81 | @param failure 失败回调 |
| 77 | */ | 82 | */ |
| 78 | -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 83 | ++ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 84 | + | ||
| 79 | 85 | ||
| 80 | /** | 86 | /** |
| 81 | @abstract 更新用户附加信息 | 87 | @abstract 更新用户附加信息 |
| @@ -84,7 +90,8 @@ | @@ -84,7 +90,8 @@ | ||
| 84 | @param success 成功回调 | 90 | @param success 成功回调 |
| 85 | @param failure 失败回调 | 91 | @param failure 失败回调 |
| 86 | */ | 92 | */ |
| 87 | -+ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 93 | ++ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 94 | + | ||
| 88 | 95 | ||
| 89 | /** | 96 | /** |
| 90 | @abstract 修改用户单项信息 | 97 | @abstract 修改用户单项信息 |
| @@ -94,7 +101,8 @@ | @@ -94,7 +101,8 @@ | ||
| 94 | @param success 成功回调 | 101 | @param success 成功回调 |
| 95 | @param failure 失败回调 | 102 | @param failure 失败回调 |
| 96 | */ | 103 | */ |
| 97 | -+ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 104 | ++ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 105 | + | ||
| 98 | 106 | ||
| 99 | /** | 107 | /** |
| 100 | @abstract 更新手机号 | 108 | @abstract 更新手机号 |
| @@ -104,7 +112,19 @@ | @@ -104,7 +112,19 @@ | ||
| 104 | @param success 成功回调 | 112 | @param success 成功回调 |
| 105 | @param failure 失败回调 | 113 | @param failure 失败回调 |
| 106 | */ | 114 | */ |
| 107 | -+ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 115 | ++ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 116 | + | ||
| 117 | + | ||
| 118 | +/** | ||
| 119 | + @abstract 绑定第三方账号 | ||
| 120 | + @param uid 用户ID | ||
| 121 | + @param plat 第三方平台编号(如platform: 1:sina weibo 2:qq 3:weixin 4:renren 注:如绑定qq,thirdPartyPlat = @"2") | ||
| 122 | + @param thirdPartyId 第三方用户ID | ||
| 123 | + @param success 成功回调 | ||
| 124 | + @param failure 失败回调 | ||
| 125 | + */ | ||
| 126 | ++ (void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | ||
| 127 | + | ||
| 108 | 128 | ||
| 109 | /** | 129 | /** |
| 110 | @abstract 修改密码(通过手机号修改) | 130 | @abstract 修改密码(通过手机号修改) |
| @@ -114,7 +134,8 @@ | @@ -114,7 +134,8 @@ | ||
| 114 | @param success 成功回调 | 134 | @param success 成功回调 |
| 115 | @param failure 失败回调 | 135 | @param failure 失败回调 |
| 116 | */ | 136 | */ |
| 117 | -+ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 137 | ++ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 138 | + | ||
| 118 | 139 | ||
| 119 | /** | 140 | /** |
| 120 | @abstract 上传头像 | 141 | @abstract 上传头像 |
| @@ -123,7 +144,8 @@ | @@ -123,7 +144,8 @@ | ||
| 123 | @param success 成功回调 | 144 | @param success 成功回调 |
| 124 | @param failure 失败回调 | 145 | @param failure 失败回调 |
| 125 | */ | 146 | */ |
| 126 | -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 147 | ++ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 148 | + | ||
| 127 | 149 | ||
| 128 | /** | 150 | /** |
| 129 | @abstract 查询用户信息 | 151 | @abstract 查询用户信息 |
| @@ -132,7 +154,8 @@ | @@ -132,7 +154,8 @@ | ||
| 132 | @param success 成功回调 | 154 | @param success 成功回调 |
| 133 | @param failure 失败回调 | 155 | @param failure 失败回调 |
| 134 | */ | 156 | */ |
| 135 | -+ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 157 | ++ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 158 | + | ||
| 136 | 159 | ||
| 137 | /** | 160 | /** |
| 138 | @abstract 用户反馈 | 161 | @abstract 用户反馈 |
| @@ -141,7 +164,8 @@ | @@ -141,7 +164,8 @@ | ||
| 141 | @param success 成功回调 | 164 | @param success 成功回调 |
| 142 | @param failure 失败回调 | 165 | @param failure 失败回调 |
| 143 | */ | 166 | */ |
| 144 | -+ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 167 | ++ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 168 | + | ||
| 145 | 169 | ||
| 146 | /** | 170 | /** |
| 147 | * 获取SDK版本号 | 171 | * 获取SDK版本号 |
Products/CNLiveUserSystemSDK.framework/Info.plist
No preview for this file type
用户系统.pages
No preview for this file type