【feature】注册时支持短信验证码
This commit is contained in:
@@ -90,6 +90,17 @@ typedef void(^kanHuShangJia)(CertificationShopModel*kanHuShangJia);
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *err))result;
|
||||
|
||||
/**
|
||||
* 获取验证码 SMS
|
||||
*
|
||||
* @param timeBtn 验证码按钮
|
||||
* @param zone 区域号,不要加"+"号(Area code)
|
||||
* @param isTextCode 是否为短信验证码
|
||||
*/
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *err))result;
|
||||
|
||||
|
||||
/**
|
||||
* 注册
|
||||
|
||||
@@ -177,12 +177,12 @@
|
||||
addPhoneNumber:(NSString*)phoneNumber
|
||||
addSendType:(NSString*)sendType
|
||||
backData:(backVerifyCode)backVerifyCodeblock{
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
|
||||
[self getverifyWithTimerButton:timeBtn addphoneNumber:phoneNumber AddSendType:sendType backData:backVerifyCodeblock];
|
||||
|
||||
}
|
||||
#pragma mark 倒计时
|
||||
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber{
|
||||
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber timeBtnFinalTitle:(NSString *)title{
|
||||
|
||||
__block int timeout=60; //倒计时时间
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
|
||||
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
@@ -232,7 +232,7 @@
|
||||
dispatch_source_cancel(_timer1);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
@@ -311,11 +311,42 @@
|
||||
#pragma mark - SMS 新
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *err))result
|
||||
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *))result
|
||||
|
||||
{
|
||||
NSString *title = isTextCode ? @"短信验证码" : @"语音验证码";
|
||||
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:title];
|
||||
|
||||
[SMSSDK getVerificationCodeByMethod:isTextCode ? SMSGetCodeMethodSMS : SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
|
||||
|
||||
if (!error) {
|
||||
NSLog(@"获取验证码成功");
|
||||
|
||||
} else {
|
||||
NSLog(@"错误信息:%@",error);
|
||||
dispatch_source_cancel(_timer1);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
|
||||
});
|
||||
[self showTitle:@"" messsage:@"获取验证失败"];
|
||||
|
||||
}
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *))result
|
||||
|
||||
{
|
||||
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
|
||||
|
||||
[SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user