0.5.8 - queue reordering, bug and ui fixes, shortcut icon
This commit is contained in:
parent
396b51e90f
commit
9e18537b0c
39 changed files with 219 additions and 27 deletions
|
@ -49,6 +49,9 @@ class Cache {
|
|||
@JsonKey(ignore: true)
|
||||
StreamSubscription sleepTimer;
|
||||
|
||||
@JsonKey(defaultValue: const [])
|
||||
List<String> searchHistory;
|
||||
|
||||
//If download threads warning was shown
|
||||
@JsonKey(defaultValue: false)
|
||||
bool threadsWarning;
|
||||
|
|
|
@ -31,6 +31,8 @@ Cache _$CacheFromJson(Map<String, dynamic> json) {
|
|||
PlaylistSortType.DEFAULT
|
||||
..trackSort = _$enumDecodeNullable(_$SortTypeEnumMap, json['trackSort']) ??
|
||||
SortType.DEFAULT
|
||||
..searchHistory =
|
||||
(json['searchHistory'] as List)?.map((e) => e as String)?.toList() ?? []
|
||||
..threadsWarning = json['threadsWarning'] as bool ?? false;
|
||||
}
|
||||
|
||||
|
@ -44,6 +46,7 @@ Map<String, dynamic> _$CacheToJson(Cache instance) => <String, dynamic>{
|
|||
'libraryPlaylistSort':
|
||||
_$PlaylistSortTypeEnumMap[instance.libraryPlaylistSort],
|
||||
'trackSort': _$SortTypeEnumMap[instance.trackSort],
|
||||
'searchHistory': instance.searchHistory,
|
||||
'threadsWarning': instance.threadsWarning,
|
||||
};
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ class PlayerHelper {
|
|||
QueueSource queueSource = QueueSource(
|
||||
id: stl.id,
|
||||
source: (stl.id == 'flow')?'flow':'smarttracklist',
|
||||
text: stl.title
|
||||
text: stl.title??(stl.id == 'flow')?'Flow'.i18n:'Smart track list'.i18n
|
||||
);
|
||||
await playFromTrackList(stl.tracks, stl.tracks[0].id, queueSource);
|
||||
}
|
||||
|
@ -233,6 +233,11 @@ class PlayerHelper {
|
|||
await AudioService.customAction('queueSource', queueSource.toJson());
|
||||
}
|
||||
|
||||
//Reorder tracks in queue
|
||||
Future reorder(int oldIndex, int newIndex) async {
|
||||
await AudioService.customAction('reorder', [oldIndex, newIndex]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void backgroundTaskEntrypoint() async {
|
||||
|
@ -562,6 +567,18 @@ class AudioPlayerTask extends BackgroundAudioTask {
|
|||
if (name == 'screenAndroidAuto' && _androidAutoCallback != null) {
|
||||
_androidAutoCallback.complete(jsonDecode(args).map<MediaItem>((m) => MediaItem.fromJson(m)).toList());
|
||||
}
|
||||
//Reorder tracks, args = [old, new]
|
||||
if (name == 'reorder') {
|
||||
await _audioSource.move(args[0], args[1]);
|
||||
//Switch in queue
|
||||
List<MediaItem> newQueue = List.from(_queue);
|
||||
newQueue.removeAt(args[0]);
|
||||
newQueue.insert(args[1], _queue[args[0]]);
|
||||
_queue = newQueue;
|
||||
//Update UI
|
||||
AudioServiceBackground.setQueue(_queue);
|
||||
_broadcastState();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue