添加实名认证

This commit is contained in:
zu
2021-09-23 14:52:12 +08:00
parent 2afb85e8d7
commit 0a3fb5e26e
146 changed files with 9058 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
#import "HttpRequestHelper.h"
#import <Masonry/Masonry.h>
#import <MJExtension/MJExtension.h>
#import <RPSDK/RPSDK.h>
@interface WeakWebViewScriptMessageDelegate : NSObject<WKScriptMessageHandler>
@@ -58,6 +59,7 @@ NSString * const kJSGetUid = @"getUid";
NSString * const kJSGetDeviceId = @"getDeviceId";
NSString * const kJSGetTicket = @"getTicket";
NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
@implementation XPWebViewController
@@ -115,6 +117,27 @@ NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
} else if ([message.name isEqualToString:kJSOpenChargePage]) {
} else if ([message.name isEqualToString:kJSOpenFaceLiveness]) {
NSString *verifyToken = message.body;
#if TARGET_OS_IPHONE
[RPSDK startWithVerifyToken:verifyToken viewController:self.navigationController completion:^(RPResult * _Nonnull auditState) {
NSString *jsStrUrl;
switch (auditState.state) {
case RPStatePass:
jsStrUrl = [NSString stringWithFormat:@"renderByStatus(\"%d\")", 2];
break;
case RPStateFail:
jsStrUrl = [NSString stringWithFormat:@"renderByStatus(\"%d\")", 1];
break;
case RPStateNotVerify:
jsStrUrl = [NSString stringWithFormat:@"renderByStatus(\"%d\")", -1];
break;
}
[self.webview evaluateJavaScript:jsStrUrl completionHandler:^(id _Nullable other, NSError * _Nullable error) {
NSLog(@"%@",error);
}];
}];
#endif
}
}
@@ -267,6 +290,8 @@ NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetTicket];
// info
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetDeviceInfo];
// :
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenFaceLiveness];
}
return _userContentController;