diff --git a/packages/neon/neon/lib/src/platform/android.dart b/packages/neon/neon/lib/src/platform/android.dart index 2ee8d3ea..253ec6bd 100644 --- a/packages/neon/neon/lib/src/platform/android.dart +++ b/packages/neon/neon/lib/src/platform/android.dart @@ -28,12 +28,6 @@ class AndroidNeonPlatform implements NeonPlatform { @override bool get canUseWindowManager => false; - @override - Future get applicationCachePath async { - final tempDir = await getTemporaryDirectory(); - return tempDir.absolute.path; - } - @override Future get userAccessibleAppDataPath async { if (!await Permission.storage.request().isGranted) { diff --git a/packages/neon/neon/lib/src/platform/linux.dart b/packages/neon/neon/lib/src/platform/linux.dart index 17c270a4..594124a4 100644 --- a/packages/neon/neon/lib/src/platform/linux.dart +++ b/packages/neon/neon/lib/src/platform/linux.dart @@ -4,7 +4,6 @@ import 'package:meta/meta.dart'; import 'package:neon/src/platform/platform.dart'; import 'package:path/path.dart' as p; import 'package:sqflite_common_ffi/sqflite_ffi.dart'; -import 'package:xdg_directories/xdg_directories.dart' as xdg; @immutable @internal @@ -29,12 +28,6 @@ class LinuxNeonPlatform implements NeonPlatform { @override bool get canUsePushNotifications => false; - @override - String get applicationCachePath => p.join( - xdg.cacheHome.absolute.path, - 'de.provokateurin.neon', - ); - @override String get userAccessibleAppDataPath => p.join(Platform.environment['HOME']!, 'Neon'); diff --git a/packages/neon/neon/lib/src/platform/platform.dart b/packages/neon/neon/lib/src/platform/platform.dart index 85eb196a..0bedd437 100644 --- a/packages/neon/neon/lib/src/platform/platform.dart +++ b/packages/neon/neon/lib/src/platform/platform.dart @@ -53,8 +53,6 @@ abstract interface class NeonPlatform { abstract final bool canUsePushNotifications; - FutureOr get applicationCachePath; - FutureOr get userAccessibleAppDataPath; FutureOr init(); diff --git a/packages/neon/neon/lib/src/utils/request_manager.dart b/packages/neon/neon/lib/src/utils/request_manager.dart index e29954e3..ff462437 100644 --- a/packages/neon/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/neon/lib/src/utils/request_manager.dart @@ -3,9 +3,9 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:meta/meta.dart'; import 'package:neon/src/bloc/result.dart'; -import 'package:neon/src/platform/platform.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:path/path.dart' as p; +import 'package:path_provider/path_provider.dart'; import 'package:rxdart/rxdart.dart'; import 'package:sqflite/sqflite.dart'; import 'package:xml/xml.dart' as xml; @@ -194,11 +194,9 @@ class Cache { return; } + final cacheDir = await getApplicationCacheDirectory(); _database = await openDatabase( - p.join( - await NeonPlatform.instance.applicationCachePath, - 'cache.db', - ), + p.join(cacheDir.path, 'cache.db'), version: 1, onCreate: (final db, final version) async { await db.execute('CREATE TABLE cache (id INTEGER PRIMARY KEY, key TEXT, value TEXT, UNIQUE(key))'); diff --git a/packages/neon/neon/pubspec.yaml b/packages/neon/neon/pubspec.yaml index 667ed1e1..d35443bb 100644 --- a/packages/neon/neon/pubspec.yaml +++ b/packages/neon/neon/pubspec.yaml @@ -54,7 +54,6 @@ dependencies: url_launcher: ^6.1.12 vector_graphics: ^1.1.7 window_manager: ^0.3.6 - xdg_directories: ^1.0.2 xml: ^6.3.0 dev_dependencies: diff --git a/packages/neon/neon_files/lib/blocs/files.dart b/packages/neon/neon_files/lib/blocs/files.dart index 9946c131..2898ce8f 100644 --- a/packages/neon/neon_files/lib/blocs/files.dart +++ b/packages/neon/neon_files/lib/blocs/files.dart @@ -82,14 +82,8 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta void openFile(final List path, final String etag, final String? mimeType) { wrapAction( () async { - final file = File( - p.join( - await NeonPlatform.instance.applicationCachePath, - 'files', - etag.replaceAll('"', ''), - path.last, - ), - ); + final cacheDir = await getApplicationCacheDirectory(); + final file = File(p.join(cacheDir.path, 'files', etag.replaceAll('"', ''), path.last)); if (!file.existsSync()) { debugPrint('Downloading ${path.join('/')} since it does not exist'); if (!file.parent.existsSync()) { diff --git a/packages/neon/neon_files/lib/neon_files.dart b/packages/neon/neon_files/lib/neon_files.dart index 0f21a143..3b41ab63 100644 --- a/packages/neon/neon_files/lib/neon_files.dart +++ b/packages/neon/neon_files/lib/neon_files.dart @@ -25,6 +25,7 @@ import 'package:neon_files/routes.dart'; import 'package:neon_files/widgets/file_list_tile.dart'; import 'package:open_file/open_file.dart'; import 'package:path/path.dart' as p; +import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; import 'package:queue/queue.dart'; import 'package:rxdart/rxdart.dart'; diff --git a/packages/neon/neon_files/pubspec.yaml b/packages/neon/neon_files/pubspec.yaml index 56d5b405..28fd8710 100644 --- a/packages/neon/neon_files/pubspec.yaml +++ b/packages/neon/neon_files/pubspec.yaml @@ -26,6 +26,7 @@ dependencies: path: packages/neon/neon open_file: ^3.3.2 path: ^1.8.3 + path_provider: ^2.1.0 provider: ^6.0.5 queue: ^3.1.0+2 rxdart: ^0.27.7