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