123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //
- // UserLoginPhoneViewController.m
- // XenonSDK
- //
- // Created by SAGESSE on 2019/5/29.
- // Copyright © 2019 SAGESSE. All rights reserved.
- //
- #import "XenonSDK.h"
- #import "UserLoginPhoneViewController.h"
- @interface UserLoginPhoneViewController ()
- @end
- @implementation UserLoginPhoneViewController
- - (NSInteger)smsType {
- return 3;
- }
- - (void)automatic:(NSString*)phone {
- // If no button is retrieved, failure.
- [self loadViewIfNeeded];
-
- // Automatic data entry.
- self.phoneTextField.text = phone;
- //self.securityCode(forPrepare: button)
- }
- - (void)securityCodeForVerify:(id)sender {
- [super securityCodeForVerify:sender];
-
- // Must enter phone.
- NSString* phone = self.phoneTextField.text;
- if (phone.length == 0) {
- [XSNetwork showHudFailure:@"请输入手机号"];
- return;
- }
-
- if (!sdk_verifyPhone(phone)) {
- [XSNetwork showHudFailure:@"请输入正确的手机号格式"];
- return;
- }
-
- NSString* code = self.securityCodeTextField.text;
- if (code.length == 0) {
- [XSNetwork showHudFailure:@"请输入验证码"];
- return;
- }
-
- [XSNetwork showHudLoading];
- [XSNetwork loginWithPhone:phone code:code complete:^(id object, NSError *error) {
-
- if (error != nil) {
- [XSNetwork showHudFailure:error];
- return;
- }
-
- if (XenonSDK.sharedSDK.sdk_loginCallback) {
- XenonSDK.sharedSDK.sdk_loginCallback(object);
- }
- }];
- }
- @end
|