初始化
This commit is contained in:
80
bin/enum/ReportStatus.dart
Normal file
80
bin/enum/ReportStatus.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
/// 报告状态枚举
|
||||
enum ReportStatus {
|
||||
experienceing, // 0 - 体验中 ok
|
||||
generating, // 1 - 生成报告中 ok
|
||||
appNormalClose, // 2 - APP正常关闭 ok
|
||||
appAbnormalClose, // 3 - APP异常关闭 ok 可以捕获到的异常
|
||||
appActiveClose, // 4 - APP主动关闭 ok
|
||||
reportExceptionClose,// 5 - 报告生成异常关闭 ok
|
||||
completed, // 9 - 完成
|
||||
//网络断掉了怎么办?todo websocket心跳 弹窗提示 微信视频结束之后要将微信标志重置 监听网络状态
|
||||
//网络 蓝牙 视频播放 设备连接
|
||||
//todo 监听网络状态 失败了停止播放视频
|
||||
//todo 监听蓝牙状态 断掉就停止播放视频并且发送异常关闭
|
||||
//todo 重新打开app
|
||||
}
|
||||
|
||||
/// 扩展方法,提供数字映射和文本描述
|
||||
extension ReportStatusExtension on ReportStatus {
|
||||
/// 获取对应的数字状态值
|
||||
int get value {
|
||||
switch (this) {
|
||||
case ReportStatus.experienceing:
|
||||
return 0;
|
||||
case ReportStatus.generating:
|
||||
return 1;
|
||||
case ReportStatus.appNormalClose:
|
||||
return 2;
|
||||
case ReportStatus.appAbnormalClose:
|
||||
return 3;
|
||||
case ReportStatus.appActiveClose:
|
||||
return 4;
|
||||
case ReportStatus.reportExceptionClose:
|
||||
return 5;
|
||||
case ReportStatus.completed:
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取文本描述
|
||||
String get label {
|
||||
switch (this) {
|
||||
case ReportStatus.experienceing:
|
||||
return "体验中";
|
||||
case ReportStatus.generating:
|
||||
return "生成报告中";
|
||||
case ReportStatus.appNormalClose:
|
||||
return "APP正常关闭";
|
||||
case ReportStatus.appAbnormalClose:
|
||||
return "APP异常关闭";
|
||||
case ReportStatus.appActiveClose:
|
||||
return "APP主动关闭";
|
||||
case ReportStatus.reportExceptionClose:
|
||||
return "报告生成异常关闭";
|
||||
case ReportStatus.completed:
|
||||
return "完成";
|
||||
}
|
||||
}
|
||||
|
||||
/// 根据数字获取枚举
|
||||
static ReportStatus fromValue(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return ReportStatus.experienceing;
|
||||
case 1:
|
||||
return ReportStatus.generating;
|
||||
case 2:
|
||||
return ReportStatus.appNormalClose;
|
||||
case 3:
|
||||
return ReportStatus.appAbnormalClose;
|
||||
case 4:
|
||||
return ReportStatus.appActiveClose;
|
||||
case 5:
|
||||
return ReportStatus.reportExceptionClose;
|
||||
case 9:
|
||||
return ReportStatus.completed;
|
||||
default:
|
||||
throw Exception("未知报告状态: $value");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user