Browse Source

file picker and share support for aurora

aurora2
Марков Сергей Викторович 9 months ago
parent
commit
0aaef61e46
  1. 21
      .vscode/c_cpp_properties.json
  2. 26
      .vscode/launch.json
  3. 76
      .vscode/settings.json
  4. 20
      packages/app/aurora/desktop/su.markow.nextcloud-neon.desktop
  5. 3
      packages/app/aurora/main.cpp
  6. 1
      packages/app/aurora/rpm/su.markow.nextcloud-neon.spec
  7. 4
      packages/app/linux/flutter/generated_plugin_registrant.cc
  8. 1
      packages/app/linux/flutter/generated_plugins.cmake
  9. 119
      packages/app/pubspec.lock
  10. 17
      packages/app/pubspec.yaml
  11. 3
      packages/neon/neon/lib/src/app.dart
  12. 2
      packages/neon/neon/lib/src/pages/settings.dart
  13. 4
      packages/neon/neon/lib/src/platform/android.dart
  14. 6
      packages/neon/neon/lib/src/platform/aurora.dart
  15. 1
      packages/neon/neon/lib/src/router.dart
  16. 170
      packages/neon/neon/lib/src/settings/models/storage.dart
  17. 6
      packages/neon/neon/lib/src/utils/request_manager.dart
  18. 2
      packages/neon/neon/lib/src/utils/save_file.dart
  19. 8
      packages/neon/neon/pubspec.yaml
  20. 4
      packages/neon/neon_files/lib/blocs/files.dart
  21. 1
      packages/neon/neon_files/lib/dialogs/choose_create.dart
  22. 2
      packages/neon/neon_files/lib/neon_files.dart
  23. 15
      packages/neon/neon_files/pubspec.yaml

21
.vscode/c_cpp_properties.json vendored

@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/external/share_plus_aurora/aurora/include/**",
"/home/mars/Aurora_Platform_SDK_4.0.2.303/targets/AuroraOS-4.0.2.303-base-armv7hl/usr/include/flutter-embedder/**",
"/home/mars/Aurora_Platform_SDK_4.0.2.303/targets/AuroraOS-4.0.2.303-base-armv7hl/usr/include/qt5/**",
"/home/mars/Aurora_Platform_SDK_4.0.2.303/targets/AuroraOS-4.0.2.303-base-armv7hl/usr/include/auroraapp"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

26
.vscode/launch.json vendored

@ -2,24 +2,16 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "app", "name": "Attach with GDB",
"cwd": "packages/app", "type": "cppdbg",
"request": "launch", "request": "launch",
"type": "dart" "program": "./packages/app/build/aurora/psdk_4.0.2.303/aurora-arm/debug/su.markow.nextcloud-neon",
}, "MIMode": "gdb",
{ "miDebuggerPath": "/home/mars/.local/opt/gdb-14.1/bin/gdb",
"name": "app (profile mode)", "miDebuggerServerAddress": "192.168.1.95:10005",
"cwd": "packages/app", "useExtendedRemote": true,
"request": "launch", "cwd": "${workspaceRoot}",
"type": "dart", "visualizerFile": "/home/mars/.config/Code/User/workspaceStorage/fea3d830734d8233dc16614e19dcbb1c/tonka3000.qtvsctools/qt.natvis.xml"
"flutterMode": "profile"
},
{
"name": "app (release mode)",
"cwd": "packages/app",
"request": "launch",
"type": "dart",
"flutterMode": "release"
} }
] ]
} }

76
.vscode/settings.json vendored

@ -11,5 +11,79 @@
}, },
"files.associations": { "files.associations": {
"*.arb": "json", "*.arb": "json",
} "cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"qdbusconnectioninterface": "cpp"
},
"cmake.sourceDirectory": "/home/mars/dev/aurora/neon/external/share_plus_aurora/aurora"
} }

20
packages/app/aurora/desktop/su.markow.nextcloud-neon.desktop

@ -4,9 +4,25 @@ Name=nextcloud-neon
Comment=A new Flutter project. Comment=A new Flutter project.
Icon=su.markow.nextcloud-neon Icon=su.markow.nextcloud-neon
Exec=/usr/bin/su.markow.nextcloud-neon Exec=/usr/bin/su.markow.nextcloud-neon
X-Nemo-Application-Type=silica-qt5 #X-Nemo-Application-Type=silica-qt5
#X-Share-Methods=files;
#X-Maemo-Service=su.markow.nextcloud-neon
#X-Maemo-Method=su.markow.nextcloud-neon.activateWindow
[X-Application] [X-Application]
Permissions=UserDirs;Internet;Camera Permissions=SecureStorage;UserDirs;Internet;Camera;Sharing
OrganizationName=su.markow OrganizationName=su.markow
ApplicationName=nextcloud-neon ApplicationName=nextcloud-neon
#ExecDBus=/usr/bin/su.markow.nextcloud-neon --dbus-launch
[X-Sailjail]
Permissions=Sensors;SecureStorage;PushNotifications;DeviceInfo;Audio;Bluetooth;Camera;Internet;Location;MediaIndexing;Microphone;RemovableMedia;UserDirs
OrganizationName=su.markow
ApplicationName=nextcloud-neon
#ExecDBus=usr/bin/su.markow.nextcloud --dbus-launch
#[X-Share Method files]
#Description=Nextcloud file share
#Description[ru]=Nextcloud обмена изображениями
#Capabilities=*/*
#SupportsMultipleFiles=yes

3
packages/app/aurora/main.cpp

@ -1,7 +1,10 @@
#include <flutter/application.h> #include <flutter/application.h>
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <cstdio>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
//freopen("/home/defaultuser/Downloads/nextcloud.debug.out.txt", "w", stdout);
//freopen("/home/defaultuser/Downloads/nextcloud.debug.err.txt", "w", stderr);
Application::Initialize(argc, argv); Application::Initialize(argc, argv);
RegisterPlugins(); RegisterPlugins();
Application::Launch(); Application::Launch();

1
packages/app/aurora/rpm/su.markow.nextcloud-neon.spec

@ -12,6 +12,7 @@ BuildRequires: cmake
BuildRequires: pkgconfig(flutter-embedder) BuildRequires: pkgconfig(flutter-embedder)
BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(streamcamera) BuildRequires: pkgconfig(streamcamera)
BuildRequires: pkgconfig(Qt5DBus)
%description %description
%{summary}. %{summary}.

4
packages/app/linux/flutter/generated_plugin_registrant.cc

@ -8,6 +8,7 @@
#include <dynamic_color/dynamic_color_plugin.h> #include <dynamic_color/dynamic_color_plugin.h>
#include <file_selector_linux/file_selector_plugin.h> #include <file_selector_linux/file_selector_plugin.h>
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h> #include <screen_retriever/screen_retriever_plugin.h>
#include <tray_manager/tray_manager_plugin.h> #include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
@ -20,6 +21,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar); file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar = g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);

1
packages/app/linux/flutter/generated_plugins.cmake

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color dynamic_color
file_selector_linux file_selector_linux
flutter_secure_storage_linux
screen_retriever screen_retriever
tray_manager tray_manager
url_launcher_linux url_launcher_linux

119
packages/app/pubspec.lock

@ -249,6 +249,14 @@ packages:
relative: true relative: true
source: path source: path
version: "1.0.0" version: "1.0.0"
encrypt:
dependency: transitive
description:
name: encrypt
sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2"
url: "https://pub.dev"
source: hosted
version: "5.0.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -280,14 +288,31 @@ packages:
relative: true relative: true
source: path source: path
version: "1.0.0" version: "1.0.0"
file_picker: file_manager:
dependency: transitive dependency: transitive
description:
name: file_manager
sha256: "72c3ec25614ca7a115995db5ca6a7fe84ab3e9b9280e7ab25ab50b9c892f437e"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
file_picker:
dependency: "direct main"
description: description:
name: file_picker name: file_picker
sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.1" version: "6.1.1"
file_picker_aurora:
dependency: "direct main"
description:
path: "packages/file_picker/file_picker_aurora"
ref: file_picker_aurora
resolved-ref: fbcaeb1e3a8cb5118737529dd9d21eba1ff29913
url: "https://gitlab.com/hooky-mars/flutter-plugins.git"
source: git
version: "0.0.1"
file_selector_linux: file_selector_linux:
dependency: transitive dependency: transitive
description: description:
@ -431,6 +456,63 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.17" version: "2.0.17"
flutter_secure_storage:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "22dbf16f23a4bcf9d35e51be1c84ad5bb6f627750565edd70dab70f3ff5fff8f"
url: "https://pub.dev"
source: hosted
version: "8.1.0"
flutter_secure_storage_aurora:
dependency: "direct main"
description:
path: "packages/flutter_secure_storage/flutter_secure_storage_aurora"
ref: "flutter_secure_storage_aurora-0.0.1"
resolved-ref: "569e04ade1870ee39b64a75dd2258fa463725de8"
url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git"
source: git
version: "0.0.1"
flutter_secure_storage_linux:
dependency: transitive
description:
name: flutter_secure_storage_linux
sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c
url: "https://pub.dev"
source: hosted
version: "3.0.1"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
name: flutter_secure_storage_platform_interface
sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
flutter_secure_storage_web:
dependency: transitive
description:
name: flutter_secure_storage_web
sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20"
url: "https://pub.dev"
source: hosted
version: "1.1.2"
flutter_secure_storage_windows:
dependency: transitive
description:
name: flutter_secure_storage_windows
sha256: "38f9501c7cb6f38961ef0e1eacacee2b2d4715c63cc83fe56449c4d3d0b47255"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
flutter_svg: flutter_svg:
dependency: transitive dependency: transitive
description: description:
@ -775,8 +857,8 @@ packages:
dependency: transitive dependency: transitive
description: description:
path: "packages/package_info_plus/package_info_plus_aurora" path: "packages/package_info_plus/package_info_plus_aurora"
ref: master ref: "package_info_plus_aurora-0.0.1"
resolved-ref: "9c83303f10ec396bbb008e983659382ef69d4577" resolved-ref: "5d3895d6b876a7c5239d66569ee1c59175713d34"
url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git" url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@ -808,10 +890,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
@ -824,8 +906,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "packages/path_provider/path_provider_aurora" path: "packages/path_provider/path_provider_aurora"
ref: master ref: "path_provider_aurora-0.0.1"
resolved-ref: "9c83303f10ec396bbb008e983659382ef69d4577" resolved-ref: "4f2de1bfd4d111803553794327208609f1512016"
url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git" url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@ -1045,6 +1127,15 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.2.1" version: "7.2.1"
share_plus_aurora:
dependency: transitive
description:
path: "packages/share_plus/share_plus_aurora"
ref: "share_plus_aurora-0.0.1"
resolved-ref: c089fd68e49a81017706de26d8897d91377bbbc3
url: "https://gitlab.com/hooky-mars/flutter-plugins.git"
source: git
version: "0.0.1"
share_plus_platform_interface: share_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -1073,8 +1164,8 @@ packages:
dependency: transitive dependency: transitive
description: description:
path: "packages/shared_preferences/shared_preferences_aurora" path: "packages/shared_preferences/shared_preferences_aurora"
ref: master ref: "shared_preferences_aurora-0.0.1"
resolved-ref: "9c83303f10ec396bbb008e983659382ef69d4577" resolved-ref: "52c11f10424ea5c699a537a9a782eaa1bf596d5d"
url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git" url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@ -1383,10 +1474,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: uuid name: uuid
sha256: df5a4d8f22ee4ccd77f8839ac7cb274ebc11ef9adcce8b92be14b797fe889921 sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.2.1" version: "4.3.3"
vector_graphics: vector_graphics:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1527,8 +1618,8 @@ packages:
dependency: transitive dependency: transitive
description: description:
path: "packages/xdga_directories" path: "packages/xdga_directories"
ref: master ref: "xdga_directories-0.0.1"
resolved-ref: "9c83303f10ec396bbb008e983659382ef69d4577" resolved-ref: "1869a4da50d080a8a7e8cc159783d83674a3490a"
url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git" url: "https://gitlab.com/omprussia/flutter/flutter-plugins.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@ -1557,5 +1648,5 @@ packages:
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
sdks: sdks:
dart: ">=3.2.0-194.0.dev <4.0.0" dart: ">=3.2.2 <4.0.0"
flutter: ">=3.13.0" flutter: ">=3.13.0"

17
packages/app/pubspec.yaml

@ -9,6 +9,18 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_secure_storage: ^8.0.0
flutter_secure_storage_aurora:
git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: flutter_secure_storage_aurora-0.0.1
path: packages/flutter_secure_storage/flutter_secure_storage_aurora
file_picker: ^6.0.0
file_picker_aurora:
git:
url: https://gitlab.com/hooky-mars/flutter-plugins.git
ref: file_picker_aurora
path: packages/file_picker/file_picker_aurora
camera: ^0.10.5+5 camera: ^0.10.5+5
camera_aurora: camera_aurora:
git: git:
@ -27,7 +39,7 @@ dependencies:
path_provider_aurora: path_provider_aurora:
git: git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: master ref: path_provider_aurora-0.0.1
path: packages/path_provider/path_provider_aurora path: packages/path_provider/path_provider_aurora
neon: neon:
git: git:
@ -70,7 +82,8 @@ dev_dependencies:
git: git:
url: https://github.com/nextcloud/neon url: https://github.com/nextcloud/neon
path: packages/nextcloud path: packages/nextcloud
shared_preferences: any shared_preferences: ^2.1.2
vector_graphics_compiler: any vector_graphics_compiler: any
flutter: flutter:

3
packages/neon/neon/lib/src/app.dart

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:dynamic_color/dynamic_color.dart'; import 'package:dynamic_color/dynamic_color.dart';
import 'package:file_picker_aurora/app_router.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
@ -54,7 +55,7 @@ class NeonApp extends StatefulWidget {
// ignore: prefer_mixin // ignore: prefer_mixin
class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.TrayListener, WindowListener { class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.TrayListener, WindowListener {
final _appRegex = RegExp(r'^app_([a-z]+)$', multiLine: true); final _appRegex = RegExp(r'^app_([a-z]+)$', multiLine: true);
final _navigatorKey = GlobalKey<NavigatorState>(); final _navigatorKey = FilePickerAuroraAppRouter.navigatorKey;
late final Iterable<AppImplementation> _appImplementations; late final Iterable<AppImplementation> _appImplementations;
late final GlobalOptions _globalOptions; late final GlobalOptions _globalOptions;
late final AccountsBloc _accountsBloc; late final AccountsBloc _accountsBloc;

2
packages/neon/neon/lib/src/pages/settings.dart

@ -1,4 +1,5 @@
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:file_picker_aurora/file_picker_aurora.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
@ -270,6 +271,7 @@ class _SettingsPageState extends State<SettingsPage> {
final settingsExportHelper = _buildSettingsExportHelper(context); final settingsExportHelper = _buildSettingsExportHelper(context);
try { try {
FilePickerAurora.registerWith();
final result = await FilePicker.platform.pickFiles( final result = await FilePicker.platform.pickFiles(
withReadStream: true, withReadStream: true,
); );

4
packages/neon/neon/lib/src/platform/android.dart

@ -23,10 +23,10 @@ class AndroidNeonPlatform implements NeonPlatform {
bool get canUseCamera => true; bool get canUseCamera => true;
@override @override
bool get canUsePushNotifications => true; bool get canUsePushNotifications => false;
@override @override
bool get canUseQuickActions => true; bool get canUseQuickActions => false;
@override @override
bool get canUseSystemTray => false; bool get canUseSystemTray => false;

6
packages/neon/neon/lib/src/platform/aurora.dart

@ -21,10 +21,10 @@ class AuroraNeonPlatform implements NeonPlatform {
bool get canUseCamera => true; bool get canUseCamera => true;
@override @override
bool get canUsePushNotifications => true; bool get canUsePushNotifications => false;
@override @override
bool get canUseQuickActions => true; bool get canUseQuickActions => false;
@override @override
bool get canUseSystemTray => false; bool get canUseSystemTray => false;
@ -39,7 +39,7 @@ class AuroraNeonPlatform implements NeonPlatform {
bool get canUseSharing => true; bool get canUseSharing => true;
@override @override
bool get shouldUseFileDialog => true; bool get shouldUseFileDialog => false;
@override @override
Future<String> get userAccessibleAppDataPath async { Future<String> get userAccessibleAppDataPath async {

1
packages/neon/neon/lib/src/router.dart

@ -7,7 +7,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:meta/meta_meta.dart';
import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_implementation.dart'; import 'package:neon/src/models/app_implementation.dart';

170
packages/neon/neon/lib/src/settings/models/storage.dart

@ -1,6 +1,13 @@
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:nextcloud/ids.dart'; import 'package:nextcloud/ids.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_secure_storage_aurora/flutter_secure_storage_aurora.dart';
/// Storage interface used by `Option`s. /// Storage interface used by `Option`s.
/// ///
@ -91,6 +98,162 @@ enum StorageKeys implements Storable {
final String value; final String value;
} }
@internal
class SharedPreferencesAurora implements SharedPreferences {
static FlutterSecureStorage? _flutterSecureStorage;
static Map<String, String> tmp = <String, String>{};
static Future<void> init() async {
FlutterSecureStorageAurora.setSecret('5872747ed1ceda3638qwerty8b2b18b20');
_flutterSecureStorage = FlutterSecureStorage();
tmp.addAll(await _flutterSecureStorage!.readAll());
}
@override
bool containsKey(final String key) => tmp.containsKey(key);
@override
bool? getBool(final String key) {
if (tmp.containsKey(key)) {
return bool.parse(tmp[key]!);
}
return null;
}
@override
String? getString(final String key) => tmp[key];
@override
List<String>? getStringList(final String key) {
if (tmp.containsKey(key)) {
final list = jsonDecode(tmp[key]!)['list'] as List<dynamic>;
final resut = List<String>.empty(growable: true);
for (final item in list) {
resut.add(item as String);
}
return resut;
}
return null;
}
@override
Future<bool> remove(final String key) async {
if (_flutterSecureStorage == null) {
throw StateError(
'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.',
);
}
tmp.remove(key);
await _flutterSecureStorage!.delete(key: key);
return true;
}
@override
Future<bool> setBool(final String key, final bool value) async {
if (_flutterSecureStorage == null) {
throw StateError(
'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.',
);
}
tmp[key] = value.toString();
await _flutterSecureStorage!.write(key: key, value: value.toString());
return true;
}
@override
Future<bool> setString(final String key, final String value) async {
if (_flutterSecureStorage == null) {
throw StateError(
'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.',
);
}
tmp[key] = value;
await _flutterSecureStorage!.write(key: key, value: value);
return true;
}
@override
Future<bool> setStringList(final String key, final List<String> value) async {
if (_flutterSecureStorage == null) {
throw StateError(
'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.',
);
}
final list = jsonEncode({'list': value});
tmp[key] = list;
await _flutterSecureStorage!.write(key: key, value: list);
return true;
}
@override
Future<bool> clear() async {
if (_flutterSecureStorage == null) {
throw StateError(
'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.',
);
}
tmp.clear();
await _flutterSecureStorage!.deleteAll();
return true;
}
@override
Future<bool> commit() {
// TODO: implement commit
throw UnimplementedError();
}
@override
Object? get(String key) {
// TODO: implement get
throw UnimplementedError();
}
@override
double? getDouble(String key) {
// TODO: implement getDouble
throw UnimplementedError();
}
@override
int? getInt(String key) {
// TODO: implement getInt
throw UnimplementedError();
}
@override
Set<String> getKeys() {
// TODO: implement getKeys
throw UnimplementedError();
}
@override
Future<void> reload() {
// TODO: implement reload
throw UnimplementedError();
}
@override
Future<bool> setDouble(String key, double value) {
// TODO: implement setDouble
throw UnimplementedError();
}
@override
Future<bool> setInt(String key, int value) {
// TODO: implement setInt
throw UnimplementedError();
}
}
/// Neon storage that manages the storage backend. /// Neon storage that manages the storage backend.
/// ///
/// [init] must be called and completed before accessing individual storages. /// [init] must be called and completed before accessing individual storages.
@ -122,7 +285,12 @@ final class NeonStorage {
return; return;
} }
_sharedPreferences = await SharedPreferences.getInstance(); if (TargetPlatform.aurora == defaultTargetPlatform) {
await SharedPreferencesAurora.init();
_sharedPreferences = SharedPreferencesAurora();
} else {
_sharedPreferences = await SharedPreferences.getInstance();
}
} }
/// Returns the database instance. /// Returns the database instance.

6
packages/neon/neon/lib/src/utils/request_manager.dart

@ -162,7 +162,11 @@ class RequestManager {
final BehaviorSubject<Result<T>> subject, final BehaviorSubject<Result<T>> subject,
) { ) {
final value = subject.valueOrNull?.copyWith(error: error, isLoading: false) ?? Result.error(error); final value = subject.valueOrNull?.copyWith(error: error, isLoading: false) ?? Result.error(error);
subject.add(value); try {
subject.add(value);
} catch (e) {
print(e);
}
} }
Future<bool> _emitCached<T, R>( Future<bool> _emitCached<T, R>(

2
packages/neon/neon/lib/src/utils/save_file.dart

@ -1,6 +1,7 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:file_picker_aurora/file_picker_aurora.dart';
import 'package:flutter_file_dialog/flutter_file_dialog.dart'; import 'package:flutter_file_dialog/flutter_file_dialog.dart';
import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/platform/platform.dart';
import 'package:universal_io/io.dart'; import 'package:universal_io/io.dart';
@ -20,6 +21,7 @@ Future<String?> saveFileWithPickDialog(final String fileName, final Uint8List da
), ),
); );
} else { } else {
FilePickerAurora.registerWith();
final result = await FilePicker.platform.saveFile( final result = await FilePicker.platform.saveFile(
fileName: fileName, fileName: fileName,
); );

8
packages/neon/neon/pubspec.yaml

@ -11,7 +11,13 @@ dependencies:
crypto: ^3.0.0 crypto: ^3.0.0
cupertino_icons: ^1.0.0 cupertino_icons: ^1.0.0
dynamic_color: ^1.0.0 dynamic_color: ^1.0.0
file_manager: ^1.0.2
file_picker: ^6.0.0 file_picker: ^6.0.0
file_picker_aurora:
git:
url: https://gitlab.com/hooky-mars/flutter-plugins.git
ref: file_picker_aurora
path: packages/file_picker/file_picker_aurora
filesize: ^2.0.0 filesize: ^2.0.0
flutter: flutter:
sdk: flutter sdk: flutter
@ -47,7 +53,7 @@ dependencies:
shared_preferences_aurora: shared_preferences_aurora:
git: git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: master ref: shared_preferences_aurora-0.0.1
path: packages/shared_preferences/shared_preferences_aurora path: packages/shared_preferences/shared_preferences_aurora
sort_box: sort_box:
git: git:

4
packages/neon/neon_files/lib/blocs/files.dart

@ -172,7 +172,9 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
} }
Future<File> _cacheFile(final PathUri uri, final String etag) async { Future<File> _cacheFile(final PathUri uri, final String etag) async {
final cacheDir = await getApplicationCacheDirectory(); final cacheDir = TargetPlatform.aurora == defaultTargetPlatform
? await getTemporaryDirectory()
: await getApplicationCacheDirectory();
final file = File(p.join(cacheDir.path, 'files', etag.replaceAll('"', ''), uri.name)); final file = File(p.join(cacheDir.path, 'files', etag.replaceAll('"', ''), uri.name));
if (!file.existsSync()) { if (!file.existsSync()) {

1
packages/neon/neon_files/lib/dialogs/choose_create.dart

@ -16,6 +16,7 @@ class FilesChooseCreateDialog extends StatefulWidget {
class _FilesChooseCreateDialogState extends State<FilesChooseCreateDialog> { class _FilesChooseCreateDialogState extends State<FilesChooseCreateDialog> {
Future<void> uploadFromPick(final FileType type) async { Future<void> uploadFromPick(final FileType type) async {
FilePickerAurora.registerWith();
final result = await FilePicker.platform.pickFiles( final result = await FilePicker.platform.pickFiles(
allowMultiple: true, allowMultiple: true,
type: type, type: type,

2
packages/neon/neon_files/lib/neon_files.dart

@ -29,7 +29,9 @@ import 'dart:async';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:file_icons/file_icons.dart'; import 'package:file_icons/file_icons.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:file_picker_aurora/file_picker_aurora.dart';
import 'package:filesize/filesize.dart'; import 'package:filesize/filesize.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';

15
packages/neon/neon_files/pubspec.yaml

@ -13,6 +13,11 @@ dependencies:
url: https://github.com/nextcloud/neon url: https://github.com/nextcloud/neon
path: packages/file_icons path: packages/file_icons
file_picker: ^6.0.0 file_picker: ^6.0.0
file_picker_aurora:
git:
url: https://gitlab.com/hooky-mars/flutter-plugins.git
ref: file_picker_aurora
path: packages/file_picker/file_picker_aurora
filesize: ^2.0.0 filesize: ^2.0.0
flutter: flutter:
sdk: flutter sdk: flutter
@ -33,9 +38,19 @@ dependencies:
open_file: ^3.0.0 open_file: ^3.0.0
path: ^1.0.0 path: ^1.0.0
path_provider: ^2.0.0 path_provider: ^2.0.0
path_provider_aurora:
git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: path_provider_aurora-0.0.1
path: packages/path_provider/path_provider_aurora
queue: ^3.0.0 queue: ^3.0.0
rxdart: ^0.27.0 rxdart: ^0.27.0
share_plus: ^7.0.0 share_plus: ^7.0.0
share_plus_aurora:
git:
url: https://gitlab.com/hooky-mars/flutter-plugins.git
ref: share_plus_aurora-0.0.1
path: packages/share_plus/share_plus_aurora
universal_io: ^2.0.0 universal_io: ^2.0.0
dev_dependencies: dev_dependencies:

Loading…
Cancel
Save