From d6e1318ec381a07ab370e72a82fa49c56b92c087 Mon Sep 17 00:00:00 2001 From: chenhui Date: Wed, 28 Jun 2023 15:23:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20getUserProfile=20A?= =?UTF-8?q?PI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Api/MOPButtonOpenTypeDelegate.h | 19 +++++++++++ ios/Classes/Api/MOPButtonOpenTypeDelegate.m | 38 +++++++++++++++++++++ ios/Classes/Api/MOP_registerAppletHandler.m | 2 ++ 3 files changed, 59 insertions(+) create mode 100644 ios/Classes/Api/MOPButtonOpenTypeDelegate.h create mode 100644 ios/Classes/Api/MOPButtonOpenTypeDelegate.m diff --git a/ios/Classes/Api/MOPButtonOpenTypeDelegate.h b/ios/Classes/Api/MOPButtonOpenTypeDelegate.h new file mode 100644 index 0000000..5d0ad87 --- /dev/null +++ b/ios/Classes/Api/MOPButtonOpenTypeDelegate.h @@ -0,0 +1,19 @@ +// +// MOPButtonOpenTypeDelegate.h +// mop +// +// Created by vhcan on 2023/6/28. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MOPButtonOpenTypeDelegate : NSObject + ++ (instancetype)instance; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Api/MOPButtonOpenTypeDelegate.m b/ios/Classes/Api/MOPButtonOpenTypeDelegate.m new file mode 100644 index 0000000..abf65b0 --- /dev/null +++ b/ios/Classes/Api/MOPButtonOpenTypeDelegate.m @@ -0,0 +1,38 @@ +// +// MOPButtonOpenTypeDelegate.m +// mop +// +// Created by vhcan on 2023/6/28. +// + +#import "MOPButtonOpenTypeDelegate.h" +#import "MopPlugin.h" +#import "MopCustomMenuModel.h" +#import +#import + +@implementation MOPButtonOpenTypeDelegate + ++ (instancetype)instance +{ + static MOPButtonOpenTypeDelegate *_instance; + static dispatch_once_t once; + dispatch_once(&once, ^{ + _instance = [[self alloc] init]; + }); + return _instance; +} + +- (BOOL)getUserProfileWithAppletInfo:(FATAppletInfo *)appletInfo + bindGetUserProfile:(void (^)(NSDictionary *result))bindGetUserProfile +{ + FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; + [channel invokeMethod:@"extensionApi:getUserProfile" + arguments:nil + result:^(id result) { + bindGetUserProfile ? bindGetUserProfile(result) : nil; + }]; + return YES; +} + +@end diff --git a/ios/Classes/Api/MOP_registerAppletHandler.m b/ios/Classes/Api/MOP_registerAppletHandler.m index a1a0b63..284c775 100644 --- a/ios/Classes/Api/MOP_registerAppletHandler.m +++ b/ios/Classes/Api/MOP_registerAppletHandler.m @@ -8,6 +8,7 @@ #import "MOP_registerAppletHandler.h" #import "MopPlugin.h" #import "MOPAppletDelegate.h" +#import "MOPButtonOpenTypeDelegate.h" #import @implementation MOP_registerAppletHandler @@ -16,6 +17,7 @@ { NSLog(@"MOP_registerAppletHandler"); [FATClient sharedClient].delegate = [MOPAppletDelegate instance]; + [FATClient sharedClient].buttonOpenTypeDelegate = [MOPButtonOpenTypeDelegate instance]; } @end