Skip to content

Commit

Permalink
Merge pull request #470 from lamarios/feature/improve-speed-of-playli…
Browse files Browse the repository at this point in the history
…st-button

speed up the video long tap add to playlist button when dearrow is en…
  • Loading branch information
lamarios authored Feb 2, 2024
2 parents 6d24ed0 + 362f27b commit 26c6346
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class Service {
return videosWithContinuation;
}

Future<List<Playlist>> getUserPlaylists() async {
Future<List<Playlist>> getUserPlaylists({bool postProcessing = true}) async {
var currentlySelectedServer = await db.getCurrentlySelectedServer();

try {
Expand All @@ -575,8 +575,10 @@ class Service {
final response = await http.get(url, headers: headers);
Iterable i = handleResponse(response);
var list = List<Playlist>.from(i.map((e) => Playlist.fromJson(e)));
for (var pl in list) {
pl.videos = (await postProcessVideos(pl.videos)).cast();
if (postProcessing) {
for (var pl in list) {
pl.videos = (await postProcessVideos(pl.videos)).cast();
}
}
return list.sortByReversed((e) => e.updated ?? 0).toList();
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/videos/states/add_to_playlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AddToPlaylistCubit extends Cubit<AddToPlaylistController> {
emit(state.copyWith(loading: true));
late List<Playlist> playlists;
if (state.isLoggedIn) {
playlists = await service.getUserPlaylists();
playlists = await service.getUserPlaylists(postProcessing: false);
} else {
playlists = List.empty();
}
Expand Down

0 comments on commit 26c6346

Please sign in to comment.