更新安卓通知栏提示
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
|
||||
part 'common_message_setting_controller.g.dart'; // 由json_serializable自动生成的部分
|
||||
|
||||
@JsonSerializable()
|
||||
class CommonMessageSettingModel {
|
||||
int? setting = 0;//总设置 0 关闭 1 开启
|
||||
int? appSetting = 0;//app消息设置
|
||||
int? serviceSetting = 0;//服务号消息
|
||||
int? tipSetting = 0;//设备放置说明
|
||||
int? deviceUpgradeSetting = 0;//设备升级提示
|
||||
int? deviceIssueSetting = 0;//设备故障提示
|
||||
|
||||
int? setting = 0; //总设置 0 关闭 1 开启
|
||||
int? appSetting = 0; //app消息设置
|
||||
int? serviceSetting = 0; //服务号消息
|
||||
int? tipSetting = 0; //设备放置说明
|
||||
int? deviceUpgradeSetting = 0; //设备升级提示
|
||||
int? deviceIssueSetting = 0; //设备故障提示
|
||||
int? sleepReportSetting = 0; //睡眠报告通知
|
||||
|
||||
CommonMessageSettingModel();
|
||||
|
||||
@@ -30,9 +32,58 @@ class CommonMessageSettingModel {
|
||||
Map<String, dynamic> toJson() => _$CommonMessageSettingModelToJson(this);
|
||||
}
|
||||
|
||||
class CommonMessageSettingController extends GetControllerEx<CommonMessageSettingModel> {
|
||||
class CommonMessageSettingController
|
||||
extends GetControllerEx<CommonMessageSettingModel> {
|
||||
CommonMessageSettingController() {
|
||||
attr = GetModel(CommonMessageSettingModel()).obs;
|
||||
}
|
||||
|
||||
Future<void> getAppSleepNotify() async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "sleep_report_notify";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
await requestWithLog(
|
||||
logTitle: "查询用户睡眠通知消息配置",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
if (res.data == null) {
|
||||
model.sleepReportSetting = 1;
|
||||
} else {
|
||||
model.sleepReportSetting = res.data["setting"];
|
||||
}
|
||||
updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
print(res);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateSleepNotify(bool val) async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "sleep_report_notify";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
var data = {
|
||||
"type": type,
|
||||
"setting": val == true ? 1 : 0,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "查询用户睡眠通知消息配置",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
print(res);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user