Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
2c645693
提交
2c645693
authored
8月 29, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:crashed when send reponse back on iOS
上级
76e3eacf
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
59 行增加
和
21 行删除
+59
-21
AppDelegate.m
example/ios/Runner/AppDelegate.m
+11
-0
pay_page.dart
example/lib/pay_page.dart
+3
-1
share_text_image.dart
example/lib/share_text_image.dart
+6
-1
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+9
-1
FluwxPaymentHandler.m
ios/Classes/handler/FluwxPaymentHandler.m
+2
-2
StringUtil.h
ios/Classes/helper/StringUtil.h
+2
-0
StringUtil.m
ios/Classes/helper/StringUtil.m
+4
-0
FluwxResponseHandler.h
ios/Classes/wechat/FluwxResponseHandler.h
+1
-0
FluwxResponseHandler.m
ios/Classes/wechat/FluwxResponseHandler.m
+20
-16
WXApiRequestHandler.m
ios/Classes/wechat/WXApiRequestHandler.m
+1
-0
没有找到文件。
example/ios/Runner/AppDelegate.m
浏览文件 @
2c645693
...
@@ -17,6 +17,17 @@
...
@@ -17,6 +17,17 @@
}
}
-
(
BOOL
)
application
:(
UIApplication
*
)
application
openURL
:(
NSURL
*
)
url
sourceApplication
:(
NSString
*
)
sourceApplication
annotation
:(
id
)
annotation
{
return
[
WXApi
handleOpenURL
:
url
delegate
:[
FluwxResponseHandler
responseHandler
]];
}
// NOTE: 9.0以后使用新API接口
-
(
BOOL
)
application
:(
UIApplication
*
)
app
openURL
:(
NSURL
*
)
url
options
:(
NSDictionary
<
NSString
*
,
id
>
*
)
options
{
return
[
WXApi
handleOpenURL
:
url
delegate
:[
FluwxResponseHandler
responseHandler
]];
}
-
(
void
)
applicationWillResignActive
:(
UIApplication
*
)
application
{
-
(
void
)
applicationWillResignActive
:(
UIApplication
*
)
application
{
}
}
...
...
example/lib/pay_page.dart
浏览文件 @
2c645693
...
@@ -54,7 +54,9 @@ class _PayPageState extends State<PayPage> {
...
@@ -54,7 +54,9 @@ class _PayPageState extends State<PayPage> {
timeStamp:
result
[
'timestamp'
].
toString
(),
timeStamp:
result
[
'timestamp'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
sign:
result
[
'sign'
].
toString
(),
),
),
);
).
then
((
data
){
print
(
"---》
$data
"
);
});
},
},
child:
const
Text
(
"pay"
),
child:
const
Text
(
"pay"
),
),
),
...
...
example/lib/share_text_image.dart
浏览文件 @
2c645693
...
@@ -15,6 +15,9 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -15,6 +15,9 @@ class _ShareTextPageState extends State<ShareTextPage> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
fluwx
=
new
Fluwx
();
fluwx
=
new
Fluwx
();
fluwx
.
response
.
listen
((
data
){
print
(
data
.
toString
());
});
}
}
@override
@override
...
@@ -84,7 +87,9 @@ class _ShareTextPageState extends State<ShareTextPage> {
...
@@ -84,7 +87,9 @@ class _ShareTextPageState extends State<ShareTextPage> {
fluwx
.
share
(
WeChatShareTextModel
(
fluwx
.
share
(
WeChatShareTextModel
(
text:
_text
,
text:
_text
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
transaction:
"text
${DateTime.now().millisecondsSinceEpoch}
"
,
scene:
scene
));
scene:
scene
)).
then
((
data
){
print
(
data
);
});
// fluwx.sendAuth(WeChatSendAuthModel(scope: "snsapi_userinfo",state: "wechat_sdk_demo_test"));
// fluwx.sendAuth(WeChatSendAuthModel(scope: "snsapi_userinfo",state: "wechat_sdk_demo_test"));
}
}
...
...
ios/Classes/FluwxPlugin.m
浏览文件 @
2c645693
...
@@ -12,6 +12,10 @@
...
@@ -12,6 +12,10 @@
BOOL
isWeChatRegistered
=
NO
;
BOOL
isWeChatRegistered
=
NO
;
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
+
(
void
)
registerWithRegistrar
:
(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
+
(
void
)
registerWithRegistrar
:
(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
...
@@ -31,12 +35,16 @@ BOOL isWeChatRegistered = NO;
...
@@ -31,12 +35,16 @@ BOOL isWeChatRegistered = NO;
_fluwxShareHandler
=
[[
FluwxShareHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxShareHandler
=
[[
FluwxShareHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxAuthHandler
=
[[
FluwxAuthHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxAuthHandler
=
[[
FluwxAuthHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxWXApiHandler
=
[[
FluwxWXApiHandler
alloc
]
init
];
_fluwxWXApiHandler
=
[[
FluwxWXApiHandler
alloc
]
init
];
_fluwxPaymentHandler
=
[[
FluwxPaymentHandler
alloc
]
init
];
_fluwxPaymentHandler
=
[[
FluwxPaymentHandler
alloc
]
initWithRegistrar
:
registrar
];
}
}
return
self
;
return
self
;
}
}
-
(
void
)
handleMethodCall
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
handleMethodCall
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
...
...
ios/Classes/handler/FluwxPaymentHandler.m
浏览文件 @
2c645693
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
@implementation
FluwxPaymentHandler
@implementation
FluwxPaymentHandler
-
(
instancetype
)
initWithRegistrar
{
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
self
=
[
super
init
];
return
self
;
return
self
;
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
NSString
*
nonceStr
=
call
.
arguments
[
@"nonceStr"
];
NSString
*
nonceStr
=
call
.
arguments
[
@"nonceStr"
];
UInt32
timeStamp
=
(
UInt32
)
call
.
arguments
[
@"timeStamp"
];
UInt32
timeStamp
=
(
UInt32
)
call
.
arguments
[
@"timeStamp"
];
NSString
*
sign
=
call
.
arguments
[
@"sign"
];
NSString
*
sign
=
call
.
arguments
[
@"sign"
];
BOOL
done
=
[
WXApiRequestHandler
sendPayment
:
@""
BOOL
done
=
[
WXApiRequestHandler
sendPayment
:
call
.
arguments
[
@"appId"
]
PartnerId
:
partnerId
PartnerId
:
partnerId
PrepayId:
prepayId
PrepayId:
prepayId
NonceStr:
nonceStr
NonceStr:
nonceStr
...
...
ios/Classes/helper/StringUtil.h
浏览文件 @
2c645693
...
@@ -7,4 +7,5 @@
...
@@ -7,4 +7,5 @@
@interface
StringUtil
:
NSObject
@interface
StringUtil
:
NSObject
+
(
BOOL
)
isBlank
:(
NSString
*
)
string
;
+
(
BOOL
)
isBlank
:(
NSString
*
)
string
;
+
(
NSString
*
)
nilToEmpty
:(
NSString
*
)
string
;
@end
@end
\ No newline at end of file
ios/Classes/helper/StringUtil.m
浏览文件 @
2c645693
...
@@ -25,4 +25,7 @@
...
@@ -25,4 +25,7 @@
}
}
-
(
NSString
*
)
nilToEmpty
:(
NSString
*
)
string
{
return
string
==
nil
?
@""
:
string
;
}
@end
@end
\ No newline at end of file
ios/Classes/wechat/FluwxResponseHandler.h
浏览文件 @
2c645693
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#import <Flutter/Flutter.h>
#import <Flutter/Flutter.h>
#import "FluwxKeys.h"
#import "FluwxKeys.h"
#import "WXApi.h"
#import "WXApi.h"
#import "StringUtil.h"
@protocol
WXApiManagerDelegate
<
NSObject
>
@protocol
WXApiManagerDelegate
<
NSObject
>
...
...
ios/Classes/wechat/FluwxResponseHandler.m
浏览文件 @
2c645693
...
@@ -36,7 +36,6 @@ FlutterMethodChannel *methodChannel = nil;
...
@@ -36,7 +36,6 @@ FlutterMethodChannel *methodChannel = nil;
}
}
#pragma mark - WXApiDelegate
#pragma mark - WXApiDelegate
-
(
void
)
onResp
:(
BaseResp
*
)
resp
{
-
(
void
)
onResp
:(
BaseResp
*
)
resp
{
if
([
resp
isKindOfClass
:[
SendMessageToWXResp
class
]])
{
if
([
resp
isKindOfClass
:[
SendMessageToWXResp
class
]])
{
if
(
_delegate
if
(
_delegate
...
@@ -46,14 +45,19 @@ FlutterMethodChannel *methodChannel = nil;
...
@@ -46,14 +45,19 @@ FlutterMethodChannel *methodChannel = nil;
// @{fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyResult: @(done)}
// @{fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyResult: @(done)}
}
}
SendMessageToWXResp
*
messageResp
=
(
SendMessageToWXResp
*
)
resp
;
SendMessageToWXResp
*
messageResp
=
(
SendMessageToWXResp
*
)
resp
;
NSDictionary
*
result
=
@{
NSDictionary
*
result
=
@{
description:
messageResp
.
description
,
description:
messageResp
.
description
==
nil
?
@""
:
messageResp
.
description
,
errStr:
messageResp
.
errStr
,
errStr:
messageResp
.
errStr
==
nil
?
@""
:
messageResp
.
errStr
,
errCode:
@
(
messageResp
.
errCode
),
errCode:
@
(
messageResp
.
errCode
),
type:
@
(
messageResp
.
type
),
type:
messageResp
.
type
==
nil
?
@2
:
@
(
messageResp
.
type
),
country:
messageResp
.
country
,
country:
messageResp
.
country
==
nil
?
@""
:
messageResp
.
country
,
lang:
messageResp
.
lang
,
lang:
messageResp
.
lang
==
nil
?
@""
:
messageResp
.
lang
,
fluwxKeyPlatform:
fluwxKeyIOS
fluwxKeyPlatform:
fluwxKeyIOS
};
};
[
methodChannel
invokeMethod
:
@"onShareResponse"
arguments
:
result
];
[
methodChannel
invokeMethod
:
@"onShareResponse"
arguments
:
result
];
...
@@ -70,15 +74,15 @@ FlutterMethodChannel *methodChannel = nil;
...
@@ -70,15 +74,15 @@ FlutterMethodChannel *methodChannel = nil;
SendAuthResp
*
authResp
=
(
SendAuthResp
*
)
resp
;
SendAuthResp
*
authResp
=
(
SendAuthResp
*
)
resp
;
NSDictionary
*
result
=
@{
NSDictionary
*
result
=
@{
description:
authResp
.
description
,
description:
authResp
.
description
==
nil
?
@""
:
authResp
.
description
,
errStr:
authResp
.
errStr
,
errStr:
authResp
.
errStr
==
nil
?
@""
:
authResp
.
errStr
,
errCode:
@
(
authResp
.
errCode
),
errCode:
@
(
authResp
.
errCode
),
type:
@
(
authResp
.
type
),
type:
authResp
.
type
==
nil
?
@1
:
@
(
authResp
.
type
),
country:
authResp
.
country
,
country:
authResp
.
country
==
nil
?
@""
:
authResp
.
country
,
lang:
authResp
.
lang
,
lang:
authResp
.
lang
==
nil
?
@""
:
authResp
.
lang
,
fluwxKeyPlatform:
fluwxKeyIOS
,
fluwxKeyPlatform:
fluwxKeyIOS
,
@"code"
:
authResp
.
code
,
@"code"
:
[
StringUtil
nilToEmpty
:
authResp
.
code
]
,
@"state"
:
authResp
.
state
@"state"
:
[
StringUtil
nilToEmpty
:
authResp
.
state
]
};
};
[
methodChannel
invokeMethod
:
@"onAuthResponse"
arguments
:
result
];
[
methodChannel
invokeMethod
:
@"onAuthResponse"
arguments
:
result
];
...
@@ -131,10 +135,10 @@ FlutterMethodChannel *methodChannel = nil;
...
@@ -131,10 +135,10 @@ FlutterMethodChannel *methodChannel = nil;
PayResp
*
payResp
=
(
PayResp
*
)
resp
;
PayResp
*
payResp
=
(
PayResp
*
)
resp
;
NSDictionary
*
result
=
@{
NSDictionary
*
result
=
@{
description:
payResp
.
description
,
description:
[
StringUtil
nilToEmpty
:
payResp
.
description
]
,
errStr:
payResp
.
errStr
,
errStr:
[
StringUtil
nilToEmpty
:
resp
.
errStr
]
,
errCode:
@
(
payResp
.
errCode
),
errCode:
@
(
payResp
.
errCode
),
type:
@
(
payResp
.
type
),
type:
payResp
.
type
==
nil
?
@5
:
@
(
payResp
.
type
),
fluwxKeyPlatform:
fluwxKeyIOS
,
fluwxKeyPlatform:
fluwxKeyIOS
,
};
};
[
methodChannel
invokeMethod
:
@"onAuthResponse"
arguments
:
result
];
[
methodChannel
invokeMethod
:
@"onAuthResponse"
arguments
:
result
];
...
...
ios/Classes/wechat/WXApiRequestHandler.m
浏览文件 @
2c645693
...
@@ -382,6 +382,7 @@
...
@@ -382,6 +382,7 @@
+
(
BOOL
)
sendPayment
:(
NSString
*
)
appId
PartnerId
:(
NSString
*
)
partnerId
PrepayId
:(
NSString
*
)
prepayId
NonceStr
:(
NSString
*
)
nonceStr
Timestamp
:(
UInt32
)
timestamp
Package
:(
NSString
*
)
package
Sign
:(
NSString
*
)
sign
{
+
(
BOOL
)
sendPayment
:(
NSString
*
)
appId
PartnerId
:(
NSString
*
)
partnerId
PrepayId
:(
NSString
*
)
prepayId
NonceStr
:(
NSString
*
)
nonceStr
Timestamp
:(
UInt32
)
timestamp
Package
:(
NSString
*
)
package
Sign
:(
NSString
*
)
sign
{
PayReq
*
req
=
[[
PayReq
alloc
]
init
];
PayReq
*
req
=
[[
PayReq
alloc
]
init
];
req
.
openID
=
(
appId
==
(
id
)
[
NSNull
null
])
?
nil
:
appId
;
req
.
partnerId
=
partnerId
;
req
.
partnerId
=
partnerId
;
req
.
prepayId
=
prepayId
;
req
.
prepayId
=
prepayId
;
req
.
nonceStr
=
nonceStr
;
req
.
nonceStr
=
nonceStr
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论