mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05: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 {
|
return {
|
||||||
"album": album?.toJson(),
|
"album": album?.toJson(),
|
||||||
"artists": artists?.map((artist) => artist.toJson()).toList(),
|
"artists": artists?.map((artist) => artist.toJson()).toList(),
|
||||||
"availableMarkets": availableMarkets,
|
"availableMarkets": availableMarkets?.map((e) => e.name).toList(),
|
||||||
"discNumber": discNumber,
|
"discNumber": discNumber,
|
||||||
"duration": duration.toString(),
|
"duration": duration.toString(),
|
||||||
"durationMs": durationMs,
|
"durationMs": durationMs,
|
||||||
|
@ -47,10 +47,15 @@ class SettingsPage extends HookConsumerWidget {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
final pickDownloadLocation = useCallback(() async {
|
final pickDownloadLocation = useCallback(() async {
|
||||||
final dirStr = await getDirectoryPath(
|
await openFile();
|
||||||
|
String? dirStr = await getDirectoryPath(
|
||||||
initialDirectory: preferences.downloadLocation,
|
initialDirectory: preferences.downloadLocation,
|
||||||
);
|
);
|
||||||
if (dirStr == null) return;
|
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.setDownloadLocation(dirStr);
|
||||||
}, [preferences.downloadLocation]);
|
}, [preferences.downloadLocation]);
|
||||||
|
|
||||||
|
@ -119,8 +119,9 @@ class PlaylistQueries {
|
|||||||
return useSpotifyQuery<bool, dynamic>(
|
return useSpotifyQuery<bool, dynamic>(
|
||||||
"playlist-is-followed/$playlistId/$userId",
|
"playlist-is-followed/$playlistId/$userId",
|
||||||
(spotify) async {
|
(spotify) async {
|
||||||
final result = await spotify.playlists.followedBy(playlistId, [userId]);
|
final result =
|
||||||
return result.first;
|
await spotify.playlists.followedByUsers(playlistId, [userId]);
|
||||||
|
return result[userId] ?? false;
|
||||||
},
|
},
|
||||||
ref: ref,
|
ref: ref,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user