fix: initialize reminder channel and clarify notification permission diagnostics

This commit is contained in:
Codex
2026-10-27 17:37:03 +08:00
parent db953b8b3d
commit fbcb7fb637
9 changed files with 165 additions and 10 deletions
@@ -70,6 +70,42 @@ Future<void> _open(WidgetTester tester, _Notifications notifications) async {
}
void main() {
testWidgets(
'Android 7 does not ask the user to create an unsupported category',
(tester) async {
final notifications = _Notifications()
..diagnosis = Completer<Map<String, Object?>>();
notifications.diagnosis!.complete({
'notifications': true,
'appNotificationsEnabled': true,
'channelExists': false,
'system': {'sdk': 24},
});
await _open(tester, notifications);
await tester.tap(find.text('检查提醒'));
await tester.pumpAndSettle();
expect(find.textContaining('类别尚未建立'), findsNothing);
expect(find.text('系统通知总开关:已允许'), findsOneWidget);
},
);
testWidgets(
'diagnosis separates the application switch from the reminder category',
(tester) async {
final notifications = _Notifications()
..diagnosis = Completer<Map<String, Object?>>();
notifications.diagnosis!.complete({
'notifications': false,
'appNotificationsEnabled': false,
'channelExists': true,
'courseChannelEnabled': true,
});
await _open(tester, notifications);
await tester.tap(find.text('检查提醒'));
await tester.pumpAndSettle();
expect(find.text('系统通知总开关:未允许'), findsOneWidget);
expect(find.text('课前提醒类别:已允许'), findsOneWidget);
},
);
testWidgets('test controls distinguish immediate and background reminders', (
tester,
) async {