Michael-128 / qBitControl

qBittorrent remote client for iOS devices.
https://x.com/qbitcontrol
GNU General Public License v3.0
196 stars 9 forks source link

[Categories] Use Category struct instead of [String: [String: String]] #17

Closed narenh closed 3 months ago

narenh commented 4 months ago

This fixes #16 and also generally improves how Categories function across the app. I've eliminated the separate arrays for category names and save paths, and simplified the completion handlers to always sort remote categories before appending them to the array.

There are more optimizations that should be done here (possibly a CategoryManager to avoid refetching categories so frequently?) but for now this change should prevent any weirdness from the qBittorrent JSON response.

Tests: Added a new torrent and verified that categories download regardless of download_path being set to No. Categories display sorted in filter view and in torrent details view. Changing the category updates the category in qBittorrent in real time.

Note: this PR depends on #15 so ignore the older commit in this PR, as ideally that one should be merged first.