Commit Graph

72 Commits

Author SHA1 Message Date
Arkadiusz Fal
f4d4daccd0 Optimize SwiftUI performance throughout the app
This commit addresses multiple SwiftUI performance bottlenecks identified
through code analysis, focusing on view rendering efficiency, list
performance, and memory usage optimization.

Key improvements:

- HomeView: Optimize async task management using structured concurrency
  with async let to handle multiple Defaults updates in a single task

- VideoCell: Remove GeometryReader from VideoCellThumbnail to eliminate
  layout thrashing; change @ObservedObject to computed property for shared
  ThumbnailsModel

- ThumbnailView: Cache URL extension computation in init() instead of
  recalculating on every body evaluation

- FavoriteItemView: Replace filter().prefix() with early-exit loop and
  capacity reservation for significant performance gain on large lists

- ContentItemView: Optimize FetchRequest creation with direct predicate
  construction only for video items, empty predicate for others

- VideoPlayerView: Fix playerSize didSet trigger by moving
  updateSidebarQueue() calls to explicit onChange/onAppear handlers

- FeedView: Replace .unique() with Set-based deduplication for O(n)
  performance and reduced allocations

- VerticalCells: Remove expensive sorting on every redraw; items should
  be pre-sorted from source

These optimizations follow SwiftUI best practices by minimizing expensive
computations in view bodies, caching computed values, using efficient data
structures, and avoiding unnecessary redraws and layout passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 18:14:35 +01:00
Toni Förster
35534bcbb1 Improved thumbnail handling
- ThumbnailsModel optionally returns the quality
- Have constants for 4:3 and 16:9 aspect ratio
- Add high quality options for thumbnails
- Rename Highest quality to Best quality
- make 4:3 thumbnails fill the VideoCell
- use .maxes instead of .maxresdefault (the latter sometimes returns white images)

Signed-off-by: Toni Förster <toni.foerster@gmail.com>
2024-08-19 16:35:29 +02:00
Arkadiusz Fal
12a8582e89 Fix style issues, remove unused code 2023-09-23 17:14:21 +02:00
Arkadiusz Fal
3c9e04d243 Channels performance improvements
Add settings:
Show channel avatars in channels lists
Show channel avatars in videos lists

Fix #508
2023-07-24 19:45:30 +02:00
Arkadiusz Fal
eed9330c0c Add buttons for hiding watched videos
Fix #448
2023-05-25 18:36:02 +02:00
Arkadiusz Fal
ac7dad2ab8 Fix #450 2023-05-25 18:36:02 +02:00
Arkadiusz Fal
5c0cf7452c Remove unused code 2023-04-22 23:39:43 +02:00
Arkadiusz Fal
8ef016d792 Minor performance improvement 2023-04-22 23:10:27 +02:00
Arkadiusz Fal
48d14c623c Fix build issue 2023-02-19 14:19:37 +01:00
Arkadiusz Fal
c432aa3b9a Minor fixes 2023-02-05 14:24:15 +01:00
Arkadiusz Fal
adc32d5ae1 Add playing indicator 2023-02-05 14:24:13 +01:00
Arkadiusz Fal
4a7d6ace24 Add button for toggling watch status 2023-02-05 14:24:12 +01:00
Arkadiusz Fal
71c666ebfe Fix placeholders 2023-02-05 14:24:11 +01:00
Arkadiusz Fal
037d3a0481 Add channels thumbnails to cells and list 2023-02-05 14:24:11 +01:00
Arkadiusz Fal
3b31f21c81 Channels caching 2023-02-05 14:24:11 +01:00
Arkadiusz Fal
33bd052fdc Fix placeholder cells 2023-02-05 14:24:08 +01:00
Arkadiusz Fal
e3daa738ce Fix thumbnails 2023-02-05 14:24:08 +01:00
Arkadiusz Fal
5e0f13cace Subscribed channels list in tab navigation 2023-02-05 14:24:08 +01:00
Arkadiusz Fal
7ba743afbc Use ImageManager of SDWebImageSwiftUI 2023-02-05 14:24:07 +01:00
Arkadiusz Fal
faf2469e04 Initial PeerTube Support 2023-02-05 14:24:07 +01:00
Arkadiusz Fal
82cd08d44e Fix updating video watches 2022-12-05 10:13:20 +01:00
Arkadiusz Fal
53620c4d35 Fix default alignment swiftlint offense 2022-12-05 10:13:19 +01:00
Arkadiusz Fal
0d333b5583 Replace environment objects with observed objects 2022-12-05 10:13:19 +01:00
Arkadiusz Fal
59eda3af26 Don't show empty channel button 2022-12-04 13:32:28 +01:00
Arkadiusz Fal
80d8d66986 Local videos fixes 2022-12-04 13:32:24 +01:00
Arkadiusz Fal
4d94126abd Load images with low priority 2022-12-04 13:32:22 +01:00
Arkadiusz Fal
a086a0f440 Use Swift 5.7 if-let style 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
1c926f276b Use WebImage fix 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
b94dc08b68 Revert "Add CachedAsyncImage"
This reverts commit 50c77325f6.
2022-10-27 18:03:57 +02:00
Arkadiusz Fal
b320ffb540 Revert "Fix images layout"
This reverts commit ee6e2370d2.
2022-10-27 18:03:57 +02:00
Arkadiusz Fal
f7dd88a6cb Fix images layout 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
418dae9dbe Add CachedAsyncImage 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
b8380b2528 Minor fixes 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
f5016cc961 Model improvements 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
0d3ccc00ce Model improvements 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
0f7d826a3e Controls layouts, gestures and settings 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
6deaec90f8 Fix cells on tvOS 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
c51b9dd8e8 Code style change 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
def67409cc Hide channel name in channel view (fix #229) 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
117c4fc9b6 Fix #190 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
f3f8466a95 Improve URL handling 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
aa9e52fa01 Fix video cell details layout 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
35fd392307 Add initial version of music mode 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
0ad350a6b5 New channel navigation 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
3b1f6b21f3 Fix playing video from start when history disabled 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
78d7693128 Player overlaying other views and swipe gesture (fix #44, #130) 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
613f874c42 PiP improvements 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
6376e573b1 Run play action async 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
31a28a7cbd Hello, mpv! 🎉 2022-10-27 18:03:57 +02:00
Arkadiusz Fal
1c520831d1 Improve placeholders 2022-03-27 20:27:59 +02:00