Rewrite the notification code in Kotlin

This commit is contained in:
2023-07-28 00:46:19 +02:00
parent 1771c0e1b6
commit 864b868f45
25 changed files with 318 additions and 129 deletions

View File

@@ -1,6 +1,5 @@
library moxplatform_android;
export 'src/isolate_android.dart';
export 'src/media_android.dart';
export 'src/plugin_android.dart';
export 'src/service_android.dart';

View File

@@ -1,9 +0,0 @@
import 'package:media_scanner/media_scanner.dart';
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
class AndroidMediaScannerImplementation extends MediaScannerImplementation {
@override
void scanFile(String path) {
MediaScanner.loadMedia(path: path);
}
}

View File

@@ -1,7 +1,7 @@
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
class AndroidNotificationsImplementation extends NotificationsImplementation {
final NotificationsImplementationApi _api = NotificationsImplementationApi();
final MoxplatformApi _api = MoxplatformApi();
@override

View File

@@ -0,0 +1,13 @@
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
class AndroidPlatformImplementation extends PlatformImplementation {
@override
Future<String> getCacheDataPath() {
return MoxplatformInterface.api.getCacheDataPath();
}
@override
Future<String> getPersistentDataPath() {
return MoxplatformInterface.api.getPersistentDataPath();
}
}

View File

@@ -1,8 +1,8 @@
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/media_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';
class MoxplatformAndroidPlugin extends MoxplatformInterface {
@@ -12,8 +12,8 @@ class MoxplatformAndroidPlugin extends MoxplatformInterface {
MoxplatformInterface.contacts = AndroidContactsImplementation();
MoxplatformInterface.crypto = AndroidCryptographyImplementation();
MoxplatformInterface.handler = AndroidIsolateHandler();
MoxplatformInterface.media = AndroidMediaScannerImplementation();
MoxplatformInterface.notifications = AndroidNotificationsImplementation();
MoxplatformInterface.platform = AndroidPlatformImplementation();
}
@override