|
|
@@ -1,3 +1,4 @@ |
|
|
|
import 'dart:async'; |
|
|
|
import 'dart:convert'; |
|
|
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
@@ -16,6 +17,7 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart'; |
|
|
|
class UserInfoNotifier with ChangeNotifier { |
|
|
|
/// 用户信息 |
|
|
|
static UserInfoModel _userInfo; |
|
|
|
static bool reFresh=false; |
|
|
|
|
|
|
|
static UserInfoModel get staitcUserInfo { |
|
|
|
return _userInfo; |
|
|
@@ -66,16 +68,22 @@ class UserInfoNotifier with ChangeNotifier { |
|
|
|
void unLogin() async { |
|
|
|
_userInfo = null; |
|
|
|
// 清除缓存数据 |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_TOKEN, null); |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_MOBILE, null); |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_USER_INFO, null); |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_TOKEN, ''); |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_MOBILE, ''); |
|
|
|
await SharedPreferencesUtil.setStringValue(GlobalConfig.SHARED_KEY_USER_INFO, ''); |
|
|
|
// 退出淘宝登录 |
|
|
|
FlutterAlibc.loginOut(); |
|
|
|
// 退出QQ登录 |
|
|
|
MobUtil.cancelQQAuth(); |
|
|
|
// 退出微信登录 |
|
|
|
MobUtil.cancelWeChatAuth(); |
|
|
|
EventUtil.instance.fire(LogOut()); |
|
|
|
if(!reFresh){ |
|
|
|
reFresh=true; |
|
|
|
Timer(Duration(milliseconds: 1000), (){ |
|
|
|
EventUtil.instance.fire(LogOut()); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
notifyListeners(); |
|
|
|
} |
|
|
|
|
|
|
|