OMP#OS-16943 Flutter local notifications and Info plus See merge request non-oss/flutter/flutter-plugins!3merge-requests/3/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/ |
||||||
|
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 |
@ -0,0 +1 @@ |
|||||||
|
flutter/ephemeral |
@ -0,0 +1,47 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.10) |
||||||
|
project(com.example.path_provider_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=path_provider_aurora_example |
||||||
|
Comment=Demonstrates how to use the path_provider_aurora plugin. |
||||||
|
Icon=com.example.path_provider_aurora_example |
||||||
|
Exec=/usr/bin/com.example.path_provider_aurora_example |
||||||
|
X-Nemo-Application-Type=silica-qt5 |
||||||
|
|
||||||
|
[X-Application] |
||||||
|
Permissions=UserDirs |
||||||
|
OrganizationName=com.example |
||||||
|
ApplicationName=path_provider_aurora_example |
@ -0,0 +1,16 @@ |
|||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#include <flutter/application.h> |
||||||
|
#include <path_provider_aurora/path_provider_aurora_plugin.h> |
||||||
|
|
||||||
|
#include "generated_plugin_registrant.h" |
||||||
|
|
||||||
|
void RegisterPlugins() { |
||||||
|
Application::RegisterPlugins({ |
||||||
|
std::make_shared<PathProviderAuroraPlugin>(), |
||||||
|
}); |
||||||
|
} |
@ -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,32 @@ |
|||||||
|
# |
||||||
|
# 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 |
||||||
|
path_provider_aurora |
||||||
|
) |
||||||
|
|
||||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||||
|
xdga_directories |
||||||
|
) |
||||||
|
|
||||||
|
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.path_provider_aurora_example |
||||||
|
Summary: Demonstrates how to use the path_provider_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,249 @@ |
|||||||
|
import 'dart:io'; |
||||||
|
|
||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:path_provider/path_provider.dart'; |
||||||
|
import 'package:path_provider_aurora/path_provider_aurora.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? _applicationOrg; |
||||||
|
String? _applicationName; |
||||||
|
String? _pathApplicationSupportDirectory; |
||||||
|
String? _pathTempDirectory; |
||||||
|
String? _pathApplicationDocumentsPath; |
||||||
|
String? _pathDownloadsPath; |
||||||
|
String? _pathPictures; |
||||||
|
String? _pathMusic; |
||||||
|
String? _pathMovies; |
||||||
|
|
||||||
|
@override |
||||||
|
void initState() { |
||||||
|
super.initState(); |
||||||
|
loadPathDirectory(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Asynchronous function receiving directory paths |
||||||
|
Future<void> loadPathDirectory() async { |
||||||
|
try { |
||||||
|
// Get names |
||||||
|
String? applicationOrg = await PathProviderAurora.getApplicationOrg(); |
||||||
|
String? applicationName = await PathProviderAurora.getApplicationName(); |
||||||
|
|
||||||
|
// Get directories |
||||||
|
Directory? applicationSupportDirectory = await getApplicationSupportDirectory(); |
||||||
|
Directory? tempDirectory = await getTemporaryDirectory(); |
||||||
|
Directory? pathApplicationDocumentsPath = await getApplicationDocumentsDirectory(); |
||||||
|
Directory? pathDownloadsPath = await getDownloadsDirectory(); |
||||||
|
List<Directory>? pathPictures = await getExternalStorageDirectories(type: StorageDirectory.pictures); |
||||||
|
List<Directory>? pathMusic = await getExternalStorageDirectories(type: StorageDirectory.music); |
||||||
|
List<Directory>? pathMovies = await getExternalStorageDirectories(type: StorageDirectory.movies); |
||||||
|
|
||||||
|
// Update state variable |
||||||
|
setState(() { |
||||||
|
_applicationOrg = applicationOrg; |
||||||
|
_applicationName = applicationName; |
||||||
|
|
||||||
|
_pathApplicationSupportDirectory = applicationSupportDirectory.path; |
||||||
|
_pathTempDirectory = tempDirectory.path; |
||||||
|
_pathApplicationDocumentsPath = pathApplicationDocumentsPath.path; |
||||||
|
_pathDownloadsPath = pathDownloadsPath?.path; |
||||||
|
_pathPictures = pathPictures?.first.path; |
||||||
|
_pathMusic = pathMusic?.first.path; |
||||||
|
_pathMovies = pathMovies?.first.path; |
||||||
|
}); |
||||||
|
} 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 path_provider'), |
||||||
|
), |
||||||
|
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 path_provider', |
||||||
|
style: textStyleWhite, |
||||||
|
textAlign: TextAlign.center, |
||||||
|
), |
||||||
|
), |
||||||
|
const SizedBox(height: 30), |
||||||
|
|
||||||
|
// ApplicationOrg |
||||||
|
const Text( |
||||||
|
'Application Org', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_applicationOrg ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
|
||||||
|
spaceMedium, |
||||||
|
// ApplicationName |
||||||
|
const Text( |
||||||
|
'Application Name', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_applicationName ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
|
||||||
|
spaceMedium, |
||||||
|
// TempDirectory |
||||||
|
const Text( |
||||||
|
'ApplicationSupportDirectory', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathApplicationSupportDirectory ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
|
||||||
|
spaceMedium, |
||||||
|
// TempDirectory |
||||||
|
const Text( |
||||||
|
'TempDirectory', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathTempDirectory ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
spaceMedium, |
||||||
|
|
||||||
|
// ApplicationDocumentsPath |
||||||
|
const Text( |
||||||
|
'ApplicationDocumentsPath', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathApplicationDocumentsPath ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
spaceMedium, |
||||||
|
|
||||||
|
// DownloadsPath |
||||||
|
const Text( |
||||||
|
'DownloadsPath', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathDownloadsPath ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
spaceMedium, |
||||||
|
|
||||||
|
// Pictures |
||||||
|
const Text( |
||||||
|
'Pictures', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathPictures ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
spaceMedium, |
||||||
|
|
||||||
|
// Music |
||||||
|
const Text( |
||||||
|
'Music', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathMusic ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
spaceMedium, |
||||||
|
|
||||||
|
// Movies |
||||||
|
const Text( |
||||||
|
'Movies', |
||||||
|
style: textStyleTitle, |
||||||
|
), |
||||||
|
spaceSmall, |
||||||
|
Text( |
||||||
|
_pathMovies ?? 'Not found.', |
||||||
|
style: textStylePath, |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,266 @@ |
|||||||
|
# Generated by pub |
||||||
|
# See https://dart.dev/tools/pub/glossary#lockfile |
||||||
|
packages: |
||||||
|
async: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: async |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.9.0" |
||||||
|
boolean_selector: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: boolean_selector |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.0" |
||||||
|
characters: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: characters |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.1" |
||||||
|
clock: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: clock |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.1.1" |
||||||
|
collection: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: collection |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.16.0" |
||||||
|
cupertino_icons: |
||||||
|
dependency: "direct main" |
||||||
|
description: |
||||||
|
name: cupertino_icons |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.0.5" |
||||||
|
fake_async: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: fake_async |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.3.1" |
||||||
|
ffi: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: ffi |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.1" |
||||||
|
file: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: file |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "6.1.4" |
||||||
|
flutter: |
||||||
|
dependency: "direct main" |
||||||
|
description: flutter |
||||||
|
source: sdk |
||||||
|
version: "0.0.0" |
||||||
|
flutter_lints: |
||||||
|
dependency: "direct dev" |
||||||
|
description: |
||||||
|
name: flutter_lints |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.1" |
||||||
|
flutter_test: |
||||||
|
dependency: "direct dev" |
||||||
|
description: flutter |
||||||
|
source: sdk |
||||||
|
version: "0.0.0" |
||||||
|
lints: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: lints |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.1" |
||||||
|
matcher: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: matcher |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "0.12.12" |
||||||
|
material_color_utilities: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: material_color_utilities |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "0.1.5" |
||||||
|
meta: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: meta |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.8.0" |
||||||
|
path: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.8.2" |
||||||
|
path_provider: |
||||||
|
dependency: "direct main" |
||||||
|
description: |
||||||
|
name: path_provider |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.14" |
||||||
|
path_provider_android: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path_provider_android |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.26" |
||||||
|
path_provider_aurora: |
||||||
|
dependency: "direct main" |
||||||
|
description: |
||||||
|
path: ".." |
||||||
|
relative: true |
||||||
|
source: path |
||||||
|
version: "0.0.1" |
||||||
|
path_provider_foundation: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path_provider_foundation |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.2.2" |
||||||
|
path_provider_linux: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path_provider_linux |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.10" |
||||||
|
path_provider_platform_interface: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path_provider_platform_interface |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.6" |
||||||
|
path_provider_windows: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path_provider_windows |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.0.7" |
||||||
|
platform: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: platform |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "3.1.0" |
||||||
|
plugin_platform_interface: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: plugin_platform_interface |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.4" |
||||||
|
process: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: process |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "4.2.4" |
||||||
|
sky_engine: |
||||||
|
dependency: transitive |
||||||
|
description: flutter |
||||||
|
source: sdk |
||||||
|
version: "0.0.99" |
||||||
|
source_span: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: source_span |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.9.0" |
||||||
|
stack_trace: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: stack_trace |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.10.0" |
||||||
|
stream_channel: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: stream_channel |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.0" |
||||||
|
string_scanner: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: string_scanner |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.1.1" |
||||||
|
term_glyph: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: term_glyph |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.1" |
||||||
|
test_api: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: test_api |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "0.4.12" |
||||||
|
vector_math: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: vector_math |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.2" |
||||||
|
win32: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: win32 |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.6.1" |
||||||
|
xdg_directories: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: xdg_directories |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.0.0" |
||||||
|
xdga_directories: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
path: "../../../xdga_directories" |
||||||
|
relative: false |
||||||
|
source: path |
||||||
|
version: "0.0.1" |
||||||
|
sdks: |
||||||
|
dart: ">=2.18.6 <3.0.0" |
||||||
|
flutter: ">=3.3.0" |
@ -0,0 +1,85 @@ |
|||||||
|
name: path_provider_aurora_example |
||||||
|
description: Demonstrates how to use the path_provider_aurora plugin. |
||||||
|
|
||||||
|
# The following line prevents the package from being accidentally published to |
||||||
|
# pub.dev using `flutter pub publish`. This is preferred for private packages. |
||||||
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev |
||||||
|
|
||||||
|
environment: |
||||||
|
sdk: '>=2.18.6 <3.0.0' |
||||||
|
|
||||||
|
# Dependencies specify other packages that your package needs in order to work. |
||||||
|
# To automatically upgrade your package dependencies to the latest versions |
||||||
|
# consider running `flutter pub upgrade --major-versions`. Alternatively, |
||||||
|
# dependencies can be manually updated by changing the version numbers below to |
||||||
|
# the latest version available on pub.dev. To see which dependencies have newer |
||||||
|
# versions available, run `flutter pub outdated`. |
||||||
|
dependencies: |
||||||
|
flutter: |
||||||
|
sdk: flutter |
||||||
|
|
||||||
|
path_provider: ^2.0.7 |
||||||
|
path_provider_aurora: |
||||||
|
# When depending on this package from a real application you should use: |
||||||
|
# path_provider_aurora: ^x.y.z |
||||||
|
# See https://dart.dev/tools/pub/dependencies#version-constraints |
||||||
|
# The example app is bundled with the plugin so we use a path dependency on |
||||||
|
# the parent directory to use the current plugin's version. |
||||||
|
path: ../ |
||||||
|
|
||||||
|
# The following adds the Cupertino Icons font to your application. |
||||||
|
# Use with the CupertinoIcons class for iOS style icons. |
||||||
|
cupertino_icons: ^1.0.2 |
||||||
|
|
||||||
|
dev_dependencies: |
||||||
|
flutter_test: |
||||||
|
sdk: flutter |
||||||
|
|
||||||
|
# The "flutter_lints" package below contains a set of recommended lints to |
||||||
|
# encourage good coding practices. The lint set provided by the package is |
||||||
|
# activated in the `analysis_options.yaml` file located at the root of your |
||||||
|
# package. See that file for information about deactivating specific lint |
||||||
|
# rules and activating additional ones. |
||||||
|
flutter_lints: ^2.0.0 |
||||||
|
|
||||||
|
# For information on the generic Dart part of this file, see the |
||||||
|
# following page: https://dart.dev/tools/pub/pubspec |
||||||
|
|
||||||
|
# The following section is specific to Flutter packages. |
||||||
|
flutter: |
||||||
|
|
||||||
|
# The following line ensures that the Material Icons font is |
||||||
|
# included with your application, so that you can use the icons in |
||||||
|
# the material Icons class. |
||||||
|
uses-material-design: true |
||||||
|
|
||||||
|
# To add assets to your application, add an assets section, like this: |
||||||
|
# assets: |
||||||
|
# - images/a_dot_burr.jpeg |
||||||
|
# - images/a_dot_ham.jpeg |
||||||
|
|
||||||
|
# An image asset can refer to one or more resolution-specific "variants", see |
||||||
|
# https://flutter.dev/assets-and-images/#resolution-aware |
||||||
|
|
||||||
|
# For details regarding adding assets from package dependencies, see |
||||||
|
# https://flutter.dev/assets-and-images/#from-packages |
||||||
|
|
||||||
|
# To add custom fonts to your application, add a fonts section here, |
||||||
|
# in this "flutter" section. Each entry in this list should have a |
||||||
|
# "family" key with the font family name, and a "fonts" key with a |
||||||
|
# list giving the asset and other descriptors for the font. For |
||||||
|
# example: |
||||||
|
# fonts: |
||||||
|
# - family: Schyler |
||||||
|
# fonts: |
||||||
|
# - asset: fonts/Schyler-Regular.ttf |
||||||
|
# - asset: fonts/Schyler-Italic.ttf |
||||||
|
# style: italic |
||||||
|
# - family: Trajan Pro |
||||||
|
# fonts: |
||||||
|
# - asset: fonts/TrajanPro.ttf |
||||||
|
# - asset: fonts/TrajanPro_Bold.ttf |
||||||
|
# weight: 700 |
||||||
|
# |
||||||
|
# For details regarding fonts from package dependencies, |
||||||
|
# see https://flutter.dev/custom-fonts/#from-packages |
@ -0,0 +1,27 @@ |
|||||||
|
// This is a basic Flutter widget test. |
||||||
|
// |
||||||
|
// To perform an interaction with a widget in your test, use the WidgetTester |
||||||
|
// utility in the flutter_test package. For example, you can send tap and scroll |
||||||
|
// gestures. You can also use WidgetTester to find child widgets in the widget |
||||||
|
// tree, read text, and verify that the values of widget properties are correct. |
||||||
|
|
||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
|
||||||
|
import 'package:path_provider_aurora_example/main.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
testWidgets('Verify Platform version', (WidgetTester tester) async { |
||||||
|
// Build our app and trigger a frame. |
||||||
|
await tester.pumpWidget(const MyApp()); |
||||||
|
|
||||||
|
// Verify that platform version is retrieved. |
||||||
|
expect( |
||||||
|
find.byWidgetPredicate( |
||||||
|
(Widget widget) => widget is Text && |
||||||
|
widget.data!.startsWith('Running on:'), |
||||||
|
), |
||||||
|
findsOneWidget, |
||||||
|
); |
||||||
|
}); |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; |
||||||
|
import 'package:xdga_directories/xdga_directories.dart' as xdga_directories; |
||||||
|
import 'package:path/path.dart' as p; |
||||||
|
|
||||||
|
import 'path_provider_aurora_platform_interface.dart'; |
||||||
|
|
||||||
|
/// The aurora implementation of [PathProviderPlatform] |
||||||
|
/// |
||||||
|
/// This class implements the `package:path_provider` functionality for Aurora. |
||||||
|
class PathProviderAurora extends PathProviderPlatform { |
||||||
|
/// Registers this class as the default instance of [PathProviderPlatform] |
||||||
|
static void registerWith() { |
||||||
|
PathProviderPlatform.instance = PathProviderAurora(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Get application name |
||||||
|
static Future<String?> getApplicationName() { |
||||||
|
return PathProviderAuroraPlatform.instance.getApplicationName(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Get application org |
||||||
|
static Future<String?> getApplicationOrg() { |
||||||
|
return PathProviderAuroraPlatform.instance.getApplicationOrg(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Path to a directory where the application may place application support files. |
||||||
|
@override |
||||||
|
Future<String?> getApplicationSupportPath() async { |
||||||
|
String? org = await getApplicationOrg(); |
||||||
|
String? name = await getApplicationName(); |
||||||
|
// QStandardPaths::AppDataLocation |
||||||
|
return p.join(xdga_directories.getAppDataLocation(), org, name); |
||||||
|
} |
||||||
|
|
||||||
|
/// Path to the temporary directory on the device that is not backed up and is |
||||||
|
/// suitable for storing caches of downloaded files. |
||||||
|
@override |
||||||
|
Future<String> getTemporaryPath() async { |
||||||
|
String? org = await getApplicationOrg(); |
||||||
|
String? name = await getApplicationName(); |
||||||
|
// QStandardPaths::CacheLocation |
||||||
|
return p.join(xdga_directories.getCacheLocation(), org, name); |
||||||
|
} |
||||||
|
|
||||||
|
/// Path to a directory where the application may place data that is |
||||||
|
/// user-generated, or that cannot otherwise be recreated by your application. |
||||||
|
@override |
||||||
|
Future<String> getApplicationDocumentsPath() async { |
||||||
|
// QStandardPaths::DocumentsLocation |
||||||
|
return xdga_directories.getDocumentsLocation(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Path to the directory where downloaded files can be stored. |
||||||
|
/// This is typically only relevant on desktop operating systems. |
||||||
|
@override |
||||||
|
Future<String> getDownloadsPath() async { |
||||||
|
// QStandardPaths::DownloadLocation |
||||||
|
return xdga_directories.getDownloadLocation(); |
||||||
|
} |
||||||
|
|
||||||
|
/// Paths to directories where application specific data can be stored. |
||||||
|
/// These paths typically reside on external storage like separate partitions |
||||||
|
/// or SD cards. Phones may have multiple storage directories available. |
||||||
|
@override |
||||||
|
Future<List<String>?> getExternalStoragePaths({ |
||||||
|
/// Optional parameter. See [StorageDirectory] for more informations on |
||||||
|
/// how this type translates to Android storage directories. |
||||||
|
StorageDirectory? type, |
||||||
|
}) async { |
||||||
|
switch (type) { |
||||||
|
case StorageDirectory.pictures: |
||||||
|
return [xdga_directories.getPicturesLocation()]; // QStandardPaths::PicturesLocation |
||||||
|
case StorageDirectory.music: |
||||||
|
return [xdga_directories.getMusicLocation()]; // QStandardPaths::MusicLocation |
||||||
|
case StorageDirectory.movies: |
||||||
|
return [xdga_directories.getMoviesLocation()]; // QStandardPaths::MoviesLocation |
||||||
|
default: |
||||||
|
throw UnimplementedError('Type "$type" not supported.'); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
import 'package:flutter/foundation.dart'; |
||||||
|
import 'package:flutter/services.dart'; |
||||||
|
|
||||||
|
import 'path_provider_aurora_platform_interface.dart'; |
||||||
|
|
||||||
|
/// An implementation of [PathProviderAuroraPlatform] that uses method channels. |
||||||
|
class MethodChannelPathProviderAurora extends PathProviderAuroraPlatform { |
||||||
|
/// The method channel used to interact with the native platform. |
||||||
|
@visibleForTesting |
||||||
|
final methodChannel = const MethodChannel('path_provider_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,33 @@ |
|||||||
|
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
||||||
|
|
||||||
|
import 'path_provider_aurora_method_channel.dart'; |
||||||
|
|
||||||
|
abstract class PathProviderAuroraPlatform extends PlatformInterface { |
||||||
|
/// Constructs a PathProviderAuroraPlatform. |
||||||
|
PathProviderAuroraPlatform() : super(token: _token); |
||||||
|
|
||||||
|
static final Object _token = Object(); |
||||||
|
|
||||||
|
static PathProviderAuroraPlatform _instance = MethodChannelPathProviderAurora(); |
||||||
|
|
||||||
|
/// The default instance of [PathProviderAuroraPlatform] to use. |
||||||
|
/// |
||||||
|
/// Defaults to [MethodChannelPathProviderAurora]. |
||||||
|
static PathProviderAuroraPlatform get instance => _instance; |
||||||
|
|
||||||
|
/// Platform-specific implementations should set this with their own |
||||||
|
/// platform-specific class that extends [PathProviderAuroraPlatform] when |
||||||
|
/// they register themselves. |
||||||
|
static set instance(PathProviderAuroraPlatform 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,32 @@ |
|||||||
|
name: path_provider_aurora |
||||||
|
description: The Aurora OS implementation of path_provider. |
||||||
|
version: 0.0.1 |
||||||
|
homepage: https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/packages/xdga_directories |
||||||
|
|
||||||
|
environment: |
||||||
|
sdk: '>=2.18.6 <3.0.0' |
||||||
|
flutter: ">=2.5.0" |
||||||
|
|
||||||
|
flutter: |
||||||
|
plugin: |
||||||
|
implements: path_provider |
||||||
|
platforms: |
||||||
|
aurora: |
||||||
|
dartPluginClass: PathProviderAurora |
||||||
|
pluginClass: PathProviderAuroraPlugin |
||||||
|
|
||||||
|
dependencies: |
||||||
|
flutter: |
||||||
|
sdk: flutter |
||||||
|
path: ^1.8.2 |
||||||
|
plugin_platform_interface: ^2.0.2 |
||||||
|
path_provider_platform_interface: ^2.0.6 |
||||||
|
xdga_directories: |
||||||
|
path: ../../xdga_directories |
||||||
|
|
||||||
|
dev_dependencies: |
||||||
|
flutter_test: |
||||||
|
sdk: flutter |
||||||
|
flutter_lints: ^2.0.0 |
||||||
|
|
||||||
|
|
@ -0,0 +1,34 @@ |
|||||||
|
import 'package:flutter/services.dart'; |
||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
import 'package:path_provider_aurora/path_provider_aurora_method_channel.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
MethodChannelPathProviderAurora platform = MethodChannelPathProviderAurora(); |
||||||
|
const MethodChannel channel = MethodChannel('path_provider_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,30 @@ |
|||||||
|
# Miscellaneous |
||||||
|
*.class |
||||||
|
*.log |
||||||
|
*.pyc |
||||||
|
*.swp |
||||||
|
.DS_Store |
||||||
|
.atom/ |
||||||
|
.buildlog/ |
||||||
|
.history |
||||||
|
.svn/ |
||||||
|
migrate_working_dir/ |
||||||
|
|
||||||
|
# IntelliJ related |
||||||
|
*.iml |
||||||
|
*.ipr |
||||||
|
*.iws |
||||||
|
.idea/ |
||||||
|
|
||||||
|
# The .vscode folder contains launch configuration and tasks you configure in |
||||||
|
# VS Code which you may wish to be included in version control, so this line |
||||||
|
# is commented out by default. |
||||||
|
#.vscode/ |
||||||
|
|
||||||
|
# Flutter/Dart/Pub related |
||||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||||
|
/pubspec.lock |
||||||
|
**/doc/api/ |
||||||
|
.dart_tool/ |
||||||
|
.packages |
||||||
|
build/ |
@ -0,0 +1,30 @@ |
|||||||
|
# This file tracks properties of this Flutter project. |
||||||
|
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
||||||
|
# |
||||||
|
# This file should be version controlled. |
||||||
|
|
||||||
|
version: |
||||||
|
revision: 135454af32477f815a7525073027a3ff9eff1bfd |
||||||
|
channel: unknown |
||||||
|
|
||||||
|
project_type: plugin |
||||||
|
|
||||||
|
# Tracks metadata for the flutter migrate command |
||||||
|
migration: |
||||||
|
platforms: |
||||||
|
- platform: root |
||||||
|
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd |
||||||
|
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd |
||||||
|
- platform: aurora |
||||||
|
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd |
||||||
|
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd |
||||||
|
|
||||||
|
# User provided section |
||||||
|
|
||||||
|
# List of Local paths (relative to this file) that should be |
||||||
|
# ignored by the migrate tool. |
||||||
|
# |
||||||
|
# Files that are not part of the templates will be ignored by default. |
||||||
|
unmanaged_files: |
||||||
|
- 'lib/main.dart' |
||||||
|
- 'ios/Runner.xcodeproj/project.pbxproj' |
@ -0,0 +1,17 @@ |
|||||||
|
# shared_preferences_aurora |
||||||
|
|
||||||
|
The Aurora implementation of [`shared_preferences`][https://pub.dev/packages/shared_preferences]. |
||||||
|
|
||||||
|
## Usage |
||||||
|
This package is not an _endorsed_ implementation of `shared_preferences`. |
||||||
|
Therefore, you have to include `path_provider_aurora` alongside `shared_preferences` as dependencies in your `pubspec.yaml` file. |
||||||
|
|
||||||
|
```yaml |
||||||
|
dependencies: |
||||||
|
shared_preferences: ^2.1.1 |
||||||
|
shared_preferences_aurora: ^0.0.0 # @todo Not published |
||||||
|
``` |
||||||
|
|
||||||
|
### 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,25 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.10) |
||||||
|
|
||||||
|
set(PROJECT_NAME shared_preferences_aurora) |
||||||
|
set(PLUGIN_NAME shared_preferences_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) |
||||||
|
pkg_check_modules(Qt5Core REQUIRED IMPORTED_TARGET Qt5Core) |
||||||
|
|
||||||
|
add_library(${PLUGIN_NAME} SHARED shared_preferences_aurora_plugin.cpp) |
||||||
|
|
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) |
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) |
||||||
|
target_link_libraries(${PLUGIN_NAME} PUBLIC PkgConfig::Qt5Core) |
||||||
|
|
||||||
|
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) |
||||||
|
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) |
@ -0,0 +1,66 @@ |
|||||||
|
#ifndef FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H |
||||||
|
#define FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H |
||||||
|
|
||||||
|
#include <flutter/plugin-interface.h> |
||||||
|
#include <flutter/method-channel.h> |
||||||
|
#include <QSettings> |
||||||
|
#include <QString> |
||||||
|
|
||||||
|
#ifdef PLUGIN_IMPL |
||||||
|
#define PLUGIN_EXPORT __attribute__((visibility("default"))) |
||||||
|
#else |
||||||
|
#define PLUGIN_EXPORT |
||||||
|
#endif |
||||||
|
|
||||||
|
class PLUGIN_EXPORT SharedPreferencesAuroraPlugin final : public PluginInterface |
||||||
|
{ |
||||||
|
public: |
||||||
|
SharedPreferencesAuroraPlugin(); |
||||||
|
void RegisterWithRegistrar(PluginRegistrar ®istrar) override; |
||||||
|
|
||||||
|
struct ARGS |
||||||
|
{ |
||||||
|
QString prefix; |
||||||
|
QString key; |
||||||
|
Encodable value; |
||||||
|
}; |
||||||
|
|
||||||
|
enum Types |
||||||
|
{
|
||||||
|
Int, |
||||||
|
Bool, |
||||||
|
Double, |
||||||
|
String, |
||||||
|
List |
||||||
|
}; |
||||||
|
|
||||||
|
enum Methods
|
||||||
|
{
|
||||||
|
setInt, |
||||||
|
setBool, |
||||||
|
setDouble, |
||||||
|
setString, |
||||||
|
setStringList, |
||||||
|
clearWithPrefix, |
||||||
|
remove, |
||||||
|
getAllWithPrefix, |
||||||
|
}; |
||||||
|
|
||||||
|
private: |
||||||
|
void onMethodCall(const MethodCall &call); |
||||||
|
void unimplemented(const MethodCall &call); |
||||||
|
ARGS getArguments(const MethodCall &call); |
||||||
|
void onSetInt(const MethodCall &call); |
||||||
|
void onSetBool(const MethodCall &call); |
||||||
|
void onSetDouble(const MethodCall &call); |
||||||
|
void onSetString(const MethodCall &call); |
||||||
|
void onSetStringList(const MethodCall &call); |
||||||
|
void onClearWithPrefix(const MethodCall &call); |
||||||
|
void onRemove(const MethodCall &call); |
||||||
|
void onGetAllWithPrefix(const MethodCall &call); |
||||||
|
|
||||||
|
QSettings settings; |
||||||
|
std::map <std::string, int> mapping; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif /* FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H */ |
@ -0,0 +1,256 @@ |
|||||||
|
#include <shared_preferences_aurora/shared_preferences_aurora_plugin.h> |
||||||
|
#include <flutter/method-channel.h> |
||||||
|
#include <flutter/application.h> |
||||||
|
#include <QSettings> |
||||||
|
#include <QVariant> |
||||||
|
#include <QDir> |
||||||
|
|
||||||
|
namespace { |
||||||
|
|
||||||
|
QString defaultSettingsFile() |
||||||
|
{ |
||||||
|
const auto [orgname, appname] = Application::GetID(); |
||||||
|
|
||||||
|
return QStringLiteral("%1/.local/share/%2/%3/.flutter_shared_preferences.conf") |
||||||
|
.arg(QDir::homePath()) |
||||||
|
.arg(QString::fromStdString(orgname)) |
||||||
|
.arg(QString::fromStdString(appname)); |
||||||
|
} |
||||||
|
|
||||||
|
} /* namespace */ |
||||||
|
|
||||||
|
SharedPreferencesAuroraPlugin::SharedPreferencesAuroraPlugin(): settings( |
||||||
|
defaultSettingsFile(), |
||||||
|
QSettings::NativeFormat |
||||||
|
) { |
||||||
|
// map methods
|
||||||
|
this->mapping = std::map <std::string, int>({ |
||||||
|
{"setInt", Methods::setInt}, |
||||||
|
{"setBool", Methods::setBool}, |
||||||
|
{"setDouble", Methods::setDouble}, |
||||||
|
{"setString", Methods::setString}, |
||||||
|
{"setStringList", Methods::setStringList}, |
||||||
|
{"clearWithPrefix", Methods::clearWithPrefix}, |
||||||
|
{"remove", Methods::remove}, |
||||||
|
{"getAllWithPrefix", Methods::getAllWithPrefix}, |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
||||||
|
{ |
||||||
|
registrar.RegisterMethodChannel("shared_preferences_aurora", |
||||||
|
MethodCodecType::Standard, |
||||||
|
[this](const MethodCall &call) { this->onMethodCall(call); }); |
||||||
|
} |
||||||
|
|
||||||
|
SharedPreferencesAuroraPlugin::ARGS SharedPreferencesAuroraPlugin::getArguments(const MethodCall &call) |
||||||
|
{ |
||||||
|
QString key = QString::fromStdString(call.GetArguments()["key"].GetString()); |
||||||
|
Encodable value = call.GetArguments()["value"]; |
||||||
|
ARGS args; |
||||||
|
|
||||||
|
args.prefix = key.split('.').first(); |
||||||
|
args.key = key.mid(args.prefix.length() + 1, key.length()); |
||||||
|
args.value = value; |
||||||
|
|
||||||
|
return args; |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onMethodCall(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto &method = call.GetMethod(); |
||||||
|
|
||||||
|
switch (this->mapping[method])
|
||||||
|
{ |
||||||
|
case Methods::setInt:
|
||||||
|
onSetInt(call);
|
||||||
|
return; |
||||||
|
case Methods::setBool:
|
||||||
|
onSetBool(call);
|
||||||
|
return; |
||||||
|
case Methods::setDouble:
|
||||||
|
onSetDouble(call);
|
||||||
|
return; |
||||||
|
case Methods::setString:
|
||||||
|
onSetString(call);
|
||||||
|
return; |
||||||
|
case Methods::setStringList:
|
||||||
|
onSetStringList(call);
|
||||||
|
return; |
||||||
|
case Methods::clearWithPrefix:
|
||||||
|
onClearWithPrefix(call);
|
||||||
|
return; |
||||||
|
case Methods::remove:
|
||||||
|
onRemove(call);
|
||||||
|
return; |
||||||
|
case Methods::getAllWithPrefix:
|
||||||
|
onGetAllWithPrefix(call);
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
unimplemented(call); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onSetInt(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto [prefix, key, value] = this->getArguments(call); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.setValue( |
||||||
|
QStringLiteral("%1:").arg(Types::Int) + key,
|
||||||
|
value.GetInt() |
||||||
|
); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onSetBool(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto [prefix, key, value] = this->getArguments(call); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.setValue( |
||||||
|
QStringLiteral("%1:").arg(Types::Bool) + key,
|
||||||
|
value.GetBoolean() |
||||||
|
); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onSetDouble(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto [prefix, key, value] = this->getArguments(call); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.setValue( |
||||||
|
QStringLiteral("%1:").arg(Types::Double) + key,
|
||||||
|
value.GetFloat() |
||||||
|
); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onSetString(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto [prefix, key, value] = this->getArguments(call); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.setValue( |
||||||
|
QStringLiteral("%1:").arg(Types::String) + key,
|
||||||
|
QString::fromStdString(value.GetString()) |
||||||
|
); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onSetStringList(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto [prefix, key, value] = this->getArguments(call); |
||||||
|
const auto vec = value.GetList(); |
||||||
|
|
||||||
|
QStringList strings; |
||||||
|
|
||||||
|
for (const auto& item : vec) |
||||||
|
{ |
||||||
|
strings.append(QString::fromStdString(item.GetString())); |
||||||
|
} |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.setValue( |
||||||
|
QStringLiteral("%1:").arg(Types::List) + key,
|
||||||
|
strings |
||||||
|
); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onClearWithPrefix(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto prefix = QString::fromStdString(call.GetArguments()["prefix"].GetString()) |
||||||
|
.replace(".", ""); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.remove(""); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onRemove(const MethodCall &call) |
||||||
|
{ |
||||||
|
QString raw = QString::fromStdString(call.GetArguments()["key"].GetString()); |
||||||
|
|
||||||
|
const auto prefix = raw.split('.').first(); |
||||||
|
const auto key = raw.mid(prefix.length() + 1, raw.length()); |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
settings.remove(QStringLiteral("%1:").arg(Types::Int) + key); |
||||||
|
settings.remove(QStringLiteral("%1:").arg(Types::Bool) + key); |
||||||
|
settings.remove(QStringLiteral("%1:").arg(Types::Double) + key); |
||||||
|
settings.remove(QStringLiteral("%1:").arg(Types::String) + key); |
||||||
|
settings.remove(QStringLiteral("%1:").arg(Types::List) + key); |
||||||
|
settings.sync(); |
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(true); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::onGetAllWithPrefix(const MethodCall &call) |
||||||
|
{ |
||||||
|
const auto prefix = QString::fromStdString(call.GetArguments()["prefix"].GetString()) |
||||||
|
.replace(".", ""); |
||||||
|
|
||||||
|
std::map<Encodable, Encodable> map; |
||||||
|
|
||||||
|
settings.beginGroup(prefix); |
||||||
|
|
||||||
|
for (const auto& item : settings.allKeys()) |
||||||
|
{ |
||||||
|
const auto type = item.split(":").first(); |
||||||
|
const auto key = prefix + "." + item.mid(type.length() + 1, item.length()); |
||||||
|
const auto variant = settings.value(item); |
||||||
|
|
||||||
|
switch (type.toInt()) |
||||||
|
{ |
||||||
|
case Types::Int: |
||||||
|
map[key.toStdString()] = Encodable(variant.toInt()); |
||||||
|
break; |
||||||
|
case Types::Bool: |
||||||
|
map[key.toStdString()] = Encodable(variant.toBool()); |
||||||
|
break; |
||||||
|
case Types::Double: |
||||||
|
map[key.toStdString()] = Encodable(variant.toDouble()); |
||||||
|
break; |
||||||
|
case Types::String: |
||||||
|
map[key.toStdString()] = Encodable(variant.toString().toStdString()); |
||||||
|
break; |
||||||
|
case Types::List: |
||||||
|
std::vector<Encodable> vec; |
||||||
|
QStringList list = variant.toStringList(); |
||||||
|
for (const auto& item : list) |
||||||
|
{ |
||||||
|
vec.push_back(item.toStdString()); |
||||||
|
} |
||||||
|
map[key.toStdString()] = vec; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
settings.endGroup(); |
||||||
|
|
||||||
|
call.SendSuccessResponse(map); |
||||||
|
} |
||||||
|
|
||||||
|
void SharedPreferencesAuroraPlugin::unimplemented(const MethodCall &call) |
||||||
|
{ |
||||||
|
call.SendSuccessResponse(nullptr); |
||||||
|
} |
After Width: | Height: | Size: 91 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 |