Skip to content

Commit

Permalink
fix(android ): file_selector getDirectoryPath returns unusable conten…
Browse files Browse the repository at this point in the history
…t urls #720
  • Loading branch information
KRTirtho committed Sep 26, 2023
1 parent a7e102f commit b3cf639
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/extensions/track.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion lib/pages/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
5 changes: 3 additions & 2 deletions lib/services/queries/playlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down

0 comments on commit b3cf639

Please sign in to comment.