|
|
@ -27,7 +27,6 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
String get contentRef => _contentRef;
|
|
|
|
String get contentRef => _contentRef;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<bool> init() async {
|
|
|
|
Future<bool> init() async {
|
|
|
|
if (HiveStore.appBox?.containsKey('token') ?? false) {
|
|
|
|
if (HiveStore.appBox?.containsKey('token') ?? false) {
|
|
|
|
final token = HiveStore.appBox?.get('token') as String;
|
|
|
|
final token = HiveStore.appBox?.get('token') as String;
|
|
|
@ -75,29 +74,37 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
Future updateConSms() async {
|
|
|
|
Future updateConSms() async {
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
final service=FlutterBackgroundService();
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 1});
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 1});
|
|
|
|
if (base.code == 0) {
|
|
|
|
if (base.code == 0) {
|
|
|
|
await prefs.remove('conSms');
|
|
|
|
await prefs.remove('conSms');
|
|
|
|
await prefs.setString('conSms', base.data['content']);
|
|
|
|
await prefs.setString('conSms', base.data['content']);
|
|
|
|
service.invoke("stopService");
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
|
|
|
if(prefs.getBool('kg')!){
|
|
|
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
|
|
|
|
service.startService();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future updateRefSms() async {
|
|
|
|
Future updateRefSms() async {
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
final service=FlutterBackgroundService();
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 2});
|
|
|
|
var base = await apiClient.request(API.app.find, data: {'status': 2});
|
|
|
|
if (base.code == 0) {
|
|
|
|
if (base.code == 0) {
|
|
|
|
await prefs.remove('refSms');
|
|
|
|
await prefs.remove('refSms');
|
|
|
|
print(base.data['content']);
|
|
|
|
|
|
|
|
await prefs.setString('refSms', base.data['content']);
|
|
|
|
await prefs.setString('refSms', base.data['content']);
|
|
|
|
print(prefs.getString('refSms'));
|
|
|
|
|
|
|
|
service.invoke("stopService");
|
|
|
|
service.invoke("stopService");
|
|
|
|
|
|
|
|
if(prefs.getBool('kg')!){
|
|
|
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () async {
|
|
|
|
|
|
|
|
service.startService();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|