hyzp_ybqx-Commit120:已初步实现定时提醒,默认提醒间隔为60S,准备实现用户设置定时间隔

master
WinUser01 4 years ago
parent 38ce516148
commit 0e3e9e4fdf

@ -1,9 +1,11 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer' as developer;
import 'dart:io';
import 'dart:math';
import 'package:ai_save_account/ai_save_account.dart';
import 'package:audioplayers/audio_cache.dart';
import 'package:camera/camera.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart' as crypto;
@ -17,6 +19,7 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:hyzp_ybqx/provider/player_region.dart';
import 'UserInfo.dart';
import 'dioFun.dart';
////////////////////////////////////////////
// begin hyzp_ybqx-Commit022--OK
@ -71,7 +74,48 @@ const serviceUrl_ybqx_media = 'http://125.64.218.67:9906/';
// 2sip01访使1sip
const String setSphericalCameraUrl = 'http://125.64.218.67:9903/'; //
const int g_sip = 1; // sip01
///
//
List listReviewed = [];
bool g_bVoiceRemind = false; //
int g_remindGap = 60; // 60S0
Timer g_remindTimer; //
//
setRemindTimer() {
//
if (null != g_remindTimer) {
g_remindTimer.cancel(); //
}
//
if (g_remindGap > 0) {
/// g_remindGap
g_remindTimer = Timer.periodic(Duration(seconds: g_remindGap), (timer) {
///
doRemind();
});
}
}
//
Future doRemind() async {
//
listReviewed.clear();
print("listReviewed = $listReviewed");
await getReviewedList(); //访
print("listReviewed = $listReviewed");
if (g_bVoiceRemind && listReviewed.length > 0) {
// if (g_bVoiceRemind) {
// import 'dart:io';
// import 'package:audioplayers/audio_cache.dart';
// print("播放:语音提醒.mp3");
AudioCache().play(File('audio/语音提醒.mp3').path); //
}
}
///
// {
// "ret": 200,

@ -447,9 +447,6 @@ List listGetTsjj = [];
//idlistGetZpjl
List listGetZpjl = [];
//
List listReviewed = [];
//workflow : 1=> | 2=> | 999=> | 1000=>
Map<int, String> mapAuditStatus = {
1: "待审",

@ -119,6 +119,9 @@ class _MyAppState extends State<MyApp> {
// g_bVoiceRemind = (null == g_bVoiceRemind) ? false : g_bVoiceRemind; //
g_bVoiceRemind = (null == g_bVoiceRemind) ? true : g_bVoiceRemind; //
// print('g_bVoiceRemind = $g_bVoiceRemind');
g_remindGap = await Storage.getInt('nRemindGap');
g_remindGap = (null == g_remindGap) ? 60 : g_remindGap; // 60S
eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
}

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:badges/badges.dart';
@ -58,6 +59,9 @@ class _TabsState extends State<Tabs> {
String sAppBar = 'Flutter Demo';
PageController _pageController;
///
// Timer g_remindTimer;
@override
void initState() {
super.initState();
@ -87,17 +91,39 @@ class _TabsState extends State<Tabs> {
// // print('g_bVoiceRemind = $g_bVoiceRemind');
// eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
//
print("listReviewed = $listReviewed");
await getReviewedList(); //访
print("listReviewed = $listReviewed");
if (g_bVoiceRemind && listReviewed.length > 0) {
// if (g_bVoiceRemind) {
// import 'dart:io';
// import 'package:audioplayers/audio_cache.dart';
// print("播放:语音提醒.mp3");
AudioCache().play(File('audio/语音提醒.mp3').path); //
//
doRemind();
// g_remindGap
setRemindTimer();
// g_remindTimer = Timer.periodic(Duration(seconds: g_remindGap), (timer) {
// ///
// doRemind();
// });
}
// //
// Future doRemind() async {
// //
// listReviewed.clear();
// print("listReviewed = $listReviewed");
// await getReviewedList(); //访
// print("listReviewed = $listReviewed");
// if (g_bVoiceRemind && listReviewed.length > 0) {
// // if (g_bVoiceRemind) {
// // import 'dart:io';
// // import 'package:audioplayers/audio_cache.dart';
// // print("播放:语音提醒.mp3");
// AudioCache().play(File('audio/语音提醒.mp3').path); //
// }
// }
@override
void dispose() {
// ///
// g_remindTimer.cancel();
super.dispose();
}
double _activeIconWidth = 68;

@ -11,6 +11,16 @@ class Storage {
return sp.getString(key);
}
static Future<void> setInt(String key, int value) async {
SharedPreferences sp = await SharedPreferences.getInstance();
sp.setInt(key, value);
}
static Future<int> getInt(String key) async {
SharedPreferences sp = await SharedPreferences.getInstance();
return sp.getInt(key);
}
static Future<void> setBool(String key, bool value) async {
SharedPreferences sp = await SharedPreferences.getInstance();
sp.setBool(key, value);

Loading…
Cancel
Save