提交 44871968 authored 作者: Charley's avatar Charley

iOS主动拉取信息

上级 7b49a11b
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
#import "FluwxAuthHandler.h" #import "FluwxAuthHandler.h"
#import "FluwxShareHandler.h" #import "FluwxShareHandler.h"
@interface FluwxPlugin()<WXApiManagerDelegate>
@property (strong,nonatomic)NSString *extMsg;
@end
@implementation FluwxPlugin @implementation FluwxPlugin
FluwxAuthHandler *_fluwxAuthHandler; FluwxAuthHandler *_fluwxAuthHandler;
FluwxShareHandler *_fluwxShareHandler; FluwxShareHandler *_fluwxShareHandler;
...@@ -23,6 +27,7 @@ FlutterMethodChannel *channel = nil; ...@@ -23,6 +27,7 @@ FlutterMethodChannel *channel = nil;
FluwxPlugin *instance = [[FluwxPlugin alloc] initWithRegistrar:registrar methodChannel:channel]; FluwxPlugin *instance = [[FluwxPlugin alloc] initWithRegistrar:registrar methodChannel:channel];
[registrar addMethodCallDelegate:instance channel:channel]; [registrar addMethodCallDelegate:instance channel:channel];
[[FluwxResponseHandler defaultManager] setMethodChannel:channel]; [[FluwxResponseHandler defaultManager] setMethodChannel:channel];
[registrar addApplicationDelegate:instance]; [registrar addApplicationDelegate:instance];
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
} }
...@@ -35,8 +40,8 @@ FlutterMethodChannel *channel = nil; ...@@ -35,8 +40,8 @@ FlutterMethodChannel *channel = nil;
if (self) { if (self) {
_fluwxAuthHandler = [[FluwxAuthHandler alloc] initWithRegistrar:registrar methodChannel:flutterMethodChannel]; _fluwxAuthHandler = [[FluwxAuthHandler alloc] initWithRegistrar:registrar methodChannel:flutterMethodChannel];
_fluwxShareHandler = [[FluwxShareHandler alloc] initWithRegistrar:registrar]; _fluwxShareHandler = [[FluwxShareHandler alloc] initWithRegistrar:registrar];
[FluwxResponseHandler defaultManager].delegate = self;
} }
return self; return self;
} }
...@@ -65,6 +70,8 @@ FlutterMethodChannel *channel = nil; ...@@ -65,6 +70,8 @@ FlutterMethodChannel *channel = nil;
[self handleAutoDeductWithCall:call result:result]; [self handleAutoDeductWithCall:call result:result];
}else if([@"authByPhoneLogin" isEqualToString:call.method]){ }else if([@"authByPhoneLogin" isEqualToString:call.method]){
[_fluwxAuthHandler handleAuthByPhoneLogin:call result:result]; [_fluwxAuthHandler handleAuthByPhoneLogin:call result:result];
}else if([@"getExtMsg" isEqualToString:call.method]){
[self handelGetExtMsgWithCall:call result:result];
} else if ([call.method hasPrefix:@"share"]) { } else if ([call.method hasPrefix:@"share"]) {
[_fluwxShareHandler handleShare:call result:result]; [_fluwxShareHandler handleShare:call result:result];
} else { } else {
...@@ -189,6 +196,10 @@ FlutterMethodChannel *channel = nil; ...@@ -189,6 +196,10 @@ FlutterMethodChannel *channel = nil;
}]; }];
} }
- (void)handelGetExtMsgWithCall:(FlutterMethodCall *)call result:(FlutterResult)result {
result(self.extMsg);
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]]; return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
...@@ -216,4 +227,8 @@ FlutterMethodChannel *channel = nil; ...@@ -216,4 +227,8 @@ FlutterMethodChannel *channel = nil;
} }
} }
- (void)managerDidRecvLaunchFromWXReq:(LaunchFromWXReq *)request {
self.extMsg = request.message.messageExt;
}
@end @end
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论