Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
5d1b34d2
提交
5d1b34d2
authored
10月 24, 2019
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename functions
上级
296c957c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
203 行增加
和
0 行删除
+203
-0
fluwx_iml.dart
lib/src/fluwx_iml.dart
+203
-0
没有找到文件。
lib/src/fluwx_iml.dart
浏览文件 @
5d1b34d2
...
...
@@ -154,6 +154,7 @@ Future registerWxApi(
}
///we don't need the response any longer if params are true.
@Deprecated
(
"use closeFluwxStreams instead"
)
void
dispose
(
{
shareResponse:
true
,
authResponse:
true
,
...
...
@@ -191,6 +192,44 @@ void dispose({
}
}
///we don't need the response any longer if params are true.
void
closeFluwxStreams
(
{
shareResponse:
true
,
authResponse:
true
,
paymentResponse:
true
,
launchMiniProgramResponse:
true
,
onAuthByQRCodeFinished:
true
,
onAuthGotQRCode:
true
,
onQRCodeScanned:
true
,
})
{
if
(
shareResponse
)
{
_responseShareController
.
close
();
}
if
(
authResponse
)
{
_responseAuthController
.
close
();
}
if
(
launchMiniProgramResponse
)
{
_responseLaunchMiniProgramController
.
close
();
}
if
(
paymentResponse
)
{
_responsePaymentController
.
close
();
}
if
(
onAuthByQRCodeFinished
)
{
_authByQRCodeFinishedController
.
close
();
}
if
(
onAuthGotQRCode
)
{
_onAuthGotQRCodeController
.
close
();
}
if
(
onQRCodeScanned
)
{
_onQRCodeScannedController
.
close
();
}
}
// static Future unregisterApp(RegisterModel model) async {
// return await _channel.invokeMethod("unregisterApp", model.toMap());
// }
...
...
@@ -201,6 +240,7 @@ void dispose({
///[WeChatShareVideoModel]
///[WeChatShareMusicModel]
///[WeChatShareImageModel]
@Deprecated
(
"use shareToWeChat instead"
)
Future
share
(
WeChatShareModel
model
)
async
{
if
(
_shareModelMethodMapper
.
containsKey
(
model
.
runtimeType
))
{
return
await
_channel
.
invokeMethod
(
...
...
@@ -210,6 +250,21 @@ Future share(WeChatShareModel model) async {
}
}
///the [WeChatShareModel] can not be null
///see [WeChatShareWebPageModel]
/// [WeChatShareTextModel]
///[WeChatShareVideoModel]
///[WeChatShareMusicModel]
///[WeChatShareImageModel]
Future
shareToWeChat
(
WeChatShareModel
model
)
async
{
if
(
_shareModelMethodMapper
.
containsKey
(
model
.
runtimeType
))
{
return
await
_channel
.
invokeMethod
(
_shareModelMethodMapper
[
model
.
runtimeType
],
model
.
toMap
());
}
else
{
return
Future
.
error
(
"no method mapper found[
${model.runtimeType}
]"
);
}
}
/// The WeChat-Login is under Auth-2.0
/// This method login with native WeChat app.
/// For users without WeChat app, please use [authByQRCode] instead
...
...
@@ -217,6 +272,7 @@ Future share(WeChatShareModel model) async {
/// Once AuthCode got, you need to request Access_Token
/// For more information please visit:
/// * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317851&token=
@Deprecated
(
"use sendWeChatAuth instead"
)
Future
sendAuth
(
{
String
openId
,
@required
String
scope
,
String
state
})
async
{
// "scope": scope, "state": state, "openId": openId
...
...
@@ -225,11 +281,27 @@ Future sendAuth({String openId, @required String scope, String state}) async {
"sendAuth"
,
{
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
});
}
/// The WeChat-Login is under Auth-2.0
/// This method login with native WeChat app.
/// For users without WeChat app, please use [authByQRCode] instead
/// This method only supports getting AuthCode,this is first step to login with WeChat
/// Once AuthCode got, you need to request Access_Token
/// For more information please visit:
/// * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317851&token=
Future
sendWeChatAuth
(
{
String
openId
,
@required
String
scope
,
String
state
})
async
{
// "scope": scope, "state": state, "openId": openId
assert
(
scope
!=
null
&&
scope
.
trim
().
isNotEmpty
);
return
await
_channel
.
invokeMethod
(
"sendAuth"
,
{
"scope"
:
scope
,
"state"
:
state
,
"openId"
:
openId
});
}
/// Sometimes WeChat is not installed on users's devices.However we can
/// request a QRCode so that we can get AuthCode by scanning the QRCode
/// All required params must not be null or empty
/// [schemeData] only works on iOS
/// see * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN
@Deprecated
(
"use authWeChatByQRCode instead"
)
Future
authByQRCode
(
{
@required
String
appId
,
@required
String
scope
,
...
...
@@ -253,13 +325,50 @@ Future authByQRCode(
});
}
/// Sometimes WeChat is not installed on users's devices.However we can
/// request a QRCode so that we can get AuthCode by scanning the QRCode
/// All required params must not be null or empty
/// [schemeData] only works on iOS
/// see * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN
Future
authWeChatByQRCode
(
{
@required
String
appId
,
@required
String
scope
,
@required
String
nonceStr
,
@required
String
timeStamp
,
@required
String
signature
,
String
schemeData
})
async
{
assert
(
appId
!=
null
&&
appId
.
isNotEmpty
);
assert
(
scope
!=
null
&&
scope
.
isNotEmpty
);
assert
(
nonceStr
!=
null
&&
nonceStr
.
isNotEmpty
);
assert
(
timeStamp
!=
null
&&
timeStamp
.
isNotEmpty
);
assert
(
signature
!=
null
&&
signature
.
isNotEmpty
);
return
await
_channel
.
invokeMethod
(
"authByQRCode"
,
{
"appId"
:
appId
,
"scope"
:
scope
,
"nonceStr"
:
nonceStr
,
"timeStamp"
:
timeStamp
,
"signature"
:
signature
,
"schemeData"
:
schemeData
});
}
/// stop auth
@Deprecated
(
"use stopWeChatAuthByQRCode instead"
)
Future
stopAuthByQRCode
(
)
async
{
return
await
_channel
.
invokeMethod
(
"stopAuthByQRCode"
);
}
/// stop auth
Future
stopWeChatAuthByQRCode
(
)
async
{
return
await
_channel
.
invokeMethod
(
"stopAuthByQRCode"
);
}
/// open mini-program
/// see [WXMiniProgramType]
@Deprecated
(
"use launchWeChatMiniProgram instead"
)
Future
launchMiniProgram
(
{
@required
String
username
,
String
path
,
...
...
@@ -272,6 +381,21 @@ Future launchMiniProgram(
});
}
/// open mini-program
/// see [WXMiniProgramType]
Future
launchWeChatMiniProgram
(
{
@required
String
username
,
String
path
,
WXMiniProgramType
miniProgramType
=
WXMiniProgramType
.
RELEASE
})
async
{
assert
(
username
!=
null
&&
username
.
trim
().
isNotEmpty
);
return
await
_channel
.
invokeMethod
(
"launchMiniProgram"
,
{
"userName"
:
username
,
"path"
:
path
,
"miniProgramType"
:
miniProgramTypeToInt
(
miniProgramType
)
});
}
/// true if WeChat is installed,otherwise false.
/// However,the following key-value must be added into your info.plist since iOS 9:
/// <key>LSApplicationQueriesSchemes</key>
...
...
@@ -289,6 +413,7 @@ Future isWeChatInstalled() async {
}
/// params are from server
@Deprecated
(
"use payWithWeChat instead"
)
Future
pay
(
{
@required
String
appId
,
@required
String
partnerId
,
...
...
@@ -312,7 +437,35 @@ Future pay(
});
}
/// params are from server
Future
payWithWeChat
(
{
@required
String
appId
,
@required
String
partnerId
,
@required
String
prepayId
,
@required
String
packageValue
,
@required
String
nonceStr
,
@required
int
timeStamp
,
@required
String
sign
,
String
signType
,
String
extData
})
async
{
return
await
_channel
.
invokeMethod
(
"payWithFluwx"
,
{
"appId"
:
appId
,
"partnerId"
:
partnerId
,
"prepayId"
:
prepayId
,
"packageValue"
:
packageValue
,
"nonceStr"
:
nonceStr
,
"timeStamp"
:
timeStamp
,
"sign"
:
sign
,
"signType"
:
signType
,
"extData"
:
extData
,
});
}
/// subscribe message
@Deprecated
(
"use subscribeWeChatMsg instead"
)
Future
subscribeMsg
(
{
@required
String
appId
,
@required
int
scene
,
...
...
@@ -330,7 +483,26 @@ Future subscribeMsg({
);
}
/// subscribe message
Future
subscribeWeChatMsg
(
{
@required
String
appId
,
@required
int
scene
,
@required
String
templateId
,
String
reserved
,
})
async
{
return
await
_channel
.
invokeMethod
(
"subscribeMsg"
,
{
"appId"
:
appId
,
"scene"
:
scene
,
"templateId"
:
templateId
,
"reserved"
:
reserved
,
},
);
}
/// please read official docs.
@Deprecated
(
"use autoDeDuctWeChat instead"
)
Future
autoDeDuct
(
{
@required
String
appId
,
@required
String
mchId
,
...
...
@@ -360,6 +532,37 @@ Future autoDeDuct(
});
}
/// please read official docs.
Future
autoDeDuctWeChat
(
{
@required
String
appId
,
@required
String
mchId
,
@required
String
planId
,
@required
String
contractCode
,
@required
String
requestSerial
,
@required
String
contractDisplayAccount
,
@required
String
notifyUrl
,
@required
String
version
,
@required
String
sign
,
@required
String
timestamp
,
String
returnApp
=
'3'
,
int
businessType
=
12
})
async
{
return
await
_channel
.
invokeMethod
(
"autoDeduct"
,
{
'appid'
:
appId
,
'mch_id'
:
mchId
,
'plan_id'
:
planId
,
'contract_code'
:
contractCode
,
'request_serial'
:
requestSerial
,
'contract_display_account'
:
contractDisplayAccount
,
'notify_url'
:
notifyUrl
,
'version'
:
version
,
'sign'
:
sign
,
'timestamp'
:
timestamp
,
'return_app'
:
returnApp
,
"businessType"
:
businessType
});
}
Future
<
bool
>
openWeChatApp
()
async
{
return
await
_channel
.
invokeMethod
(
"openWXApp"
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论