nc-photos/app/lib/web/notification.dart

31 lines
898 B
Dart
Raw Normal View History

2022-04-08 21:16:10 +02:00
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:nc_photos/app_localizations.dart';
import 'package:nc_photos/k.dart' as k;
import 'package:nc_photos/platform/notification.dart' as itf;
import 'package:nc_photos/snack_bar_manager.dart';
2022-12-16 16:01:04 +01:00
import 'package:np_codegen/np_codegen.dart';
2022-04-08 21:16:10 +02:00
2022-12-16 16:01:04 +01:00
part 'notification.g.dart';
@npLog
2022-04-08 21:16:10 +02:00
class NotificationManager implements itf.NotificationManager {
@override
notify(itf.Notification n) async {
if (n is itf.LogSaveSuccessfulNotification) {
SnackBarManager().showSnackBar(SnackBar(
2023-04-28 19:50:54 +02:00
content: Text(L10n.global().captureLogSuccessNotification),
2022-04-08 21:16:10 +02:00
duration: k.snackBarDurationShort,
));
} else {
_log.shout("[notify] Unknown type: ${n.runtimeType}");
throw UnsupportedError("Unsupported notification");
}
}
@override
dismiss(dynamic id) async {
return;
}
}