Skip to content

An open-source cross-platform alternative to AirDrop

fix: get downloads directory correctly

Tien Do Nam75f1817c34bc
diff --git a/assets/CHANGELOG.md b/assets/CHANGELOG.md
index d34bd2c2..41b17ec4 100644
--- a/assets/CHANGELOG.md
+++ b/assets/CHANGELOG.md
@@ -2,8 +2,10 @@
- feat: dynamic colors (Material You) (by @Tienisto)
- feat: sharing APKs includes version in file name (by @Tienisto)
-- fix: cancellation fixes during active file transfer (by @SelaseKay)
+- feat(windows): use specialized fonts for Chinese, Japanese and Korean (by @graphemecluster, @Tienisto)
+- fix: cancellation fixes during active file transfer (by @SelaseKay)
- fix: possible settings corruption on Windows (by @TheGB0077, @Tienisto)
+- fix(android): get downloads directory correctly (by @Tienisto)
## 1.9.1 (2023-05-05)
diff --git a/lib/util/native/get_destination_directory.dart b/lib/util/native/get_destination_directory.dart
index e1ed289d..8114a891 100644
--- a/lib/util/native/get_destination_directory.dart
+++ b/lib/util/native/get_destination_directory.dart
@@ -1,10 +1,14 @@
import 'package:flutter/foundation.dart';
import 'package:path_provider/path_provider.dart' as path;
+import 'package:shared_storage/environment.dart';
+import 'package:shared_storage/shared_storage.dart' as shared_storage;
Future<String> getDefaultDestinationDirectory() async {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
- return '/storage/emulated/0/Download';
+ // ignore: deprecated_member_use
+ final dir = await shared_storage.getExternalStoragePublicDirectory(EnvironmentDirectory.downloads);
+ return dir?.path ?? '/storage/emulated/0/Download';
case TargetPlatform.iOS:
return (await path.getApplicationDocumentsDirectory()).path;
case TargetPlatform.linux:
diff --git a/pubspec.lock b/pubspec.lock
index 4a67ef33..d554b791 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1174,6 +1174,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
+ shared_storage:
+ dependency: "direct main"
+ description:
+ name: shared_storage
+ sha256: "2761c1f6562d7cfb7626982d3fc7ce0bb1d9bf86ff7db2f6d77ee078d8f57de9"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.1"
shelf:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 90ef7f45..10a4050a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -45,6 +45,7 @@ dependencies:
screen_retriever: 0.1.6
share_handler: 0.0.16
shared_preferences: 2.1.1
+ shared_storage: 0.7.1
shelf: 1.4.1
shelf_router: 1.1.4
slang: 3.18.0