actually fix them + fix same tracks in queue view

This commit is contained in:
Pato05 2024-04-27 01:54:36 +02:00
parent 2e67b50332
commit ae6a1efd4e
No known key found for this signature in database
GPG Key ID: F53CA394104BA0CB
9 changed files with 13 additions and 17 deletions

View File

@ -477,6 +477,7 @@ class DeezerAPI {
Future<List<Playlist>> getPlaylists() async {
Map data = await callApi('deezer.pageProfile',
params: {'nb': 2000, 'tab': 'playlists', 'user_id': userId});
print(data);
return data['results']['TAB']['playlists']['data']
.map<Playlist>((json) => Playlist.fromPrivateJson(json, library: true))
.toList();

View File

@ -41,6 +41,6 @@ class ServiceInterface {
return service!.invoke(method, args);
}
sendPort!.send({'_': method, if (args != null) ...args});
sendPort.send({'_': method, if (args != null) ...args});
}
}

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:audio_service/audio_service.dart';
import 'package:audio_session/audio_session.dart';
import 'package:freezer/api/cache.dart';
@ -480,7 +482,6 @@ class AudioPlayerTask extends BaseAudioHandler {
if (queue.value.isNotEmpty) favoriteControl(),
if (_queueIndex != 0) MediaControl.skipToPrevious,
_player.playing ? MediaControl.pause : MediaControl.play,
MediaControl.stop,
if (queue.hasValue && _queueIndex != queue.value.length - 1)
MediaControl.skipToNext,
]
@ -491,7 +492,6 @@ class AudioPlayerTask extends BaseAudioHandler {
action: MediaAction.rewind,
), // acts as prev-30
_player.playing ? MediaControl.pause : MediaControl.play,
MediaControl.stop,
const MediaControl(
androidIcon: 'drawable/ic_forward_30',
label: 'forward 30',
@ -518,8 +518,8 @@ class AudioPlayerTask extends BaseAudioHandler {
speed: _player.speed,
queueIndex: _queueIndex,
androidCompactActionIndices: List.generate(controls.length, (i) => i)
.whereNot((i) => controls[i].action == MediaAction.stop)
.toList(growable: false),
.toList(growable: false)
.sublist(max(0, controls.length - 3)),
repeatMode: _repeatMode,
shuffleMode: _originalQueue == null
? AudioServiceShuffleMode.none
@ -657,7 +657,6 @@ class AudioPlayerTask extends BaseAudioHandler {
Future customAction(String name, [Map<String, dynamic>? extras]) async {
switch (name) {
case 'updateQuality':
print('updateQuality($extras)');
//Pass wifi & mobile quality by custom action
//Isolate can't access globals
wifiQuality = extras!['wifiQuality'] as AudioQuality;

View File

@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:audio_service/audio_service.dart';
import 'package:cookie_jar/cookie_jar.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/cupertino.dart';

View File

@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:freezer/api/definitions.dart';
import 'package:freezer/api/download.dart';
import 'package:freezer/api/player/audio_handler.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:json_annotation/json_annotation.dart';

View File

@ -218,8 +218,8 @@ class MenuSheet {
title: option.label,
leading: option.icon,
onTap: () {
option.onTap.call();
Navigator.pop(context);
option.onTap.call();
},
))
.toList(growable: false))),
@ -804,8 +804,7 @@ class _SleepTimerDialogState extends State<SleepTimerDialog> {
class SelectPlaylistDialog extends StatefulWidget {
final Track? track;
final Function? callback;
const SelectPlaylistDialog({this.track, this.callback, Key? key})
: super(key: key);
const SelectPlaylistDialog({this.track, this.callback, super.key});
@override
State<SelectPlaylistDialog> createState() => _SelectPlaylistDialogState();
@ -835,7 +834,7 @@ class _SelectPlaylistDialogState extends State<SelectPlaylistDialog> {
child: ErrorScreen(),
);
}
if (snapshot.connectionState != ConnectionState.done) {
if (snapshot.data == null) {
return const SizedBox(
height: 100,
child: Center(
@ -882,8 +881,7 @@ class CreatePlaylistDialog extends StatefulWidget {
final List<Track?>? tracks;
//If playlist not null, update
final Playlist? playlist;
const CreatePlaylistDialog({this.tracks, this.playlist, Key? key})
: super(key: key);
const CreatePlaylistDialog({this.tracks, this.playlist, super.key});
@override
State<CreatePlaylistDialog> createState() => _CreatePlaylistDialogState();

View File

@ -135,7 +135,7 @@ class _QueueListWidgetState extends State<QueueListWidget> {
final mediaItem = _queueCache[index];
final int itemId = mediaItem.extras!['id'] ?? 0;
return Dismissible(
key: ValueKey(mediaItem.id.hashCode | itemId),
key: ValueKey(mediaItem.id.hashCode ^ itemId),
background: _dismissibleBackground,
secondaryBackground: _dismissibleSecondaryBackground,
onDismissed: (_) {

View File

@ -294,7 +294,8 @@ class _SearchScreenState extends State<SearchScreen> {
),
...List.generate(min(cache.searchHistory.length, 10),
(int i) {
switch (cache.searchHistory[i]) {
switch (cache
.searchHistory[cache.searchHistory.length - i]) {
case final Track data:
return TrackTile.fromTrack(
data,

View File

@ -18,7 +18,6 @@ import 'package:freezer/ui/login_on_other_device.dart';
import 'package:freezer/ui/login_screen.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:scrobblenaut/scrobblenaut.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:freezer/api/cache.dart';
import 'package:freezer/api/deezer.dart';