From 8837bd5614a103983eff6d7fe8d25149e97fdb69 Mon Sep 17 00:00:00 2001 From: wanghualei Date: Wed, 29 Dec 2021 10:11:50 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E4=BA=8C=E7=BB=B4=E7=A0=81=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=B0=8F=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/.flutter-plugins-dependencies | 2 +- .../contents.xcworkspacedata | 2 +- ios/Classes/Api/MOP_qrcodeOpenApplet.h | 18 +++++++++ ios/Classes/Api/MOP_qrcodeOpenApplet.m | 37 +++++++++++++++++++ ios/mop.podspec | 4 +- lib/mop.dart | 5 +++ 6 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 ios/Classes/Api/MOP_qrcodeOpenApplet.h create mode 100644 ios/Classes/Api/MOP_qrcodeOpenApplet.m diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 438deb6..ec9321b 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-11-15 23:44:20.482386","version":"2.2.2"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/haley/Documents/Finogeeks/Gitlab/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/haley/Documents/Finogeeks/Gitlab/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-12-29 10:07:33.662750","version":"2.3.0-1.0.pre.169"} \ No newline at end of file diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Classes/Api/MOP_qrcodeOpenApplet.h b/ios/Classes/Api/MOP_qrcodeOpenApplet.h new file mode 100644 index 0000000..f9fdbf0 --- /dev/null +++ b/ios/Classes/Api/MOP_qrcodeOpenApplet.h @@ -0,0 +1,18 @@ +// +// MOP_scanOpenApplet.h +// mop +// +// Created by beetle_92 on 2021/6/7. +// + +#import "MOPBaseApi.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MOP_qrcodeOpenApplet : MOPBaseApi + +@property (nonatomic,copy) NSString *qrcode; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Api/MOP_qrcodeOpenApplet.m b/ios/Classes/Api/MOP_qrcodeOpenApplet.m new file mode 100644 index 0000000..527e5ea --- /dev/null +++ b/ios/Classes/Api/MOP_qrcodeOpenApplet.m @@ -0,0 +1,37 @@ +// +// MOP_scanOpenApplet.m +// mop +// +// Created by beetle_92 on 2021/6/7. +// + +#import "MOP_qrcodeOpenApplet.h" +#import "MOPTools.h" +#import + +@implementation MOP_qrcodeOpenApplet + +- (void)setupApiWithSuccess:(void (^)(NSDictionary * _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 { + failure(error.description); + } + } closeCompletion:^{ + NSLog(@"关闭"); + }]; + }); + +} + +@end diff --git a/ios/mop.podspec b/ios/mop.podspec index 4c79944..59e3ab1 100644 --- a/ios/mop.podspec +++ b/ios/mop.podspec @@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk. s.dependency 'Flutter' s.ios.deployment_target = '9.0' - s.dependency 'FinApplet' , '2.34.12' - s.dependency 'FinAppletExt' , '2.34.12' + s.dependency 'FinApplet' , '2.35.0-alpha20211229v02' + s.dependency 'FinAppletExt' , '2.35.0-alpha20211229v02' end diff --git a/lib/mop.dart b/lib/mop.dart index 8c08066..2dd8e92 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -178,6 +178,11 @@ class Mop { return await _channel.invokeMapMethod("scanOpenApplet", params); } + Future qrcodeOpenApplet(String qrcode) async { + Map params = {'qrcode': qrcode}; + return await _channel.invokeMapMethod("qrcodeOpenApplet", params); + } + /// /// 根据微信QrCode信息解析小程序信息 ///