Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR was motivated by reviewing the implementation of editing
UITableView. The review showed four main findings:Unneeded calls of
reloadDataandselectRowAtIndexPathCalls of
reloadDataandselectRowAtIndexPathare not required insidecommitEditingStyleandmoveRowAtIndexPath:ToIndexPath. They got removed.Handling removal last playlist
It was also found that after deleting the last playlist item the info label "No items found." was not shown, and that the edit button was still shown active and selected. This is now corrected.
Improper error handling in moveRowAtIndexPath:ToIndexPath
In case an error was reported for
Playlist.Remove(e.g. when attempting to move the current playing item) the playlist was not properly reloaded. This resulted in inconsistency between the real playlist in Kodi and the one displayed by the remote app. Also, the wrong item was shown as playing. The correct solution is to callcreatePlaylistAnimatedwhich will reload the playlist from Kodi and update theUITableView. In case of a (theoretical) issue withPlaylist.Insertthe same error handling is applied.Repeated action to remove playlist on server disconnect
In case of server being disconnected a set of actions (fade out
playlistTableView, deleteplaylistData,reloadData, send notification for iPad that playlist is empty) was called repeated, even thoughplaylistDatais already empty. An early return is added toserverIsDisconnectedto avoid this.Important: Needs minor rebasing once #1441 and #1442 were merged.
Summary for release notes
Bugfix: Fixes wrong playlist state when facing an error during moving an item in the playlist
Improvement: Shows "No items found." in the playlist once all items were removed by user