Skip to content

Commit

Permalink
Update: v6.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Oct 3, 2023
1 parent ae15da7 commit 2120231
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
8 changes: 8 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/66.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bug fixes

- Fixed remove feature in custom playlists

Enhancements

- Added undo dialog after removing song from custom playlists
- Made various quality and performance improvements for app stability and speed
29 changes: 21 additions & 8 deletions lib/API/musify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,31 +126,44 @@ String createCustomPlaylist(
return '${context.l10n()!.addedSuccess}!';
}

String addSongInCustomPlaylist(String playlistName, dynamic song, {int? indexToInsert}) {
String addSongInCustomPlaylist(
String playlistName,
dynamic song, {
int? indexToInsert,
}) {
final customPlaylist = userCustomPlaylists.firstWhere(
(playlist) => playlist['title'] == playlistName,
orElse: () => null,
);

if (customPlaylist != null) {
final List<dynamic> playlistSongs = customPlaylist['list'];
indexToInsert != null ? playlistSongs.insert(indexToInsert, song) :
playlistSongs.add(song);
indexToInsert != null
? playlistSongs.insert(indexToInsert, song)
: playlistSongs.add(song);
addOrUpdateData('user', 'customPlaylists', userCustomPlaylists);
return 'Song added to custom playlist: $playlistName';
} else {
return 'Custom playlist not found: $playlistName';
}
}

void removeSongFromPlaylist(dynamic playlist, dynamic songToRemove, {int? removeOneAtIndex}) {
void removeSongFromPlaylist(
dynamic playlist,
dynamic songToRemove, {
int? removeOneAtIndex,
}) {
if (playlist == null || playlist['list'] == null) return;
final playlistSongs = List<dynamic>.from(playlist['list']);
removeOneAtIndex != null? playlistSongs.removeAt(removeOneAtIndex):
playlistSongs.removeWhere((song) => song['ytid'] == songToRemove['ytid']);
removeOneAtIndex != null
? playlistSongs.removeAt(removeOneAtIndex)
: playlistSongs
.removeWhere((song) => song['ytid'] == songToRemove['ytid']);
playlist['list'] = playlistSongs;
if(playlist['isCustom']) addOrUpdateData('user', 'customPlaylists', userCustomPlaylists);
else addOrUpdateData('user', 'playlists', userPlaylists);
if (playlist['isCustom'])
addOrUpdateData('user', 'customPlaylists', userCustomPlaylists);
else
addOrUpdateData('user', 'playlists', userPlaylists);
}

void removeUserPlaylist(String playlistId) {
Expand Down
2 changes: 1 addition & 1 deletion lib/API/version.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const appVersion = '6.5.1';
const appVersion = '6.5.2';
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/gokadzev/Musify
issue_tracker: https://github.com/gokadzev/Musify/issues

publish_to: 'none'
version: 6.5.1+65 # run update.sh after changing the version
version: 6.5.2+66 # run update.sh after changing the version

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down

0 comments on commit 2120231

Please sign in to comment.