Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
ac270724
提交
ac270724
authored
8月 23, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
send auth
上级
69a62e0d
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
86 行增加
和
31 行删除
+86
-31
FluwxPlugin.kt
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
+2
-2
FluwxAuthHandler.kt
.../main/kotlin/com/jarvan/fluwx/handler/FluwxAuthHandler.kt
+3
-5
WXEntryActivity.java
...kotlin/com/jarvan/fluwxexample/wxapi/WXEntryActivity.java
+0
-1
AppDelegate.h
example/ios/Runner/AppDelegate.h
+1
-0
AppDelegate.m
example/ios/Runner/AppDelegate.m
+1
-0
FluwxPlugin.h
ios/Classes/FluwxPlugin.h
+3
-1
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+20
-16
FluwxAuthHandler.h
ios/Classes/handler/FluwxAuthHandler.h
+22
-0
FluwxAuthHandler.m
ios/Classes/handler/FluwxAuthHandler.m
+27
-0
FluwxShareHandler.h
ios/Classes/handler/FluwxShareHandler.h
+1
-2
WXApiRequestHandler.h
ios/Classes/wechat/WXApiRequestHandler.h
+1
-0
WXApiRequestHandler.m
ios/Classes/wechat/WXApiRequestHandler.m
+1
-2
wechat_send_auth_model.dart
lib/src/models/wechat_send_auth_model.dart
+4
-2
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
浏览文件 @
ac270724
...
...
@@ -2,7 +2,7 @@ package com.jarvan.fluwx
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.constant.WeChatPluginMethods.IS_WE_CHAT_INSTALLED
import
com.jarvan.fluwx.handler.Fluwx
Login
Handler
import
com.jarvan.fluwx.handler.Fluwx
Auth
Handler
import
com.jarvan.fluwx.handler.FluwxResponseHandler
import
com.jarvan.fluwx.handler.FluwxShareHandler
import
com.jarvan.fluwx.handler.WXAPiHandler
...
...
@@ -44,7 +44,7 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
}
if
(
"sendAuth"
==
call
.
method
)
{
Fluwx
Login
Handler
.
sendAuth
(
call
,
result
)
Fluwx
Auth
Handler
.
sendAuth
(
call
,
result
)
return
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/Fluwx
Login
Handler.kt
→
android/src/main/kotlin/com/jarvan/fluwx/handler/Fluwx
Auth
Handler.kt
浏览文件 @
ac270724
package
com.jarvan.fluwx.handler
import
com.jarvan.fluwx.constant.WechatPluginKeys
import
com.tencent.mm.opensdk.modelmsg.SendAuth
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
internal
object
Fluwx
Login
Handler
{
internal
object
Fluwx
Auth
Handler
{
fun
sendAuth
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
val
req
=
SendAuth
.
Req
()
req
.
scope
=
call
.
argument
(
"scope"
)
req
.
state
=
call
.
argument
(
"state"
)
req
.
openId
=
call
.
argument
(
"openId"
)
result
.
success
(
WXAPiHandler
.
wxApi
?.
sendReq
(
req
))
}
fun
hehe
(){
}
}
\ No newline at end of file
example/android/app/src/main/kotlin/com/jarvan/fluwxexample/wxapi/WXEntryActivity.java
浏览文件 @
ac270724
...
...
@@ -5,7 +5,6 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.widget.Button
;
import
com.jarvan.fluwx.handler.FluwxLoginHandler
;
import
com.tencent.mm.opensdk.modelbase.BaseReq
;
import
com.tencent.mm.opensdk.modelbase.BaseResp
;
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
;
...
...
example/ios/Runner/AppDelegate.h
浏览文件 @
ac270724
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
#import "FluwxShareHandler.h"
@interface
AppDelegate
:
FlutterAppDelegate
...
...
example/ios/Runner/AppDelegate.m
浏览文件 @
ac270724
...
...
@@ -8,6 +8,7 @@
didFinishLaunchingWithOptions
:(
NSDictionary
*
)
launchOptions
{
[
GeneratedPluginRegistrant
registerWithRegistry
:
self
];
// Override point for customization after application launch.
return
[
super
application
:
application
didFinishLaunchingWithOptions
:
launchOptions
];
}
...
...
ios/Classes/FluwxPlugin.h
浏览文件 @
ac270724
...
...
@@ -3,7 +3,7 @@
#import "FluwxKeys.h"
@class
FluwxShareHandler
;
@class
FluwxResponseHandler
;
@class
FluwxAuthHandler
;
extern
BOOL
isWeChatRegistered
;
...
...
@@ -12,6 +12,8 @@ extern BOOL isWeChatRegistered;
@private
FluwxShareHandler
*
_fluwxShareHandler
;
@private
FluwxAuthHandler
*
_fluwxAuthHandler
;
}
@end
ios/Classes/FluwxPlugin.m
浏览文件 @
ac270724
...
...
@@ -5,6 +5,7 @@
#import "../../../../../../ios/Classes/handler/FluwxShareHandler.h"
#import "ImageSchema.h"
#import "FluwxResponseHandler.h"
#import "FluwxAuthHandler.h"
@implementation
FluwxPlugin
...
...
@@ -24,10 +25,11 @@ BOOL isWeChatRegistered = NO;
}
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
if
(
self
)
{
_fluwxShareHandler
=
[[
FluwxShareHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxAuthHandler
=
[[
FluwxAuthHandler
alloc
]
initWithRegistrar
:
registrar
];
}
return
self
;
...
...
@@ -41,12 +43,18 @@ BOOL isWeChatRegistered = NO;
return
;
}
if
([
unregisterApp
isEqualToString
:
call
.
method
])
{
[
self
initWeChatIfNeeded
:
call
result
:
result
];
return
;
}
if
([
unregisterApp
isEqualToString
:
call
.
method
])
{
[
self
initWeChatIfNeeded
:
call
result
:
result
];
return
;
}
if
([
call
.
method
hasPrefix
:
@"share"
])
{
if
([
@"sendAuth"
isEqualToString
:
call
.
method
]){
[
_fluwxAuthHandler
handleAuth
:
call
result
:
result
];
return
;
}
if
([
call
.
method
hasPrefix
:
@"share"
])
{
[
_fluwxShareHandler
handleShare
:
call
result
:
result
];
return
;
}
else
{
...
...
@@ -54,21 +62,18 @@ BOOL isWeChatRegistered = NO;
}
}
-
(
void
)
initWeChatIfNeeded
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
(
!
call
.
arguments
[
fluwxKeyIOS
])
{
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@NO
});
if
(
!
call
.
arguments
[
fluwxKeyIOS
])
{
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@NO
});
return
;
}
if
(
isWeChatRegistered
)
{
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@YES
});
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@YES
});
return
;
}
...
...
@@ -80,15 +85,14 @@ BOOL isWeChatRegistered = NO;
isWeChatRegistered
=
[
WXApi
registerApp
:
appId
];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
isWeChatRegistered
)});
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
isWeChatRegistered
)});
}
-
(
void
)
unregisterApp
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
isWeChatRegistered
=
false
;
result
(
@YES
);
isWeChatRegistered
=
false
;
result
(
@YES
);
}
@end
ios/Classes/handler/FluwxAuthHandler.h
0 → 100644
浏览文件 @
ac270724
//
// Created by mo on 2018/8/23.
//
#import <Foundation/Foundation.h>
#import "CallResults.h"
#import "WXApiRequestHandler.h"
#import "FluwxKeys.h"
#import "StringToWeChatScene.h"
#import "WXApi.h"
#import "FluwxMethods.h"
#import <Flutter/Flutter.h>
#import "FluwxPlugin.h"
#import "ThumbnailHelper.h"
#import "NSStringWrapper.h"
@class
StringUtil
;
@interface
FluwxAuthHandler
:
NSObject
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
;
-
(
void
)
handleAuth
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
\ No newline at end of file
ios/Classes/handler/FluwxAuthHandler.m
0 → 100644
浏览文件 @
ac270724
//
// Created by mo on 2018/8/23.
//
#import "FluwxAuthHandler.h"
@implementation
FluwxAuthHandler
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
// if (self) {
//
// }
return
self
;
}
-
(
void
)
handleAuth
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
[
WXApiRequestHandler
sendAuthRequestScope
:
call
.
arguments
[
@"scope"
]
State
:
call
.
arguments
[
@"state"
]
OpenID:
call
.
arguments
[
@"openId"
]
InViewController:
nil
];
}
@end
\ No newline at end of file
ios/Classes/handler/FluwxShareHandler.h
浏览文件 @
ac270724
...
...
@@ -18,4 +18,4 @@
@interface
FluwxShareHandler
:
NSObject
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
;
-
(
void
)
handleShare
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
\ No newline at end of file
@end
ios/Classes/wechat/WXApiRequestHandler.h
浏览文件 @
ac270724
...
...
@@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
#import "WXApiObject.h"
#import "StringUtil.h"
#import "FluwxResponseHandler.h"
@interface
WXApiRequestHandler
:
NSObject
...
...
ios/Classes/wechat/WXApiRequestHandler.m
浏览文件 @
ac270724
...
...
@@ -9,7 +9,6 @@
#import <Foundation/Foundation.h>
#import "WXApi.h"
#import "WXApiRequestHandler.h"
#import "WXApiManager.h"
#import "SendMessageToWXReq+requestWithTextOrMediaMessage.h"
#import "WXMediaMessage+messageConstruct.h"
...
...
@@ -319,7 +318,7 @@
return
[
WXApi
sendAuthReq
:
req
viewController
:
viewController
delegate:
[
WXApiManager
sharedManag
er
]];
delegate:
[
FluwxResponseHandler
responseHandl
er
]];
}
+
(
BOOL
)
openProfileWithAppID
:(
NSString
*
)
appID
...
...
lib/src/models/wechat_send_auth_model.dart
浏览文件 @
ac270724
class
WeChatSendAuthModel
{
final
String
scope
;
final
String
state
;
final
String
openId
;
WeChatSendAuthModel
(
this
.
scope
,
this
.
state
)
:
WeChatSendAuthModel
(
this
.
scope
,
this
.
state
,
this
.
openId
)
:
assert
(
scope
!=
null
&&
scope
.
trim
()
.
isNotEmpty
);
...
...
@@ -10,7 +11,8 @@ class WeChatSendAuthModel {
Map
toMap
()
{
return
{
"scope"
:
scope
,
"state"
:
state
"state"
:
state
,
"openId"
:
openId
};
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论