小程序代理配置
parent
717507f7ea
commit
b860cb8a93
|
@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@interface MOPAppletDelegate : NSObject<FATAppletDelegate>
|
||||
|
||||
+ (instancetype)instance;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -10,11 +10,21 @@
|
|||
|
||||
@implementation MOPAppletDelegate
|
||||
|
||||
+ (instancetype)instance
|
||||
{
|
||||
static MOPAppletDelegate *_instance;
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once, ^{
|
||||
_instance = [[self alloc] init];
|
||||
});
|
||||
return _instance;
|
||||
}
|
||||
|
||||
- (void)forwardAppletWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode, NSDictionary *))completion
|
||||
{
|
||||
NSLog(@"forwardAppletWithInfo:%@",contentInfo);
|
||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||
[channel invokeMethod:@"extensionApi:forwardApplet" arguments:contentInfo result:^(id _Nullable result) {
|
||||
[channel invokeMethod:@"extensionApi:forwardApplet" arguments:@{@"appletInfo":contentInfo} result:^(id _Nullable result) {
|
||||
if([result isKindOfClass:[FlutterError class]]|| [result isKindOfClass:[FlutterMethodNotImplemented class] ])
|
||||
{
|
||||
completion(FATExtensionCodeFailure,nil);
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
|
||||
{
|
||||
NSLog(@"MOP_registerAppletHandler");
|
||||
[[FATClient sharedClient] setDelegate:[[MOPAppletDelegate alloc] init]];
|
||||
|
||||
[FATClient sharedClient].delegate = [MOPAppletDelegate instance];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue