Files
umbrix/lib/services/notification/notification_service.dart

34 lines
944 B
Dart
Raw Normal View History

2023-07-06 17:18:41 +03:30
import 'dart:io';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:hiddify/services/notification/local_notification_service.dart';
import 'package:hiddify/services/notification/stub_notification_service.dart';
abstract class NotificationService {
factory NotificationService() {
2023-08-23 13:01:52 +03:30
// HACK temporarily return stub for linux and mac as well
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
2023-07-23 13:40:59 +03:30
return StubNotificationService();
}
2023-07-06 17:18:41 +03:30
return LocalNotificationService(FlutterLocalNotificationsPlugin());
}
Future<void> init();
void onDidReceiveNotificationResponse(
NotificationResponse notificationResponse,
);
Future<bool> grantPermission();
Future<void> showNotification({
required int id,
required String title,
String? body,
NotificationDetails? details,
String? payload,
});
Future<void> removeNotification(int id);
}