OMP#OS-17020 Plugin with information about device (device_info_plus) See merge request non-oss/flutter/flutter-plugins!4merge-requests/4/merge
@ -0,0 +1,7 @@
|
||||
# Authors |
||||
|
||||
* Denis Glazkov, <d.glazkov@omp.ru> |
||||
* Product owner, 2023 |
||||
* Maintainer, 2023 |
||||
|
||||
* Vitaliy Zarubin, <v.zarubin@omp.ru> |
@ -0,0 +1,83 @@
|
||||
# Code of Conduct |
||||
|
||||
## What is this code of conduct for? |
||||
|
||||
Code of conduct is a current set of rules of the Open Mobile Platform |
||||
which informs you how we expect |
||||
the members of the Open Mobile Platform community |
||||
will interact while contributing and communicating. |
||||
We are committed to providing a friendly, safe and welcoming |
||||
environment for all, regardless of gender, gender identity and expression, |
||||
sexual orientation, ability, physical appearance, body size, race, age, |
||||
socioeconomic status, religion (or lack thereof), |
||||
or other marginalized aspect of community members. |
||||
We expect all members of the Open Mobile Platform community |
||||
to abide by this Code of Conduct whenever interacting |
||||
in Open Mobile Platform venues |
||||
(merge requests, pull requests, issues, 1-1 or group chat, meetups, conferences, etc.) |
||||
|
||||
## Examples of appropriate behavior |
||||
|
||||
* Using welcoming and inclusive language. |
||||
* Being respectful of differing viewpoints and experiences. |
||||
* Gracefully accepting constructive criticism. |
||||
* Focusing on what is best for the community. |
||||
* Showing empathy towards other community members. |
||||
|
||||
## Examples of inappropriate behavior |
||||
|
||||
Because we come from a variety of backgrounds, |
||||
we do not want to assume that everyone has the same assumptions |
||||
about what is and is not appropriate. |
||||
Here are some examples of inappropriate behavior |
||||
that are incompatible with our community's ethos: |
||||
|
||||
* spamming, trolling, intentionally disrupting conversations, |
||||
or irrelevant solicitation or advertisement; |
||||
* making demeaning or discriminatory comments; |
||||
* making negative assumptions about someone's background, |
||||
abilities, or intentions; |
||||
* harassing or stalking individuals (online or in person). |
||||
|
||||
In general: treat others how you would like to be treated, |
||||
were you in their place. |
||||
Do ask questions. |
||||
Do keep conflicts productively focused on technical issues. |
||||
Do remember that we are all people, not robots, |
||||
and all equally deserving of sensitivity and respect. |
||||
|
||||
## What will organizers do about inappropriate behavior? |
||||
|
||||
If we notice you doing or saying something inappropriate, |
||||
an organizer will ask you to stop. |
||||
We will not demonize you. |
||||
But please do stop the inappropriate behavior |
||||
so we can get back to writing and discussing code in a safe environment. |
||||
If you have philosophical disagreements about what is actually inappropriate, |
||||
please take them to a separate public or private conversation |
||||
with an Open Mobile Platform maintainer |
||||
so we don't turn pull requests into an ethics debate. |
||||
If you keep doing unacceptable things, |
||||
we will likely ban you, report you to the administration, |
||||
or take other appropriate action. |
||||
|
||||
## What if I see or am subject to what feels like inappropriate behavior? |
||||
|
||||
Let us know. |
||||
Please notify a community organizer as soon as possible. |
||||
Full contact information is listed in the Contact Info section of this document. |
||||
All communications will be kept strictly confidential, |
||||
unless otherwise required by law. |
||||
No issue will be considered too inconsequential or unimportant for us |
||||
to have a conversation about. |
||||
|
||||
## Contact Info |
||||
|
||||
If you need to report an incident, |
||||
please contact <community@omp.ru>. |
||||
|
||||
This work is licensed under a Creative Commons Attribution 3.0 Unported License |
||||
For attribution requirements: |
||||
«Open Mobile Platform Code of Conduct» |
||||
Copyright (c) 2021 Open Mobile Platform LLC, |
||||
used under a [Creative Commons Attribution Unported license](http://creativecommons.org/licenses/by/3.0/). |
@ -0,0 +1,169 @@
|
||||
# Contributor License Agreements |
||||
|
||||
Thank you for your interest in contributing |
||||
to software projects managed by Open Mobile Platform («We» or «Us»). |
||||
This contributor agreement («Agreement») |
||||
documents the rights granted by contributors to Us. |
||||
To make this document effective, |
||||
please sign it and send it to Us by email or electronic submission. |
||||
This is a legally binding document, |
||||
so please read it carefully before agreeing to it. |
||||
The Agreement may cover more than one software project managed by Us. |
||||
|
||||
## 1. Definitions |
||||
|
||||
**«We» or «Us»** means Open Mobile Platform Limited Liability Company |
||||
(Open Mobile Platform LLC), |
||||
420500, Republic of Tatarstan, Verkhneuslonsky District, |
||||
Innopolis, Universitetskaya Street, h. 7, office 59, |
||||
OGRN (Primary State Registration Number) 1161690087020. |
||||
|
||||
**«You»** means the individual who Submits a Contribution to Us. |
||||
|
||||
**«Contribution»** means any work of authorship |
||||
that is Submitted by You to Us |
||||
in which You own or assert ownership of the Copyright. |
||||
|
||||
**«Copyright»** means all rights protecting works of authorship |
||||
owned or controlled by You, |
||||
including copyright, moral and neighboring rights, as appropriate, |
||||
for the full term of their existence including any extensions by You. |
||||
|
||||
**«Material»** means the work of authorship |
||||
which is made available by Us to third parties. |
||||
When this Agreement covers more than one software project, |
||||
the Material means the work of authorship |
||||
to which the Contribution was Submitted. |
||||
After You Submit the Contribution, |
||||
it may be included in the Material. |
||||
|
||||
**«Submit»** means any form of electronic, verbal, or written communication |
||||
sent to Us or our representatives, |
||||
including but not limited to electronic mailing lists, |
||||
source code control systems, and issue tracking systems |
||||
that are managed by, or on behalf of, Us |
||||
for the purpose of discussing and improving the Material, |
||||
but excluding communication that is conspicuously marked |
||||
or otherwise designated in writing by You as «Not a Contribution». |
||||
|
||||
**«Submission Date»** means the date |
||||
on which You Submit a Contribution to Us. |
||||
|
||||
**«Effective Date»** means the date You execute this Agreement |
||||
or the date You first Submit a Contribution to Us, |
||||
whichever is earlier. |
||||
|
||||
**«Media»** means any portion of a Contribution which is not software. |
||||
|
||||
## 2. Grant of Rights |
||||
|
||||
### 2.1. Copyright License |
||||
|
||||
(a) You retain ownership of the Copyright in Your Contribution |
||||
and have the same rights to use or license the Contribution |
||||
which You would have had without entering into the Agreement. |
||||
|
||||
(b) To the maximum extent permitted by the relevant law, |
||||
You grant to Us a perpetual, worldwide, non-exclusive, |
||||
transferable, royalty-free, irrevocable license |
||||
under the Copyright covering the Contribution, |
||||
with the right to sublicense |
||||
such rights through multiple tiers of sublicensees, |
||||
to reproduce, modify, display, perform and distribute |
||||
the Contribution as part of the Material; |
||||
provided that this license is conditioned upon compliance with Section 2.3. |
||||
|
||||
### 2.2. Patent License |
||||
|
||||
For patent claims including, without limitation, |
||||
method, process, and apparatus claims |
||||
which You own, control or have the right to grant, now or in the future, |
||||
You grant to Us a perpetual, worldwide, non-exclusive, |
||||
transferable, royalty-free, irrevocable patent license, |
||||
with the right to sublicense these rights to multiple tiers of sublicensees, |
||||
to make, have made, use, sell, offer for sale, import |
||||
and otherwise transfer the Contribution |
||||
and the Contribution in combination with the Material |
||||
(and portions of such combination). |
||||
This license is granted only to the extent |
||||
that the exercise of the licensed rights infringes such patent claims; |
||||
and provided that this license is conditioned upon compliance with Section 2.3. |
||||
|
||||
### 2.3. Outbound License |
||||
|
||||
Based on the grant of rights in Sections 2.1 and 2.2, |
||||
if We include Your Contribution in a Material, |
||||
We may license the Contribution under any license, |
||||
including copyleft, permissive, commercial, or proprietary licenses. |
||||
As a condition on the exercise of this right, |
||||
We agree to also license the Contribution |
||||
under the terms of the license or licenses |
||||
which We are using for the Material on the Submission Date. |
||||
|
||||
### 2.4. Our Rights |
||||
|
||||
You acknowledge that We are not obligated |
||||
to use Your Contribution as part of the Material |
||||
and may decide to include any Contribution We consider appropriate. |
||||
|
||||
## 3. Agreement |
||||
|
||||
You confirm that: |
||||
|
||||
(a) You have the legal authority to enter into this Agreement. |
||||
|
||||
(b) You own the Copyright and patent claims |
||||
covering the Contribution which are required |
||||
to grant the rights under Section 2. |
||||
|
||||
(c) The grant of rights under Section 2 |
||||
does not violate any grant of rights |
||||
which You have made to third parties, including Your employer. |
||||
If You are an employee, |
||||
You have had Your employer approve this Agreement |
||||
or sign the Entity version of this document. |
||||
If You are less than eighteen years old, |
||||
please have Your parents or guardian sign the Agreement. |
||||
|
||||
## 4. Disclaimer |
||||
|
||||
EXCEPT FOR THE EXPRESS WARRANTIES IN SECTION 3, |
||||
THE CONTRIBUTION IS PROVIDED «AS IS». |
||||
MORE PARTICULARLY, ALL EXPRESS OR IMPLIED WARRANTIES |
||||
INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE |
||||
AND NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US. |
||||
TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED, |
||||
SUCH WARRANTY IS LIMITED IN DURATION TO THE MINIMUM PERIOD PERMITTED BY LAW. |
||||
|
||||
## 5. Miscellaneous |
||||
|
||||
5.1. This Agreement will be governed by and construed |
||||
in accordance with the laws of Russian Federation. |
||||
|
||||
5.2. This Agreement sets out the entire agreement between You |
||||
and Us for Your Contributions to Us |
||||
and overrides all other agreements or understandings. |
||||
|
||||
5.3. If You or We assign the rights or obligations |
||||
received through this Agreement to a third party, |
||||
as a condition of the assignment, |
||||
that third party must agree in writing |
||||
to abide by all the rights and obligations in the Agreement. |
||||
|
||||
5.4. The failure of either party to require performance |
||||
by the other party of any provision of this Agreement in one situation |
||||
shall not affect the right of a party |
||||
to require such performance at any time in the future. |
||||
A waiver of performance under a provision in one situation |
||||
shall not be considered a waiver of the performance |
||||
of the provision in the future or a waiver of the provision in its entirety. |
||||
|
||||
5.5. If any provision of this Agreement is found void and unenforceable, |
||||
such provision will be replaced to the extent possible with a provision |
||||
that comes closest to the meaning of the original provision |
||||
and which is enforceable. |
||||
The terms and conditions set forth in this Agreement |
||||
shall apply notwithstanding any failure of essential purpose |
||||
of this Agreement or any limited remedy |
||||
to the maximum extent possible under law. |
@ -0,0 +1,30 @@
|
||||
# The 3-Clause BSD License |
||||
|
||||
_Copyright (C) 2022 ru.auroraos_ |
||||
|
||||
Redistribution and use in source and binary forms, |
||||
with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
1. Redistributions of source code must retain |
||||
the above copyright notice, this list of conditions and the following disclaimer. |
||||
2. Redistributions in binary form must reproduce |
||||
the above copyright notice, this list of conditions and the following disclaimer |
||||
in the documentation and/or other materials provided with the distribution. |
||||
3. Neither the name of the copyright holder nor the names of its contributors |
||||
may be used to endorse or promote products derived from this software |
||||
without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@ -0,0 +1,5 @@
|
||||
# Flutter Packages Aurora OS |
||||
|
||||
This repo is a companion repo to the main flutter repo. |
||||
It contains the source code for Aurora Flutter's packages (i.e., packages developed by the Aurora team). |
||||
Check the packages directory to see all packages. |
@ -0,0 +1,32 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
/pubspec.lock |
||||
**/doc/api/ |
||||
.dart_tool/ |
||||
.packages |
||||
build/ |
||||
.metadata |
||||
run.sh |
@ -0,0 +1,56 @@
|
||||
# device_info_plus_aurora |
||||
|
||||
The Aurora implementation of [`device_info_plus`](https://pub.dev/packages/device_info_plus). |
||||
|
||||
Permission: `DeviceInfo` |
||||
|
||||
Information available: |
||||
|
||||
- `id` - Target platform. |
||||
- `name` - Name OS. |
||||
- `version` - Versions OS. |
||||
- `prettyName` - Name and version OS. |
||||
- `hasGNSS` - The presence of GNSS in the device. |
||||
- `hasNFC` - The presence of NFC in the device. |
||||
- `hasBluetooth` - The presence of bluetooth in the device. |
||||
- `hasWlan` - The presence of wlan in the device. |
||||
- `maxCpuClockSpeed` - Max CPU clock speed. |
||||
- `numberCpuCores` - Number CPU cores. |
||||
- `batteryChargePercentage` - Device battery charge percentage. |
||||
- `mainCameraResolution` - Device main camera resolution. |
||||
- `frontalCameraResolution` - Device frontal camera resolution. |
||||
- `ramTotalSize` - Size total ram. |
||||
- `ramFreeSize` - Size free ram. |
||||
- `screenResolution` - Device screen resolution. |
||||
- `osVersion` - Name and version OS. |
||||
- `deviceModel` - Device name model. |
||||
- `internalStorage` - Map with information on internal storage. |
||||
- `internalStorage` - Map with information on internal storage. |
||||
- `simCards` - Array with information about SIM cards. |
||||
|
||||
## Usage |
||||
This package is not an _endorsed_ implementation of `device_info_plus`. |
||||
Therefore, you have to include `device_info_plus_aurora` alongside `device_info_plus` as dependencies in your `pubspec.yaml` file. |
||||
|
||||
```yaml |
||||
dependencies: |
||||
device_info_plus: ^9.0.1 |
||||
device_info_plus_aurora: |
||||
path: # path to folder with plugin |
||||
``` |
||||
|
||||
After that you can use like this: |
||||
|
||||
```dart |
||||
import 'package:device_info_plus/device_info_plus.dart'; |
||||
|
||||
final deviceInfoPlugin = DeviceInfoPlugin(); |
||||
final deviceInfo = await deviceInfoPlugin.linuxInfo as AuroraDeviceInfo; |
||||
|
||||
debutPrint(deviceInfo.data); |
||||
``` |
||||
|
||||
### Preview example |
||||
|
||||
 |
||||
|
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
After Width: | Height: | Size: 94 KiB |
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="ru.omp.deviceinfo.Features"> |
||||
<signal name="cameraEnabledChanged"> |
||||
<arg name="enabled" type="b" direction="out"/> |
||||
</signal> |
||||
<method name="hasGNSS"> |
||||
<arg type="b" direction="out"/> |
||||
</method> |
||||
<method name="hasNFC"> |
||||
<arg type="b" direction="out"/> |
||||
</method> |
||||
<method name="hasBluetooth"> |
||||
<arg type="b" direction="out"/> |
||||
</method> |
||||
<method name="hasWlan"> |
||||
<arg type="b" direction="out"/> |
||||
</method> |
||||
<method name="getMaxCpuClockSpeed"> |
||||
<arg type="u" direction="out"/> |
||||
</method> |
||||
<method name="getNumberCpuCores"> |
||||
<arg type="u" direction="out"/> |
||||
</method> |
||||
<method name="getCpuModel"> |
||||
<arg type="s" direction="out"/> |
||||
</method> |
||||
<method name="getMaxCpuCoresClockSpeed"> |
||||
<arg type="av" direction="out"/> |
||||
</method> |
||||
<method name="getBatteryChargePercentage"> |
||||
<arg type="u" direction="out"/> |
||||
</method> |
||||
<method name="getMainCameraResolution"> |
||||
<arg type="d" direction="out"/> |
||||
</method> |
||||
<method name="getFrontalCameraResolution"> |
||||
<arg type="d" direction="out"/> |
||||
</method> |
||||
<method name="getRamTotalSize"> |
||||
<arg type="t" direction="out"/> |
||||
</method> |
||||
<method name="getRamFreeSize"> |
||||
<arg type="t" direction="out"/> |
||||
</method> |
||||
<method name="getScreenResolution"> |
||||
<arg type="s" direction="out"/> |
||||
</method> |
||||
<method name="getOsVersion"> |
||||
<arg type="s" direction="out"/> |
||||
</method> |
||||
<method name="getDeviceModel"> |
||||
<arg type="s" direction="out"/> |
||||
</method> |
||||
<method name="getSerialNumber"> |
||||
<arg type="s" direction="out"/> |
||||
</method> |
||||
</interface> |
||||
</node> |
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="ru.omp.deviceinfo.SIM"> |
||||
<signal name="simCardsEnabledChanged"> |
||||
<arg name="updatedSimCards" type="aa{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMapList"/> |
||||
</signal> |
||||
<signal name="preferredDataTransferSimChanged"> |
||||
<arg name="updatedSimCards" type="aa{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMapList"/> |
||||
</signal> |
||||
<signal name="preferredVoiceCallSimChanged"> |
||||
<arg name="updatedSimCards" type="aa{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMapList"/> |
||||
</signal> |
||||
<method name="getSimCardsInfo"> |
||||
<arg type="aa{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMapList"/> |
||||
</method> |
||||
</interface> |
||||
</node> |
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="ru.omp.deviceinfo.Storages"> |
||||
<signal name="externalStorageChanged"> |
||||
<arg name="updatedStorage" type="a{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> |
||||
</signal> |
||||
<method name="getInternalStorageInfo"> |
||||
<arg type="a{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> |
||||
</method> |
||||
<method name="getInternalUserPartitionInfo"> |
||||
<arg type="a{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> |
||||
</method> |
||||
<method name="getExternalStorageInfo"> |
||||
<arg type="a{sv}" direction="out"/> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> |
||||
</method> |
||||
</interface> |
||||
</node> |
@ -0,0 +1,45 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
**/doc/api/ |
||||
**/ios/Flutter/.last_build_id |
||||
.dart_tool/ |
||||
.flutter-plugins |
||||
.flutter-plugins-dependencies |
||||
.packages |
||||
.pub-cache/ |
||||
.pub/ |
||||
/build/ |
||||
pubspec.lock |
||||
|
||||
# Symbolication related |
||||
app.*.symbols |
||||
|
||||
# Obfuscation related |
||||
app.*.map.json |
||||
|
||||
# Android Studio will place build artifacts here |
||||
/android/app/debug |
||||
/android/app/profile |
||||
/android/app/release |
@ -0,0 +1,17 @@
|
||||
# device_info_plus_aurora |
||||
|
||||
Demonstrates how to use the device_info_plus_aurora plugin. |
||||
|
||||
## Build |
||||
|
||||
```shell |
||||
# Add an alias if it doesn't already exist |
||||
alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter |
||||
# Get dependencies |
||||
flutter-aurora pub get |
||||
# Run build |
||||
flutter-aurora build aurora --release |
||||
``` |
||||
|
||||
You can collect, sign, run an example on the device with a script located in the `script/build_example.sh` |
||||
More information in `build_example.sh`. |
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
@ -0,0 +1 @@
|
||||
flutter/ephemeral |
@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
project(com.example.device_info_plus_aurora_example LANGUAGES CXX) |
||||
|
||||
include(GNUInstallDirs) |
||||
|
||||
set(BINARY_NAME ${CMAKE_PROJECT_NAME}) |
||||
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
||||
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra") |
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") |
||||
|
||||
set(CMAKE_SKIP_RPATH OFF) |
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") |
||||
|
||||
find_package(PkgConfig REQUIRED) |
||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) |
||||
|
||||
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) |
||||
|
||||
include(flutter/generated_plugins.cmake) |
||||
|
||||
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) |
||||
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications) |
||||
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) |
||||
|
||||
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so |
||||
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) |
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
|
||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
||||
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) |
||||
|
||||
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) |
||||
install(FILES icons/${ICONS_SIZE}.png |
||||
RENAME ${BINARY_NAME}.png |
||||
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) |
||||
endforeach(ICONS_SIZE) |
@ -0,0 +1,12 @@
|
||||
[Desktop Entry] |
||||
Type=Application |
||||
Name=device_info_plus_aurora_example |
||||
Comment=Demonstrates how to use the device_info_plus_aurora plugin. |
||||
Icon=com.example.device_info_plus_aurora_example |
||||
Exec=/usr/bin/com.example.device_info_plus_aurora_example |
||||
X-Nemo-Application-Type=silica-qt5 |
||||
|
||||
[X-Application] |
||||
Permissions=DeviceInfo |
||||
OrganizationName=com.example |
||||
ApplicationName=device_info_plus_aurora_example |
@ -0,0 +1,14 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include <flutter/application.h> |
||||
|
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
void RegisterPlugins() { |
||||
Application::RegisterPlugins({ |
||||
}); |
||||
} |
@ -0,0 +1,12 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT |
||||
#define GENERATED_PLUGIN_REGISTRANT |
||||
|
||||
void RegisterPlugins(); |
||||
|
||||
#endif /* GENERATED_PLUGIN_REGISTRANT */ |
@ -0,0 +1,30 @@
|
||||
# |
||||
# Generated file, do not edit. |
||||
# |
||||
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") |
||||
|
||||
function(add_library TARGET) |
||||
_add_library(${TARGET} ${ARGN}) |
||||
|
||||
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
add_custom_command(TARGET ${TARGET} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
"$<TARGET_FILE:${TARGET}>" |
||||
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>") |
||||
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
endfunction() |
||||
|
||||
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST |
||||
) |
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
) |
||||
|
||||
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN}) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin) |
||||
endforeach(PLUGIN) |
||||
|
||||
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN}) |
||||
endforeach(FFI_PLUGIN) |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 6.5 KiB |
@ -0,0 +1,10 @@
|
||||
#include <flutter/application.h> |
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
Application::Initialize(argc, argv); |
||||
Application::SetPixelRatio(1.8); |
||||
RegisterPlugins(); |
||||
Application::Launch(); |
||||
return 0; |
||||
} |
@ -0,0 +1,31 @@
|
||||
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ |
||||
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ |
||||
|
||||
Name: com.example.device_info_plus_aurora_example |
||||
Summary: Demonstrates how to use the device_info_plus_aurora plugin. |
||||
Version: 0.1.0 |
||||
Release: 1 |
||||
License: Proprietary |
||||
Source0: %{name}-%{version}.tar.zst |
||||
|
||||
BuildRequires: cmake |
||||
BuildRequires: pkgconfig(flutter-embedder) |
||||
|
||||
%description |
||||
%{summary}. |
||||
|
||||
%prep |
||||
%autosetup |
||||
|
||||
%build |
||||
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} |
||||
%make_build |
||||
|
||||
%install |
||||
%make_install |
||||
|
||||
%files |
||||
%{_bindir}/%{name} |
||||
%{_datadir}/%{name}/* |
||||
%{_datadir}/applications/%{name}.desktop |
||||
%{_datadir}/icons/hicolor/*/apps/%{name}.png |
@ -0,0 +1,385 @@
|
||||
import 'package:device_info_plus_aurora/aurora_device_info.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'dart:async'; |
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart'; |
||||
|
||||
void main() { |
||||
runApp(const MyApp()); |
||||
} |
||||
|
||||
class MyApp extends StatefulWidget { |
||||
const MyApp({super.key}); |
||||
|
||||
@override |
||||
State<MyApp> createState() => _MyAppState(); |
||||
} |
||||
|
||||
class _MyAppState extends State<MyApp> { |
||||
String? _error; |
||||
String? _id; |
||||
String? _name; |
||||
String? _version; |
||||
String? _prettyName; |
||||
bool? _hasGNSS; |
||||
bool? _hasNFC; |
||||
bool? _hasBluetooth; |
||||
bool? _hasWlan; |
||||
int? _maxCpuClockSpeed; |
||||
int? _numberCpuCores; |
||||
int? _batteryChargePercentage; |
||||
double? _mainCameraResolution; |
||||
double? _frontalCameraResolution; |
||||
int? _ramTotalSize; |
||||
int? _ramFreeSize; |
||||
String? _screenResolution; |
||||
String? _osVersion; |
||||
String? _deviceModel; |
||||
Map<String, dynamic>? _externalStorage; |
||||
Map<String, dynamic>? _internalStorage; |
||||
List<Map<String, dynamic>>? _simCards; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
initPlatformState(); |
||||
} |
||||
|
||||
// Platform messages are asynchronous, so we initialize in an async method. |
||||
Future<void> initPlatformState() async { |
||||
final deviceInfoPlugin = DeviceInfoPlugin(); |
||||
|
||||
try { |
||||
final deviceInfo = await deviceInfoPlugin.linuxInfo as AuroraDeviceInfo; |
||||
setState(() { |
||||
_id = deviceInfo.id; |
||||
_name = deviceInfo.name; |
||||
_version = deviceInfo.version; |
||||
_prettyName = deviceInfo.prettyName; |
||||
_hasGNSS = deviceInfo.hasGNSS; |
||||
_hasNFC = deviceInfo.hasNFC; |
||||
_hasBluetooth = deviceInfo.hasBluetooth; |
||||
_hasWlan = deviceInfo.hasWlan; |
||||
_maxCpuClockSpeed = deviceInfo.maxCpuClockSpeed; |
||||
_numberCpuCores = deviceInfo.numberCpuCores; |
||||
_batteryChargePercentage = deviceInfo.batteryChargePercentage; |
||||
_mainCameraResolution = deviceInfo.mainCameraResolution; |
||||
_frontalCameraResolution = deviceInfo.frontalCameraResolution; |
||||
_ramTotalSize = deviceInfo.ramTotalSize; |
||||
_ramFreeSize = deviceInfo.ramFreeSize; |
||||
_screenResolution = deviceInfo.screenResolution; |
||||
_osVersion = deviceInfo.osVersion; |
||||
_deviceModel = deviceInfo.deviceModel; |
||||
_externalStorage = deviceInfo.externalStorage; |
||||
_internalStorage = deviceInfo.internalStorage; |
||||
_simCards = deviceInfo.simCards; |
||||
}); |
||||
} on Exception catch (e) { |
||||
setState(() { |
||||
_error = e.toString(); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); |
||||
const textStyleTitle = TextStyle(fontSize: 20, color: Colors.black); |
||||
const textStylePath = TextStyle(fontSize: 18, color: Colors.black54); |
||||
|
||||
const spaceMedium = SizedBox(height: 20); |
||||
const spaceSmall = SizedBox(height: 10); |
||||
|
||||
return MaterialApp( |
||||
home: Scaffold( |
||||
appBar: AppBar( |
||||
title: const Text('Example device_info_plus'), |
||||
), |
||||
body: Stack( |
||||
children: [ |
||||
// Error message |
||||
Visibility( |
||||
visible: _error != null, |
||||
child: Center( |
||||
child: Padding( |
||||
padding: const EdgeInsets.all(16), |
||||
child: Container( |
||||
padding: const EdgeInsets.all(20), |
||||
decoration: const BoxDecoration( |
||||
color: Colors.redAccent, |
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)), |
||||
), |
||||
child: Text( |
||||
_error ?? '', |
||||
style: textStyleWhite, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
// List directories path |
||||
Visibility( |
||||
visible: _error == null, |
||||
child: SingleChildScrollView( |
||||
child: Padding( |
||||
padding: const EdgeInsets.all(16), |
||||
child: Center( |
||||
child: Column( |
||||
children: [ |
||||
// Info |
||||
Container( |
||||
padding: const EdgeInsets.all(20), |
||||
decoration: const BoxDecoration( |
||||
color: Colors.green, |
||||
borderRadius: |
||||
BorderRadius.all(Radius.circular(10.0)), |
||||
), |
||||
child: const Text( |
||||
'Demo application demonstration implementation of device_info_plus', |
||||
style: textStyleWhite, |
||||
textAlign: TextAlign.center, |
||||
), |
||||
), |
||||
const SizedBox(height: 30), |
||||
|
||||
const Text( |
||||
'ID', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_id.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Name', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_name.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Version', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_version.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Pretty Name', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_prettyName.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Has GNSS', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_hasGNSS.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Has NFC', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_hasNFC.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Has Bluetooth', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_hasBluetooth.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Has Wlan', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_hasWlan.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Max Cpu Clock Speed', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_maxCpuClockSpeed.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Number Cpu Cores', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_numberCpuCores.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Battery Charge Percentage', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_batteryChargePercentage.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Main Camera Resolution', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_mainCameraResolution.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Frontal Camera Resolution', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_frontalCameraResolution.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Ram Total Size', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_ramTotalSize.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Ram Free Size', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_ramFreeSize.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Screen Resolution', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_screenResolution.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'OS Version', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_osVersion.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Device Model', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_deviceModel.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'External Storage Info', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_externalStorage.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Internal Storage Info', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_internalStorage.toString(), |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'SIM Cards Info', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_simCards.toString(), |
||||
style: textStylePath, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
name: device_info_plus_aurora_example |
||||
description: Demonstrates how to use the device_info_plus_aurora plugin. |
||||
|
||||
publish_to: 'none' |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
device_info_plus: ^9.0.1 |
||||
device_info_plus_aurora: |
||||
path: ../ |
||||
cupertino_icons: ^1.0.2 |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
uses-material-design: true |
@ -0,0 +1,106 @@
|
||||
import 'package:device_info_plus/device_info_plus.dart'; |
||||
|
||||
class AuroraDeviceInfo implements LinuxDeviceInfo { |
||||
/// Constructs a AuroraDeviceInfo. |
||||
AuroraDeviceInfo({ |
||||
required this.hasGNSS, |
||||
required this.hasNFC, |
||||
required this.hasBluetooth, |
||||
required this.hasWlan, |
||||
required this.maxCpuClockSpeed, |
||||
required this.numberCpuCores, |
||||
required this.batteryChargePercentage, |
||||
required this.mainCameraResolution, |
||||
required this.frontalCameraResolution, |
||||
required this.ramTotalSize, |
||||
required this.ramFreeSize, |
||||
required this.screenResolution, |
||||
required this.osVersion, |
||||
required this.deviceModel, |
||||
required this.externalStorage, |
||||
required this.internalStorage, |
||||
required this.simCards, |
||||
}); |
||||
|
||||
@override |
||||
String get id => 'aurora'; |
||||
|
||||
@override |
||||
String get name => osVersion.split(' ').first; |
||||
|
||||
@override |
||||
String? get version => osVersion.split(' ').last; |
||||
|
||||
@override |
||||
String get prettyName => osVersion; |
||||
|
||||
final bool hasGNSS; |
||||
final bool hasNFC; |
||||
final bool hasBluetooth; |
||||
final bool hasWlan; |
||||
final int maxCpuClockSpeed; |
||||
final int numberCpuCores; |
||||
final int batteryChargePercentage; |
||||
final double mainCameraResolution; |
||||
final double frontalCameraResolution; |
||||
final int ramTotalSize; |
||||
final int ramFreeSize; |
||||
final String screenResolution; |
||||
final String osVersion; |
||||
final String deviceModel; |
||||
final Map<String, dynamic> externalStorage; |
||||
final Map<String, dynamic> internalStorage; |
||||
final List<Map<String, dynamic>> simCards; |
||||
|
||||
@override |
||||
Map<String, dynamic> get data => { |
||||
'id': id, |
||||
'name': name, |
||||
'version': version, |
||||
'prettyName': prettyName, |
||||
'hasGNSS': hasGNSS, |
||||
'hasNFC': hasNFC, |
||||
'hasBluetooth': hasBluetooth, |
||||
'hasWlan': hasWlan, |
||||
'maxCpuClockSpeed': maxCpuClockSpeed, |
||||
'numberCpuCores': numberCpuCores, |
||||
'batteryChargePercentage': batteryChargePercentage, |
||||
'mainCameraResolution': mainCameraResolution, |
||||
'frontalCameraResolution': frontalCameraResolution, |
||||
'ramTotalSize': ramTotalSize, |
||||
'ramFreeSize': ramFreeSize, |
||||
'screenResolution': screenResolution, |
||||
'osVersion': osVersion, |
||||
'deviceModel': deviceModel, |
||||
'externalStorage': externalStorage, |
||||
'internalStorage': internalStorage, |
||||
'simCards': simCards, |
||||
}; |
||||
|
||||
@override |
||||
String? get buildId => null; |
||||
|
||||
@override |
||||
List<String>? get idLike => null; |
||||
|
||||
@override |
||||
String? get machineId => null; |
||||
|
||||
@override |
||||
String? get variant => null; |
||||
|
||||
@override |
||||
String? get variantId => null; |
||||
|
||||
@override |
||||
String? get versionCodename => null; |
||||
|
||||
@override |
||||
String? get versionId => null; |
||||
|
||||
@Deprecated('Use [data] getter instead') |
||||
@override |
||||
Map<String, dynamic> toMap() { |
||||
return data; |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
import 'package:dbus/dbus.dart'; |
||||
import 'package:device_info_plus/device_info_plus.dart'; |
||||
import 'package:device_info_plus_aurora/ru_omp_deviceinfo_features.dart'; |
||||
import 'package:device_info_plus_aurora/ru_omp_deviceinfo_sim.dart'; |
||||
import 'package:device_info_plus_aurora/ru_omp_deviceinfo_storages.dart'; |
||||
import 'package:device_info_plus_platform_interface/device_info_plus_platform_interface.dart'; |
||||
import 'package:flutter/foundation.dart'; |
||||
import 'aurora_device_info.dart'; |
||||
|
||||
class DeviceInfoPlusAurora extends DeviceInfoPlatform { |
||||
/// Register this dart class as the platform implementation for aurora |
||||
static void registerWith() { |
||||
if (TargetPlatform.aurora == defaultTargetPlatform) { |
||||
DeviceInfoPlatform.instance = DeviceInfoPlusAurora(); |
||||
} else { |
||||
DeviceInfoPlatform.instance = DeviceInfoPlusLinuxPlugin(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Future<BaseDeviceInfo> deviceInfo() async { |
||||
final client = DBusClient.session(); |
||||
|
||||
// Features |
||||
final features = RuOmpDeviceinfoFeatures(client, 'ru.omp.deviceinfo', |
||||
DBusObjectPath('/ru/omp/deviceinfo/Features')); |
||||
|
||||
final hasGNSS = await features.callhasGNSS(); |
||||
final hasNFC = await features.callhasNFC(); |
||||
final hasBluetooth = await features.callhasBluetooth(); |
||||
final hasWlan = await features.callhasWlan(); |
||||
final maxCpuClockSpeed = await features.callgetMaxCpuClockSpeed(); |
||||
final numberCpuCores = await features.callgetNumberCpuCores(); |
||||
final batteryChargePercentage = |
||||
await features.callgetBatteryChargePercentage(); |
||||
final mainCameraResolution = await features.callgetMainCameraResolution(); |
||||
final frontalCameraResolution = |
||||
await features.callgetFrontalCameraResolution(); |
||||
final ramTotalSize = await features.callgetRamTotalSize(); |
||||
final ramFreeSize = await features.callgetRamFreeSize(); |
||||
final screenResolution = await features.callgetScreenResolution(); |
||||
final osVersion = await features.callgetOsVersion(); |
||||
final deviceModel = await features.callgetDeviceModel(); |
||||
|
||||
// Storages |
||||
final storages = RuOmpDeviceinfoStorages(client, 'ru.omp.deviceinfo', |
||||
DBusObjectPath('/ru/omp/deviceinfo/Storages')); |
||||
|
||||
final Map<String, dynamic> internalStorage = {}; |
||||
(await storages.callgetInternalStorageInfo()).forEach((key, value) { |
||||
internalStorage[key] = value.toNative(); |
||||
}); |
||||
|
||||
final Map<String, dynamic> externalStorage = {}; |
||||
(await storages.callgetExternalStorageInfo()).forEach((key, value) { |
||||
externalStorage[key] = value.toNative(); |
||||
}); |
||||
|
||||
// SIM |
||||
final infoSIM = RuOmpDeviceinfoSIM( |
||||
client, 'ru.omp.deviceinfo', DBusObjectPath('/ru/omp/deviceinfo/SIM')); |
||||
|
||||
final List<Map<String, dynamic>> simCards = []; |
||||
for (var element in await infoSIM.callgetSimCardsInfo()) { |
||||
final Map<String, dynamic> simCard = {}; |
||||
element.forEach((key, value) { |
||||
simCard[key] = value.toNative(); |
||||
}); |
||||
simCards.add(simCard); |
||||
} |
||||
|
||||
await client.close(); |
||||
|
||||
return AuroraDeviceInfo( |
||||
hasGNSS: hasGNSS, |
||||
hasNFC: hasNFC, |
||||
hasBluetooth: hasBluetooth, |
||||
hasWlan: hasWlan, |
||||
maxCpuClockSpeed: maxCpuClockSpeed, |
||||
numberCpuCores: numberCpuCores, |
||||
batteryChargePercentage: batteryChargePercentage, |
||||
mainCameraResolution: mainCameraResolution, |
||||
frontalCameraResolution: frontalCameraResolution, |
||||
ramTotalSize: ramTotalSize, |
||||
ramFreeSize: ramFreeSize, |
||||
screenResolution: screenResolution, |
||||
osVersion: osVersion, |
||||
deviceModel: deviceModel, |
||||
externalStorage: externalStorage, |
||||
internalStorage: internalStorage, |
||||
simCards: simCards, |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,237 @@
|
||||
// This file was generated using the following command and may be overwritten. |
||||
// dart-dbus generate-remote-object data/ru.omp.deviceinfo.Features.xml |
||||
|
||||
import 'package:dbus/dbus.dart'; |
||||
|
||||
/// dart-dbus generate-remote-object data/ru.omp.deviceinfo.Features.xml -o lib/ru_omp_deviceinfo_features.dart |
||||
/// Signal data for ru.omp.deviceinfo.Features.cameraEnabledChanged. |
||||
class RuOmpDeviceinfoFeaturescameraEnabledChanged extends DBusSignal { |
||||
bool get enabled => values[0].asBoolean(); |
||||
|
||||
RuOmpDeviceinfoFeaturescameraEnabledChanged(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
class RuOmpDeviceinfoFeatures extends DBusRemoteObject { |
||||
/// Stream of ru.omp.deviceinfo.Features.cameraEnabledChanged signals. |
||||
late final Stream<RuOmpDeviceinfoFeaturescameraEnabledChanged> |
||||
cameraEnabledChanged; |
||||
|
||||
RuOmpDeviceinfoFeatures( |
||||
DBusClient client, String destination, DBusObjectPath path) |
||||
: super(client, name: destination, path: path) { |
||||
cameraEnabledChanged = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'ru.omp.deviceinfo.Features', |
||||
name: 'cameraEnabledChanged', |
||||
signature: DBusSignature('b')) |
||||
.asBroadcastStream() |
||||
.map((signal) => RuOmpDeviceinfoFeaturescameraEnabledChanged(signal)); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.hasGNSS() |
||||
Future<bool> callhasGNSS( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod('ru.omp.deviceinfo.Features', 'hasGNSS', [], |
||||
replySignature: DBusSignature('b'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asBoolean(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.hasNFC() |
||||
Future<bool> callhasNFC( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod('ru.omp.deviceinfo.Features', 'hasNFC', [], |
||||
replySignature: DBusSignature('b'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asBoolean(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.hasBluetooth() |
||||
Future<bool> callhasBluetooth( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'hasBluetooth', [], |
||||
replySignature: DBusSignature('b'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asBoolean(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.hasWlan() |
||||
Future<bool> callhasWlan( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod('ru.omp.deviceinfo.Features', 'hasWlan', [], |
||||
replySignature: DBusSignature('b'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asBoolean(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getMaxCpuClockSpeed() |
||||
Future<int> callgetMaxCpuClockSpeed( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getMaxCpuClockSpeed', [], |
||||
replySignature: DBusSignature('u'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint32(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getNumberCpuCores() |
||||
Future<int> callgetNumberCpuCores( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getNumberCpuCores', [], |
||||
replySignature: DBusSignature('u'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint32(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getCpuModel() |
||||
Future<String> callgetCpuModel( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getCpuModel', [], |
||||
replySignature: DBusSignature('s'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asString(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getMaxCpuCoresClockSpeed() |
||||
Future<List<DBusValue>> callgetMaxCpuCoresClockSpeed( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getMaxCpuCoresClockSpeed', [], |
||||
replySignature: DBusSignature('av'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asVariantArray().toList(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getBatteryChargePercentage() |
||||
Future<int> callgetBatteryChargePercentage( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getBatteryChargePercentage', [], |
||||
replySignature: DBusSignature('u'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint32(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getMainCameraResolution() |
||||
Future<double> callgetMainCameraResolution( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getMainCameraResolution', [], |
||||
replySignature: DBusSignature('d'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asDouble(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getFrontalCameraResolution() |
||||
Future<double> callgetFrontalCameraResolution( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getFrontalCameraResolution', [], |
||||
replySignature: DBusSignature('d'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asDouble(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getRamTotalSize() |
||||
Future<int> callgetRamTotalSize( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getRamTotalSize', [], |
||||
replySignature: DBusSignature('t'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint64(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getRamFreeSize() |
||||
Future<int> callgetRamFreeSize( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getRamFreeSize', [], |
||||
replySignature: DBusSignature('t'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint64(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getScreenResolution() |
||||
Future<String> callgetScreenResolution( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getScreenResolution', [], |
||||
replySignature: DBusSignature('s'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asString(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getOsVersion() |
||||
Future<String> callgetOsVersion( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getOsVersion', [], |
||||
replySignature: DBusSignature('s'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asString(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getDeviceModel() |
||||
Future<String> callgetDeviceModel( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getDeviceModel', [], |
||||
replySignature: DBusSignature('s'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asString(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Features.getSerialNumber() |
||||
Future<String> callgetSerialNumber( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Features', 'getSerialNumber', [], |
||||
replySignature: DBusSignature('s'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asString(); |
||||
} |
||||
} |
@ -0,0 +1,105 @@
|
||||
// This file was generated using the following command and may be overwritten. |
||||
// dart-dbus generate-remote-object data/ru.omp.deviceinfo.SIM.xml |
||||
|
||||
import 'package:dbus/dbus.dart'; |
||||
|
||||
/// dart-dbus generate-remote-object data/ru.omp.deviceinfo.SIM.xml -o lib/ru_omp_deviceinfo_sim.dart |
||||
/// Signal data for ru.omp.deviceinfo.SIM.simCardsEnabledChanged. |
||||
class RuOmpDeviceinfoSIMsimCardsEnabledChanged extends DBusSignal { |
||||
List<Map<String, DBusValue>> get updatedSimCards => |
||||
values[0].asArray().map((child) => child.asStringVariantDict()).toList(); |
||||
|
||||
RuOmpDeviceinfoSIMsimCardsEnabledChanged(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
/// Signal data for ru.omp.deviceinfo.SIM.preferredDataTransferSimChanged. |
||||
class RuOmpDeviceinfoSIMpreferredDataTransferSimChanged extends DBusSignal { |
||||
List<Map<String, DBusValue>> get updatedSimCards => |
||||
values[0].asArray().map((child) => child.asStringVariantDict()).toList(); |
||||
|
||||
RuOmpDeviceinfoSIMpreferredDataTransferSimChanged(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
/// Signal data for ru.omp.deviceinfo.SIM.preferredVoiceCallSimChanged. |
||||
class RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged extends DBusSignal { |
||||
List<Map<String, DBusValue>> get updatedSimCards => |
||||
values[0].asArray().map((child) => child.asStringVariantDict()).toList(); |
||||
|
||||
RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
class RuOmpDeviceinfoSIM extends DBusRemoteObject { |
||||
/// Stream of ru.omp.deviceinfo.SIM.simCardsEnabledChanged signals. |
||||
late final Stream<RuOmpDeviceinfoSIMsimCardsEnabledChanged> |
||||
simCardsEnabledChanged; |
||||
|
||||
/// Stream of ru.omp.deviceinfo.SIM.preferredDataTransferSimChanged signals. |
||||
late final Stream<RuOmpDeviceinfoSIMpreferredDataTransferSimChanged> |
||||
preferredDataTransferSimChanged; |
||||
|
||||
/// Stream of ru.omp.deviceinfo.SIM.preferredVoiceCallSimChanged signals. |
||||
late final Stream<RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged> |
||||
preferredVoiceCallSimChanged; |
||||
|
||||
RuOmpDeviceinfoSIM(DBusClient client, String destination, DBusObjectPath path) |
||||
: super(client, name: destination, path: path) { |
||||
simCardsEnabledChanged = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'ru.omp.deviceinfo.SIM', |
||||
name: 'simCardsEnabledChanged', |
||||
signature: DBusSignature('aa{sv}')) |
||||
.asBroadcastStream() |
||||
.map((signal) => RuOmpDeviceinfoSIMsimCardsEnabledChanged(signal)); |
||||
|
||||
preferredDataTransferSimChanged = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'ru.omp.deviceinfo.SIM', |
||||
name: 'preferredDataTransferSimChanged', |
||||
signature: DBusSignature('aa{sv}')) |
||||
.asBroadcastStream() |
||||
.map((signal) => |
||||
RuOmpDeviceinfoSIMpreferredDataTransferSimChanged(signal)); |
||||
|
||||
preferredVoiceCallSimChanged = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'ru.omp.deviceinfo.SIM', |
||||
name: 'preferredVoiceCallSimChanged', |
||||
signature: DBusSignature('aa{sv}')) |
||||
.asBroadcastStream() |
||||
.map( |
||||
(signal) => RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged(signal)); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.SIM.getSimCardsInfo() |
||||
Future<List<Map<String, DBusValue>>> callgetSimCardsInfo( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.SIM', 'getSimCardsInfo', [], |
||||
replySignature: DBusSignature('aa{sv}'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0] |
||||
.asArray() |
||||
.map((child) => child.asStringVariantDict()) |
||||
.toList(); |
||||
} |
||||
} |
@ -0,0 +1,72 @@
|
||||
// This file was generated using the following command and may be overwritten. |
||||
// dart-dbus generate-remote-object data/ru.omp.deviceinfo.Storages.xml |
||||
|
||||
import 'package:dbus/dbus.dart'; |
||||
|
||||
/// dart-dbus generate-remote-object data/ru.omp.deviceinfo.Storages.xml -o lib/ru_omp_deviceinfo_storages.dart |
||||
/// Signal data for ru.omp.deviceinfo.Storages.externalStorageChanged. |
||||
class RuOmpDeviceinfoStoragesexternalStorageChanged extends DBusSignal { |
||||
Map<String, DBusValue> get updatedStorage => values[0].asStringVariantDict(); |
||||
|
||||
RuOmpDeviceinfoStoragesexternalStorageChanged(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
class RuOmpDeviceinfoStorages extends DBusRemoteObject { |
||||
/// Stream of ru.omp.deviceinfo.Storages.externalStorageChanged signals. |
||||
late final Stream<RuOmpDeviceinfoStoragesexternalStorageChanged> |
||||
externalStorageChanged; |
||||
|
||||
RuOmpDeviceinfoStorages( |
||||
DBusClient client, String destination, DBusObjectPath path) |
||||
: super(client, name: destination, path: path) { |
||||
externalStorageChanged = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'ru.omp.deviceinfo.Storages', |
||||
name: 'externalStorageChanged', |
||||
signature: DBusSignature('a{sv}')) |
||||
.asBroadcastStream() |
||||
.map((signal) => RuOmpDeviceinfoStoragesexternalStorageChanged(signal)); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Storages.getInternalStorageInfo() |
||||
Future<Map<String, DBusValue>> callgetInternalStorageInfo( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Storages', 'getInternalStorageInfo', [], |
||||
replySignature: DBusSignature('a{sv}'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asStringVariantDict(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Storages.getInternalUserPartitionInfo() |
||||
Future<Map<String, DBusValue>> callgetInternalUserPartitionInfo( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Storages', 'getInternalUserPartitionInfo', [], |
||||
replySignature: DBusSignature('a{sv}'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asStringVariantDict(); |
||||
} |
||||
|
||||
/// Invokes ru.omp.deviceinfo.Storages.getExternalStorageInfo() |
||||
Future<Map<String, DBusValue>> callgetExternalStorageInfo( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'ru.omp.deviceinfo.Storages', 'getExternalStorageInfo', [], |
||||
replySignature: DBusSignature('a{sv}'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asStringVariantDict(); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
name: device_info_plus_aurora |
||||
description: The Aurora OS implementation of flutter_local_notifications. |
||||
version: 0.0.1 |
||||
homepage: |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
flutter: ">=2.5.0" |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
dbus: ^0.7.8 |
||||
device_info_plus: ^9.0.1 |
||||
plugin_platform_interface: ^2.0.2 |
||||
device_info_plus_platform_interface: ^7.0.0 |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
plugin: |
||||
platforms: |
||||
aurora: |
||||
dartPluginClass: DeviceInfoPlusAurora |
@ -0,0 +1,32 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
/pubspec.lock |
||||
**/doc/api/ |
||||
.dart_tool/ |
||||
.packages |
||||
build/ |
||||
run.sh |
||||
.metadata |
@ -0,0 +1,18 @@
|
||||
# flutter_local_notifications_aurora |
||||
|
||||
The Aurora implementation of [`flutter_local_notifications`][https://github.com/MaikuB/flutter_local_notifications]. |
||||
|
||||
## Usage |
||||
This package is not an _endorsed_ implementation of `flutter_local_notifications`. |
||||
Therefore, you have to include `flutter_local_notifications_aurora` alongside `flutter_local_notifications` as dependencies in your `pubspec.yaml` file. |
||||
|
||||
```yaml |
||||
dependencies: |
||||
flutter_local_notifications: 14.0.0+2 |
||||
flutter_local_notifications_aurora: |
||||
path: # path to folder with plugin |
||||
``` |
||||
|
||||
### Preview example |
||||
|
||||
 |
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="org.freedesktop.Notifications"> |
||||
<signal name="NotificationClosed"> |
||||
<arg name="id" type="u" direction="out"/> |
||||
<arg name="reason" type="u" direction="out"/> |
||||
</signal> |
||||
<signal name="ActionInvoked"> |
||||
<arg name="id" type="u" direction="out"/> |
||||
<arg name="action_key" type="s" direction="out"/> |
||||
</signal> |
||||
<method name="Notify"> |
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In6" value="QVariantMap"/> |
||||
<arg type="u" direction="out"/> |
||||
<arg name="app_name" type="s" direction="in"/> |
||||
<arg name="replaces_id" type="u" direction="in"/> |
||||
<arg name="app_icon" type="s" direction="in"/> |
||||
<arg name="summary" type="s" direction="in"/> |
||||
<arg name="body" type="s" direction="in"/> |
||||
<arg name="actions" type="as" direction="in"/> |
||||
<arg name="hints" type="a{sv}" direction="in"/> |
||||
<arg name="timeout" type="i" direction="in"/> |
||||
</method> |
||||
<method name="CloseNotification"> |
||||
<arg name="id" type="u" direction="in"/> |
||||
</method> |
||||
<method name="GetCapabilities"> |
||||
<arg type="as" name="caps" direction="out"/> |
||||
</method> |
||||
<method name="GetServerInformation"> |
||||
<arg type="s" name="name" direction="out"/> |
||||
<arg type="s" name="vendor" direction="out"/> |
||||
<arg type="s" name="version" direction="out"/> |
||||
<arg type="s" name="spec_version" direction="out"/> |
||||
</method> |
||||
</interface> |
||||
</node> |
After Width: | Height: | Size: 627 KiB |
@ -0,0 +1,46 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
**/doc/api/ |
||||
**/ios/Flutter/.last_build_id |
||||
.dart_tool/ |
||||
.flutter-plugins |
||||
.flutter-plugins-dependencies |
||||
.packages |
||||
.pub-cache/ |
||||
.pub/ |
||||
/build/ |
||||
.metadata |
||||
pubspec.lock |
||||
|
||||
# Symbolication related |
||||
app.*.symbols |
||||
|
||||
# Obfuscation related |
||||
app.*.map.json |
||||
|
||||
# Android Studio will place build artifacts here |
||||
/android/app/debug |
||||
/android/app/profile |
||||
/android/app/release |
@ -0,0 +1,17 @@
|
||||
# flutter_local_notifications_aurora_example |
||||
|
||||
Demonstrates how to use the flutter_local_notifications_aurora plugin. |
||||
|
||||
## Build |
||||
|
||||
```shell |
||||
# Add an alias if it doesn't already exist |
||||
alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter |
||||
# Get dependencies |
||||
flutter-aurora pub get |
||||
# Run build |
||||
flutter-aurora build aurora --release |
||||
``` |
||||
|
||||
You can collect, sign, run an example on the device with a script located in the `script/build_example.sh` |
||||
More information in `build_example.sh`. |
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
@ -0,0 +1 @@
|
||||
flutter/ephemeral |
@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
project(com.example.flutter_local_notifications_aurora_example LANGUAGES CXX) |
||||
|
||||
include(GNUInstallDirs) |
||||
|
||||
set(BINARY_NAME ${CMAKE_PROJECT_NAME}) |
||||
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
||||
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra") |
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") |
||||
|
||||
set(CMAKE_SKIP_RPATH OFF) |
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") |
||||
|
||||
find_package(PkgConfig REQUIRED) |
||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) |
||||
|
||||
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) |
||||
|
||||
include(flutter/generated_plugins.cmake) |
||||
|
||||
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) |
||||
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications) |
||||
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) |
||||
|
||||
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so |
||||
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) |
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
|
||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
||||
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) |
||||
|
||||
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) |
||||
install(FILES icons/${ICONS_SIZE}.png |
||||
RENAME ${BINARY_NAME}.png |
||||
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) |
||||
endforeach(ICONS_SIZE) |
@ -0,0 +1,12 @@
|
||||
[Desktop Entry] |
||||
Type=Application |
||||
Name=Flutter Notification |
||||
Comment=Demonstrates how to use the flutter_local_notifications_aurora plugin. |
||||
Icon=com.example.flutter_local_notifications_aurora_example |
||||
Exec=/usr/bin/com.example.flutter_local_notifications_aurora_example |
||||
X-Nemo-Application-Type=silica-qt5 |
||||
|
||||
[X-Application] |
||||
Permissions= |
||||
OrganizationName=com.example |
||||
ApplicationName=flutter_local_notifications_aurora_example |
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include <flutter/application.h> |
||||
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h> |
||||
|
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
void RegisterPlugins() { |
||||
Application::RegisterPlugins({ |
||||
std::make_shared<PackageInfoPlusAuroraPlugin>(), |
||||
}); |
||||
} |
@ -0,0 +1,12 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT |
||||
#define GENERATED_PLUGIN_REGISTRANT |
||||
|
||||
void RegisterPlugins(); |
||||
|
||||
#endif /* GENERATED_PLUGIN_REGISTRANT */ |
@ -0,0 +1,31 @@
|
||||
# |
||||
# Generated file, do not edit. |
||||
# |
||||
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") |
||||
|
||||
function(add_library TARGET) |
||||
_add_library(${TARGET} ${ARGN}) |
||||
|
||||
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
add_custom_command(TARGET ${TARGET} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
"$<TARGET_FILE:${TARGET}>" |
||||
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>") |
||||
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
endfunction() |
||||
|
||||
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST |
||||
package_info_plus_aurora |
||||
) |
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
) |
||||
|
||||
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN}) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin) |
||||
endforeach(PLUGIN) |
||||
|
||||
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN}) |
||||
endforeach(FFI_PLUGIN) |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 6.5 KiB |
@ -0,0 +1,10 @@
|
||||
#include <flutter/application.h> |
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
Application::Initialize(argc, argv); |
||||
Application::SetPixelRatio(1.8); |
||||
RegisterPlugins(); |
||||
Application::Launch(); |
||||
return 0; |
||||
} |
@ -0,0 +1,31 @@
|
||||
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ |
||||
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ |
||||
|
||||
Name: com.example.flutter_local_notifications_aurora_example |
||||
Summary: Demonstrates how to use the flutter_local_notifications_aurora plugin. |
||||
Version: 0.1.0 |
||||
Release: 1 |
||||
License: Proprietary |
||||
Source0: %{name}-%{version}.tar.zst |
||||
|
||||
BuildRequires: cmake |
||||
BuildRequires: pkgconfig(flutter-embedder) |
||||
|
||||
%description |
||||
%{summary}. |
||||
|
||||
%prep |
||||
%autosetup |
||||
|
||||
%build |
||||
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} |
||||
%make_build |
||||
|
||||
%install |
||||
%make_install |
||||
|
||||
%files |
||||
%{_bindir}/%{name} |
||||
%{_datadir}/%{name}/* |
||||
%{_datadir}/applications/%{name}.desktop |
||||
%{_datadir}/icons/hicolor/*/apps/%{name}.png |
@ -0,0 +1,90 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'dart:async'; |
||||
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; |
||||
|
||||
void main() { |
||||
runApp(const MyApp()); |
||||
} |
||||
|
||||
class MyApp extends StatefulWidget { |
||||
const MyApp({super.key}); |
||||
|
||||
@override |
||||
State<MyApp> createState() => _MyAppState(); |
||||
} |
||||
|
||||
class _MyAppState extends State<MyApp> { |
||||
final notificationID = 1; |
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = |
||||
FlutterLocalNotificationsPlugin(); |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
Future<void> _showNotification() async { |
||||
await flutterLocalNotificationsPlugin.show( |
||||
notificationID, |
||||
"Title notification", |
||||
"My long body text notification", |
||||
null, |
||||
); |
||||
} |
||||
|
||||
Future<void> _cancelNotification() async { |
||||
await flutterLocalNotificationsPlugin.cancel(notificationID); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); |
||||
const spaceMedium = SizedBox(height: 20); |
||||
|
||||
return MaterialApp( |
||||
home: Scaffold( |
||||
appBar: AppBar( |
||||
title: const Text('Example flutter_local_notifications'), |
||||
), |
||||
body: SingleChildScrollView( |
||||
child: Padding( |
||||
padding: const EdgeInsets.all(16), |
||||
child: Center( |
||||
child: Column( |
||||
children: [ |
||||
// Info |
||||
Container( |
||||
padding: const EdgeInsets.all(20), |
||||
decoration: const BoxDecoration( |
||||
color: Colors.green, |
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)), |
||||
), |
||||
child: const Text( |
||||
'Demo application demonstration implementation of flutter_local_notifications', |
||||
style: textStyleWhite, |
||||
textAlign: TextAlign.center, |
||||
), |
||||
), |
||||
const SizedBox(height: 30), |
||||
|
||||
ElevatedButton( |
||||
onPressed: _showNotification, |
||||
child: const Text('Show notification'), |
||||
), |
||||
|
||||
spaceMedium, |
||||
|
||||
ElevatedButton( |
||||
onPressed: _cancelNotification, |
||||
child: const Text('Cancel notification'), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
name: flutter_local_notifications_aurora_example |
||||
description: Demonstrates how to use the flutter_local_notifications_aurora plugin. |
||||
|
||||
publish_to: 'none' |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
flutter_local_notifications: ^14.0.0+2 |
||||
flutter_local_notifications_aurora: |
||||
path: ../ |
||||
cupertino_icons: ^1.0.2 |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
uses-material-design: true |
@ -0,0 +1,63 @@
|
||||
import 'dart:async'; |
||||
|
||||
import 'package:dbus/dbus.dart'; |
||||
import 'package:flutter_local_notifications_aurora/org_freedesktop_notifications.dart'; |
||||
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart'; |
||||
import 'package:package_info_plus/package_info_plus.dart'; |
||||
|
||||
class FlutterLocalNotificationsAurora |
||||
extends FlutterLocalNotificationsPlatform { |
||||
/// Registers this class as the default instance of [FlutterLocalNotificationsPlatform]. |
||||
static void registerWith() { |
||||
FlutterLocalNotificationsPlatform.instance = |
||||
FlutterLocalNotificationsAurora(); |
||||
} |
||||
|
||||
final Map<int, List<int>> auroraIDs = {}; |
||||
|
||||
@override |
||||
Future<void> show( |
||||
int id, |
||||
String? title, |
||||
String? body, { |
||||
String? payload, |
||||
}) async { |
||||
final appName = (await PackageInfo.fromPlatform()).appName; |
||||
final client = DBusClient.session(); |
||||
|
||||
final object = OrgFreedesktopNotifications( |
||||
client, |
||||
'org.freedesktop.Notifications', |
||||
DBusObjectPath('/org/freedesktop/Notifications')); |
||||
|
||||
auroraIDs[id] = auroraIDs[id] ?? []; |
||||
auroraIDs[id]!.add(await object.callNotify( |
||||
appName, |
||||
0, |
||||
' ', |
||||
title ?? '', |
||||
body ?? '', |
||||
[], |
||||
{}, |
||||
-1, |
||||
)); |
||||
await client.close(); |
||||
} |
||||
|
||||
@override |
||||
Future<void> cancel(int id) async { |
||||
final ids = auroraIDs[id] ?? []; |
||||
if (auroraIDs.isNotEmpty) { |
||||
final client = DBusClient.session(); |
||||
final object = OrgFreedesktopNotifications( |
||||
client, |
||||
'org.freedesktop.Notifications', |
||||
DBusObjectPath('/org/freedesktop/Notifications')); |
||||
for (final auroraID in ids) { |
||||
await object.callCloseNotification(auroraID); |
||||
} |
||||
ids.remove(id); |
||||
await client.close(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,129 @@
|
||||
// This file was generated using the following command and may be overwritten. |
||||
// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml |
||||
|
||||
// dart pub global activate dbus |
||||
// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml -o lib/org_freedesktop_notifications.dart |
||||
import 'package:dbus/dbus.dart'; |
||||
|
||||
/// Signal data for org.freedesktop.Notifications.NotificationClosed. |
||||
class OrgFreedesktopNotificationsNotificationClosed extends DBusSignal { |
||||
int get id => values[0].asUint32(); |
||||
int get reason => values[1].asUint32(); |
||||
|
||||
OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
/// Signal data for org.freedesktop.Notifications.ActionInvoked. |
||||
class OrgFreedesktopNotificationsActionInvoked extends DBusSignal { |
||||
int get id => values[0].asUint32(); |
||||
String get action_key => values[1].asString(); |
||||
|
||||
OrgFreedesktopNotificationsActionInvoked(DBusSignal signal) |
||||
: super( |
||||
sender: signal.sender, |
||||
path: signal.path, |
||||
interface: signal.interface, |
||||
name: signal.name, |
||||
values: signal.values); |
||||
} |
||||
|
||||
class OrgFreedesktopNotifications extends DBusRemoteObject { |
||||
/// Stream of org.freedesktop.Notifications.NotificationClosed signals. |
||||
late final Stream<OrgFreedesktopNotificationsNotificationClosed> |
||||
notificationClosed; |
||||
|
||||
/// Stream of org.freedesktop.Notifications.ActionInvoked signals. |
||||
late final Stream<OrgFreedesktopNotificationsActionInvoked> actionInvoked; |
||||
|
||||
OrgFreedesktopNotifications( |
||||
DBusClient client, String destination, DBusObjectPath path) |
||||
: super(client, name: destination, path: path) { |
||||
notificationClosed = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'org.freedesktop.Notifications', |
||||
name: 'NotificationClosed', |
||||
signature: DBusSignature('uu')) |
||||
.asBroadcastStream() |
||||
.map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal)); |
||||
|
||||
actionInvoked = DBusRemoteObjectSignalStream( |
||||
object: this, |
||||
interface: 'org.freedesktop.Notifications', |
||||
name: 'ActionInvoked', |
||||
signature: DBusSignature('us')) |
||||
.asBroadcastStream() |
||||
.map((signal) => OrgFreedesktopNotificationsActionInvoked(signal)); |
||||
} |
||||
|
||||
/// Invokes org.freedesktop.Notifications.Notify() |
||||
Future<int> callNotify( |
||||
String app_name, |
||||
int replaces_id, |
||||
String app_icon, |
||||
String summary, |
||||
String body, |
||||
List<String> actions, |
||||
Map<String, DBusValue> hints, |
||||
int timeout, |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'org.freedesktop.Notifications', |
||||
'Notify', |
||||
[ |
||||
DBusString(app_name), |
||||
DBusUint32(replaces_id), |
||||
DBusString(app_icon), |
||||
DBusString(summary), |
||||
DBusString(body), |
||||
DBusArray.string(actions), |
||||
DBusDict.stringVariant(hints), |
||||
DBusInt32(timeout) |
||||
], |
||||
replySignature: DBusSignature('u'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asUint32(); |
||||
} |
||||
|
||||
/// Invokes org.freedesktop.Notifications.CloseNotification() |
||||
Future<void> callCloseNotification(int id, |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
await callMethod( |
||||
'org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)], |
||||
replySignature: DBusSignature(''), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
} |
||||
|
||||
/// Invokes org.freedesktop.Notifications.GetCapabilities() |
||||
Future<List<String>> callGetCapabilities( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'org.freedesktop.Notifications', 'GetCapabilities', [], |
||||
replySignature: DBusSignature('as'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues[0].asStringArray().toList(); |
||||
} |
||||
|
||||
/// Invokes org.freedesktop.Notifications.GetServerInformation() |
||||
Future<List<DBusValue>> callGetServerInformation( |
||||
{bool noAutoStart = false, |
||||
bool allowInteractiveAuthorization = false}) async { |
||||
var result = await callMethod( |
||||
'org.freedesktop.Notifications', 'GetServerInformation', [], |
||||
replySignature: DBusSignature('ssss'), |
||||
noAutoStart: noAutoStart, |
||||
allowInteractiveAuthorization: allowInteractiveAuthorization); |
||||
return result.returnValues; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
name: flutter_local_notifications_aurora |
||||
description: The Aurora OS implementation of flutter_local_notifications. |
||||
version: 0.0.1 |
||||
homepage: |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
flutter: ">=2.5.0" |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
dbus: ^0.7.8 |
||||
plugin_platform_interface: ^2.0.2 |
||||
flutter_local_notifications_platform_interface: ^7.0.0 |
||||
package_info_plus: ^4.0.0 |
||||
package_info_plus_aurora: |
||||
path: ../../package_info_plus/package_info_plus_aurora |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
plugin: |
||||
platforms: |
||||
aurora: |
||||
dartPluginClass: FlutterLocalNotificationsAurora |
@ -0,0 +1,32 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
/pubspec.lock |
||||
**/doc/api/ |
||||
.dart_tool/ |
||||
.packages |
||||
build/ |
||||
.metadata |
||||
run.sh |
@ -0,0 +1,18 @@
|
||||
# package_info_plus_aurora |
||||
|
||||
The Aurora implementation of [`package_info_plus`](https://pub.dev/packages/package_info_plus). |
||||
|
||||
## Usage |
||||
This package is not an _endorsed_ implementation of `package_info_plus`. |
||||
Therefore, you have to include `package_info_plus_aurora` alongside `package_info_plus` as dependencies in your `pubspec.yaml` file. |
||||
|
||||
```yaml |
||||
dependencies: |
||||
package_info_plus: 4.0.0 |
||||
package_info_plus_aurora: |
||||
path: # path to folder with plugin |
||||
``` |
||||
|
||||
### Preview example |
||||
|
||||
 |
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
|
||||
set(PROJECT_NAME package_info_plus_aurora) |
||||
set(PLUGIN_NAME package_info_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) |
||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) |
||||
|
||||
add_library(${PLUGIN_NAME} SHARED package_info_plus_aurora_plugin.cpp) |
||||
|
||||
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) |
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||
|
||||
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) |
||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) |
@ -0,0 +1,24 @@
|
||||
#ifndef FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H |
||||
#define FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H |
||||
|
||||
#include <flutter/plugin-interface.h> |
||||
|
||||
#ifdef PLUGIN_IMPL |
||||
#define PLUGIN_EXPORT __attribute__((visibility("default"))) |
||||
#else |
||||
#define PLUGIN_EXPORT |
||||
#endif |
||||
|
||||
class PLUGIN_EXPORT PackageInfoPlusAuroraPlugin final : public PluginInterface |
||||
{ |
||||
public: |
||||
void RegisterWithRegistrar(PluginRegistrar ®istrar) override; |
||||
|
||||
private: |
||||
void onMethodCall(const MethodCall &call); |
||||
void onGetApplicationOrg(const MethodCall &call); |
||||
void onGetApplicationName(const MethodCall &call); |
||||
void unimplemented(const MethodCall &call); |
||||
}; |
||||
|
||||
#endif /* FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H */ |
@ -0,0 +1,43 @@
|
||||
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h> |
||||
#include <flutter/method-channel.h> |
||||
#include <flutter/application.h> |
||||
#include <sys/utsname.h> |
||||
|
||||
void PackageInfoPlusAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
||||
{ |
||||
registrar.RegisterMethodChannel("package_info_plus_aurora", |
||||
MethodCodecType::Standard, |
||||
[this](const MethodCall &call) { this->onMethodCall(call); }); |
||||
} |
||||
|
||||
void PackageInfoPlusAuroraPlugin::onMethodCall(const MethodCall &call) |
||||
{ |
||||
const auto &method = call.GetMethod(); |
||||
|
||||
if (method == "getApplicationOrg") { |
||||
onGetApplicationOrg(call); |
||||
return; |
||||
} |
||||
|
||||
if (method == "getApplicationName") { |
||||
onGetApplicationName(call); |
||||
return; |
||||
} |
||||
|
||||
unimplemented(call); |
||||
} |
||||
|
||||
void PackageInfoPlusAuroraPlugin::onGetApplicationOrg(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().orgname); |
||||
} |
||||
|
||||
void PackageInfoPlusAuroraPlugin::onGetApplicationName(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().appname); |
||||
} |
||||
|
||||
void PackageInfoPlusAuroraPlugin::unimplemented(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(nullptr); |
||||
} |
After Width: | Height: | Size: 83 KiB |
@ -0,0 +1,45 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
**/doc/api/ |
||||
**/ios/Flutter/.last_build_id |
||||
.dart_tool/ |
||||
.flutter-plugins |
||||
.flutter-plugins-dependencies |
||||
.packages |
||||
.pub-cache/ |
||||
.pub/ |
||||
/build/ |
||||
pubspec.lock |
||||
|
||||
# Symbolication related |
||||
app.*.symbols |
||||
|
||||
# Obfuscation related |
||||
app.*.map.json |
||||
|
||||
# Android Studio will place build artifacts here |
||||
/android/app/debug |
||||
/android/app/profile |
||||
/android/app/release |
@ -0,0 +1,17 @@
|
||||
# package_info_plus_aurora_example |
||||
|
||||
Demonstrates how to use the package_info_plus_aurora_example plugin. |
||||
|
||||
## Build |
||||
|
||||
```shell |
||||
# Add an alias if it doesn't already exist |
||||
alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter |
||||
# Get dependencies |
||||
flutter-aurora pub get |
||||
# Run build |
||||
flutter-aurora build aurora --release |
||||
``` |
||||
|
||||
You can collect, sign, run an example on the device with a script located in the `script/build_example.sh` |
||||
More information in `build_example.sh`. |
@ -0,0 +1 @@
|
||||
include: package:flutter_lints/flutter.yaml |
@ -0,0 +1 @@
|
||||
flutter/ephemeral |
@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
project(com.example.package_info_plus_aurora_example LANGUAGES CXX) |
||||
|
||||
include(GNUInstallDirs) |
||||
|
||||
set(BINARY_NAME ${CMAKE_PROJECT_NAME}) |
||||
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
||||
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra") |
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") |
||||
|
||||
set(CMAKE_SKIP_RPATH OFF) |
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") |
||||
|
||||
find_package(PkgConfig REQUIRED) |
||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) |
||||
|
||||
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) |
||||
|
||||
include(flutter/generated_plugins.cmake) |
||||
|
||||
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) |
||||
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications) |
||||
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) |
||||
|
||||
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so |
||||
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) |
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR}) |
||||
|
||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
||||
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) |
||||
|
||||
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) |
||||
install(FILES icons/${ICONS_SIZE}.png |
||||
RENAME ${BINARY_NAME}.png |
||||
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) |
||||
endforeach(ICONS_SIZE) |
@ -0,0 +1,12 @@
|
||||
[Desktop Entry] |
||||
Type=Application |
||||
Name=Example Info Plus |
||||
Comment=Demonstrates how to use the package_info_plus_aurora plugin. |
||||
Icon=com.example.package_info_plus_aurora_example |
||||
Exec=/usr/bin/com.example.package_info_plus_aurora_example |
||||
X-Nemo-Application-Type=silica-qt5 |
||||
|
||||
[X-Application] |
||||
Permissions= |
||||
OrganizationName=com.example |
||||
ApplicationName=package_info_plus_aurora_example |
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include <flutter/application.h> |
||||
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h> |
||||
|
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
void RegisterPlugins() { |
||||
Application::RegisterPlugins({ |
||||
std::make_shared<PackageInfoPlusAuroraPlugin>(), |
||||
}); |
||||
} |
@ -0,0 +1,12 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT |
||||
#define GENERATED_PLUGIN_REGISTRANT |
||||
|
||||
void RegisterPlugins(); |
||||
|
||||
#endif /* GENERATED_PLUGIN_REGISTRANT */ |
@ -0,0 +1,31 @@
|
||||
# |
||||
# Generated file, do not edit. |
||||
# |
||||
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") |
||||
|
||||
function(add_library TARGET) |
||||
_add_library(${TARGET} ${ARGN}) |
||||
|
||||
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
add_custom_command(TARGET ${TARGET} POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy |
||||
"$<TARGET_FILE:${TARGET}>" |
||||
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>") |
||||
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*") |
||||
endfunction() |
||||
|
||||
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST |
||||
package_info_plus_aurora |
||||
) |
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
) |
||||
|
||||
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN}) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin) |
||||
endforeach(PLUGIN) |
||||
|
||||
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN}) |
||||
endforeach(FFI_PLUGIN) |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 6.5 KiB |
@ -0,0 +1,10 @@
|
||||
#include <flutter/application.h> |
||||
#include "generated_plugin_registrant.h" |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
Application::Initialize(argc, argv); |
||||
Application::SetPixelRatio(1.8); |
||||
RegisterPlugins(); |
||||
Application::Launch(); |
||||
return 0; |
||||
} |
@ -0,0 +1,31 @@
|
||||
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ |
||||
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ |
||||
|
||||
Name: com.example.package_info_plus_aurora_example |
||||
Summary: Demonstrates how to use the package_info_plus_aurora plugin. |
||||
Version: 0.1.0 |
||||
Release: 1 |
||||
License: Proprietary |
||||
Source0: %{name}-%{version}.tar.zst |
||||
|
||||
BuildRequires: cmake |
||||
BuildRequires: pkgconfig(flutter-embedder) |
||||
|
||||
%description |
||||
%{summary}. |
||||
|
||||
%prep |
||||
%autosetup |
||||
|
||||
%build |
||||
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} |
||||
%make_build |
||||
|
||||
%install |
||||
%make_install |
||||
|
||||
%files |
||||
%{_bindir}/%{name} |
||||
%{_datadir}/%{name}/* |
||||
%{_datadir}/applications/%{name}.desktop |
||||
%{_datadir}/icons/hicolor/*/apps/%{name}.png |
@ -0,0 +1,139 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'dart:async'; |
||||
|
||||
import 'package:package_info_plus/package_info_plus.dart'; |
||||
|
||||
void main() { |
||||
runApp(const MyApp()); |
||||
} |
||||
|
||||
class MyApp extends StatefulWidget { |
||||
const MyApp({super.key}); |
||||
|
||||
@override |
||||
State<MyApp> createState() => _MyAppState(); |
||||
} |
||||
|
||||
class _MyAppState extends State<MyApp> { |
||||
String? _error; |
||||
String? _appName; |
||||
String? _packageName; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
initPlatformState(); |
||||
} |
||||
|
||||
Future<void> initPlatformState() async { |
||||
try { |
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform(); |
||||
|
||||
String appName = packageInfo.appName; |
||||
String packageName = packageInfo.packageName; |
||||
|
||||
// Update state variable |
||||
setState(() { |
||||
_appName = appName; |
||||
_packageName = packageName; |
||||
}); |
||||
} on Exception catch (e) { |
||||
setState(() { |
||||
_error = e.toString(); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); |
||||
const textStyleTitle = TextStyle(fontSize: 20, color: Colors.black); |
||||
const textStylePath = TextStyle(fontSize: 18, color: Colors.black54); |
||||
|
||||
const spaceMedium = SizedBox(height: 20); |
||||
const spaceSmall = SizedBox(height: 10); |
||||
|
||||
return MaterialApp( |
||||
home: Scaffold( |
||||
appBar: AppBar( |
||||
title: const Text('Example package_info_plus'), |
||||
), |
||||
body: Stack( |
||||
children: [ |
||||
// Error message |
||||
Visibility( |
||||
visible: _error != null, |
||||
child: Center( |
||||
child: Padding( |
||||
padding: const EdgeInsets.all(16), |
||||
child: Container( |
||||
padding: const EdgeInsets.all(20), |
||||
decoration: const BoxDecoration( |
||||
color: Colors.redAccent, |
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)), |
||||
), |
||||
child: Text( |
||||
_error ?? '', |
||||
style: textStyleWhite, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
// List directories path |
||||
Visibility( |
||||
visible: _error == null, |
||||
child: SingleChildScrollView( |
||||
child: Padding( |
||||
padding: const EdgeInsets.all(16), |
||||
child: Center( |
||||
child: Column( |
||||
children: [ |
||||
// Info |
||||
Container( |
||||
padding: const EdgeInsets.all(20), |
||||
decoration: const BoxDecoration( |
||||
color: Colors.green, |
||||
borderRadius: |
||||
BorderRadius.all(Radius.circular(10.0)), |
||||
), |
||||
child: const Text( |
||||
'Demo application demonstration implementation of package_info_plus', |
||||
style: textStyleWhite, |
||||
textAlign: TextAlign.center, |
||||
), |
||||
), |
||||
const SizedBox(height: 30), |
||||
|
||||
const Text( |
||||
'Application Name', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_appName ?? 'Not found.', |
||||
style: textStylePath, |
||||
), |
||||
|
||||
spaceMedium, |
||||
const Text( |
||||
'Package Name', |
||||
style: textStyleTitle, |
||||
), |
||||
spaceSmall, |
||||
Text( |
||||
_packageName ?? 'Not found.', |
||||
style: textStylePath, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
name: package_info_plus_aurora_example |
||||
description: Demonstrates how to use the package_info_plus_aurora plugin. |
||||
|
||||
publish_to: 'none' |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
package_info_plus: ^4.0.0 |
||||
package_info_plus_aurora: |
||||
path: ../ |
||||
cupertino_icons: ^1.0.2 |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
uses-material-design: true |
@ -0,0 +1,56 @@
|
||||
import 'dart:io'; |
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package_info_plus_aurora_platform_interface.dart'; |
||||
import 'package:package_info_plus_platform_interface/package_info_platform_interface.dart'; |
||||
import 'package:package_info_plus_platform_interface/package_info_data.dart'; |
||||
|
||||
class PackageInfoPlusAurora extends PackageInfoPlatform { |
||||
/// Register this dart class as the platform implementation for aurora |
||||
static void registerWith() { |
||||
PackageInfoPlatform.instance = PackageInfoPlusAurora(); |
||||
} |
||||
|
||||
final _platform = PackageInfoPlusAuroraPlatform.instance; |
||||
|
||||
@override |
||||
Future<PackageInfoData> getAll() async { |
||||
final versionJson = await _getVersionJson(); |
||||
return PackageInfoData( |
||||
appName: versionJson['app_name'] ?? '', |
||||
packageName: versionJson['package_name'] ?? '', |
||||
version: versionJson['version'] ?? '', |
||||
buildNumber: versionJson['build_number'] ?? '', |
||||
buildSignature: '', |
||||
); |
||||
} |
||||
|
||||
Future<Map<String, dynamic>> _getVersionJson() async { |
||||
try { |
||||
// Get package from aurora platform |
||||
final org = await _platform.getApplicationOrg(); |
||||
final name = await _platform.getApplicationName(); |
||||
final packageName = '$org.$name'; |
||||
|
||||
// Get application name |
||||
final desktop = |
||||
(await File('/usr/share/applications/$packageName.desktop') |
||||
.readAsLines()) |
||||
.where((element) => element.contains('Name=')); |
||||
|
||||
// @todo |
||||
// Get application versions |
||||
// rpm -q --queryformat %{VERSION} <package> |
||||
// not working even with Compatibility permission |
||||
|
||||
return <String, dynamic>{ |
||||
'app_name': desktop.isNotEmpty ? desktop.first.substring(5) : null, |
||||
'package_name': packageName, |
||||
'version': '', |
||||
'build_number': '', |
||||
}; |
||||
} catch (e) { |
||||
debugPrint(e.toString()); |
||||
return <String, dynamic>{}; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
import 'package:flutter/foundation.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
|
||||
import 'package_info_plus_aurora_platform_interface.dart'; |
||||
|
||||
/// An implementation of [PackageInfoPlusAuroraPlatform] that uses method channels. |
||||
class MethodChannelPackageInfoPlusAurora extends PackageInfoPlusAuroraPlatform { |
||||
/// The method channel used to interact with the native platform. |
||||
@visibleForTesting |
||||
final methodChannel = const MethodChannel('package_info_plus_aurora'); |
||||
|
||||
@override |
||||
Future<String?> getApplicationOrg() async { |
||||
return await methodChannel.invokeMethod<String>('getApplicationOrg'); |
||||
} |
||||
|
||||
@override |
||||
Future<String?> getApplicationName() async { |
||||
return await methodChannel.invokeMethod<String>('getApplicationName'); |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
||||
|
||||
import 'package_info_plus_aurora_method_channel.dart'; |
||||
|
||||
abstract class PackageInfoPlusAuroraPlatform extends PlatformInterface { |
||||
/// Constructs a PackageInfoPlusAuroraPlatform. |
||||
PackageInfoPlusAuroraPlatform() : super(token: _token); |
||||
|
||||
static final Object _token = Object(); |
||||
|
||||
static PackageInfoPlusAuroraPlatform _instance = |
||||
MethodChannelPackageInfoPlusAurora(); |
||||
|
||||
/// The default instance of [PackageInfoPlusAuroraPlatform] to use. |
||||
/// |
||||
/// Defaults to [MethodChannelPackageInfoPlusAurora]. |
||||
static PackageInfoPlusAuroraPlatform get instance => _instance; |
||||
|
||||
/// Platform-specific implementations should set this with their own |
||||
/// platform-specific class that extends [PackageInfoPlusAuroraPlatform] when |
||||
/// they register themselves. |
||||
static set instance(PackageInfoPlusAuroraPlatform instance) { |
||||
PlatformInterface.verifyToken(instance, _token); |
||||
_instance = instance; |
||||
} |
||||
|
||||
Future<String?> getApplicationOrg() { |
||||
throw UnimplementedError('getApplicationOrg() has not been implemented.'); |
||||
} |
||||
|
||||
Future<String?> getApplicationName() { |
||||
throw UnimplementedError('getApplicationName() has not been implemented.'); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
name: package_info_plus_aurora |
||||
description: A new Flutter plugin project. |
||||
version: 0.0.1 |
||||
homepage: |
||||
|
||||
environment: |
||||
sdk: '>=2.18.6 <3.0.0' |
||||
flutter: ">=2.5.0" |
||||
|
||||
dependencies: |
||||
flutter: |
||||
sdk: flutter |
||||
plugin_platform_interface: ^2.0.2 |
||||
package_info_plus_platform_interface: ^2.0.1 |
||||
|
||||
dev_dependencies: |
||||
flutter_test: |
||||
sdk: flutter |
||||
flutter_lints: ^2.0.0 |
||||
|
||||
flutter: |
||||
plugin: |
||||
platforms: |
||||
aurora: |
||||
pluginClass: PackageInfoPlusAuroraPlugin |
||||
dartPluginClass: PackageInfoPlusAurora |
@ -0,0 +1,35 @@
|
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_test/flutter_test.dart'; |
||||
import 'package:package_info_plus_aurora/package_info_plus_aurora_method_channel.dart'; |
||||
|
||||
void main() { |
||||
MethodChannelPackageInfoPlusAurora platform = |
||||
MethodChannelPackageInfoPlusAurora(); |
||||
const MethodChannel channel = MethodChannel('package_info_plus_aurora'); |
||||
|
||||
TestWidgetsFlutterBinding.ensureInitialized(); |
||||
|
||||
setUp(() { |
||||
channel.setMockMethodCallHandler((MethodCall methodCall) async { |
||||
switch (methodCall.method) { |
||||
case 'getApplicationOrg': |
||||
return 'com.example'; |
||||
case 'getApplicationName': |
||||
return 'path_provider_aurora'; |
||||
} |
||||
return ''; |
||||
}); |
||||
}); |
||||
|
||||
tearDown(() { |
||||
channel.setMockMethodCallHandler(null); |
||||
}); |
||||
|
||||
test('onGetApplicationOrg', () async { |
||||
expect(await platform.getApplicationOrg(), 'com.example'); |
||||
}); |
||||
|
||||
test('onGetApplicationName', () async { |
||||
expect(await platform.getApplicationName(), 'path_provider_aurora'); |
||||
}); |
||||
} |
@ -0,0 +1,31 @@
|
||||
# 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/ |
||||
/.metadata |
@ -0,0 +1,41 @@
|
||||
# path_provider_aurora |
||||
|
||||
The Aurora OS implementation of [`path_provider`](https://pub.dev/packages/path_provider). |
||||
Documentation for setting permissions can be found [here](https://developer.auroraos.ru/doc/software_development/reference/user_data). |
||||
|
||||
## Usage |
||||
|
||||
This package is not an _endorsed_ implementation of `path_provider`. |
||||
Therefore, you have to include `path_provider_aurora` alongside `path_provider` as dependencies in your `pubspec.yaml` file. |
||||
|
||||
```yaml |
||||
dependencies: |
||||
path_provider: ^2.0.14 |
||||
path_provider_aurora: ^0.0.0 # @todo Not published |
||||
``` |
||||
|
||||
Then you can import `path_provider` in your Dart code: |
||||
|
||||
```dart |
||||
import 'package:path_provider/path_provider.dart'; |
||||
``` |
||||
|
||||
## Supported APIs |
||||
|
||||
- [x] `getTemporaryDirectory` |
||||
- [ ] `getApplicationSupportDirectory` |
||||
- [ ] `getLibraryDirectory` |
||||
- [x] `getApplicationDocumentsDirectory` |
||||
- [ ] `getExternalStorageDirectory` |
||||
- [ ] `getExternalCacheDirectories` |
||||
- [x] `getExternalStorageDirectories` (There is no concept of External in Aurora OS, but this interface allows you to get the pictures/music/movies directory) |
||||
- [x] `getDownloadsDirectory` |
||||
|
||||
## Extra methods |
||||
|
||||
PathProviderAurora.getApplicationOrg(); |
||||
PathProviderAurora.getApplicationName(); |
||||
|
||||
### Preview example |
||||
|
||||
 |
@ -0,0 +1,4 @@
|
||||
include: package:flutter_lints/flutter.yaml |
||||
|
||||
# Additional information about this file can be found at |
||||
# https://dart.dev/guides/language/analysis-options |
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
|
||||
set(PROJECT_NAME path_provider_aurora) |
||||
set(PLUGIN_NAME path_provider_aurora_platform_plugin) |
||||
|
||||
project(${PROJECT_NAME} LANGUAGES CXX) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
||||
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi") |
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") |
||||
|
||||
find_package(PkgConfig REQUIRED) |
||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) |
||||
|
||||
add_library(${PLUGIN_NAME} SHARED path_provider_aurora_plugin.cpp) |
||||
|
||||
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) |
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||
|
||||
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) |
||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) |
@ -0,0 +1,24 @@
|
||||
#ifndef FLUTTER_PLUGIN_PATH_PROVIDER_AURORA_PLUGIN_H |
||||
#define FLUTTER_PLUGIN_PATH_PROVIDER_AURORA_PLUGIN_H |
||||
|
||||
#include <flutter/plugin-interface.h> |
||||
|
||||
#ifdef PLUGIN_IMPL |
||||
#define PLUGIN_EXPORT __attribute__((visibility("default"))) |
||||
#else |
||||
#define PLUGIN_EXPORT |
||||
#endif |
||||
|
||||
class PLUGIN_EXPORT PathProviderAuroraPlugin final : public PluginInterface |
||||
{ |
||||
public: |
||||
void RegisterWithRegistrar(PluginRegistrar ®istrar) override; |
||||
|
||||
private: |
||||
void onMethodCall(const MethodCall &call); |
||||
void onGetApplicationOrg(const MethodCall &call); |
||||
void onGetApplicationName(const MethodCall &call); |
||||
void unimplemented(const MethodCall &call); |
||||
}; |
||||
|
||||
#endif /* FLUTTER_PLUGIN_PATH_PROVIDER_AURORA_PLUGIN_H */ |
@ -0,0 +1,43 @@
|
||||
#include <path_provider_aurora/path_provider_aurora_plugin.h> |
||||
#include <flutter/method-channel.h> |
||||
#include <flutter/application.h> |
||||
#include <sys/utsname.h> |
||||
|
||||
void PathProviderAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
||||
{ |
||||
registrar.RegisterMethodChannel("path_provider_aurora", |
||||
MethodCodecType::Standard, |
||||
[this](const MethodCall &call) { this->onMethodCall(call); }); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onMethodCall(const MethodCall &call) |
||||
{ |
||||
const auto &method = call.GetMethod(); |
||||
|
||||
if (method == "getApplicationOrg") { |
||||
onGetApplicationOrg(call); |
||||
return; |
||||
} |
||||
|
||||
if (method == "getApplicationName") { |
||||
onGetApplicationName(call); |
||||
return; |
||||
} |
||||
|
||||
unimplemented(call); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onGetApplicationOrg(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().orgname); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onGetApplicationName(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().appname); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::unimplemented(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(nullptr); |
||||
} |
After Width: | Height: | Size: 157 KiB |
@ -0,0 +1,44 @@
|
||||
# Miscellaneous |
||||
*.class |
||||
*.log |
||||
*.pyc |
||||
*.swp |
||||
.DS_Store |
||||
.atom/ |
||||
.buildlog/ |
||||
.history |
||||
.svn/ |
||||
migrate_working_dir/ |
||||
|
||||
# IntelliJ related |
||||
*.iml |
||||
*.ipr |
||||
*.iws |
||||
.idea/ |
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in |
||||
# VS Code which you may wish to be included in version control, so this line |
||||
# is commented out by default. |
||||
#.vscode/ |
||||
|
||||
# Flutter/Dart/Pub related |
||||
**/doc/api/ |
||||
**/ios/Flutter/.last_build_id |
||||
.dart_tool/ |
||||
.flutter-plugins |
||||
.flutter-plugins-dependencies |
||||
.packages |
||||
.pub-cache/ |
||||
.pub/ |
||||
/build/ |
||||
|
||||
# Symbolication related |
||||
app.*.symbols |
||||
|
||||
# Obfuscation related |
||||
app.*.map.json |
||||
|
||||
# Android Studio will place build artifacts here |
||||
/android/app/debug |
||||
/android/app/profile |
||||
/android/app/release |
@ -0,0 +1,16 @@
|
||||
# path_provider_aurora_example |
||||
|
||||
Demonstrates how to use the path_provider_aurora plugin. |
||||
|
||||
## Getting Started |
||||
|
||||
This project is a starting point for a Flutter application. |
||||
|
||||
A few resources to get you started if this is your first Flutter project: |
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) |
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) |
||||
|
||||
For help getting started with Flutter development, view the |
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials, |
||||
samples, guidance on mobile development, and a full API reference. |
@ -0,0 +1,29 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to |
||||
# check for errors, warnings, and lints. |
||||
# |
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled |
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be |
||||
# invoked from the command line by running `flutter analyze`. |
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps, |
||||
# packages, and plugins designed to encourage good coding practices. |
||||
include: package:flutter_lints/flutter.yaml |
||||
|
||||
linter: |
||||
# The lint rules applied to this project can be customized in the |
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` |
||||
# included above or to enable additional rules. A list of all available lints |
||||
# and their documentation is published at |
||||
# https://dart-lang.github.io/linter/lints/index.html. |
||||
# |
||||
# Instead of disabling a lint rule for the entire project in the |
||||
# section below, it can also be suppressed for a single line of code |
||||
# or a specific dart file by using the `// ignore: name_of_lint` and |
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file |
||||
# producing the lint. |
||||
rules: |
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule |
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule |
||||
|
||||
# Additional information about this file can be found at |
||||
# https://dart.dev/guides/language/analysis-options |