mop-flutter-sdk/ios/Classes/Api/MOP_qrcodeOpenApplet.m

38 lines
1.2 KiB
Dart
Raw Permalink Normal View History

2021-12-29 10:11:50 +08:00
//
// MOP_scanOpenApplet.m
// mop
//
// Created by beetle_92 on 2021/6/7.
//
#import "MOP_qrcodeOpenApplet.h"
#import "MOPTools.h"
#import <FinApplet/FinApplet.h>
@implementation MOP_qrcodeOpenApplet
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel {
NSLog(@"MOP_qrcodeOpenApplet:%@", self.qrcode);
FATAppletQrCodeRequest *qrcodeRequest = [[FATAppletQrCodeRequest alloc] init];
qrcodeRequest.qrCode = self.qrcode;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIViewController *currentVC = [MOPTools topViewController];
[[FATClient sharedClient] startAppletWithQrCodeRequest:qrcodeRequest inParentViewController:currentVC requestBlock:^(BOOL result, FATError *error) {
NSLog(@"请求完成:%@", error);
} completion:^(BOOL result, FATError *error) {
NSLog(@"打开完成:%@", error);
if (result){
success(@{});
} else {
2022-08-10 15:56:53 +08:00
failure(error.localizedDescription);
2021-12-29 10:11:50 +08:00
}
} closeCompletion:^{
NSLog(@"关闭");
}];
});
}
@end