mirror of
https://github.com/RxReader/tencent_kit.git
synced 2025-06-10 19:13:34 +08:00
整理
This commit is contained in:
@ -33,33 +33,30 @@ class Home extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeState extends State<Home> {
|
||||
late final StreamSubscription<TencentLoginResp> _login =
|
||||
Tencent.instance.loginResp().listen(_listenLogin);
|
||||
late final StreamSubscription<TencentSdkResp> _share =
|
||||
Tencent.instance.shareResp().listen(_listenShare);
|
||||
late final StreamSubscription<BaseResp> _respSubs =
|
||||
Tencent.instance.respStream().listen(_listenLogin);
|
||||
|
||||
TencentLoginResp? _loginResp;
|
||||
LoginResp? _loginResp;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _listenLogin(TencentLoginResp resp) {
|
||||
_loginResp = resp;
|
||||
final String content = 'login: ${resp.openid} - ${resp.accessToken}';
|
||||
_showTips('登录', content);
|
||||
}
|
||||
|
||||
void _listenShare(TencentSdkResp resp) {
|
||||
final String content = 'share: ${resp.ret} - ${resp.msg}';
|
||||
_showTips('分享', content);
|
||||
void _listenLogin(BaseResp resp) {
|
||||
if (resp is LoginResp) {
|
||||
_loginResp = resp;
|
||||
final String content = 'login: ${resp.openid} - ${resp.accessToken}';
|
||||
_showTips('登录', content);
|
||||
} else if (resp is ShareMsgResp) {
|
||||
final String content = 'share: ${resp.ret} - ${resp.msg}';
|
||||
_showTips('分享', content);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_login.cancel();
|
||||
_share.cancel();
|
||||
_respSubs.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import 'package:tencent_kit_example/model/api/tencent_user_info_resp.dart';
|
||||
import 'package:tencent_kit_example/model/unionid/tencent_unionid_resp.dart';
|
||||
|
||||
extension MixerTencent on Tencent {
|
||||
|
||||
/// 用户信息
|
||||
/// https://wiki.connect.qq.com/get_user_info
|
||||
Future<TencentUserInfoResp> getUserInfo({
|
||||
|
@ -288,7 +288,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "2.1.1"
|
||||
version: "3.0.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
Reference in New Issue
Block a user