Browse Source

Merge branch 'xdga_directories' into 'master'

OMP#OS-16308 Plugin xdga_directories

See merge request non-oss/flutter/flutter-plugins!8
merge-requests/8/merge
Vitaliy Zarubin 2 years ago
parent
commit
4b9a029247
  1. 2
      .gitignore
  2. 6
      AUTHORS.md
  3. 17
      README.md
  4. 30
      packages/xdga_directories/.gitignore
  5. 40
      packages/xdga_directories/README.md
  6. 4
      packages/xdga_directories/analysis_options.yaml
  7. 15
      packages/xdga_directories/aurora/CMakeLists.txt
  8. BIN
      packages/xdga_directories/data/preview.png
  9. 44
      packages/xdga_directories/example/.gitignore
  10. 21
      packages/xdga_directories/example/README.md
  11. 4
      packages/xdga_directories/example/analysis_options.yaml
  12. 1
      packages/xdga_directories/example/aurora/.gitignore
  13. 51
      packages/xdga_directories/example/aurora/CMakeLists.txt
  14. 12
      packages/xdga_directories/example/aurora/desktop/com.example.xdga_directories_example.desktop
  15. 14
      packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.cpp
  16. 12
      packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.h
  17. 31
      packages/xdga_directories/example/aurora/flutter/generated_plugins.cmake
  18. BIN
      packages/xdga_directories/example/aurora/icons/108x108.png
  19. BIN
      packages/xdga_directories/example/aurora/icons/128x128.png
  20. BIN
      packages/xdga_directories/example/aurora/icons/172x172.png
  21. BIN
      packages/xdga_directories/example/aurora/icons/86x86.png
  22. 14
      packages/xdga_directories/example/aurora/main.cpp
  23. 31
      packages/xdga_directories/example/aurora/rpm/com.example.xdga_directories_example.spec
  24. 180
      packages/xdga_directories/example/lib/main.dart
  25. 182
      packages/xdga_directories/example/pubspec.lock
  26. 27
      packages/xdga_directories/example/pubspec.yaml
  27. 20
      packages/xdga_directories/ffigen.yaml
  28. 47
      packages/xdga_directories/lib/xdga_directories.dart
  29. 104
      packages/xdga_directories/lib/xdga_directories_bindings_generated.dart
  30. 28
      packages/xdga_directories/pubspec.yaml
  31. 24
      packages/xdga_directories/src/CMakeLists.txt
  32. 47
      packages/xdga_directories/src/xdga_directories.cpp
  33. 27
      packages/xdga_directories/src/xdga_directories.h
  34. 99
      script/build_example.sh
  35. 67
      script/vscode_properties.sh

2
.gitignore vendored

@ -0,0 +1,2 @@
/.idea/
/.vscode/

6
AUTHORS.md

@ -0,0 +1,6 @@
Authors
The following authors have created the source code of «flutter-plugins» owned by Open Mobile Platform LLC as the owner:
Denis Glazkov d.glazkov@omp.ru
Vitaliy Zarubin v.zarubin@omp.ru

17
README.md

@ -0,0 +1,17 @@
# 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).
# Packages:
* [battery_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/battery_plus/battery_plus_aurora) - The Aurora implementation of [battery_plus](https://pub.dev/packages/battery_plus).
* [device_info_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/device_info_plus/device_info_plus_aurora) - The Aurora implementation of [device_info_plus](https://pub.dev/packages/device_info_plus).
* [flutter_local_notifications](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/flutter_local_notifications/flutter_local_notifications_aurora) - The Aurora implementation of [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications).
* [flutter_secure_storage](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/flutter_secure_storage/flutter_secure_storage_aurora) - The Aurora implementation of [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage).
* [package_info_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/package_info_plus/package_info_plus_aurora) - The Aurora implementation of [package_info_plus](https://pub.dev/packages/package_info_plus).
* [path_provider](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/path_provider/path_provider_aurora) - The Aurora implementation of [path_provider](https://pub.dev/packages/path_provider).
* [shared_preferences](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/shared_preferences/shared_preferences_aurora) - The Aurora implementation of [shared_preferences](https://pub.dev/packages/shared_preferences).
* [sqflite](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/sqflite/sqflite_aurora) - The Aurora OS implementation of [sqflite](https://pub.dev/packages/sqflite).
* [wakelock](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/wakelock/wakelock_aurora) - The Aurora OS implementation of [wakelock](https://pub.dev/packages/wakelock).
* [xdga_directories](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/xdga_directories) - A Dart package for reading directory path on Aurora OS.

30
packages/xdga_directories/.gitignore vendored

@ -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/

40
packages/xdga_directories/README.md

@ -0,0 +1,40 @@
# xdga_directories
A Dart package for reading directory path on Aurora OS.
Documentation for setting permissions can be found [here](https://developer.auroraos.ru/doc/software_development/reference/user_data).
To use this package, the basic XDG values for the following are available via a Dart API:
- `getAppDataLocation` - Returns a directory location where persistent application data can be stored.
- `getCacheLocation` - Returns a directory location where user-specific non-essential (cached) data should be written.
- `getDocumentsLocation` - Returns the directory containing user document files.
- `getDownloadLocation` - Returns a directory for user's downloaded files.
- `getMusicLocation` - Returns the directory containing the user's music or other audio files.
- `getPicturesLocation` - Returns the directory containing the user's pictures or photos.
- `getGenericDataLocation` - Returns a directory location where persistent data shared across applications can be stored.
- `getMoviesLocation` - Returns the directory containing the user's movies and videos.
## Usage
**pubspec.yaml**
```yaml
dependencies:
flutter_secure_storage_aurora:
path: # path to folder with plugin
```
***.dart**
```dart
import 'package:xdga_directories/xdga_directories.dart' as xdga;
final appDataLocation = xdga.getAppDataLocation();
final cacheLocation = xdga.getCacheLocation();
final documentsLocation = xdga.getDocumentsLocation();
final downloadLocation = xdga.getDownloadLocation();
final musicLocation = xdga.getMusicLocation();
final picturesLocation = xdga.getPicturesLocation();
final genericDataLocation = xdga.getGenericDataLocation();
final moviesLocation = xdga.getMoviesLocation();
```

4
packages/xdga_directories/analysis_options.yaml

@ -0,0 +1,4 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
include: package:flutter_lints/flutter.yaml

15
packages/xdga_directories/aurora/CMakeLists.txt

@ -0,0 +1,15 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
cmake_minimum_required(VERSION 3.10)
set(PLUGIN_NAME xdga_directories)
project(${PLUGIN_NAME} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/shared)

BIN
packages/xdga_directories/data/preview.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

44
packages/xdga_directories/example/.gitignore vendored

@ -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

21
packages/xdga_directories/example/README.md

@ -0,0 +1,21 @@
# xdga_directories_example
Demonstrates how to use the xdga_directories 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 # [--release|--debug|--profile]
```
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`.
### Preview example
![preview.png](../data/preview.png)

4
packages/xdga_directories/example/analysis_options.yaml

@ -0,0 +1,4 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
include: package:flutter_lints/flutter.yaml

1
packages/xdga_directories/example/aurora/.gitignore vendored

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

51
packages/xdga_directories/example/aurora/CMakeLists.txt

@ -0,0 +1,51 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
cmake_minimum_required(VERSION 3.10)
project(com.example.xdga_directories_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)
find_package(Qt5 COMPONENTS Core 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 Qt5::Core)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
include(flutter/generated_plugins.cmake)
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so)
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR})
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR})
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172)
install(FILES icons/${ICONS_SIZE}.png
RENAME ${BINARY_NAME}.png
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/)
endforeach(ICONS_SIZE)

12
packages/xdga_directories/example/aurora/desktop/com.example.xdga_directories_example.desktop

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

14
packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.cpp

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

12
packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.h

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

31
packages/xdga_directories/example/aurora/flutter/generated_plugins.cmake

@ -0,0 +1,31 @@
#
# Generated file, do not edit.
#
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}")
function(add_library TARGET)
_add_library(${TARGET} ${ARGN})
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:${TARGET}>"
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>")
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
endfunction()
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST
)
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)

BIN
packages/xdga_directories/example/aurora/icons/108x108.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
packages/xdga_directories/example/aurora/icons/128x128.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
packages/xdga_directories/example/aurora/icons/172x172.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
packages/xdga_directories/example/aurora/icons/86x86.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

14
packages/xdga_directories/example/aurora/main.cpp

@ -0,0 +1,14 @@
/*
* Copyright (c) 2023. Open Mobile Platform LLC.
* License: Proprietary.
*/
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
int main(int argc, char *argv[]) {
Application::Initialize(argc, argv);
Application::SetPixelRatio(1.8);
RegisterPlugins();
Application::Launch();
return 0;
}

31
packages/xdga_directories/example/aurora/rpm/com.example.xdga_directories_example.spec

@ -0,0 +1,31 @@
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$
Name: com.example.xdga_directories_example
Summary: Demonstrates how to use the xdga_directories 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

180
packages/xdga_directories/example/lib/main.dart

@ -0,0 +1,180 @@
/*
* Copyright (c) 2023. Open Mobile Platform LLC.
* License: Proprietary.
*/
import 'package:flutter/material.dart';
import 'package:xdga_directories/xdga_directories.dart' as xdga;
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late String appDataLocation;
late String cacheLocation;
late String documentsLocation;
late String downloadLocation;
late String musicLocation;
late String picturesLocation;
late String genericDataLocation;
late String moviesLocation;
@override
void initState() {
super.initState();
// Get paths
appDataLocation = xdga.getAppDataLocation();
cacheLocation = xdga.getCacheLocation();
documentsLocation = xdga.getDocumentsLocation();
downloadLocation = xdga.getDownloadLocation();
musicLocation = xdga.getMusicLocation();
picturesLocation = xdga.getPicturesLocation();
genericDataLocation = xdga.getGenericDataLocation();
moviesLocation = xdga.getMoviesLocation();
}
@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: 16);
const spacerSmall = SizedBox(height: 8);
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Example xdga_directories'),
),
body: SingleChildScrollView(
child: Center(
child: Container(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: const BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: const Padding(
padding: EdgeInsets.all(20),
child: Text(
'Demo application demonstration use xdga_directories',
style: textStyleWhite,
),
),
),
const SizedBox(height: 30),
// getAppDataLocation
const Text(
'getAppDataLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
appDataLocation,
style: textStylePath,
),
spaceMedium,
// getCacheLocation
const Text(
'getCacheLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
cacheLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getDocumentsLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
documentsLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getDownloadLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
downloadLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getMusicLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
musicLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getPicturesLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
picturesLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getGenericDataLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
genericDataLocation,
style: textStylePath,
),
spaceMedium,
// getDocumentsLocation
const Text(
'getMoviesLocation()',
style: textStyleTitle,
),
spacerSmall,
Text(
moviesLocation,
style: textStylePath,
),
],
),
),
),
),
),
);
}
}

182
packages/xdga_directories/example/pubspec.lock

@ -0,0 +1,182 @@
# 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"
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"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.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"
xdga_directories:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.1"
sdks:
dart: ">=2.18.6 <3.0.0"
flutter: ">=2.11.0"

27
packages/xdga_directories/example/pubspec.yaml

@ -0,0 +1,27 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
name: xdga_directories_example
description: Demonstrates how to use the xdga_directories plugin.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.18.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
xdga_directories:
path: ../
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true

20
packages/xdga_directories/ffigen.yaml

@ -0,0 +1,20 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
name: XdgaDirectoriesBindings
llvm-path:
- '/usr/lib/llvm-14/lib/libclang.so' # Ubuntu 22.04
- '/usr/lib/llvm-15/lib/libclang.so' # Ubuntu 23.04
description: |
Bindings for `src/xdga_directories.h`.
Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
output: 'lib/xdga_directories_bindings_generated.dart'
headers:
entry-points:
- 'src/xdga_directories.h'
include-directives:
- 'src/xdga_directories.h'
comments:
style: any
length: full

47
packages/xdga_directories/lib/xdga_directories.dart

@ -0,0 +1,47 @@
/*
* Copyright (c) 2023. Open Mobile Platform LLC.
* License: Proprietary.
*/
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'xdga_directories_bindings_generated.dart';
/// The dynamic library in which the symbols for [XdgaDirectoriesBindings] can be found.
final DynamicLibrary _dylib = () {
return DynamicLibrary.open('libxdga_directories.so');
}();
/// The bindings to the native functions in [_dylib].
final XdgaDirectoriesBindings _bindings = XdgaDirectoriesBindings(_dylib);
/// QStandardPaths::CacheLocation
String getCacheLocation() =>
_bindings.getCacheLocation().cast<Utf8>().toDartString();
/// QStandardPaths::AppDataLocation
String getAppDataLocation() =>
_bindings.getAppDataLocation().cast<Utf8>().toDartString();
/// QStandardPaths::DocumentsLocation
String getDocumentsLocation() =>
_bindings.getDocumentsLocation().cast<Utf8>().toDartString();
/// QStandardPaths::DownloadLocation
String getDownloadLocation() =>
_bindings.getDownloadLocation().cast<Utf8>().toDartString();
/// QStandardPaths::MusicLocation
String getMusicLocation() =>
_bindings.getMusicLocation().cast<Utf8>().toDartString();
/// QStandardPaths::PicturesLocation
String getPicturesLocation() =>
_bindings.getPicturesLocation().cast<Utf8>().toDartString();
/// QStandardPaths::GenericDataLocation
String getGenericDataLocation() =>
_bindings.getGenericDataLocation().cast<Utf8>().toDartString();
/// QStandardPaths::MoviesLocation
String getMoviesLocation() =>
_bindings.getMoviesLocation().cast<Utf8>().toDartString();

104
packages/xdga_directories/lib/xdga_directories_bindings_generated.dart

@ -0,0 +1,104 @@
// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
import 'dart:ffi' as ffi;
/// Bindings for `src/xdga_directories.h`.
///
/// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
///
class XdgaDirectoriesBindings {
/// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
_lookup;
/// The symbols are looked up in [dynamicLibrary].
XdgaDirectoriesBindings(ffi.DynamicLibrary dynamicLibrary)
: _lookup = dynamicLibrary.lookup;
/// The symbols are looked up with [lookup].
XdgaDirectoriesBindings.fromLookup(
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
lookup)
: _lookup = lookup;
ffi.Pointer<ffi.Char> getCacheLocation() {
return _getCacheLocation();
}
late final _getCacheLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getCacheLocation');
late final _getCacheLocation =
_getCacheLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getAppDataLocation() {
return _getAppDataLocation();
}
late final _getAppDataLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getAppDataLocation');
late final _getAppDataLocation =
_getAppDataLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getDocumentsLocation() {
return _getDocumentsLocation();
}
late final _getDocumentsLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getDocumentsLocation');
late final _getDocumentsLocation =
_getDocumentsLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getDownloadLocation() {
return _getDownloadLocation();
}
late final _getDownloadLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getDownloadLocation');
late final _getDownloadLocation =
_getDownloadLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getMusicLocation() {
return _getMusicLocation();
}
late final _getMusicLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getMusicLocation');
late final _getMusicLocation =
_getMusicLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getPicturesLocation() {
return _getPicturesLocation();
}
late final _getPicturesLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getPicturesLocation');
late final _getPicturesLocation =
_getPicturesLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getGenericDataLocation() {
return _getGenericDataLocation();
}
late final _getGenericDataLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getGenericDataLocation');
late final _getGenericDataLocation =
_getGenericDataLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
ffi.Pointer<ffi.Char> getMoviesLocation() {
return _getMoviesLocation();
}
late final _getMoviesLocationPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
'getMoviesLocation');
late final _getMoviesLocation =
_getMoviesLocationPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
}

28
packages/xdga_directories/pubspec.yaml

@ -0,0 +1,28 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
name: xdga_directories
description: Plugin for Aurora OS like xdg_directories
version: 0.0.1
environment:
sdk: '>=2.18.6 <3.0.0'
flutter: ">=2.11.0"
dependencies:
flutter:
sdk: flutter
ffi: ^1.2.1
plugin_platform_interface: ^2.0.2
dev_dependencies:
ffigen: ^5.0.1
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
plugin:
platforms:
aurora:
ffiPlugin: true

24
packages/xdga_directories/src/CMakeLists.txt

@ -0,0 +1,24 @@
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
cmake_minimum_required(VERSION 3.10)
project(xdga_directories VERSION 0.0.1)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Qt5Core REQUIRED IMPORTED_TARGET Qt5Core)
add_library(xdga_directories SHARED
"xdga_directories.cpp"
)
target_link_libraries(xdga_directories PRIVATE PkgConfig::Qt5Core)
set_target_properties(xdga_directories PROPERTIES
PUBLIC_HEADER "xdga_directories.h"
OUTPUT_NAME "xdga_directories"
)
target_compile_definitions(xdga_directories PUBLIC DART_SHARED_LIB)

47
packages/xdga_directories/src/xdga_directories.cpp

@ -0,0 +1,47 @@
/*
* Copyright (c) 2023. Open Mobile Platform LLC.
* License: Proprietary.
*/
#include <QStandardPaths>
#include "xdga_directories.h"
char *getCacheLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation).toUtf8().data();
}
char *getAppDataLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toUtf8().data();
}
char *getDocumentsLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation).toUtf8().data();
}
char *getDownloadLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation).toUtf8().data();
}
char *getMusicLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::MusicLocation).toUtf8().data();
}
char *getPicturesLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).toUtf8().data();
}
char *getGenericDataLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation).toUtf8().data();
}
char *getMoviesLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation).toUtf8().data();
}

27
packages/xdga_directories/src/xdga_directories.h

@ -0,0 +1,27 @@
/*
* Copyright (c) 2023. Open Mobile Platform LLC.
* License: Proprietary.
*/
#ifdef __cplusplus
extern "C" {
#endif
char *getCacheLocation();
char *getAppDataLocation();
char *getDocumentsLocation();
char *getDownloadLocation();
char *getMusicLocation();
char *getPicturesLocation();
char *getGenericDataLocation();
char *getMoviesLocation();
#ifdef __cplusplus
}
#endif

99
script/build_example.sh

@ -0,0 +1,99 @@
#!/bin/bash
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
## Build example, sign rpm, upload/install/run rpm to device
## Usage
##
## chmod +x ./build_example.sh
##
## ./build_example.sh \
## -p xdga_directories \
## -d <ip>:<password> \
## -s /home/user/sign/system_keys
## Flatter path
FLATTER="$HOME/.local/opt/flutter-sdk/bin/flutter"
## https://developer.auroraos.ru/doc/software_development/psdk/setup
## Install Platform SDK path
## You may not have set the PSDK_DIR environment variable.
## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk
while getopts p:d:s: flag; do
case "${flag}" in
p) package=${OPTARG} ;;
d) device=${OPTARG} ;;
s) sign=${OPTARG} ;;
*)
echo "usage: $0 [-p] [-d] [-s]" >&2
exit 1
;;
esac
done
if [ -z "$package" ]; then
echo "Specify a build package"
exit
else
cd "../packages/$package" 2>/dev/null || eval 'echo "Package \"$package\" not found." && exit'
## Update dependency
$FLATTER pub get
## Run ffigen if has
$FLATTER pub run ffigen --config ffigen.yaml 2>/dev/null
## Open example dir
cd "example" || exit
## Build aurora example app
{
$FLATTER build aurora --release
} || {
exit 1;
}
fi
if [ -n "$sign" ]; then
key=$(ls "$sign"/*key.pem)
if [ -z "$key" ]; then
echo "Key *key.pem not found."
exit
fi
cert=$(ls "$sign"/*cert.pem)
if [ -z "$cert" ]; then
echo "Key *cert.pem not found."
exit
fi
## Sign rpm system key
"$PSDK_DIR"/sdk-chroot rpmsign-external sign \
--key "$key" \
--cert "$cert" \
build/aurora/arm/release/RPMS/*.rpm
fi
if [ -n "$device" ]; then
IFS=':' read -ra ADDR <<< "$device"
IFS='/' read -ra ADDP <<< "$package"
D_IP="${ADDR[0]}"
D_PASS="${ADDR[1]}"
APP_KEY="${ADDP[-1]}"
# shellcheck disable=SC2012
rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1)
# upload rpm
scp "$rpm" defaultuser@"$D_IP:/home/defaultuser/Downloads"
# install rpm
ssh -t defaultuser@$D_IP "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/*$APP_KEY*.rpm"
# run application
ssh -t defaultuser@$D_IP "/usr/bin/com.example.${APP_KEY}_example"
fi

67
script/vscode_properties.sh

@ -0,0 +1,67 @@
#!/bin/bash
# Copyright (c) 2023. Open Mobile Platform LLC.
# License: Proprietary.
## Script create c_cpp_properties.json with dependencies for flutter aurora
## Usage
##
## chmod +x ./vscode_properties.sh
## ./vscode_properties.sh
## https://developer.auroraos.ru/doc/software_development/psdk/setup
## Install Platform SDK path
## You may not have set the PSDK_DIR environment variable.
## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk
cd ../
## check file
[ -f .vscode/c_cpp_properties.json ] && { echo "File c_cpp_properties.json already exist!"; exit; }
## find target
TARGET=$($PSDK_DIR/sdk-chroot sdk-assistant list | grep armv | grep default | sed 's/^.*A/A/g' | sed 's/\s.*//g')
## mkdir .vscode if not exist
[ -d .vscode ] || mkdir .vscode
## find targets path
TARGETS_PATH=$(cd "$PSDK_DIR/../../" && pwd)/targets
## save file
tee -a .vscode/c_cpp_properties.json << END
{
"configurations": [
{
"name": "Linux",
"includePath": [
"\${workspaceFolder}/**",
"$TARGETS_PATH/$TARGET/usr/include",
"$TARGETS_PATH/$TARGET/usr/include/dconf",
"$TARGETS_PATH/$TARGET/usr/include/flutter-embedder",
"$TARGETS_PATH/$TARGET/usr/include/maliit",
"$TARGETS_PATH/$TARGET/usr/include/appmanifest-cpp",
"$TARGETS_PATH/$TARGET/usr/include/glib-2.0",
"$TARGETS_PATH/$TARGET/usr/lib/glib-2.0/include",
"$TARGETS_PATH/$TARGET/usr/include/sailfishapp",
"$TARGETS_PATH/$TARGET/usr/include/qt5",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtConcurrent",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtCore",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtDBus",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtGui",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtMultimedia",
"$TARGETS_PATH/$TARGET/usr/include/qt5/QtQuick"
],
"defines": [
"__ARM_PCS_VFP"
],
"compilerPath": "/usr/bin/g++",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
END
Loading…
Cancel
Save