mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-01-30 06:12:07 +00:00
fix: fixed race condition issue in playlist update
This commit is contained in:
@@ -95,12 +95,29 @@ public class PlaylistRepository {
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
Log.d("PLAYLIST", response.toString());
|
||||
Log.d("createPlaylist", "onResponse: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
Log.d("PLAYLIST", t.toString());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updatePlaylist(String playlistId, String name, ArrayList<String> songsId) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getPlaylistClient()
|
||||
.deletePlaylist(playlistId)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
createPlaylist(null, name, songsId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ public class PlaylistEditorViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
public void updatePlaylist(String name) {
|
||||
playlistRepository.deletePlaylist(toEdit.getId());
|
||||
playlistRepository.createPlaylist(toEdit.getId(), name, getPlaylistSongIds());
|
||||
playlistRepository.updatePlaylist(toEdit.getId(), name, getPlaylistSongIds());
|
||||
}
|
||||
|
||||
public void deletePlaylist() {
|
||||
|
||||
Reference in New Issue
Block a user