|
|
|
@ -75,7 +75,7 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future updateConSms(int num ) async {
|
|
|
|
|
Future updateConSms() async {
|
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
var base = await apiClient.request(API.content.find, data: {'status': 1});
|
|
|
|
@ -121,6 +121,52 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future updateSms() async {
|
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
var base = await apiClient.request(API.content.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']}");
|
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
if (prefs.getBool('kg')!) {
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
|
service.startService();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future updateIdleSms() async {
|
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
var base = await apiClient.request(API.content.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']}");
|
|
|
|
|
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();
|
|
|
|
|