7718604268
An abstract NotificationBridge with a dart:js_interop web implementation and an honest unsupported stub; a NotificationController that reports only the platform's permission word, asks only from an explicit gesture, never re-prompts a denied answer, and notifies once per run+kind+finished marker under its own persisted ledger key. One reusable native NotificationPermissionTile for Settings, an isolated browser probe, and focused tests. No shell/settings wiring.
28 lines
902 B
Dart
28 lines
902 B
Dart
import 'notification_bridge.dart';
|
|
import 'notification_models.dart';
|
|
|
|
/// The non-web bridge: there is no browser Notification API to reach.
|
|
///
|
|
/// It reports `unsupported` honestly rather than pretending a notification was
|
|
/// shown, so the surface falls back to the in-app `Needs you` channel. A native
|
|
/// platform notifier would replace this through the same seam.
|
|
class UnsupportedNotificationBridge implements NotificationBridge {
|
|
const UnsupportedNotificationBridge();
|
|
|
|
@override
|
|
NotificationEnvironment environment() => const NotificationEnvironment(
|
|
supported: false,
|
|
secureContext: false,
|
|
permission: 'default',
|
|
);
|
|
|
|
@override
|
|
Future<String> requestPermission() async => 'default';
|
|
|
|
@override
|
|
bool show(NotificationMessage message, {void Function()? onTap}) => false;
|
|
}
|
|
|
|
NotificationBridge createNotificationBridge() =>
|
|
const UnsupportedNotificationBridge();
|