mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
fix: android invalid download location Download not starting or not explaining error #720
This commit is contained in:
parent
433ae3d0c7
commit
d056dbf9ee
@ -1,5 +1,6 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:file_selector/file_selector.dart';
|
import 'package:file_selector/file_selector.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -47,15 +48,19 @@ class SettingsPage extends HookConsumerWidget {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
final pickDownloadLocation = useCallback(() async {
|
final pickDownloadLocation = useCallback(() async {
|
||||||
String? dirStr = await getDirectoryPath(
|
if (DesktopTools.platform.isMobile) {
|
||||||
initialDirectory: preferences.downloadLocation,
|
final dirStr = await FilePicker.platform.getDirectoryPath(
|
||||||
);
|
initialDirectory: preferences.downloadLocation,
|
||||||
if (dirStr == null) return;
|
);
|
||||||
if (DesktopTools.platform.isAndroid && dirStr.startsWith("content://")) {
|
if (dirStr == null) return;
|
||||||
dirStr =
|
preferences.setDownloadLocation(dirStr);
|
||||||
"/storage/emulated/0/${Uri.decodeFull(dirStr).split("primary:").last}";
|
} else {
|
||||||
|
String? dirStr = await getDirectoryPath(
|
||||||
|
initialDirectory: preferences.downloadLocation,
|
||||||
|
);
|
||||||
|
if (dirStr == null) return;
|
||||||
|
preferences.setDownloadLocation(dirStr);
|
||||||
}
|
}
|
||||||
preferences.setDownloadLocation(dirStr);
|
|
||||||
}, [preferences.downloadLocation]);
|
}, [preferences.downloadLocation]);
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
|
@ -513,6 +513,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.4"
|
version: "6.1.4"
|
||||||
|
file_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_picker
|
||||||
|
sha256: "903dd4ba13eae7cef64acc480e91bf54c3ddd23b5b90b639c170f3911e489620"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.0"
|
||||||
file_selector:
|
file_selector:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -114,6 +114,7 @@ dependencies:
|
|||||||
youtube_explode_dart: ^2.0.1
|
youtube_explode_dart: ^2.0.1
|
||||||
simple_icons: ^7.10.0
|
simple_icons: ^7.10.0
|
||||||
audio_service_mpris: ^0.1.0
|
audio_service_mpris: ^0.1.0
|
||||||
|
file_picker: ^6.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.3.2
|
build_runner: ^2.3.2
|
||||||
|
Loading…
Reference in New Issue
Block a user