Use native service as Android notification source

This commit is contained in:
2026-11-01 10:01:16 +00:00
parent 2808378823
commit 5346759665
5 changed files with 84 additions and 5 deletions
@@ -4,8 +4,10 @@ import 'package:pipelines_app/features/attention/notify/notification_bridge.dart
import 'package:pipelines_app/features/attention/notify/notification_controller.dart';
import 'package:pipelines_app/features/attention/notify/notification_models.dart';
import 'package:pipelines_app/features/attention/notify/notification_store.dart';
import 'package:pipelines_app/features/notification_service/notification_service_controller.dart';
import 'notification_test_support.dart';
import '../../notification_service/fake_notification_service.dart';
void main() {
group('a dismissed entry never notifies', () {
@@ -196,6 +198,45 @@ void main() {
);
});
});
group('Android background delivery is the single OS source', () {
test(
'enabled service suppresses bridge posts and toggling takes effect',
() async {
final bridge = FakeNotificationBridge(permission: 'granted');
final service = FakeNotificationService();
final serviceController = NotificationServiceController(service);
final notify = NotificationController(
store: MemoryNotificationStore(),
bridge: bridge,
serviceController: serviceController,
);
addTearDown(notify.dispose);
addTearDown(serviceController.dispose);
await notify.load();
expect(
notify.publishTransitions(
[transitionFor(1)],
qualifying: {'1:Failed'},
),
0,
);
expect(bridge.shown, isEmpty);
service.push(service.copy(enabled: false));
await pumpEventQueue();
expect(
notify.publishTransitions(
[transitionFor(2)],
qualifying: {'2:Failed'},
),
1,
);
expect(bridge.shown.map((message) => message.runId), [2]);
},
);
});
}
/// A store whose writes take a tick, so a racing implementation would overlap