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

39 lines
1.3 KiB
Dart
Raw 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;
2024-08-21 09:26:56 +08:00
qrcodeRequest.reLaunchMode = [self.reLaunchMode intValue];
2021-12-29 10:11:50 +08:00
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