From c3821419939ba6d7a90a97ed278dec7e51da95a4 Mon Sep 17 00:00:00 2001 From: Vitaliy Zarubin Date: Tue, 10 Oct 2023 18:24:46 +0000 Subject: [PATCH 1/5] [plugin] Add wakelock_plus --- README.md | 1 + example/lib/l10n/app_en.arb | 2 +- example/lib/l10n/app_ru.arb | 2 +- example/lib/packages/packages.dart | 2 + example/lib/packages/wakelock_plus/model.dart | 42 +++++++++ .../lib/packages/wakelock_plus/package.dart | 26 ++++++ example/lib/packages/wakelock_plus/page.dart | 89 +++++++++++++++++++ example/pubspec.yaml | 10 +++ .../wakelock_plus_aurora/.gitignore | 30 +++++++ .../wakelock_plus_aurora/README.md | 32 +++++++ .../analysis_options.yaml | 4 + .../data/com.nokia.mce.request.xml | 10 +++ .../lib/com_nokia_mce_request.dart | 20 +++++ .../lib/wakelock_plus_aurora.dart | 40 +++++++++ .../wakelock_plus_aurora/pubspec.yaml | 28 ++++++ 15 files changed, 336 insertions(+), 2 deletions(-) create mode 100644 example/lib/packages/wakelock_plus/model.dart create mode 100644 example/lib/packages/wakelock_plus/package.dart create mode 100644 example/lib/packages/wakelock_plus/page.dart create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/.gitignore create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/README.md create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/analysis_options.yaml create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/data/com.nokia.mce.request.xml create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/lib/com_nokia_mce_request.dart create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/lib/wakelock_plus_aurora.dart create mode 100644 packages/wakelock_plus/wakelock_plus_aurora/pubspec.yaml diff --git a/README.md b/README.md index e81c286..2c56916 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ | [path_provider_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/path_provider/path_provider_aurora) | `0.0.1` | [path_provider](https://pub.dev/packages/path_provider) | `2.1.1` | `4.0.2.269` | | [shared_preferences_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/shared_preferences/shared_preferences_aurora) | `0.0.1` | [shared_preferences](https://pub.dev/packages/shared_preferences) | `2.1.2` | `4.0.2.269` | | [sqflite_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/sqflite/sqflite_aurora) | `0.0.1` | [sqflite](https://pub.dev/packages/sqflite) | `2.3.0` | `4.0.2.269` | +| [wakelock_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/wakelock_plus/wakelock_plus_aurora) | `0.0.1` | [wakelock_plus](https://pub.dev/packages/wakelock_plus) | `1.1.1` | `4.0.2.269` | | [xdga_directories](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/xdga_directories) | `0.0.1` | - | - | `4.0.2.269` | | - | - | [flutter_cache_manager](https://pub.dev/packages/flutter_cache_manager) | `3.3.1` | `4.0.2.269` | | - | - | [cached_network_image](https://pub.dev/packages/cached_network_image) | `3.3.0` | `4.0.2.269` | diff --git a/example/lib/l10n/app_en.arb b/example/lib/l10n/app_en.arb index 2647a5f..857b8d2 100644 --- a/example/lib/l10n/app_en.arb +++ b/example/lib/l10n/app_en.arb @@ -169,7 +169,7 @@ }, "@_WAKELOCK": {}, - "wakelockTitle": "Wakelock", + "wakelockTitle": "Lock", "wakelockDesc": "The plugin allows you to enable and toggle the screen wakelock, which prevents the screen from turning off automatically.", "@_XDGA_DIRECTORIES": {}, diff --git a/example/lib/l10n/app_ru.arb b/example/lib/l10n/app_ru.arb index 89c7f69..beec8aa 100644 --- a/example/lib/l10n/app_ru.arb +++ b/example/lib/l10n/app_ru.arb @@ -161,7 +161,7 @@ "sharedPreferencesFieldError": "Пожалуйста, введите {value} значение", "@_WAKELOCK": {}, - "wakelockTitle": "Wakelock", + "wakelockTitle": "Блокировка", "wakelockDesc": "Плагин позволяет включать и переключать блокировку экрана, которая предотвращает автоматическое выключение экрана.", "@_XDGA_DIRECTORIES": {}, diff --git a/example/lib/packages/packages.dart b/example/lib/packages/packages.dart index 1d41e86..f1a3ad7 100644 --- a/example/lib/packages/packages.dart +++ b/example/lib/packages/packages.dart @@ -32,6 +32,7 @@ import 'package:flutter_example_packages/packages/scoped_model/package.dart'; import 'package:flutter_example_packages/packages/shared_preferences/package.dart'; import 'package:flutter_example_packages/packages/sqflite/package.dart'; import 'package:flutter_example_packages/packages/universal_io/package.dart'; +import 'package:flutter_example_packages/packages/wakelock_plus/package.dart'; import 'package:flutter_example_packages/packages/xdga_directories/package.dart'; /// List app packages @@ -67,5 +68,6 @@ final packages = [ packageSharedPreferences, packageSqflite, packageUniversalIO, + packageWakelockPlus, packageXdgaDirectories, ]; diff --git a/example/lib/packages/wakelock_plus/model.dart b/example/lib/packages/wakelock_plus/model.dart new file mode 100644 index 0000000..a03c63f --- /dev/null +++ b/example/lib/packages/wakelock_plus/model.dart @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter/widgets.dart'; +import 'package:scoped_model/scoped_model.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; + +/// Model for [WakelockPlusPage] +class WakelockPlusModel extends Model { + /// Get [ScopedModel] + static WakelockPlusModel of(BuildContext context) => + ScopedModel.of(context); + + /// Error + String? _error; + + /// Public error + String? get error => _error; + + /// Public is error + bool get isError => _error != null; + + /// Check is enable Wakelock + Future isEnable() async { + try { + return await WakelockPlus.enabled; + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// Set state Wakelock + Future setStateWakelockPlus(bool enable) async { + try { + await WakelockPlus.toggle(enable: enable); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + } +} diff --git a/example/lib/packages/wakelock_plus/package.dart b/example/lib/packages/wakelock_plus/package.dart new file mode 100644 index 0000000..3e057e4 --- /dev/null +++ b/example/lib/packages/wakelock_plus/package.dart @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter_example_packages/base/package/package_page.dart'; +import 'package:flutter_example_packages/packages/wakelock_plus/page.dart'; +import 'package:get_it/get_it.dart'; + +import 'model.dart'; + +/// Package values +final packageWakelockPlus = PackagePage( + key: 'wakelock_plus', + descEN: ''' + Plugin that allows you to keep the device screen awake, i.e. + prevent the screen from sleeping. + ''', + descRU: ''' + Плагин, который позволяет держать экран устройства в активном состоянии, + т. е. предотвращать переход экрана в спящий режим. + ''', + version: '1.1.1', + isPlatformDependent: true, + page: () => WakelockPlusPage(), + init: () { + GetIt.instance.registerFactory(() => WakelockPlusModel()); + }, +); diff --git a/example/lib/packages/wakelock_plus/page.dart b/example/lib/packages/wakelock_plus/page.dart new file mode 100644 index 0000000..be9634a --- /dev/null +++ b/example/lib/packages/wakelock_plus/page.dart @@ -0,0 +1,89 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter/material.dart'; +import 'package:flutter_example_packages/base/di/app_di.dart'; +import 'package:flutter_example_packages/base/package/package.dart'; +import 'package:flutter_example_packages/packages/wakelock_plus/model.dart'; +import 'package:flutter_example_packages/packages/wakelock_plus/package.dart'; +import 'package:flutter_example_packages/theme/colors.dart'; +import 'package:flutter_example_packages/widgets/base/export.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_alert.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_info_package.dart'; +import 'package:flutter_example_packages/widgets/layouts/block_layout.dart'; +import 'package:flutter_example_packages/widgets/texts/export.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + +class WakelockPlusPage extends AppStatefulWidget { + WakelockPlusPage({ + super.key, + }); + + final Package package = packageWakelockPlus; + + @override + State createState() => _WakelockPlusPageState(); +} + +class _WakelockPlusPageState extends AppState { + @override + Widget buildWide( + BuildContext context, + MediaQueryData media, + AppLocalizations l10n, + ) { + return BlockLayout( + model: getIt(), + title: widget.package.key, + builder: (context, child, model) { + return SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockInfoPackage(widget.package), + BlockAlert(model.error), + if (!model.isError) + Row( + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextTitleLarge(l10n.wakelockTitle), + const SizedBox(height: 8), + TextBodyMedium(l10n.wakelockDesc), + ], + ), + ), + FutureBuilder( + future: model.isEnable(), + builder: ( + BuildContext context, + AsyncSnapshot snapshot, + ) { + final value = snapshot.data ?? false; + return Expanded( + flex: 0, + child: Switch( + // This bool value toggles the switch. + value: value, + activeColor: AppColors.secondary, + onChanged: (bool value) { + model.setStateWakelockPlus(value); + }, + ), + ); + }, + ), + ], + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 5ee9b10..746b27b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -153,6 +153,16 @@ dependencies: # ref: master # path: packages/sqflite/sqflite_aurora + ## https://pub.dev/packages/wakelock_plus + wakelock_plus: ^1.1.1 + ## https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/wakelock_plus/wakelock_plus_aurora + wakelock_plus_aurora: + path: ../packages/wakelock_plus/wakelock_plus_aurora +# git: +# url: https://gitlab.com/omprussia/flutter/flutter-plugins.git +# ref: master +# path: packages/wakelock_plus/wakelock_plus_aurora + dev_dependencies: flutter_test: sdk: diff --git a/packages/wakelock_plus/wakelock_plus_aurora/.gitignore b/packages/wakelock_plus/wakelock_plus_aurora/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/.gitignore @@ -0,0 +1,30 @@ +# 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/ diff --git a/packages/wakelock_plus/wakelock_plus_aurora/README.md b/packages/wakelock_plus/wakelock_plus_aurora/README.md new file mode 100644 index 0000000..50d922d --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/README.md @@ -0,0 +1,32 @@ +# wakelock_plus_aurora + +The Aurora implementation of [`wakelock_plus`](https://pub.dev/packages/wakelock_plus). + +## Usage +This package is not an _endorsed_ implementation of `wakelock_plus`. +Therefore, you have to include `wakelock_plus_aurora` alongside `wakelock_plus` as dependencies in your `pubspec.yaml` file. + +**pubspec.yaml** + +```yaml +dependencies: + wakelock_plus: ^1.1.1 + wakelock_plus_aurora: + git: + url: https://gitlab.com/omprussia/flutter/flutter-plugins.git + ref: master + path: packages/wakelock_plus/wakelock_plus_aurora +``` + +***.dart** + +```dart +import 'package:wakelock_plus/wakelock_plus.dart'; +// ... + +// The following line will enable the Android and iOS wakelock. +WakelockPlus.enable(); + +// The next line disables the wakelock again. +WakelockPlus.disable(); +``` diff --git a/packages/wakelock_plus/wakelock_plus_aurora/analysis_options.yaml b/packages/wakelock_plus/wakelock_plus_aurora/analysis_options.yaml new file mode 100644 index 0000000..8a1fdc6 --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/analysis_options.yaml @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +include: package:flutter_lints/flutter.yaml diff --git a/packages/wakelock_plus/wakelock_plus_aurora/data/com.nokia.mce.request.xml b/packages/wakelock_plus/wakelock_plus_aurora/data/com.nokia.mce.request.xml new file mode 100644 index 0000000..ee47a8a --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/data/com.nokia.mce.request.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/packages/wakelock_plus/wakelock_plus_aurora/lib/com_nokia_mce_request.dart b/packages/wakelock_plus/wakelock_plus_aurora/lib/com_nokia_mce_request.dart new file mode 100644 index 0000000..8120726 --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/lib/com_nokia_mce_request.dart @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:dbus/dbus.dart'; + +class ComNokiaMceRequest extends DBusRemoteObject { + ComNokiaMceRequest(DBusClient client, String destination, + {DBusObjectPath path = + const DBusObjectPath.unchecked('/com/nokia/mce/request')}) + : super(client, name: destination, path: path); + + /// Invokes com.nokia.mce.request.req_display_blanking_pause() + Future callreq_display_blanking_pause( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + await callMethod('com.nokia.mce.request', 'req_display_blanking_pause', [], + replySignature: DBusSignature(''), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + } +} diff --git a/packages/wakelock_plus/wakelock_plus_aurora/lib/wakelock_plus_aurora.dart b/packages/wakelock_plus/wakelock_plus_aurora/lib/wakelock_plus_aurora.dart new file mode 100644 index 0000000..d8f33e7 --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/lib/wakelock_plus_aurora.dart @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'dart:async'; + +import 'package:dbus/dbus.dart'; +import 'package:wakelock_plus_platform_interface/wakelock_plus_platform_interface.dart'; +import 'com_nokia_mce_request.dart'; + +class WakelockPlusAurora extends WakelockPlusPlatformInterface { + bool _enable = false; + Timer? _timer; + + static void registerWith() { + WakelockPlusPlatformInterface.instance = WakelockPlusAurora(); + } + + @override + Future toggle({required bool enable}) async { + if (_enable != enable) { + _enable = enable; + final client = DBusClient.system(); + final request = ComNokiaMceRequest(client, 'com.nokia.mce'); + if (_timer == null) { + request.callreq_display_blanking_pause(); + _timer = Timer.periodic(const Duration(seconds: 60), (timer) { + request.callreq_display_blanking_pause(); + }); + } else { + _timer?.cancel(); + _timer = null; + } + await client.close(); + } + } + + @override + Future get enabled async { + return _enable; + } +} diff --git a/packages/wakelock_plus/wakelock_plus_aurora/pubspec.yaml b/packages/wakelock_plus/wakelock_plus_aurora/pubspec.yaml new file mode 100644 index 0000000..64526d4 --- /dev/null +++ b/packages/wakelock_plus/wakelock_plus_aurora/pubspec.yaml @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +name: wakelock_plus_aurora +description: Wakelock is Flutter plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping. +version: 0.0.1 + +environment: + sdk: '>=2.18.6 <4.0.0' + flutter: ">=3.0.0" + +dependencies: + flutter: + sdk: flutter + dbus: ^0.7.8 + plugin_platform_interface: ^2.0.2 + wakelock_plus_platform_interface: ^1.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + plugin: + platforms: + aurora: + dartPluginClass: WakelockPlusAurora From 6dcbca5ad5c5fdc55279cd011ac1fb07a0cc87ec Mon Sep 17 00:00:00 2001 From: Yura Petrov <6963227-petrovyuri@users.noreply.gitlab.com> Date: Thu, 12 Oct 2023 10:51:05 +0000 Subject: [PATCH 2/5] [documentation] Update sqflite_aurora --- packages/sqflite/sqflite_aurora/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/sqflite/sqflite_aurora/README.md b/packages/sqflite/sqflite_aurora/README.md index 8ed0763..bb3d04c 100644 --- a/packages/sqflite/sqflite_aurora/README.md +++ b/packages/sqflite/sqflite_aurora/README.md @@ -11,16 +11,28 @@ Therefore, you have to include `sqflite_aurora` alongside `sqflite` as dependenc ```yaml dependencies: - sqflite: ^2.2.6 + sqflite: ^2.3.0 sqflite_aurora: git: url: https://gitlab.com/omprussia/flutter/flutter-plugins.git ref: master path: packages/sqflite/sqflite_aurora ``` +***.desktop** + +```desktop +Permissions=UserDirs +``` + +***.spec** + +```spec +BuildRequires: pkgconfig(sqlite3) +``` ***.dart** ```dart import 'package:sqflite/sqflite.dart'; ``` + From 241a75eee282b37d0aa1bb10b2379000285991e1 Mon Sep 17 00:00:00 2001 From: Dmitry Mozer Date: Mon, 16 Oct 2023 18:09:43 +0000 Subject: [PATCH 3/5] =?UTF-8?q?[shared=5Fpreferences]=20=D0=A1hange=20getT?= =?UTF-8?q?emporaryDirectory=20to=20getApplicationSupportDirectory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/shared_preferences_aurora_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_api.dart b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_api.dart index c43b84f..d79d535 100644 --- a/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_api.dart +++ b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_api.dart @@ -53,7 +53,7 @@ class SharedPreferencesAuroraApi { /// Get file with data Future _getFile() async { return File(p.join( - (await getTemporaryDirectory()).path, + (await getApplicationSupportDirectory()).path, fileName, )).create(recursive: true); } From 3a72fa0f6e52567bafa9e0e62524dd6ca2c30826 Mon Sep 17 00:00:00 2001 From: Vitaliy Zarubin Date: Tue, 17 Oct 2023 09:31:48 +0000 Subject: [PATCH 4/5] [sensors_plus] Add plugin sensors_plus --- README.md | 33 +- ....auroraos.flutter_example_packages.desktop | 2 +- example/aurora/main.cpp | 2 + .../ru.auroraos.flutter_example_packages.spec | 1 + example/lib/l10n/app_en.arb | 20 + example/lib/l10n/app_ru.arb | 20 + .../flutter_keyboard_visibility/page.dart | 2 +- example/lib/packages/packages.dart | 2 + example/lib/packages/sensors_plus/model.dart | 11 + .../lib/packages/sensors_plus/package.dart | 26 + example/lib/packages/sensors_plus/page.dart | 209 ++++++++ example/lib/widgets/blocks/block_item.dart | 10 +- example/pubspec.yaml | 10 + .../sensors_plus_aurora/.gitignore | 30 ++ .../sensors_plus_aurora/.metadata | 30 ++ .../sensors_plus_aurora/README.md | 138 +++++ .../sensors_plus_aurora/analysis_options.yaml | 4 + .../sensors_plus_aurora/aurora/CMakeLists.txt | 34 ++ .../include/sensors_plus_aurora/globals.h | 15 + .../sensors_plus_aurora_plugin.h | 82 +++ .../aurora/sensors_plus_aurora_plugin.cpp | 493 ++++++++++++++++++ .../lib/events/als_event.dart | 11 + .../lib/events/compass_event.dart | 13 + .../lib/events/orientation_event.dart | 25 + .../lib/events/proximity_event.dart | 11 + .../lib/events/tap_event.dart | 53 ++ .../lib/sensors_plus_aurora.dart | 93 ++++ .../sensors_plus_aurora_method_channel.dart | 148 ++++++ ...ensors_plus_aurora_platform_interface.dart | 66 +++ .../sensors_plus_aurora/pubspec.yaml | 28 + 30 files changed, 1600 insertions(+), 22 deletions(-) create mode 100644 example/lib/packages/sensors_plus/model.dart create mode 100644 example/lib/packages/sensors_plus/package.dart create mode 100644 example/lib/packages/sensors_plus/page.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/.gitignore create mode 100644 packages/sensors_plus/sensors_plus_aurora/.metadata create mode 100644 packages/sensors_plus/sensors_plus_aurora/README.md create mode 100644 packages/sensors_plus/sensors_plus_aurora/analysis_options.yaml create mode 100644 packages/sensors_plus/sensors_plus_aurora/aurora/CMakeLists.txt create mode 100644 packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/globals.h create mode 100644 packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/sensors_plus_aurora_plugin.h create mode 100644 packages/sensors_plus/sensors_plus_aurora/aurora/sensors_plus_aurora_plugin.cpp create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/events/als_event.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/events/compass_event.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/events/orientation_event.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/events/proximity_event.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/events/tap_event.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_method_channel.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_platform_interface.dart create mode 100644 packages/sensors_plus/sensors_plus_aurora/pubspec.yaml diff --git a/README.md b/README.md index 2c56916..48b9b15 100644 --- a/README.md +++ b/README.md @@ -25,22 +25,23 @@ Список платформо-зависимых плагинов созданных для ОС Аврора либо зависящих от платформо-зависимых плагинов ОС Аврора. -| Плагин ОС Аврора | Версия | Внешний плагин | Версия | Версия ОС Аврора | -|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------------------------------------------------------------------------------|----------|--------------------| -| [battery_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/battery_plus/battery_plus_aurora) | `0.0.1` | [battery_plus](https://pub.dev/packages/battery_plus) | `4.0.2` | `4.0.2.269` | -| [device_info_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/device_info_plus/device_info_plus_aurora) | `0.0.1` | [device_info_plus](https://pub.dev/packages/device_info_plus) | `9.0.3` | `4.0.2.269` | -| [flutter_keyboard_visibility_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_keyboard_visibility/flutter_keyboard_visibility_aurora) | `0.0.1` | [flutter_keyboard_visibility](https://pub.dev/packages/flutter_keyboard_visibility) | `5.4.1` | `4.0.2.269` | -| [flutter_local_notifications_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_local_notifications/flutter_local_notifications_aurora) | `0.0.1` | [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) | `15.1.1` | `4.0.2.269` | -| [flutter_secure_storage_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_secure_storage/flutter_secure_storage_aurora) | `0.0.1` | [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage) | `9.0.0` | `4.0.2.269` | -| [package_info_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/package_info_plus/package_info_plus_aurora) | `0.0.1` | [package_info_plus](https://pub.dev/packages/package_info_plus) | `4.1.0` | `4.0.2.269` | -| [path_provider_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/path_provider/path_provider_aurora) | `0.0.1` | [path_provider](https://pub.dev/packages/path_provider) | `2.1.1` | `4.0.2.269` | -| [shared_preferences_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/shared_preferences/shared_preferences_aurora) | `0.0.1` | [shared_preferences](https://pub.dev/packages/shared_preferences) | `2.1.2` | `4.0.2.269` | -| [sqflite_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/sqflite/sqflite_aurora) | `0.0.1` | [sqflite](https://pub.dev/packages/sqflite) | `2.3.0` | `4.0.2.269` | -| [wakelock_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/wakelock_plus/wakelock_plus_aurora) | `0.0.1` | [wakelock_plus](https://pub.dev/packages/wakelock_plus) | `1.1.1` | `4.0.2.269` | -| [xdga_directories](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/xdga_directories) | `0.0.1` | - | - | `4.0.2.269` | -| - | - | [flutter_cache_manager](https://pub.dev/packages/flutter_cache_manager) | `3.3.1` | `4.0.2.269` | -| - | - | [cached_network_image](https://pub.dev/packages/cached_network_image) | `3.3.0` | `4.0.2.269` | -| - | - | [google_fonts](https://pub.dev/packages/google_fonts) | `6.1.0` | `4.0.2.269` | +| Плагин ОС Аврора | Версия | Внешний плагин | Версия | Версия ОС Аврора | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------|-----------|------------------| +| [battery_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/battery_plus/battery_plus_aurora) | `0.0.1` | [battery_plus](https://pub.dev/packages/battery_plus) | `4.0.2` | `4.0.2.269` | +| [device_info_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/device_info_plus/device_info_plus_aurora) | `0.0.1` | [device_info_plus](https://pub.dev/packages/device_info_plus) | `9.0.3` | `4.0.2.269` | +| [flutter_keyboard_visibility_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_keyboard_visibility/flutter_keyboard_visibility_aurora) | `0.0.1` | [flutter_keyboard_visibility](https://pub.dev/packages/flutter_keyboard_visibility) | `5.4.1` | `4.0.2.269` | +| [flutter_local_notifications_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_local_notifications/flutter_local_notifications_aurora) | `0.0.1` | [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) | `15.1.1` | `4.0.2.269` | +| [flutter_secure_storage_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/flutter_secure_storage/flutter_secure_storage_aurora) | `0.0.1` | [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage) | `9.0.0` | `4.0.2.269` | +| [package_info_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/package_info_plus/package_info_plus_aurora) | `0.0.1` | [package_info_plus](https://pub.dev/packages/package_info_plus) | `4.1.0` | `4.0.2.269` | +| [path_provider_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/path_provider/path_provider_aurora) | `0.0.1` | [path_provider](https://pub.dev/packages/path_provider) | `2.1.1` | `4.0.2.269` | +| [sensors_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/sensors_plus/sensors_plus_aurora) | `0.0.1` | [sensors_plus](https://pub.dev/packages/sensors_plus) | `3.1.0` | `4.0.2.269` | +| [shared_preferences_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/shared_preferences/shared_preferences_aurora) | `0.0.1` | [shared_preferences](https://pub.dev/packages/shared_preferences) | `2.1.2` | `4.0.2.269` | +| [sqflite_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/sqflite/sqflite_aurora) | `0.0.1` | [sqflite](https://pub.dev/packages/sqflite) | `2.3.0` | `4.0.2.269` | +| [wakelock_plus_aurora](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/wakelock_plus/wakelock_plus_aurora) | `0.0.1` | [wakelock_plus](https://pub.dev/packages/wakelock_plus) | `1.1.1` | `4.0.2.269` | +| [xdga_directories](https://gitlab.com/omprussia/flutter/flutter-plugins/-/tree/master/packages/xdga_directories) | `0.0.1` | - | - | `4.0.2.269` | +| - | - | [flutter_cache_manager](https://pub.dev/packages/flutter_cache_manager) | `3.3.1` | `4.0.2.269` | +| - | - | [cached_network_image](https://pub.dev/packages/cached_network_image) | `3.3.0` | `4.0.2.269` | +| - | - | [google_fonts](https://pub.dev/packages/google_fonts) | `6.1.0` | `4.0.2.269` | ## Пакеты Flutter diff --git a/example/aurora/desktop/ru.auroraos.flutter_example_packages.desktop b/example/aurora/desktop/ru.auroraos.flutter_example_packages.desktop index 1aa1d2b..4ce86e9 100644 --- a/example/aurora/desktop/ru.auroraos.flutter_example_packages.desktop +++ b/example/aurora/desktop/ru.auroraos.flutter_example_packages.desktop @@ -7,6 +7,6 @@ Exec=/usr/bin/ru.auroraos.flutter_example_packages X-Nemo-Application-Type=silica-qt5 [X-Application] -Permissions=DeviceInfo;UserDirs +Permissions=DeviceInfo;UserDirs;Sensors OrganizationName=ru.auroraos ApplicationName=flutter_example_packages diff --git a/example/aurora/main.cpp b/example/aurora/main.cpp index 6677776..383acc5 100644 --- a/example/aurora/main.cpp +++ b/example/aurora/main.cpp @@ -3,10 +3,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ #include +#include #include "generated_plugin_registrant.h" int main(int argc, char *argv[]) { Application::Initialize(argc, argv); + EnableQtCompatibility(); RegisterPlugins(); Application::Launch(); return 0; diff --git a/example/aurora/rpm/ru.auroraos.flutter_example_packages.spec b/example/aurora/rpm/ru.auroraos.flutter_example_packages.spec index 2c965f8..560769d 100644 --- a/example/aurora/rpm/ru.auroraos.flutter_example_packages.spec +++ b/example/aurora/rpm/ru.auroraos.flutter_example_packages.spec @@ -11,6 +11,7 @@ Source0: %{name}-%{version}.tar.zst BuildRequires: cmake BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(flutter-embedder) +BuildRequires: pkgconfig(sensord-qt5) %description %{summary}. diff --git a/example/lib/l10n/app_en.arb b/example/lib/l10n/app_en.arb index 857b8d2..c581d5b 100644 --- a/example/lib/l10n/app_en.arb +++ b/example/lib/l10n/app_en.arb @@ -1,4 +1,24 @@ { + "@_SENSORS_PLUS": {}, + "sensorsPlusTitleOrientation": "Orientation", + "sensorsPlusTitleAccelerometer": "Accelerometer", + "sensorsPlusTitleCompass": "Compass", + "sensorsPlusTitleTap": "Tap", + "sensorsPlusTitleALS": "ALS", + "sensorsPlusTitleProximity": "Proximity", + "sensorsPlusTitleGyroscope": "Gyroscope", + "sensorsPlusTitleMagnetometer": "Magnetometer", + "sensorsPlusNotFound": "Sensor not found", + "sensorsPlusSubtitle": "Sensor key: {name}", + "@sensorsPlusSubtitle": { + "placeholders": { + "name": { + "type": "String", + "example": "orientationsensor" + } + } + }, + "@_PROVIDER": {}, "providerTitle": "Provider", "providerSubtitle": "Simple example use provider package", diff --git a/example/lib/l10n/app_ru.arb b/example/lib/l10n/app_ru.arb index beec8aa..6794773 100644 --- a/example/lib/l10n/app_ru.arb +++ b/example/lib/l10n/app_ru.arb @@ -1,4 +1,24 @@ { + "@_SENSORS_PLUS": {}, + "sensorsPlusTitleOrientation": "Ориентация", + "sensorsPlusTitleAccelerometer": "Акселерометр", + "sensorsPlusTitleCompass": "Компас", + "sensorsPlusTitleTap": "Датчик движения", + "sensorsPlusTitleALS": "ALS", + "sensorsPlusTitleProximity": "Датчик приближения", + "sensorsPlusTitleGyroscope": "Гироскоп", + "sensorsPlusTitleMagnetometer": "Магнитометр", + "sensorsPlusNotFound": "Датчик не найден", + "sensorsPlusSubtitle": "Ключ датчика: {name}", + "@sensorsPlusSubtitle": { + "placeholders": { + "name": { + "type": "String", + "example": "orientationsensor" + } + } + }, + "@_PROVIDER": {}, "providerTitle": "Provider", "providerSubtitle": "Простой пример использования пакета provider", diff --git a/example/lib/packages/flutter_keyboard_visibility/page.dart b/example/lib/packages/flutter_keyboard_visibility/page.dart index 59f9a37..fa22dcd 100644 --- a/example/lib/packages/flutter_keyboard_visibility/page.dart +++ b/example/lib/packages/flutter_keyboard_visibility/page.dart @@ -99,7 +99,7 @@ class _FlutterKeyboardVisibilityPageState title: l10n.flutterKeyboardVisibilityTitleHeight, desc: l10n.flutterKeyboardVisibilityDescHeight, value: _keyboardHeight, - builder: (value) => value.toInt().toString(), + builder: (value) => value?.toInt().toString(), ), ), const SizedBox(height: 20), diff --git a/example/lib/packages/packages.dart b/example/lib/packages/packages.dart index f1a3ad7..3e56812 100644 --- a/example/lib/packages/packages.dart +++ b/example/lib/packages/packages.dart @@ -29,6 +29,7 @@ import 'package:flutter_example_packages/packages/provider/package.dart'; import 'package:flutter_example_packages/packages/qr_flutter/package.dart'; import 'package:flutter_example_packages/packages/rxdart/package.dart'; import 'package:flutter_example_packages/packages/scoped_model/package.dart'; +import 'package:flutter_example_packages/packages/sensors_plus/package.dart'; import 'package:flutter_example_packages/packages/shared_preferences/package.dart'; import 'package:flutter_example_packages/packages/sqflite/package.dart'; import 'package:flutter_example_packages/packages/universal_io/package.dart'; @@ -65,6 +66,7 @@ final packages = [ packageQrFlutter, packageRxdart, packageScopedModel, + packageSensorsPlus, packageSharedPreferences, packageSqflite, packageUniversalIO, diff --git a/example/lib/packages/sensors_plus/model.dart b/example/lib/packages/sensors_plus/model.dart new file mode 100644 index 0000000..50cfb69 --- /dev/null +++ b/example/lib/packages/sensors_plus/model.dart @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter/widgets.dart'; +import 'package:scoped_model/scoped_model.dart'; + +/// Model for [SensorsPlusPage] +class SensorsPlusModel extends Model { + /// Get [ScopedModel] + static SensorsPlusModel of(BuildContext context) => + ScopedModel.of(context); +} diff --git a/example/lib/packages/sensors_plus/package.dart b/example/lib/packages/sensors_plus/package.dart new file mode 100644 index 0000000..aa4a741 --- /dev/null +++ b/example/lib/packages/sensors_plus/package.dart @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter_example_packages/base/package/package_page.dart'; +import 'package:get_it/get_it.dart'; + +import 'model.dart'; +import 'page.dart'; + +/// Package values +final packageSensorsPlus = PackagePage( + key: 'sensors_plus', + descEN: ''' + A Flutter plugin to access the accelerometer, gyroscope, + magnetometer sensors, etc. + ''', + descRU: ''' + Плагин Flutter для доступа к датчикам акселерометра, + гироскопа, магнитометра и т.д. + ''', + version: '3.0.2', + isPlatformDependent: true, + page: () => SensorsPlusPage(), + init: () { + GetIt.instance.registerFactory(() => SensorsPlusModel()); + }, +); diff --git a/example/lib/packages/sensors_plus/page.dart b/example/lib/packages/sensors_plus/page.dart new file mode 100644 index 0000000..7304772 --- /dev/null +++ b/example/lib/packages/sensors_plus/page.dart @@ -0,0 +1,209 @@ +// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause +import 'package:flutter/material.dart'; +import 'package:flutter_example_packages/base/di/app_di.dart'; +import 'package:flutter_example_packages/base/package/package.dart'; +import 'package:flutter_example_packages/widgets/base/export.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_info_package.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_item.dart'; +import 'package:flutter_example_packages/widgets/layouts/block_layout.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:sensors_plus/sensors_plus.dart'; +import 'package:sensors_plus_aurora/events/als_event.dart'; +import 'package:sensors_plus_aurora/events/compass_event.dart'; +import 'package:sensors_plus_aurora/events/orientation_event.dart'; +import 'package:sensors_plus_aurora/events/proximity_event.dart'; +import 'package:sensors_plus_aurora/events/tap_event.dart'; +import 'package:sensors_plus_aurora/sensors_plus_aurora.dart'; + +import 'model.dart'; +import 'package.dart'; + +class SensorsPlusPage extends AppStatefulWidget { + SensorsPlusPage({ + super.key, + }); + + final Package package = packageSensorsPlus; + + @override + State createState() => _SensorsPlusPageState(); +} + +class _SensorsPlusPageState extends AppState { + Stream? _orientationEvents; + Stream? _accelerometerEvents; + Stream? _compassEvents; + Stream? _tapEvents; + Stream? _alsEvents; + Stream? _proximityEvents; + Stream? _gyroscopeEvents; + Stream? _magnetometerEvents; + + @override + void initState() { + super.initState(); + + try { + _orientationEvents = orientationEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _accelerometerEvents = accelerometerEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _compassEvents = compassEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _tapEvents = tapEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _alsEvents = alsEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _proximityEvents = proximityEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _gyroscopeEvents = gyroscopeEvents; + } catch (e) { + debugPrint(e.toString()); + } + try { + _magnetometerEvents = magnetometerEvents; + } catch (e) { + debugPrint(e.toString()); + } + } + + @override + Widget buildWide( + BuildContext context, + MediaQueryData media, + AppLocalizations l10n, + ) { + return BlockLayout( + model: getIt(), + title: widget.package.key, + builder: (context, child, model) { + return SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockInfoPackage(widget.package), + Visibility( + visible: _orientationEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleOrientation, + desc: l10n.sensorsPlusSubtitle('orientationsensor'), + stream: _orientationEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _accelerometerEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleAccelerometer, + desc: l10n.sensorsPlusSubtitle('accelerometersensor'), + stream: _accelerometerEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _compassEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleCompass, + desc: l10n.sensorsPlusSubtitle('compasssensor'), + stream: _compassEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _tapEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleTap, + desc: l10n.sensorsPlusSubtitle('tapsensor'), + stream: _tapEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _alsEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleALS, + desc: l10n.sensorsPlusSubtitle('alssensor'), + stream: _alsEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _proximityEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleProximity, + desc: l10n.sensorsPlusSubtitle('proximitysensor'), + stream: _proximityEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _gyroscopeEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleGyroscope, + desc: l10n.sensorsPlusSubtitle('rotationsensor'), + stream: _gyroscopeEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + Visibility( + visible: _magnetometerEvents != null, + child: BlockItem( + isShowProgress: false, + title: l10n.sensorsPlusTitleMagnetometer, + desc: l10n.sensorsPlusSubtitle('magnetometersensor'), + stream: _magnetometerEvents, + builder: (value) => value == null + ? l10n.sensorsPlusNotFound + : value.toString(), + ), + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/example/lib/widgets/blocks/block_item.dart b/example/lib/widgets/blocks/block_item.dart index 57fe8ad..2d5b2b9 100644 --- a/example/lib/widgets/blocks/block_item.dart +++ b/example/lib/widgets/blocks/block_item.dart @@ -15,6 +15,7 @@ class BlockItem extends AppStatelessWidget { this.future, this.stream, this.builder, + this.isShowProgress = true, }); final String? title; @@ -22,7 +23,8 @@ class BlockItem extends AppStatelessWidget { final T? value; final Stream? stream; final Future? future; - final Function(T)? builder; + final Function(T?)? builder; + final bool isShowProgress; AsyncWidgetBuilder get widgetBuilder => (BuildContext context, AsyncSnapshot snapshot) { @@ -47,14 +49,14 @@ class BlockItem extends AppStatelessWidget { ], ), ), - if (snapshot.hasData) + if (!isShowProgress || snapshot.hasData) TextBodyMedium( builder == null ? snapshot.data.toString() - : builder?.call(snapshot.data as T), + : builder?.call(snapshot.data), fontWeight: FontWeight.bold, ), - if (!snapshot.hasData) + if (isShowProgress && !snapshot.hasData) const SizedBox( width: 16, height: 16, diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 746b27b..f2b8800 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -163,6 +163,16 @@ dependencies: # ref: master # path: packages/wakelock_plus/wakelock_plus_aurora + ## https://pub.dev/packages/sensors_plus + sensors_plus: ^3.1.0 + ## https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/master/packages/sensors_plus/sensors_plus_aurora + sensors_plus_aurora: + path: ../packages/sensors_plus/sensors_plus_aurora +# git: +# url: https://gitlab.com/omprussia/flutter/flutter-plugins.git +# ref: master +# path: packages/sensors_plus/sensors_plus_aurora + dev_dependencies: flutter_test: sdk: diff --git a/packages/sensors_plus/sensors_plus_aurora/.gitignore b/packages/sensors_plus/sensors_plus_aurora/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/.gitignore @@ -0,0 +1,30 @@ +# 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/ diff --git a/packages/sensors_plus/sensors_plus_aurora/.metadata b/packages/sensors_plus/sensors_plus_aurora/.metadata new file mode 100644 index 0000000..641645c --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 135454af32477f815a7525073027a3ff9eff1bfd + channel: aurora + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd + - platform: aurora + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/sensors_plus/sensors_plus_aurora/README.md b/packages/sensors_plus/sensors_plus_aurora/README.md new file mode 100644 index 0000000..9cb7c44 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/README.md @@ -0,0 +1,138 @@ +# sensors_plus_aurora + +The Aurora implementation of [`sensors_plus`](https://pub.dev/packages/sensors_plus). + +## Usage + +This package is not an _endorsed_ implementation of `sensors_plus`. +Therefore, you have to include `sensors_plus_aurora` alongside `sensors_plus` as dependencies in your `pubspec.yaml` file. + +**pubspec.yaml** + +```yaml +dependencies: + sensors_plus: ^4.0.0 + sensors_plus_aurora: + git: + url: https://gitlab.com/omprussia/flutter/flutter-plugins.git + ref: master + path: packages/sensors_plus/sensors_plus_aurora +``` + +## Features + +- accelerometerEvents - A broadcast stream of events from the device accelerometer. +- gyroscopeEvents - A broadcast stream of events from the device gyroscope. +- magnetometerEvents - A broadcast stream of events from the device magnetometer. +- orientationEvents - A broadcast stream of events from the Aurora OS device orientation. +- compassEvents - A broadcast stream of events from the Aurora OS device compass. +- tapEvents - A broadcast stream of events from the Aurora OS device tap. +- alsEvents - A broadcast stream of events from the Aurora OS device ALS. +- proximityEvents - A broadcast stream of events from the Aurora OS device proximity. + +***.desktop** + +```desktop +Permissions=Sensors +``` +***.spec** + +```spec +BuildRequires: pkgconfig(sensord-qt5) +``` + +***.dart** + +```dart +import 'package:sensors_plus/sensors_plus.dart'; +import 'package:sensors_plus_aurora/events/als_event.dart'; +import 'package:sensors_plus_aurora/events/compass_event.dart'; +import 'package:sensors_plus_aurora/events/orientation_event.dart'; +import 'package:sensors_plus_aurora/events/proximity_event.dart'; +import 'package:sensors_plus_aurora/events/tap_event.dart'; +import 'package:sensors_plus_aurora/sensors_plus_aurora.dart'; + +/// Package sensors_plus +/// +/// A broadcast stream of events from the device accelerometer. +accelerometerEvents.listen( + (AccelerometerEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the device gyroscope. +gyroscopeEvents.listen( + (GyroscopeEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the device magnetometer. +magnetometerEvents.listen( + (MagnetometerEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// Custom Aurora OS events +/// +/// A broadcast stream of events from the Aurora OS device orientation. +orientationEvents?.listen( + (OrientationEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the Aurora OS device compass. +compassEvents?.listen( + (CompassEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the Aurora OS device tap. +tapEvents?.listen( + (TapEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the Aurora OS device ALS. +alsEvents?.listen( + (ALSEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); + +/// A broadcast stream of events from the Aurora OS device proximity. +proximityEvents?.listen( + (ProximityEvent event) { + debugPrint(event.toString()); + }, + onError: (error) { + debugPrint(error.toString()); + } +); +``` diff --git a/packages/sensors_plus/sensors_plus_aurora/analysis_options.yaml b/packages/sensors_plus/sensors_plus_aurora/analysis_options.yaml new file mode 100644 index 0000000..9e47db5 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/analysis_options.yaml @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +include: package:flutter_lints/flutter.yaml diff --git a/packages/sensors_plus/sensors_plus_aurora/aurora/CMakeLists.txt b/packages/sensors_plus/sensors_plus_aurora/aurora/CMakeLists.txt new file mode 100644 index 0000000..3b554a9 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/aurora/CMakeLists.txt @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME sensors_plus_aurora) +set(PLUGIN_NAME sensors_plus_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) +find_package(Qt5 COMPONENTS Core Network DBus REQUIRED) + +pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) +pkg_check_modules(SensordQt5 REQUIRED IMPORTED_TARGET sensord-qt5) + +add_library(${PLUGIN_NAME} SHARED sensors_plus_aurora_plugin.cpp) +set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden AUTOMOC ON) + +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) +target_link_libraries(${PLUGIN_NAME} PUBLIC Qt5::Core Qt5::Network Qt5::DBus) +target_link_libraries(${PLUGIN_NAME} PUBLIC PkgConfig::SensordQt5) + +target_include_directories(${PLUGIN_NAME} PRIVATE ${FLUTTER_DIR}) +target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}) + +target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) diff --git a/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/globals.h b/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/globals.h new file mode 100644 index 0000000..e07cf5f --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/globals.h @@ -0,0 +1,15 @@ +/** + * SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_GLOBALS_H +#define FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_GLOBALS_H + +#ifdef PLUGIN_IMPL +#define PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define PLUGIN_EXPORT +#endif + +#endif /* FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_GLOBALS_H */ diff --git a/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/sensors_plus_aurora_plugin.h b/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/sensors_plus_aurora_plugin.h new file mode 100644 index 0000000..ef0da39 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/aurora/include/sensors_plus_aurora/sensors_plus_aurora_plugin.h @@ -0,0 +1,82 @@ +/** + * SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_H +#define FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_H + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class PLUGIN_EXPORT SensorsPlusAuroraPlugin final : public QObject, public PluginInterface +{ + Q_OBJECT + +public: + void RegisterWithRegistrar(PluginRegistrar ®istrar) override; + +public slots: + void EventSensorOrientation(const Unsigned &data); + void EventSensorAccelerometer(const XYZ &data); + void EventSensorCompass(const Compass &data); + void EventSensorTap(const Tap &data); + void EventSensorALS(const Unsigned &data); + void EventSensorProximity(const Proximity &data); + void EventSensorRotation(const XYZ &data); + void EventSensorMagnetometer(const MagneticField &data); + +private: + template + bool RegisterSensorInterface(QString sensor); + void EventChannelNull(const std::string &channel); + void EventChannelData(const std::string &channel, const Encodable::List &result); + + void EnableSensorOrientation(); + void DisableSensorOrientation(); + + void EnableSensorAccelerometer(); + void DisableSensorAccelerometer(); + + void EnableSensorCompass(); + void DisableSensorCompass(); + + void EnableSensorTap(); + void DisableSensorTap(); + + void EnableSensorALS(); + void DisableSensorALS(); + + void EnableSensorProximity(); + void DisableSensorProximity(); + + void EnableSensorRotation(); + void DisableSensorRotation(); + + void EnableSensorMagnetometer(); + void DisableSensorMagnetometer(); + +private: + OrientationSensorChannelInterface *m_ifaceOrientation = nullptr; + AccelerometerSensorChannelInterface *m_ifaceAccelerometer = nullptr; + CompassSensorChannelInterface *m_ifaceCompass = nullptr; + TapSensorChannelInterface *m_ifaceTap = nullptr; + ALSSensorChannelInterface *m_ifaceALS = nullptr; + ProximitySensorChannelInterface *m_ifaceProximity = nullptr; + RotationSensorChannelInterface *m_ifaceRotation = nullptr; + MagnetometerSensorChannelInterface *m_ifaceMagnetometer = nullptr; +}; + +#endif /* FLUTTER_PLUGIN_SENSORS_PLUS_AURORA_PLUGIN_H */ diff --git a/packages/sensors_plus/sensors_plus_aurora/aurora/sensors_plus_aurora_plugin.cpp b/packages/sensors_plus/sensors_plus_aurora/aurora/sensors_plus_aurora_plugin.cpp new file mode 100644 index 0000000..43275d2 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/aurora/sensors_plus_aurora_plugin.cpp @@ -0,0 +1,493 @@ +/** + * SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace KeyChannel { +constexpr auto Orientation = "sensors_plus_aurora_orientationsensor"; +constexpr auto Accelerometer = "sensors_plus_aurora_accelerometersensor"; +constexpr auto Compass = "sensors_plus_aurora_compasssensor"; +constexpr auto Tap = "sensors_plus_aurora_tapsensor"; +constexpr auto ALS = "sensors_plus_aurora_alssensor"; +constexpr auto Proximity = "sensors_plus_aurora_proximitysensor"; +constexpr auto Rotation = "sensors_plus_aurora_rotationsensor"; +constexpr auto Magnetometer = "sensors_plus_aurora_magnetometersensor"; +} // namespace KeyChannel + +namespace KeySensor { +constexpr auto Orientation = "orientationsensor"; +constexpr auto Accelerometer = "accelerometersensor"; +constexpr auto Compass = "compasssensor"; +constexpr auto Tap = "tapsensor"; +constexpr auto ALS = "alssensor"; +constexpr auto Proximity = "proximitysensor"; +constexpr auto Rotation = "rotationsensor"; +constexpr auto Magnetometer = "magnetometersensor"; +} // namespace KeySensor + +void SensorsPlusAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) +{ + registrar.RegisterEventChannel( + KeyChannel::Orientation, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorOrientation(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorOrientation(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Accelerometer, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorAccelerometer(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorAccelerometer(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Compass, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorCompass(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorCompass(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Tap, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorTap(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorTap(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::ALS, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorALS(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorALS(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Proximity, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorProximity(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorProximity(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Rotation, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorRotation(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorRotation(); + return EventResponse(); + }); + + registrar.RegisterEventChannel( + KeyChannel::Magnetometer, + MethodCodecType::Standard, + [this](const Encodable &) { + EnableSensorMagnetometer(); + return EventResponse(); + }, + [this](const Encodable &) { + DisableSensorMagnetometer(); + return EventResponse(); + }); +} + +template +bool SensorsPlusAuroraPlugin::RegisterSensorInterface(QString sensor) +{ + SensorManagerInterface &sm = SensorManagerInterface::instance(); + if (!sm.isValid()) { + return false; + } + + QDBusReply reply(sm.loadPlugin(sensor)); + if (!reply.isValid() || !reply.value()) { + return false; + } + + sm.registerSensorInterface(sensor); + + return true; +} + +void SensorsPlusAuroraPlugin::EventChannelNull(const std::string &channel) +{ + EventChannel(channel, MethodCodecType::Standard).SendEvent(nullptr); +} + +void SensorsPlusAuroraPlugin::EventChannelData(const std::string &channel, const Encodable::List &result) +{ + EventChannel(channel, MethodCodecType::Standard).SendEvent(result); +} + +/** + * Orientation + */ +void SensorsPlusAuroraPlugin::EnableSensorOrientation() +{ + if (m_ifaceOrientation == nullptr) { + if (!RegisterSensorInterface(KeySensor::Orientation)) { + EventChannelNull(KeyChannel::Orientation); + return; + } + + m_ifaceOrientation = OrientationSensorChannelInterface::interface(KeySensor::Orientation); + + if (!m_ifaceOrientation) { + EventChannelNull(KeyChannel::Orientation); + return; + } + + connect(m_ifaceOrientation, + SIGNAL(orientationChanged(const Unsigned &)), + this, + SLOT(EventSensorOrientation(const Unsigned &))); + } + + m_ifaceOrientation->start(); + EventSensorOrientation(m_ifaceOrientation->orientation()); +} + +void SensorsPlusAuroraPlugin::DisableSensorOrientation() +{ + if (m_ifaceOrientation) { + m_ifaceOrientation->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorOrientation(const Unsigned &data) +{ + EventChannelData(KeyChannel::Orientation, Encodable::List {data.x()}); +} + +/** + * Accelerometer + */ +void SensorsPlusAuroraPlugin::EnableSensorAccelerometer() +{ + if (m_ifaceAccelerometer == nullptr) { + if (!RegisterSensorInterface( + KeySensor::Accelerometer)) { + EventChannelNull(KeyChannel::Accelerometer); + return; + } + + m_ifaceAccelerometer = AccelerometerSensorChannelInterface::interface( + KeySensor::Accelerometer); + + if (!m_ifaceAccelerometer) { + EventChannelNull(KeyChannel::Accelerometer); + return; + } + + connect(m_ifaceAccelerometer, + SIGNAL(dataAvailable(const XYZ &)), + this, + SLOT(EventSensorAccelerometer(const XYZ &))); + } + + m_ifaceAccelerometer->start(); + EventSensorAccelerometer(m_ifaceAccelerometer->get()); +} + +void SensorsPlusAuroraPlugin::DisableSensorAccelerometer() +{ + if (m_ifaceAccelerometer) { + m_ifaceAccelerometer->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorAccelerometer(const XYZ &data) +{ + EventChannelData(KeyChannel::Accelerometer, Encodable::List {data.x(), data.y(), data.z()}); +} + +/** + * Compass + */ +void SensorsPlusAuroraPlugin::EnableSensorCompass() +{ + if (m_ifaceCompass == nullptr) { + if (!RegisterSensorInterface(KeySensor::Compass)) { + EventChannelNull(KeyChannel::Compass); + return; + } + + m_ifaceCompass = CompassSensorChannelInterface::interface(KeySensor::Compass); + + if (!m_ifaceCompass) { + EventChannelNull(KeyChannel::Compass); + return; + } + + connect(m_ifaceCompass, + SIGNAL(dataAvailable(const Compass &)), + this, + SLOT(EventSensorCompass(const Compass &))); + } + + m_ifaceCompass->start(); + EventSensorCompass(m_ifaceCompass->get()); +} + +void SensorsPlusAuroraPlugin::DisableSensorCompass() +{ + if (m_ifaceCompass) { + m_ifaceCompass->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorCompass(const Compass &data) +{ + EventChannelData(KeyChannel::Compass, Encodable::List {data.degrees(), data.level()}); +} + +/** + * Tap + */ +void SensorsPlusAuroraPlugin::EnableSensorTap() +{ + if (m_ifaceTap == nullptr) { + if (!RegisterSensorInterface(KeySensor::Tap)) { + EventChannelNull(KeyChannel::Tap); + return; + } + + m_ifaceTap = TapSensorChannelInterface::interface(KeySensor::Tap); + + if (!m_ifaceTap) { + EventChannelNull(KeyChannel::Tap); + return; + } + + connect(m_ifaceTap, + SIGNAL(dataAvailable(const Tap &)), + this, + SLOT(EventSensorTap(const Tap &))); + } + + m_ifaceTap->start(); +} + +void SensorsPlusAuroraPlugin::DisableSensorTap() +{ + if (m_ifaceTap) { + m_ifaceTap->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorTap(const Tap &data) +{ + EventChannelData(KeyChannel::Tap, Encodable::List { + static_cast(data.direction()), + static_cast(data.type()) + }); +} + +/** + * ALS + */ +void SensorsPlusAuroraPlugin::EnableSensorALS() +{ + if (m_ifaceALS == nullptr) { + if (!RegisterSensorInterface(KeySensor::ALS)) { + EventChannelNull(KeyChannel::ALS); + return; + } + + m_ifaceALS = ALSSensorChannelInterface::interface(KeySensor::ALS); + + if (!m_ifaceALS) { + EventChannelNull(KeyChannel::ALS); + return; + } + + connect(m_ifaceALS, + SIGNAL(ALSChanged(const Unsigned &)), + this, + SLOT(EventSensorALS(const Unsigned &))); + } + + m_ifaceALS->start(); + EventSensorALS(m_ifaceALS->lux()); +} + +void SensorsPlusAuroraPlugin::DisableSensorALS() +{ + if (m_ifaceALS) { + m_ifaceALS->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorALS(const Unsigned &data) +{ + EventChannelData(KeyChannel::ALS, Encodable::List {data.x()}); +} + +/** + * Proximity + */ +void SensorsPlusAuroraPlugin::EnableSensorProximity() +{ + if (m_ifaceProximity == nullptr) { + if (!RegisterSensorInterface(KeySensor::Proximity)) { + EventChannelNull(KeyChannel::Proximity); + return; + } + + m_ifaceProximity = ProximitySensorChannelInterface::interface(KeySensor::Proximity); + + if (!m_ifaceProximity) { + EventChannelNull(KeyChannel::Proximity); + return; + } + + connect(m_ifaceProximity, + SIGNAL(reflectanceDataAvailable(const Proximity &)), + this, + SLOT(EventSensorProximity(const Proximity &))); + } + + m_ifaceProximity->start(); + EventSensorProximity(m_ifaceProximity->proximityReflectance()); +} + +void SensorsPlusAuroraPlugin::DisableSensorProximity() +{ + if (m_ifaceProximity) { + m_ifaceProximity->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorProximity(const Proximity &data) +{ + EventChannelData(KeyChannel::Proximity, Encodable::List {data.withinProximity() ? 1 : 0}); +} + +/** + * Rotation + */ +void SensorsPlusAuroraPlugin::EnableSensorRotation() +{ + if (m_ifaceRotation == nullptr) { + if (!RegisterSensorInterface(KeySensor::Rotation)) { + EventChannelNull(KeyChannel::Rotation); + return; + } + + m_ifaceRotation = RotationSensorChannelInterface::interface(KeySensor::Rotation); + + if (!m_ifaceRotation) { + EventChannelNull(KeyChannel::Rotation); + return; + } + + connect(m_ifaceRotation, + SIGNAL(dataAvailable(const XYZ &)), + this, + SLOT(EventSensorRotation(const XYZ &))); + } + + m_ifaceRotation->start(); + EventSensorRotation(m_ifaceRotation->rotation()); +} + +void SensorsPlusAuroraPlugin::DisableSensorRotation() +{ + if (m_ifaceRotation) { + m_ifaceRotation->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorRotation(const XYZ &data) +{ + EventChannelData(KeyChannel::Rotation, Encodable::List {data.x(), data.y(), data.z()}); +} + +/** + * Magnetometer + */ +void SensorsPlusAuroraPlugin::EnableSensorMagnetometer() +{ + if (m_ifaceMagnetometer == nullptr) { + if (!RegisterSensorInterface(KeySensor::Magnetometer)) { + EventChannelNull(KeyChannel::Magnetometer); + return; + } + + m_ifaceMagnetometer = MagnetometerSensorChannelInterface::interface(KeySensor::Magnetometer); + + if (!m_ifaceMagnetometer) { + EventChannelNull(KeyChannel::Magnetometer); + return; + } + + connect(m_ifaceMagnetometer, + SIGNAL(dataAvailable(const MagneticField &)), + this, + SLOT(EventSensorMagnetometer(const MagneticField &))); + } + + m_ifaceMagnetometer->start(); + EventSensorMagnetometer(m_ifaceMagnetometer->magneticField()); +} + +void SensorsPlusAuroraPlugin::DisableSensorMagnetometer() +{ + if (m_ifaceMagnetometer) { + m_ifaceMagnetometer->stop(); + } +} + +void SensorsPlusAuroraPlugin::EventSensorMagnetometer(const MagneticField &data) +{ + EventChannelData(KeyChannel::Magnetometer, Encodable::List {data.x(), data.y(), data.z()}); +} + +#include "moc_sensors_plus_aurora_plugin.cpp" diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/events/als_event.dart b/packages/sensors_plus/sensors_plus_aurora/lib/events/als_event.dart new file mode 100644 index 0000000..c23368c --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/events/als_event.dart @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +class ALSEvent { + ALSEvent(this.degrees); + + final int degrees; + + @override + String toString() => '[ALSEvent (degrees: $degrees)]'; +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/events/compass_event.dart b/packages/sensors_plus/sensors_plus_aurora/lib/events/compass_event.dart new file mode 100644 index 0000000..9e42086 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/events/compass_event.dart @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +class CompassEvent { + CompassEvent(this.degrees, this.level); + + final int degrees; + + final int level; + + @override + String toString() => '[CompassEvent (degrees: $degrees, level: $level)]'; +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/events/orientation_event.dart b/packages/sensors_plus/sensors_plus_aurora/lib/events/orientation_event.dart new file mode 100644 index 0000000..3b743da --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/events/orientation_event.dart @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +enum OrientationEvent { + /// The orientation is unknown. + undefined, + + /// The Top edge of the device is pointing up. + topUp, + + /// The Top edge of the device is pointing down. + topDown, + + /// The Left edge of the device is pointing up. + leftUp, + + /// The Right edge of the device is pointing up. + rightUp, + + /// The Face of the device is pointing up. + faceUp, + + /// The Face of the device is pointing down. + faceDown +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/events/proximity_event.dart b/packages/sensors_plus/sensors_plus_aurora/lib/events/proximity_event.dart new file mode 100644 index 0000000..ffda18c --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/events/proximity_event.dart @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +class ProximityEvent { + ProximityEvent(this.withinProximity); + + final bool withinProximity; + + @override + String toString() => '[ProximityEvent (withinProximity: $withinProximity)]'; +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/events/tap_event.dart b/packages/sensors_plus/sensors_plus_aurora/lib/events/tap_event.dart new file mode 100644 index 0000000..df4e031 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/events/tap_event.dart @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +/// Direction of tap. The last six directions may not be supported +/// depending on hardware. +enum TapDirection { + /// Left or right side tapped + x, + + /// Top or down side tapped + y, + + /// Face or bottom tapped + z, + + /// Tapped from left to right + leftRight, + + /// Tapped from right to left + rightLeft, + + /// Tapped from top to bottom + topBottom, + + /// Tapped from bottom to top + bottomTop, + + /// Tapped from face to back + faceBack, + + /// Tapped from back to face + backFace +} + +/// Type of tap. +enum TapType { + /// Double tap + doubleTap, + + /// Single tap. + singleTap +} + +class TapEvent { + TapEvent(this.direction, this.type); + + final TapDirection direction; + + final TapType type; + + @override + String toString() => '[TapEvent (direction: $direction, level: $type)]'; +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora.dart b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora.dart new file mode 100644 index 0000000..05776f3 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora.dart @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +import 'package:flutter/foundation.dart'; +import 'package:sensors_plus_aurora/events/als_event.dart'; +import 'package:sensors_plus_aurora/events/compass_event.dart'; +import 'package:sensors_plus_aurora/events/orientation_event.dart'; +import 'package:sensors_plus_aurora/events/proximity_event.dart'; +import 'package:sensors_plus_aurora/events/tap_event.dart'; +import 'package:sensors_plus_platform_interface/sensors_plus_platform_interface.dart'; + +import 'sensors_plus_aurora_platform_interface.dart'; + +/// A broadcast stream of events from the Aurora OS device orientation. +Stream? get orientationEvents { + if (TargetPlatform.aurora == defaultTargetPlatform) { + return SensorsPlusAurora().onChangeOrientation; + } + return null; +} + +/// A broadcast stream of events from the Aurora OS device compass. +Stream? get compassEvents { + if (TargetPlatform.aurora == defaultTargetPlatform) { + return SensorsPlusAurora().onChangeCompass; + } + return null; +} + +/// A broadcast stream of events from the Aurora OS device tap. +Stream? get tapEvents { + if (TargetPlatform.aurora == defaultTargetPlatform) { + return SensorsPlusAurora().onChangeTap; + } + return null; +} + +/// A broadcast stream of events from the Aurora OS device ALS. +Stream? get alsEvents { + if (TargetPlatform.aurora == defaultTargetPlatform) { + return SensorsPlusAurora().onChangeALS; + } + return null; +} + +/// A broadcast stream of events from the Aurora OS device proximity. +Stream? get proximityEvents { + if (TargetPlatform.aurora == defaultTargetPlatform) { + return SensorsPlusAurora().onChangeProximity; + } + return null; +} + +class SensorsPlusAurora extends SensorsPlatform { + static void registerWith() { + SensorsPlatform.instance = SensorsPlusAurora(); + } + + /// orientationsensor + Stream get onChangeOrientation => + SensorsPlusAuroraPlatform.instance.onChangeOrientation(); + + /// accelerometersensor + @override + Stream get accelerometerEvents => + SensorsPlusAuroraPlatform.instance.onChangeAccelerometer(); + + /// compasssensor + Stream get onChangeCompass => + SensorsPlusAuroraPlatform.instance.onChangeCompass(); + + /// tapsensor + Stream get onChangeTap => + SensorsPlusAuroraPlatform.instance.onChangeTap(); + + /// alssensor + Stream get onChangeALS => + SensorsPlusAuroraPlatform.instance.onChangeALS(); + + /// proximitysensor + Stream get onChangeProximity => + SensorsPlusAuroraPlatform.instance.onChangeProximity(); + + /// rotationsensor + @override + Stream get gyroscopeEvents => + SensorsPlusAuroraPlatform.instance.onChangeRotation(); + + /// magnetometersensor + @override + Stream get magnetometerEvents => + SensorsPlusAuroraPlatform.instance.onChangeMagnetometer(); +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_method_channel.dart b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_method_channel.dart new file mode 100644 index 0000000..dae0a05 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_method_channel.dart @@ -0,0 +1,148 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:sensors_plus_aurora/events/als_event.dart'; +import 'package:sensors_plus_aurora/events/compass_event.dart'; +import 'package:sensors_plus_aurora/events/orientation_event.dart'; +import 'package:sensors_plus_aurora/events/proximity_event.dart'; +import 'package:sensors_plus_aurora/events/tap_event.dart'; +import 'package:sensors_plus_platform_interface/sensors_plus_platform_interface.dart'; + +import 'sensors_plus_aurora_platform_interface.dart'; + +/// An implementation of [SensorsPlusAuroraPlatform] that uses method channels. +class MethodChannelSensorsPlusAurora extends SensorsPlusAuroraPlatform { + /// The method channel used to interact with the native platform. + @visibleForTesting + final methodChannel = const MethodChannel('sensors_plus_aurora'); + + List _loadData(dynamic data, String key) { + if (data == null) { + throw "Failed to load sensor '$key'"; + } + + return (data as List).map((e) => int.parse(e.toString())).toList(); + } + + @override + Stream onChangeOrientation() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_orientationsensor') + .receiveBroadcastStream()) { + switch (_loadData(data, 'orientationsensor')[0]) { + case 1: + yield OrientationEvent.rightUp; + break; + case 2: + yield OrientationEvent.leftUp; + break; + case 3: + yield OrientationEvent.topDown; + break; + case 4: + yield OrientationEvent.topUp; + break; + case 5: + yield OrientationEvent.faceDown; + break; + case 6: + yield OrientationEvent.faceUp; + break; + default: + yield OrientationEvent.undefined; + } + } + } + + @override + Stream onChangeAccelerometer() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_accelerometersensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'accelerometersensor'); + yield AccelerometerEvent( + result[0].toDouble(), + result[1].toDouble(), + result[2].toDouble(), + ); + } + } + + @override + Stream onChangeCompass() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_compasssensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'compasssensor'); + yield CompassEvent( + result[0], + result[1], + ); + } + } + + @override + Stream onChangeTap() async* { + await for (final data in const EventChannel('sensors_plus_aurora_tapsensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'tapsensor'); + yield TapEvent( + TapDirection.values[result[0]], + TapType.values[result[1]], + ); + } + } + + @override + Stream onChangeALS() async* { + await for (final data in const EventChannel('sensors_plus_aurora_alssensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'alssensor'); + yield ALSEvent( + result[0], + ); + } + } + + @override + Stream onChangeProximity() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_proximitysensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'proximitysensor'); + yield ProximityEvent( + result[0] == 1, + ); + } + } + + @override + Stream onChangeRotation() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_rotationsensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'rotationsensor'); + yield GyroscopeEvent( + result[0].toDouble(), + result[1].toDouble(), + result[2].toDouble(), + ); + } + } + + @override + Stream onChangeMagnetometer() async* { + await for (final data + in const EventChannel('sensors_plus_aurora_magnetometersensor') + .receiveBroadcastStream()) { + final result = _loadData(data, 'magnetometersensor'); + yield MagnetometerEvent( + result[0].toDouble(), + result[1].toDouble(), + result[2].toDouble(), + ); + } + } +} diff --git a/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_platform_interface.dart b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_platform_interface.dart new file mode 100644 index 0000000..859ed25 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/lib/sensors_plus_aurora_platform_interface.dart @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +// SPDX-License-Identifier: BSD-3-Clause + +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'package:sensors_plus_aurora/events/als_event.dart'; +import 'package:sensors_plus_aurora/events/compass_event.dart'; +import 'package:sensors_plus_aurora/events/orientation_event.dart'; +import 'package:sensors_plus_aurora/events/proximity_event.dart'; +import 'package:sensors_plus_aurora/events/tap_event.dart'; +import 'package:sensors_plus_platform_interface/sensors_plus_platform_interface.dart'; + +import 'sensors_plus_aurora_method_channel.dart'; + +abstract class SensorsPlusAuroraPlatform extends PlatformInterface { + /// Constructs a SensorsPlusAuroraPlatform. + SensorsPlusAuroraPlatform() : super(token: _token); + + static final Object _token = Object(); + + static SensorsPlusAuroraPlatform _instance = MethodChannelSensorsPlusAurora(); + + /// The default instance of [SensorsPlusAuroraPlatform] to use. + /// + /// Defaults to [MethodChannelSensorsPlusAurora]. + static SensorsPlusAuroraPlatform get instance => _instance; + + /// Platform-specific implementations should set this with their own + /// platform-specific class that extends [SensorsPlusAuroraPlatform] when + /// they register themselves. + static set instance(SensorsPlusAuroraPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + _instance = instance; + } + + Stream onChangeOrientation() { + throw UnimplementedError('onChangeOrientation() has not been implemented.'); + } + + Stream onChangeAccelerometer() { + throw UnimplementedError('onChangeAccelerometer() has not been implemented.'); + } + + Stream onChangeCompass() { + throw UnimplementedError('onChangeCompass() has not been implemented.'); + } + + Stream onChangeTap() { + throw UnimplementedError('onChangeTap() has not been implemented.'); + } + + Stream onChangeALS() { + throw UnimplementedError('onChangeALS() has not been implemented.'); + } + + Stream onChangeProximity() { + throw UnimplementedError('onChangeProximity() has not been implemented.'); + } + + Stream onChangeRotation() { + throw UnimplementedError('onChangeRotation() has not been implemented.'); + } + + Stream onChangeMagnetometer() { + throw UnimplementedError('onChangeMagnetometer() has not been implemented.'); + } +} diff --git a/packages/sensors_plus/sensors_plus_aurora/pubspec.yaml b/packages/sensors_plus/sensors_plus_aurora/pubspec.yaml new file mode 100644 index 0000000..f54dc72 --- /dev/null +++ b/packages/sensors_plus/sensors_plus_aurora/pubspec.yaml @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +name: sensors_plus_aurora +description: A new Flutter plugin project. +version: 0.0.1 + +environment: + sdk: '>=2.18.6 <4.0.0' + flutter: ">=3.0.0" + +dependencies: + flutter: + sdk: flutter + plugin_platform_interface: ^2.0.2 + sensors_plus_platform_interface: ^1.1.3 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + plugin: + platforms: + aurora: + pluginClass: SensorsPlusAuroraPlugin + dartPluginClass: SensorsPlusAurora From 5c413c93c66ab3cadbcd2843cbe3efee84b1ce1f Mon Sep 17 00:00:00 2001 From: Vitaliy Zarubin Date: Tue, 17 Oct 2023 12:58:39 +0300 Subject: [PATCH 5/5] [example] Update versions packages in application --- example/lib/packages/battery_plus/package.dart | 2 +- example/lib/packages/build_runner/package.dart | 2 +- example/lib/packages/cached_network_image/package.dart | 2 +- example/lib/packages/crypto/package.dart | 2 +- example/lib/packages/cupertino_icons/package.dart | 2 +- example/lib/packages/device_info_plus/package.dart | 2 +- example/lib/packages/flutter_cache_manager/package.dart | 2 +- example/lib/packages/flutter_local_notifications/package.dart | 2 +- example/lib/packages/flutter_markdown/package.dart | 2 +- example/lib/packages/flutter_secure_storage/package.dart | 2 +- example/lib/packages/freezed/package.dart | 2 +- example/lib/packages/freezed_annotation/package.dart | 2 +- example/lib/packages/get_it/package.dart | 2 +- example/lib/packages/google_fonts/package.dart | 2 +- example/lib/packages/intl/package.dart | 2 +- example/lib/packages/json_annotation/package.dart | 2 +- example/lib/packages/json_serializable/package.dart | 2 +- example/lib/packages/package_info_plus/package.dart | 2 +- example/lib/packages/path/package.dart | 2 +- example/lib/packages/path_provider/package.dart | 2 +- example/lib/packages/qr_flutter/package.dart | 2 +- example/lib/packages/sensors_plus/package.dart | 2 +- example/lib/packages/sqflite/package.dart | 2 +- example/lib/packages/universal_io/package.dart | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/example/lib/packages/battery_plus/package.dart b/example/lib/packages/battery_plus/package.dart index 64c1208..d4e2045 100644 --- a/example/lib/packages/battery_plus/package.dart +++ b/example/lib/packages/battery_plus/package.dart @@ -17,7 +17,7 @@ final packageBatteryPlus = PackagePage( Плагин Flutter для доступа к различной информации о аккумулятор устройства, на котором запущено приложение. ''', - version: '4.0.1', + version: '4.0.2', isPlatformDependent: true, page: () => BatteryPlusPage(), init: () { diff --git a/example/lib/packages/build_runner/package.dart b/example/lib/packages/build_runner/package.dart index 240abf4..31a76c7 100644 --- a/example/lib/packages/build_runner/package.dart +++ b/example/lib/packages/build_runner/package.dart @@ -24,6 +24,6 @@ final packageBuildRunner = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '2.3.3', + version: '2.4.6', isPlatformDependent: false, ); diff --git a/example/lib/packages/cached_network_image/package.dart b/example/lib/packages/cached_network_image/package.dart index 933df7b..f5883da 100644 --- a/example/lib/packages/cached_network_image/package.dart +++ b/example/lib/packages/cached_network_image/package.dart @@ -17,7 +17,7 @@ final packageCachedNetworkImage = PackagePage( Библиотека флаттера для отображения изображений из Интернета и хранения их в каталоге кеша. ''', - version: '3.2.3', + version: '3.3.0', isPlatformDependent: true, page: () => CachedNetworkImagePage(), init: () { diff --git a/example/lib/packages/crypto/package.dart b/example/lib/packages/crypto/package.dart index b776585..589d88c 100644 --- a/example/lib/packages/crypto/package.dart +++ b/example/lib/packages/crypto/package.dart @@ -19,6 +19,6 @@ final packageCrypto = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '3.0.2', + version: '3.0.3', isPlatformDependent: false, ); diff --git a/example/lib/packages/cupertino_icons/package.dart b/example/lib/packages/cupertino_icons/package.dart index d3d8d31..6521f89 100644 --- a/example/lib/packages/cupertino_icons/package.dart +++ b/example/lib/packages/cupertino_icons/package.dart @@ -21,6 +21,6 @@ final packageCupertinoIcons = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '1.0.5', + version: '1.0.6', isPlatformDependent: false, ); diff --git a/example/lib/packages/device_info_plus/package.dart b/example/lib/packages/device_info_plus/package.dart index 02425fd..499971a 100644 --- a/example/lib/packages/device_info_plus/package.dart +++ b/example/lib/packages/device_info_plus/package.dart @@ -15,7 +15,7 @@ final packageDeviceInfoPlus = PackagePage( descRU: ''' Получите текущую информацию об устройстве из приложения Flutter. ''', - version: '8.2.2', + version: '9.0.3', isPlatformDependent: true, page: () => DeviceInfoPlusPage(), init: () { diff --git a/example/lib/packages/flutter_cache_manager/package.dart b/example/lib/packages/flutter_cache_manager/package.dart index 803d527..e558e11 100644 --- a/example/lib/packages/flutter_cache_manager/package.dart +++ b/example/lib/packages/flutter_cache_manager/package.dart @@ -21,6 +21,6 @@ final packageFlutterCacheManager = PackageDialog( Это плагин зависимый от платформы, используется в плагине cached_network_image, должен работать и у вас. ''', - version: '3.3.0', + version: '3.3.1', isPlatformDependent: true, ); diff --git a/example/lib/packages/flutter_local_notifications/package.dart b/example/lib/packages/flutter_local_notifications/package.dart index bf271d1..348b119 100644 --- a/example/lib/packages/flutter_local_notifications/package.dart +++ b/example/lib/packages/flutter_local_notifications/package.dart @@ -15,7 +15,7 @@ final packageFlutterLocalNotifications = PackagePage( descRU: ''' Кроссплатформенный плагин для отображения локальных уведомлений. ''', - version: '14.1.1', + version: '15.1.1', isPlatformDependent: true, page: () => FlutterLocalNotificationsPage(), init: () { diff --git a/example/lib/packages/flutter_markdown/package.dart b/example/lib/packages/flutter_markdown/package.dart index a5dca5d..9ff4a70 100644 --- a/example/lib/packages/flutter_markdown/package.dart +++ b/example/lib/packages/flutter_markdown/package.dart @@ -17,7 +17,7 @@ final packageFlutterMarkdown = PackagePage( Рендерер уценки для Flutter. Он поддерживает исходный формат, но не поддерживает встроенный HTML. ''', - version: '0.6.15', + version: '0.6.17+4', isPlatformDependent: false, page: () => FlutterMarkdownPage(), init: () { diff --git a/example/lib/packages/flutter_secure_storage/package.dart b/example/lib/packages/flutter_secure_storage/package.dart index 443b9fb..9b37bf7 100644 --- a/example/lib/packages/flutter_secure_storage/package.dart +++ b/example/lib/packages/flutter_secure_storage/package.dart @@ -15,7 +15,7 @@ final packageFlutterSecureStorage = PackagePage( descRU: ''' Flutter Secure Storage предоставляет API для хранения данных в безопасном хранилище. ''', - version: '8.0.0', + version: '9.0.0', isPlatformDependent: true, page: () => FlutterSecureStoragePage(), init: () { diff --git a/example/lib/packages/freezed/package.dart b/example/lib/packages/freezed/package.dart index 9085dd9..8b0559a 100644 --- a/example/lib/packages/freezed/package.dart +++ b/example/lib/packages/freezed/package.dart @@ -16,7 +16,7 @@ final packageFreezed = PackagePage( Генератор кода для классов данных/объединений/сопоставления с образцом/клонирования. ''', - version: '2.3.3', + version: '2.4.3', isPlatformDependent: false, page: () => FreezedPage(), init: () { diff --git a/example/lib/packages/freezed_annotation/package.dart b/example/lib/packages/freezed_annotation/package.dart index 98c6e78..be94897 100644 --- a/example/lib/packages/freezed_annotation/package.dart +++ b/example/lib/packages/freezed_annotation/package.dart @@ -19,6 +19,6 @@ final packageFreezedAnnotation = PackageDialog( Это плагин независимый от платформы, используется в этом приложении в демострации работы плагина freezed. ''', - version: '2.2.0', + version: '2.4.1', isPlatformDependent: false, ); diff --git a/example/lib/packages/get_it/package.dart b/example/lib/packages/get_it/package.dart index a04a0e6..09b4e1e 100644 --- a/example/lib/packages/get_it/package.dart +++ b/example/lib/packages/get_it/package.dart @@ -21,6 +21,6 @@ final packageGetIt = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '7.6.0', + version: '7.6.4', isPlatformDependent: false, ); diff --git a/example/lib/packages/google_fonts/package.dart b/example/lib/packages/google_fonts/package.dart index 838b4aa..56af011 100644 --- a/example/lib/packages/google_fonts/package.dart +++ b/example/lib/packages/google_fonts/package.dart @@ -19,6 +19,6 @@ final packageGoogleFonts = PackageDialog( Это плагин зависимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '4.0.4', + version: '6.1.0', isPlatformDependent: true, ); diff --git a/example/lib/packages/intl/package.dart b/example/lib/packages/intl/package.dart index 285a63b..f21231a 100644 --- a/example/lib/packages/intl/package.dart +++ b/example/lib/packages/intl/package.dart @@ -23,6 +23,6 @@ final packageIntl = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '0.17.0', + version: '0.18.1', isPlatformDependent: false, ); diff --git a/example/lib/packages/json_annotation/package.dart b/example/lib/packages/json_annotation/package.dart index e59b9c2..b2a0419 100644 --- a/example/lib/packages/json_annotation/package.dart +++ b/example/lib/packages/json_annotation/package.dart @@ -21,6 +21,6 @@ final packageJsonAnnotation = PackageDialog( Это плагин независимый от платформы, используется в этом приложении в демострации работы плагина freezed. ''', - version: '4.8.0', + version: '4.8.1', isPlatformDependent: false, ); diff --git a/example/lib/packages/json_serializable/package.dart b/example/lib/packages/json_serializable/package.dart index 119ac8e..fcd762b 100644 --- a/example/lib/packages/json_serializable/package.dart +++ b/example/lib/packages/json_serializable/package.dart @@ -19,6 +19,6 @@ final packageJsonSerializable = PackageDialog( Это плагин независимый от платформы, используется в этом приложении в демострации работы плагина freezed. ''', - version: '6.6.1', + version: '6.7.1', isPlatformDependent: false, ); diff --git a/example/lib/packages/package_info_plus/package.dart b/example/lib/packages/package_info_plus/package.dart index f005221..9de057c 100644 --- a/example/lib/packages/package_info_plus/package.dart +++ b/example/lib/packages/package_info_plus/package.dart @@ -17,7 +17,7 @@ final packagePackageInfoPlus = PackagePage( Этот плагин Flutter предоставляет API для запроса информации о пакете приложения. ''', - version: '3.1.2', + version: '4.1.0', isPlatformDependent: true, page: () => PackageInfoPlusPage(), init: () { diff --git a/example/lib/packages/path/package.dart b/example/lib/packages/path/package.dart index d11d1ac..94ce3dd 100644 --- a/example/lib/packages/path/package.dart +++ b/example/lib/packages/path/package.dart @@ -19,6 +19,6 @@ final packagePath = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '1.8.2', + version: '1.8.3', isPlatformDependent: false, ); diff --git a/example/lib/packages/path_provider/package.dart b/example/lib/packages/path_provider/package.dart index a2389c8..c849548 100644 --- a/example/lib/packages/path_provider/package.dart +++ b/example/lib/packages/path_provider/package.dart @@ -19,7 +19,7 @@ final packagePathProvider = PackagePage( Поддерживает Android, iOS, Linux, macOS, Windows и ОС Aurora. Не все методы поддерживаются на всех платформах. ''', - version: '2.0.15', + version: '2.1.1', isPlatformDependent: true, page: () => PathProviderPage(), init: () { diff --git a/example/lib/packages/qr_flutter/package.dart b/example/lib/packages/qr_flutter/package.dart index ee08fda..ab57fcc 100644 --- a/example/lib/packages/qr_flutter/package.dart +++ b/example/lib/packages/qr_flutter/package.dart @@ -17,7 +17,7 @@ final packageQrFlutter = PackagePage( ПQR.Flutter — это библиотека Flutter для простого и быстрого рендеринга QR-кода с помощью виджета или пользовательского рисовальщика. ''', - version: '4.0.0', + version: '4.1.0', isPlatformDependent: false, page: () => QrFlutterPage(), init: () { diff --git a/example/lib/packages/sensors_plus/package.dart b/example/lib/packages/sensors_plus/package.dart index aa4a741..239ba1b 100644 --- a/example/lib/packages/sensors_plus/package.dart +++ b/example/lib/packages/sensors_plus/package.dart @@ -17,7 +17,7 @@ final packageSensorsPlus = PackagePage( Плагин Flutter для доступа к датчикам акселерометра, гироскопа, магнитометра и т.д. ''', - version: '3.0.2', + version: '3.1.0', isPlatformDependent: true, page: () => SensorsPlusPage(), init: () { diff --git a/example/lib/packages/sqflite/package.dart b/example/lib/packages/sqflite/package.dart index b4dec5c..05da72b 100644 --- a/example/lib/packages/sqflite/package.dart +++ b/example/lib/packages/sqflite/package.dart @@ -15,7 +15,7 @@ final packageSqflite = PackagePage( descRU: ''' Плагин SQLite для Flutter. Поддерживает iOS, Android, MacOS и ОС Аврора. ''', - version: '2.2.6', + version: '2.3.0', isPlatformDependent: true, page: () => SqflitePage(), init: () { diff --git a/example/lib/packages/universal_io/package.dart b/example/lib/packages/universal_io/package.dart index b390a5f..42aac0b 100644 --- a/example/lib/packages/universal_io/package.dart +++ b/example/lib/packages/universal_io/package.dart @@ -21,6 +21,6 @@ final packageUniversalIO = PackageDialog( Это плагин независимый от платформы, используется в этом приложении, должен работать и у вас. ''', - version: '2.2.0', + version: '2.2.2', isPlatformDependent: false, );