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

60 lines
1.6 KiB
Dart
Raw Normal View History

2020-04-26 14:57:08 +08:00
//
// MOPAppletDelegate.m
// mop
//
// Created by 康旭耀 on 2020/4/20.
//
#import "MOPAppletDelegate.h"
#import "MopPlugin.h"
@implementation MOPAppletDelegate
2020-04-27 18:55:36 +08:00
+ (instancetype)instance
{
static MOPAppletDelegate *_instance;
static dispatch_once_t once;
dispatch_once(&once, ^{
_instance = [[self alloc] init];
});
return _instance;
}
2020-04-26 14:57:08 +08:00
- (void)forwardAppletWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode, NSDictionary *))completion
{
2020-12-10 17:53:10 +08:00
NSLog(@"forwardAppletWithInfo1:%@",contentInfo);
2020-04-26 14:57:08 +08:00
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
2020-04-27 18:55:36 +08:00
[channel invokeMethod:@"extensionApi:forwardApplet" arguments:@{@"appletInfo":contentInfo} result:^(id _Nullable result) {
2020-04-26 14:57:08 +08:00
if([result isKindOfClass:[FlutterError class]]|| [result isKindOfClass:[FlutterMethodNotImplemented class] ])
{
completion(FATExtensionCodeFailure,nil);
}else
{
completion(FATExtensionCodeSuccess,result);
}
}];
}
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo
{
NSLog(@"getUserInfoWithAppletInfo");
__block NSDictionary *userInfo;
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
[channel invokeMethod:@"extensionApi:getUserInfo" arguments:nil result:^(id _Nullable result) {
2020-05-20 16:20:50 +08:00
userInfo = result;
2020-04-26 14:57:08 +08:00
}];
return userInfo;
}
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInMoreItemAtPath:(NSString *)path
{
return nil;
}
- (void)customMenu:(id<FATAppletMenuProtocol>)customMenu didClickAtPath:(NSString *)path
{
}
@end