feat:增加日志记录
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flisp_app/service/calendar_service.dart';
|
|||||||
import 'package:flisp_app/service/todo_service.dart';
|
import 'package:flisp_app/service/todo_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_common/utils/date_utils.dart';
|
import 'package:flutter_common/utils/date_utils.dart';
|
||||||
|
import 'package:flutter_common/utils/log_utils.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:timezone/data/latest_all.dart' as tz;
|
import 'package:timezone/data/latest_all.dart' as tz;
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
@@ -55,6 +56,7 @@ class NotifyService {
|
|||||||
|
|
||||||
/// 重新刷新提醒 防止每次重启设备后提醒丢失的问题
|
/// 重新刷新提醒 防止每次重启设备后提醒丢失的问题
|
||||||
void _refreshScheduled() async {
|
void _refreshScheduled() async {
|
||||||
|
logger.i('开始刷新提醒');
|
||||||
await cancelAllNotifications();
|
await cancelAllNotifications();
|
||||||
|
|
||||||
TodoService todoService = TodoService();
|
TodoService todoService = TodoService();
|
||||||
@@ -77,6 +79,8 @@ class NotifyService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.i('刷新 ${todayTodos.length}个 待办提醒');
|
||||||
|
|
||||||
CalendarService calendarService = CalendarService();
|
CalendarService calendarService = CalendarService();
|
||||||
final List<Calendar> calendarResult = calendarService.getAllCalendars();
|
final List<Calendar> calendarResult = calendarService.getAllCalendars();
|
||||||
final List<Calendar> todayCalendars =
|
final List<Calendar> todayCalendars =
|
||||||
@@ -92,6 +96,9 @@ class NotifyService {
|
|||||||
scheduledTime: calendar.scheduledTime!,
|
scheduledTime: calendar.scheduledTime!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.i('刷新 ${todayCalendars.length}个 日程提醒');
|
||||||
|
logger.i('结束刷新提醒');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建Android通知详情
|
// 创建Android通知详情
|
||||||
@@ -157,7 +164,7 @@ class NotifyService {
|
|||||||
try {
|
try {
|
||||||
await _notifications.cancel(id);
|
await _notifications.cancel(id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('取消通知失败: $e');
|
logger.i('取消通知失败: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user