|
|
|
@ -5,6 +5,7 @@ import 'package:project_telephony/utils/user_tool.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
import '../constants/api.dart';
|
|
|
|
|
import '../model/exclude_phone_model.dart';
|
|
|
|
|
import '../model/login_info_model.dart';
|
|
|
|
|
import '../model/network/api_client.dart';
|
|
|
|
|
import '../model/user_info_model.dart';
|
|
|
|
@ -54,6 +55,7 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
await updateUserInfo();
|
|
|
|
|
updateConSms();
|
|
|
|
|
updateRefSms();
|
|
|
|
|
getExclude();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future logout() async {
|
|
|
|
@ -79,9 +81,11 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 1});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
await prefs.remove('conSms');
|
|
|
|
|
await prefs.setString('conSms', (UserTool.userProvider.userInfo.tag)==""?"${base
|
|
|
|
|
.data['content']}":"【${UserTool.userProvider.userInfo.tag}】${base
|
|
|
|
|
.data['content']}");
|
|
|
|
|
await prefs.setString(
|
|
|
|
|
'conSms',
|
|
|
|
|
(UserTool.userProvider.userInfo.tag) == ""
|
|
|
|
|
? "${base.data['content']}"
|
|
|
|
|
: "【${UserTool.userProvider.userInfo.tag}】${base.data['content']}");
|
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
if (prefs.getBool('kg')!) {
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
@ -91,7 +95,6 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,9 +104,30 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 2});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
await prefs.remove('refSms');
|
|
|
|
|
await prefs.setString('refSms', (UserTool.userProvider.userInfo.tag)==""?"${base
|
|
|
|
|
.data['content']}":"【${UserTool.userProvider.userInfo.tag}】${base
|
|
|
|
|
.data['content']}" );
|
|
|
|
|
await prefs.setString(
|
|
|
|
|
'refSms',
|
|
|
|
|
(UserTool.userProvider.userInfo.tag) == ""
|
|
|
|
|
? "${base.data['content']}"
|
|
|
|
|
: "【${UserTool.userProvider.userInfo.tag}】${base.data['content']}");
|
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
if (prefs.getBool('kg')!) {
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
|
service.startService();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getExclude() async {
|
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
var base = await apiClient.request(API.exclude.find);
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
await prefs.remove('exclude');
|
|
|
|
|
await prefs.setStringList('exclude', base.data);
|
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
if (prefs.getBool('kg')!) {
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
|