Fix release notification resource and add multiple advance reminders

This commit is contained in:
Codex
2026-10-14 11:30:37 +08:00
parent caf7abe0c0
commit 4d86db3dd5
16 changed files with 350 additions and 58 deletions
@@ -35,4 +35,57 @@ void main() {
await gateway.initialize();
expect(attempts, 2);
});
test(
'disabled course notification channel is reported even with app permission',
() async {
debugDefaultTargetPlatformOverride = TargetPlatform.android;
AndroidFlutterLocalNotificationsPlugin.registerWith();
const channel = MethodChannel(
'dexterous.com/flutter/local_notifications',
);
var importance = 0;
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (call) async {
switch (call.method) {
case 'initialize':
return true;
case 'getNotificationAppLaunchDetails':
return {'notificationLaunchedApp': false};
case 'areNotificationsEnabled':
return true;
case 'canScheduleExactNotifications':
return true;
case 'getNotificationChannels':
return [
{
'id': 'hepan_lessons',
'name': '课前提醒',
'description': '课程开始前的提醒',
'importance': importance,
'showBadge': true,
'playSound': true,
'enableVibration': true,
'enableLights': false,
'bypassDnd': false,
'ledColor': 0,
'audioAttributesUsage': 5,
},
];
}
return null;
});
addTearDown(() {
debugDefaultTargetPlatformOverride = null;
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, null);
});
final gateway = PluginReminderGateway();
expect(
(await gateway.permissions(request: false)).notifications,
isFalse,
);
importance = 4;
expect((await gateway.permissions(request: false)).notifications, isTrue);
},
);
}