mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix(android ): file_selector getDirectoryPath returns unusable content urls #720
This commit is contained in:
parent
a7e102ffc7
commit
b3cf639ee2
@ -7,7 +7,7 @@ extension TrackJson on Track {
|
||||
return {
|
||||
"album": album?.toJson(),
|
||||
"artists": artists?.map((artist) => artist.toJson()).toList(),
|
||||
"availableMarkets": availableMarkets,
|
||||
"availableMarkets": availableMarkets?.map((e) => e.name).toList(),
|
||||
"discNumber": discNumber,
|
||||
"duration": duration.toString(),
|
||||
"durationMs": durationMs,
|
||||
|
@ -47,10 +47,15 @@ class SettingsPage extends HookConsumerWidget {
|
||||
}, []);
|
||||
|
||||
final pickDownloadLocation = useCallback(() async {
|
||||
final dirStr = await getDirectoryPath(
|
||||
await openFile();
|
||||
String? dirStr = await getDirectoryPath(
|
||||
initialDirectory: preferences.downloadLocation,
|
||||
);
|
||||
if (dirStr == null) return;
|
||||
if (DesktopTools.platform.isAndroid && dirStr.startsWith("content://")) {
|
||||
dirStr =
|
||||
"/storage/emulated/0/${Uri.decodeFull(dirStr).split("primary:").last}";
|
||||
}
|
||||
preferences.setDownloadLocation(dirStr);
|
||||
}, [preferences.downloadLocation]);
|
||||
|
||||
|
@ -119,8 +119,9 @@ class PlaylistQueries {
|
||||
return useSpotifyQuery<bool, dynamic>(
|
||||
"playlist-is-followed/$playlistId/$userId",
|
||||
(spotify) async {
|
||||
final result = await spotify.playlists.followedBy(playlistId, [userId]);
|
||||
return result.first;
|
||||
final result =
|
||||
await spotify.playlists.followedByUsers(playlistId, [userId]);
|
||||
return result[userId] ?? false;
|
||||
},
|
||||
ref: ref,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user