提交 79b44680 authored 作者: wtdu's avatar wtdu

add new logic: support phone number login when Wechat is not installed

上级 4f654846
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array/>
</dict>
</plist>
......@@ -18,4 +18,6 @@
- (void)authByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)stopAuthByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)handAuthByPhoneLogin:(FlutterMethodCall*)call result:(FlutterResult)result;
@end
......@@ -21,6 +21,16 @@ FlutterMethodChannel *_fluwxMethodChannel = nil;
return self;
}
- (void)handAuthByPhoneLogin:(FlutterMethodCall*)call result:(FlutterResult)result{
UIViewController *vc = UIApplication.sharedApplication.keyWindow.rootViewController;
SendAuthReq *authReq = [[SendAuthReq alloc]init];
authReq.scope = @"snsapi_userinfo";
authReq.state = @"123";
[WXApi sendAuthReq:authReq viewController:vc delegate:[FluwxResponseHandler defaultManager] completion:^(BOOL success) {
result(@(success));
}];
}
- (void)handleAuth:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *openId = call.arguments[@"openId"];
......
......@@ -54,6 +54,8 @@ BOOL handleOpenURLByFluwx = YES;
[self handleSubscribeWithCall:call result:result];
} else if ([@"autoDeduct" isEqualToString:call.method]) {
[self handleAutoDeductWithCall:call result:result];
}else if([@"authByPhoneLogin" isEqualToString:call.method]){
[_fluwxAuthHandler handAuthByPhoneLogin:call result:result];
} else if ([call.method hasPrefix:@"share"]) {
[_fluwxShareHandler handleShare:call result:result];
} else {
......@@ -178,6 +180,7 @@ BOOL handleOpenURLByFluwx = YES;
}];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
}
......
......@@ -240,3 +240,7 @@ Future _methodHandler(MethodCall methodCall) {
_weChatResponseEventHandlerController.add(response);
return Future.value();
}
Future<bool> authWechatByPhoneLogin() async{
return await _channel.invokeMethod("authByPhoneLogin");
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论