chore(android,base,interface): Move notification stuff into Moxxy

This commit is contained in:
2023-09-03 13:03:51 +02:00
parent 7cc2d0e4be
commit f2b140de18
16 changed files with 38 additions and 3214 deletions

View File

@@ -1,64 +0,0 @@
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
class AndroidNotificationsImplementation extends NotificationsImplementation {
final MoxplatformApi _api = MoxplatformApi();
final EventChannel _channel =
const EventChannel('me.polynom/notification_stream');
@override
Future<void> createNotificationChannels(
List<NotificationChannel> channels) async {
return _api.createNotificationChannels(channels);
}
@override
Future<void> deleteNotificationChannels(List<String> ids) {
return _api.deleteNotificationChannels(ids);
}
@override
Future<void> createNotificationGroups(List<NotificationGroup> groups) async {
return _api.createNotificationGroups(groups);
}
@override
Future<void> deleteNotificationGroups(List<String> ids) {
return _api.deleteNotificationGroups(ids);
}
@override
Future<void> showMessagingNotification(
MessagingNotification notification,
) async {
return _api.showMessagingNotification(notification);
}
@override
Future<void> showNotification(RegularNotification notification) async {
return _api.showNotification(notification);
}
@override
Future<void> dismissNotification(int id) async {
return _api.dismissNotification(id);
}
@override
Future<void> setNotificationSelfAvatar(String path) async {
return _api.setNotificationSelfAvatar(path);
}
@override
Future<void> setI18n(NotificationI18nData data) {
return _api.setNotificationI18n(data);
}
@override
Stream<NotificationEvent> getEventStream() => _channel
.receiveBroadcastStream()
.cast<Object>()
.map(NotificationEvent.decode);
}

View File

@@ -1,7 +1,6 @@
import 'package:moxplatform_android/src/contacts_android.dart';
import 'package:moxplatform_android/src/crypto_android.dart';
import 'package:moxplatform_android/src/isolate_android.dart';
import 'package:moxplatform_android/src/notifications_android.dart';
import 'package:moxplatform_android/src/platform_android.dart';
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
@@ -12,7 +11,6 @@ class MoxplatformAndroidPlugin extends MoxplatformInterface {
MoxplatformInterface.contacts = AndroidContactsImplementation();
MoxplatformInterface.crypto = AndroidCryptographyImplementation();
MoxplatformInterface.handler = AndroidIsolateHandler();
MoxplatformInterface.notifications = AndroidNotificationsImplementation();
MoxplatformInterface.platform = AndroidPlatformImplementation();
}