diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md b/packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md index f1c2507..7bdbd98 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md @@ -12,3 +12,7 @@ dependencies: flutter_local_notifications_aurora: path: # path to folder with plugin ``` + +### Preview example + +![preview.png](data%2Fpreview.gif) diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt b/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt deleted file mode 100644 index e80a561..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -set(PROJECT_NAME flutter_local_notifications_aurora) -set(PLUGIN_NAME flutter_local_notifications_aurora_platform_plugin) - -project(${PROJECT_NAME} LANGUAGES CXX) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") - -find_package(PkgConfig REQUIRED) -pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) - -add_library(${PLUGIN_NAME} SHARED flutter_local_notifications_aurora_plugin.cpp) - -set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) -target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) - -target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp b/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp deleted file mode 100644 index 70a45ef..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include - -void FlutterLocalNotificationsAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) -{ - registrar.RegisterMethodChannel("flutter_local_notifications_aurora", - MethodCodecType::Standard, - [this](const MethodCall &call) { this->onMethodCall(call); }); -} - -void FlutterLocalNotificationsAuroraPlugin::onMethodCall(const MethodCall &call) -{ - const auto &method = call.GetMethod(); - - if (method == "getPlatformVersion") { - onGetPlatformVersion(call); - return; - } - - unimplemented(call); -} - -void FlutterLocalNotificationsAuroraPlugin::onGetPlatformVersion(const MethodCall &call) -{ - utsname uname_data{}; - uname(&uname_data); - - std::string preamble = "Aurora (Linux): "; - std::string version = preamble + uname_data.version; - - call.SendSuccessResponse(version); -} - -void FlutterLocalNotificationsAuroraPlugin::unimplemented(const MethodCall &call) -{ - call.SendSuccessResponse(nullptr); -} diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h b/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h deleted file mode 100644 index 1d39f28..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H -#define FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H - -#include - -#ifdef PLUGIN_IMPL -#define PLUGIN_EXPORT __attribute__((visibility("default"))) -#else -#define PLUGIN_EXPORT -#endif - -class PLUGIN_EXPORT FlutterLocalNotificationsAuroraPlugin final : public PluginInterface -{ -public: - void RegisterWithRegistrar(PluginRegistrar ®istrar) override; - -private: - void onMethodCall(const MethodCall &call); - void onGetPlatformVersion(const MethodCall &call); - void unimplemented(const MethodCall &call); -}; - -#endif /* FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H */ diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/data/preview.gif b/packages/flutter_local_notifications/flutter_local_notifications_aurora/data/preview.gif new file mode 100644 index 0000000..6572ae0 Binary files /dev/null and b/packages/flutter_local_notifications/flutter_local_notifications_aurora/data/preview.gif differ diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp index 7b569e4..d6335b1 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp @@ -5,12 +5,12 @@ // clang-format off #include -#include +#include #include "generated_plugin_registrant.h" void RegisterPlugins() { Application::RegisterPlugins({ - std::make_shared(), + std::make_shared(), }); } diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake index a0de669..4957f88 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake @@ -15,7 +15,7 @@ function(add_library TARGET) endfunction() list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST - flutter_local_notifications_aurora + package_info_plus_aurora ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart index eae59f6..5b62e87 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart @@ -15,6 +15,7 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State { + final notificationID = 1; final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -25,24 +26,62 @@ class _MyAppState extends State { Future _showNotification() async { await flutterLocalNotificationsPlugin.show( - 166, + notificationID, "Title notification", "My long body text notification", null, ); } + Future _cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(notificationID); + } + @override Widget build(BuildContext context) { + const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); + const spaceMedium = SizedBox(height: 20); + return MaterialApp( home: Scaffold( appBar: AppBar( - title: const Text('Plugin example app'), + title: const Text('Example flutter_local_notifications'), ), - body: Center( - child: ElevatedButton( - onPressed: _showNotification, - child: const Text('Show notification'), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16), + child: Center( + child: Column( + children: [ + // Info + Container( + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + ), + child: const Text( + 'Demo application demonstration implementation of flutter_local_notifications', + style: textStyleWhite, + textAlign: TextAlign.center, + ), + ), + const SizedBox(height: 30), + + ElevatedButton( + onPressed: _showNotification, + child: const Text('Show notification'), + ), + + spaceMedium, + + ElevatedButton( + onPressed: _cancelNotification, + child: const Text('Cancel notification'), + ) + ], + ), + ), ), ), ), diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart deleted file mode 100644 index 6167e4b..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:flutter_local_notifications_aurora_example/main.dart'; - -void main() { - testWidgets('Verify Platform version', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that platform version is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data!.startsWith('Running on:'), - ), - findsOneWidget, - ); - }); -} diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart index 330691e..a4a1151 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart @@ -1,10 +1,9 @@ +import 'dart:async'; + import 'package:dbus/dbus.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_local_notifications_aurora/org_freedesktop_notifications.dart'; -import 'dart:async'; import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart'; - -import 'flutter_local_notifications_aurora_platform_interface.dart'; +import 'package:package_info_plus/package_info_plus.dart'; class FlutterLocalNotificationsAurora extends FlutterLocalNotificationsPlatform { @@ -14,10 +13,8 @@ class FlutterLocalNotificationsAurora FlutterLocalNotificationsAurora(); } - final Map ids = {}; + final Map> auroraIDs = {}; - /// dart pub global activate dbus - /// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml -o lib/org_freedesktop_notifications.dart @override Future show( int id, @@ -25,42 +22,42 @@ class FlutterLocalNotificationsAurora String? body, { String? payload, }) async { - var client = DBusClient.session(); + final appName = (await PackageInfo.fromPlatform()).appName; + final client = DBusClient.session(); final object = OrgFreedesktopNotifications( client, 'org.freedesktop.Notifications', DBusObjectPath('/org/freedesktop/Notifications')); - final auroraID = await object.callNotify( - 'app_name', + auroraIDs[id] = auroraIDs[id] ?? []; + auroraIDs[id]!.add(await object.callNotify( + appName, 0, - 'image://theme/icon-l-play', - title ?? 'Title', - body ?? 'Body', + ' ', + title ?? '', + body ?? '', [], {}, - 4000, - ); - - ids[id] = auroraID; - + -1, + )); await client.close(); } @override Future cancel(int id) async { - var client = DBusClient.session(); - var object = OrgFreedesktopNotifications( - client, - 'org.freedesktop.Notifications', - DBusObjectPath('/org/freedesktop/Notifications')); - await object.callCloseNotification(ids[id] ?? 0); - await client.close(); - } - - Future getPlatformVersion() { - return FlutterLocalNotificationsAuroraPlatform.instance - .getPlatformVersion(); + final ids = auroraIDs[id] ?? []; + if (auroraIDs.isNotEmpty) { + final client = DBusClient.session(); + final object = OrgFreedesktopNotifications( + client, + 'org.freedesktop.Notifications', + DBusObjectPath('/org/freedesktop/Notifications')); + for (final auroraID in ids) { + await object.callCloseNotification(auroraID); + } + ids.remove(id); + await client.close(); + } } } diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart deleted file mode 100644 index 22a8f3e..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; - -import 'flutter_local_notifications_aurora_platform_interface.dart'; - -/// An implementation of [FlutterLocalNotificationsAuroraPlatform] that uses method channels. -class MethodChannelFlutterLocalNotificationsAurora extends FlutterLocalNotificationsAuroraPlatform { - /// The method channel used to interact with the native platform. - @visibleForTesting - final methodChannel = const MethodChannel('flutter_local_notifications_aurora'); - - @override - Future getPlatformVersion() async { - final version = await methodChannel.invokeMethod('getPlatformVersion'); - return version; - } -} diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart deleted file mode 100644 index 1e4f0d2..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:plugin_platform_interface/plugin_platform_interface.dart'; - -import 'flutter_local_notifications_aurora_method_channel.dart'; - -abstract class FlutterLocalNotificationsAuroraPlatform extends PlatformInterface { - /// Constructs a FlutterLocalNotificationsAuroraPlatform. - FlutterLocalNotificationsAuroraPlatform() : super(token: _token); - - static final Object _token = Object(); - - static FlutterLocalNotificationsAuroraPlatform _instance = MethodChannelFlutterLocalNotificationsAurora(); - - /// The default instance of [FlutterLocalNotificationsAuroraPlatform] to use. - /// - /// Defaults to [MethodChannelFlutterLocalNotificationsAurora]. - static FlutterLocalNotificationsAuroraPlatform get instance => _instance; - - /// Platform-specific implementations should set this with their own - /// platform-specific class that extends [FlutterLocalNotificationsAuroraPlatform] when - /// they register themselves. - static set instance(FlutterLocalNotificationsAuroraPlatform instance) { - PlatformInterface.verifyToken(instance, _token); - _instance = instance; - } - - Future getPlatformVersion() { - throw UnimplementedError('platformVersion() has not been implemented.'); - } -} diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart index 20e8a51..325fa10 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart @@ -1,6 +1,8 @@ // This file was generated using the following command and may be overwritten. // dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml +// dart pub global activate dbus +// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml -o lib/org_freedesktop_notifications.dart import 'package:dbus/dbus.dart'; /// Signal data for org.freedesktop.Notifications.NotificationClosed. @@ -8,7 +10,13 @@ class OrgFreedesktopNotificationsNotificationClosed extends DBusSignal { int get id => values[0].asUint32(); int get reason => values[1].asUint32(); - OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values); + OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); } /// Signal data for org.freedesktop.Notifications.ActionInvoked. @@ -16,42 +24,106 @@ class OrgFreedesktopNotificationsActionInvoked extends DBusSignal { int get id => values[0].asUint32(); String get action_key => values[1].asString(); - OrgFreedesktopNotificationsActionInvoked(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values); + OrgFreedesktopNotificationsActionInvoked(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); } class OrgFreedesktopNotifications extends DBusRemoteObject { /// Stream of org.freedesktop.Notifications.NotificationClosed signals. - late final Stream notificationClosed; + late final Stream + notificationClosed; /// Stream of org.freedesktop.Notifications.ActionInvoked signals. late final Stream actionInvoked; - OrgFreedesktopNotifications(DBusClient client, String destination, DBusObjectPath path) : super(client, name: destination, path: path) { - notificationClosed = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'NotificationClosed', signature: DBusSignature('uu')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal)); + OrgFreedesktopNotifications( + DBusClient client, String destination, DBusObjectPath path) + : super(client, name: destination, path: path) { + notificationClosed = DBusRemoteObjectSignalStream( + object: this, + interface: 'org.freedesktop.Notifications', + name: 'NotificationClosed', + signature: DBusSignature('uu')) + .asBroadcastStream() + .map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal)); - actionInvoked = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'ActionInvoked', signature: DBusSignature('us')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsActionInvoked(signal)); + actionInvoked = DBusRemoteObjectSignalStream( + object: this, + interface: 'org.freedesktop.Notifications', + name: 'ActionInvoked', + signature: DBusSignature('us')) + .asBroadcastStream() + .map((signal) => OrgFreedesktopNotificationsActionInvoked(signal)); } /// Invokes org.freedesktop.Notifications.Notify() - Future callNotify(String app_name, int replaces_id, String app_icon, String summary, String body, List actions, Map hints, int timeout, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { - var result = await callMethod('org.freedesktop.Notifications', 'Notify', [DBusString(app_name), DBusUint32(replaces_id), DBusString(app_icon), DBusString(summary), DBusString(body), DBusArray.string(actions), DBusDict.stringVariant(hints), DBusInt32(timeout)], replySignature: DBusSignature('u'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); + Future callNotify( + String app_name, + int replaces_id, + String app_icon, + String summary, + String body, + List actions, + Map hints, + int timeout, + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'org.freedesktop.Notifications', + 'Notify', + [ + DBusString(app_name), + DBusUint32(replaces_id), + DBusString(app_icon), + DBusString(summary), + DBusString(body), + DBusArray.string(actions), + DBusDict.stringVariant(hints), + DBusInt32(timeout) + ], + replySignature: DBusSignature('u'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); return result.returnValues[0].asUint32(); } /// Invokes org.freedesktop.Notifications.CloseNotification() - Future callCloseNotification(int id, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { - await callMethod('org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)], replySignature: DBusSignature(''), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); + Future callCloseNotification(int id, + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + await callMethod( + 'org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)], + replySignature: DBusSignature(''), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); } /// Invokes org.freedesktop.Notifications.GetCapabilities() - Future> callGetCapabilities({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { - var result = await callMethod('org.freedesktop.Notifications', 'GetCapabilities', [], replySignature: DBusSignature('as'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); + Future> callGetCapabilities( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'org.freedesktop.Notifications', 'GetCapabilities', [], + replySignature: DBusSignature('as'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); return result.returnValues[0].asStringArray().toList(); } /// Invokes org.freedesktop.Notifications.GetServerInformation() - Future> callGetServerInformation({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { - var result = await callMethod('org.freedesktop.Notifications', 'GetServerInformation', [], replySignature: DBusSignature('ssss'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); + Future> callGetServerInformation( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'org.freedesktop.Notifications', 'GetServerInformation', [], + replySignature: DBusSignature('ssss'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); return result.returnValues; } } diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml b/packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml index eeed050..742f4ac 100644 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml +++ b/packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml @@ -13,11 +13,10 @@ dependencies: dbus: ^0.7.8 plugin_platform_interface: ^2.0.2 flutter_local_notifications_platform_interface: ^7.0.0 - package_info_plus: 4.0.0 + package_info_plus: ^4.0.0 package_info_plus_aurora: path: ../../package_info_plus/package_info_plus_aurora - dev_dependencies: flutter_test: sdk: flutter @@ -27,5 +26,4 @@ flutter: plugin: platforms: aurora: - pluginClass: FlutterLocalNotificationsAuroraPlugin dartPluginClass: FlutterLocalNotificationsAurora diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart deleted file mode 100644 index 877a511..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_method_channel.dart'; - -void main() { - MethodChannelFlutterLocalNotificationsAurora platform = MethodChannelFlutterLocalNotificationsAurora(); - const MethodChannel channel = MethodChannel('flutter_local_notifications_aurora'); - - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - - test('getPlatformVersion', () async { - expect(await platform.getPlatformVersion(), '42'); - }); -} diff --git a/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart b/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart deleted file mode 100644 index e3bb959..0000000 --- a/packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora.dart'; -import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_platform_interface.dart'; -import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_method_channel.dart'; -import 'package:plugin_platform_interface/plugin_platform_interface.dart'; - -class MockFlutterLocalNotificationsAuroraPlatform - with MockPlatformInterfaceMixin - implements FlutterLocalNotificationsAuroraPlatform { - - @override - Future getPlatformVersion() => Future.value('42'); -} - -void main() { - final FlutterLocalNotificationsAuroraPlatform initialPlatform = FlutterLocalNotificationsAuroraPlatform.instance; - - test('$MethodChannelFlutterLocalNotificationsAurora is the default instance', () { - expect(initialPlatform, isInstanceOf()); - }); - - test('getPlatformVersion', () async { - FlutterLocalNotificationsAurora flutterLocalNotificationsAuroraPlugin = FlutterLocalNotificationsAurora(); - MockFlutterLocalNotificationsAuroraPlatform fakePlatform = MockFlutterLocalNotificationsAuroraPlatform(); - FlutterLocalNotificationsAuroraPlatform.instance = fakePlatform; - - expect(await flutterLocalNotificationsAuroraPlugin.getPlatformVersion(), '42'); - }); -}