Browse Source

[local_notification] base plagin data

merge-requests/3/head
Vitaliy Zarubin 2 years ago
parent
commit
62f95278f3
  1. 32
      packages/flutter_local_notifications/flutter_local_notifications_aurora/.gitignore
  2. 14
      packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md
  3. 1
      packages/flutter_local_notifications/flutter_local_notifications_aurora/analysis_options.yaml
  4. 23
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt
  5. 38
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp
  6. 23
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h
  7. 46
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/.gitignore
  8. 17
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/README.md
  9. 1
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/analysis_options.yaml
  10. 1
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/.gitignore
  11. 47
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/CMakeLists.txt
  12. 12
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/desktop/com.example.flutter_local_notifications_aurora_example.desktop
  13. 16
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp
  14. 12
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.h
  15. 31
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake
  16. BIN
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/108x108.png
  17. BIN
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/128x128.png
  18. BIN
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/172x172.png
  19. BIN
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/86x86.png
  20. 10
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/main.cpp
  21. 31
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/rpm/com.example.flutter_local_notifications_aurora_example.spec
  22. 51
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart
  23. 23
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/pubspec.yaml
  24. 27
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart
  25. 67
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart
  26. 17
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart
  27. 29
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart
  28. 27
      packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml
  29. 24
      packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart
  30. 29
      packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart
  31. 7
      script/build_example.sh
  32. 2
      script/vscode_properties.sh

32
packages/flutter_local_notifications/flutter_local_notifications_aurora/.gitignore vendored

@ -0,0 +1,32 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
run.sh
.metadata

14
packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md

@ -0,0 +1,14 @@
# flutter_local_notifications_aurora
The Aurora implementation of [`flutter_local_notifications`][https://github.com/MaikuB/flutter_local_notifications].
## Usage
This package is not an _endorsed_ implementation of `flutter_local_notifications`.
Therefore, you have to include `flutter_local_notifications_aurora` alongside `flutter_local_notifications` as dependencies in your `pubspec.yaml` file.
```yaml
dependencies:
flutter_local_notifications: 14.0.0+2
flutter_local_notifications_aurora:
path: # path to folder with plugin
```

1
packages/flutter_local_notifications/flutter_local_notifications_aurora/analysis_options.yaml

@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml

23
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt

@ -0,0 +1,23 @@
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)

38
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp

@ -0,0 +1,38 @@
#include <flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h>
#include <flutter/method-channel.h>
#include <sys/utsname.h>
void FlutterLocalNotificationsAuroraPlugin::RegisterWithRegistrar(PluginRegistrar &registrar)
{
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);
}

23
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h

@ -0,0 +1,23 @@
#ifndef FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H
#define FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H
#include <flutter/plugin-interface.h>
#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 &registrar) 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 */

46
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/.gitignore vendored

@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
.metadata
pubspec.lock
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

17
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/README.md

@ -0,0 +1,17 @@
# flutter_local_notifications_aurora_example
Demonstrates how to use the flutter_local_notifications_aurora plugin.
## Build
```shell
# Add an alias if it doesn't already exist
alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter
# Get dependencies
flutter-aurora pub get
# Run build
flutter-aurora build aurora --release
```
You can collect, sign, run an example on the device with a script located in the `script/build_example.sh`
More information in `build_example.sh`.

1
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/analysis_options.yaml

@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml

1
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/.gitignore vendored

@ -0,0 +1 @@
flutter/ephemeral

47
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/CMakeLists.txt

@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.10)
project(com.example.flutter_local_notifications_aurora_example LANGUAGES CXX)
include(GNUInstallDirs)
set(BINARY_NAME ${CMAKE_PROJECT_NAME})
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_SKIP_RPATH OFF)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
include(flutter/generated_plugins.cmake)
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so)
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR})
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR})
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172)
install(FILES icons/${ICONS_SIZE}.png
RENAME ${BINARY_NAME}.png
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/)
endforeach(ICONS_SIZE)

12
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/desktop/com.example.flutter_local_notifications_aurora_example.desktop

@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Name=flutter_local_notifications_aurora_example
Comment=Demonstrates how to use the flutter_local_notifications_aurora plugin.
Icon=com.example.flutter_local_notifications_aurora_example
Exec=/usr/bin/com.example.flutter_local_notifications_aurora_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=
OrganizationName=com.example
ApplicationName=flutter_local_notifications_aurora_example

16
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp

@ -0,0 +1,16 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include <flutter/application.h>
#include <flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h>
#include "generated_plugin_registrant.h"
void RegisterPlugins() {
Application::RegisterPlugins({
std::make_shared<FlutterLocalNotificationsAuroraPlugin>(),
});
}

12
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.h

@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT
#define GENERATED_PLUGIN_REGISTRANT
void RegisterPlugins();
#endif /* GENERATED_PLUGIN_REGISTRANT */

31
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake

@ -0,0 +1,31 @@
#
# Generated file, do not edit.
#
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}")
function(add_library TARGET)
_add_library(${TARGET} ${ARGN})
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:${TARGET}>"
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>")
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
endfunction()
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST
flutter_local_notifications_aurora
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN})
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin)
endforeach(PLUGIN)
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN})
endforeach(FFI_PLUGIN)

BIN
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/108x108.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/128x128.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/172x172.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/icons/86x86.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

10
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/main.cpp

@ -0,0 +1,10 @@
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
int main(int argc, char *argv[]) {
Application::Initialize(argc, argv);
Application::SetPixelRatio(1.8);
RegisterPlugins();
Application::Launch();
return 0;
}

31
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/rpm/com.example.flutter_local_notifications_aurora_example.spec

@ -0,0 +1,31 @@
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$
Name: com.example.flutter_local_notifications_aurora_example
Summary: Demonstrates how to use the flutter_local_notifications_aurora plugin.
Version: 0.1.0
Release: 1
License: Proprietary
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: pkgconfig(flutter-embedder)
%description
%{summary}.
%prep
%autosetup
%build
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type}
%make_build
%install
%make_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

51
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart

@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
@override
void initState() {
super.initState();
}
Future<void> _showNotification() async {
await flutterLocalNotificationsPlugin.show(
0,
"Title",
"Body",
null,
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: ElevatedButton(
onPressed: _showNotification,
child: const Text('Show notification'),
),
),
),
);
}
}

23
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/pubspec.yaml

@ -0,0 +1,23 @@
name: flutter_local_notifications_aurora_example
description: Demonstrates how to use the flutter_local_notifications_aurora plugin.
publish_to: 'none'
environment:
sdk: '>=2.18.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
flutter_local_notifications: ^14.0.0+2
flutter_local_notifications_aurora:
path: ../
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true

27
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart

@ -0,0 +1,27 @@
// 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,
);
});
}

67
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart

@ -0,0 +1,67 @@
import 'dart:io';
import 'package:dbus/dbus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart';
import 'flutter_local_notifications_aurora_platform_interface.dart';
class FlutterLocalNotificationsAurora
extends FlutterLocalNotificationsPlatform {
/// Registers this class as the default instance of [FlutterLocalNotificationsPlatform].
static void registerWith() {
// debugPrint(Platform.numberOfProcessors.toString());
// debugPrint(Platform.pathSeparator.toString());
// debugPrint(Platform.operatingSystem.toString());
// debugPrint(Platform.operatingSystemVersion.toString());
// debugPrint(Platform.localHostname.toString());
// debugPrint(Platform.version.toString());
debugPrint(defaultTargetPlatform.name);
debugPrint("!!!!!!!!!!!!!!!!!1");
FlutterLocalNotificationsPlatform.instance =
FlutterLocalNotificationsAurora();
}
@override
Future<void> show(
int id,
String? title,
String? body, {
String? payload,
}) async {
debugPrint('Hello target: ${defaultTargetPlatform.name}!');
// var client = DBusClient.session();
// var object = DBusRemoteObject(client,
// name: 'com.example.Test',
// path: DBusObjectPath('/com/example/Test/Object'));
// var value = await object.getProperty('com.example.Test', 'Version',
// signature: DBusSignature('s'));
// var version = value.asString();
// debugPrint('version: $version');
// var response = await object.callMethod(
// 'com.example.Test', 'ReverseText', [DBusString('Hello World')],
// replySignature: DBusSignature('s'));
// var reversedText = response.values[0].asString();
// debugPrint('$reversedText');
// await client.close();
}
Future<String?> getPlatformVersion() {
return FlutterLocalNotificationsAuroraPlatform.instance
.getPlatformVersion();
}
}

17
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart

@ -0,0 +1,17 @@
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<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}

29
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart

@ -0,0 +1,29 @@
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<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}

27
packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml

@ -0,0 +1,27 @@
name: flutter_local_notifications_aurora
description: The Aurora OS implementation of flutter_local_notifications.
version: 0.0.1
homepage:
environment:
sdk: '>=2.18.6 <3.0.0'
flutter: ">=2.5.0"
dependencies:
flutter:
sdk: flutter
dbus: ^0.7.8
plugin_platform_interface: ^2.0.2
flutter_local_notifications_platform_interface: ^7.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
plugin:
platforms:
aurora:
pluginClass: FlutterLocalNotificationsAuroraPlugin
dartPluginClass: FlutterLocalNotificationsAurora

24
packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart

@ -0,0 +1,24 @@
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');
});
}

29
packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart

@ -0,0 +1,29 @@
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<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final FlutterLocalNotificationsAuroraPlatform initialPlatform = FlutterLocalNotificationsAuroraPlatform.instance;
test('$MethodChannelFlutterLocalNotificationsAurora is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelFlutterLocalNotificationsAurora>());
});
test('getPlatformVersion', () async {
FlutterLocalNotificationsAurora flutterLocalNotificationsAuroraPlugin = FlutterLocalNotificationsAurora();
MockFlutterLocalNotificationsAuroraPlatform fakePlatform = MockFlutterLocalNotificationsAuroraPlatform();
FlutterLocalNotificationsAuroraPlatform.instance = fakePlatform;
expect(await flutterLocalNotificationsAuroraPlugin.getPlatformVersion(), '42');
});
}

7
script/build_example.sh

@ -12,7 +12,10 @@
## -s /home/user/sign/system_keys
## Flatter path
FLATTER="$HOME/.local/opt/flutter-sdk/bin/flutter"
# FLATTER="$HOME/.local/opt/flutter-sdk/bin/flutter"
# @todo
FLATTER="/home/keygenqt/Documents/OMP/flutter-sdk/bin/flutter"
## https://developer.auroraos.ru/doc/software_development/psdk/setup
## Install Platform SDK path
@ -93,4 +96,4 @@ if [ -n "$device" ]; then
# run application
ssh -t defaultuser@$D_IP "/usr/bin/com.example.${APP_KEY}_example"
fi
fi

2
script/vscode_properties.sh

@ -61,4 +61,4 @@ tee -a .vscode/c_cpp_properties.json << END
],
"version": 4
}
END
END

Loading…
Cancel
Save