refactor: simplify queueAudioBookDownload method by removing callback handling

This commit is contained in:
Dr-Blank 2024-09-22 22:24:36 -04:00
parent 792448b0ef
commit 5c9273c812
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
2 changed files with 3 additions and 21 deletions

View file

@ -50,28 +50,10 @@ class DownloadManager extends _$DownloadManager {
} }
Future<void> queueAudioBookDownload( Future<void> queueAudioBookDownload(
LibraryItemExpanded item, { LibraryItemExpanded item,
void Function(TaskStatusUpdate)? taskStatusCallback, ) async {
void Function(TaskProgressUpdate)? taskProgressCallback,
}) async {
await state.queueAudioBookDownload( await state.queueAudioBookDownload(
item, item,
taskStatusCallback: (item) {
try {
taskStatusCallback?.call(item);
} catch (e) {
_logger.severe('Error in taskStatusCallback', e);
}
ref.notifyListeners();
},
taskProgressCallback: (item) {
try {
taskProgressCallback?.call(item);
} catch (e) {
_logger.severe('Error in taskProgressCallback', e);
}
ref.notifyListeners();
},
); );
} }

View file

@ -174,7 +174,7 @@ final simpleDownloadManagerProvider = NotifierProvider<SimpleDownloadManager,
); );
typedef _$SimpleDownloadManager = Notifier<core.AudiobookDownloadManager>; typedef _$SimpleDownloadManager = Notifier<core.AudiobookDownloadManager>;
String _$downloadManagerHash() => r'9566b772d792b32e1b199d4aa834e28de3b034d0'; String _$downloadManagerHash() => r'7296a39439230f77abbe7d3231dae748f09c7ecf';
/// See also [DownloadManager]. /// See also [DownloadManager].
@ProviderFor(DownloadManager) @ProviderFor(DownloadManager)