mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-04-20 21:29:36 +00:00
123
This commit is contained in:
parent
6ffd76a194
commit
b0f5dd8951
18 changed files with 441 additions and 64 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:background_downloader/background_downloader.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
|
@ -26,6 +28,7 @@ class SimpleDownloadManager extends _$SimpleDownloadManager {
|
|||
requiresWiFi: downloadSettings.requiresWiFi,
|
||||
retries: downloadSettings.retries,
|
||||
allowPause: downloadSettings.allowPause,
|
||||
path: downloadSettings.path,
|
||||
);
|
||||
core.tq.maxConcurrent = downloadSettings.maxConcurrent;
|
||||
core.tq.maxConcurrentByHost = downloadSettings.maxConcurrentByHost;
|
||||
|
|
@ -56,6 +59,8 @@ class DownloadManager extends _$DownloadManager {
|
|||
LibraryItemExpanded item,
|
||||
) async {
|
||||
_logger.fine('queueing download for ${item.id}');
|
||||
// final appSettings = ref.read(appSettingsProvider);
|
||||
|
||||
await state.queueAudioBookDownload(
|
||||
item,
|
||||
);
|
||||
|
|
@ -66,6 +71,24 @@ class DownloadManager extends _$DownloadManager {
|
|||
await state.deleteDownloadedItem(item);
|
||||
ref.notifyListeners();
|
||||
}
|
||||
|
||||
String _getDirectory(String path) {
|
||||
if (Platform.isWindows) {
|
||||
return path;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
BaseDirectory _getBaseDirectory() {
|
||||
if (Platform.isIOS) {
|
||||
return BaseDirectory.applicationDocuments;
|
||||
} else if (Platform.isAndroid) {
|
||||
return BaseDirectory.temporary;
|
||||
} else if (Platform.isWindows) {
|
||||
return BaseDirectory.root;
|
||||
}
|
||||
return BaseDirectory.applicationSupport;
|
||||
}
|
||||
}
|
||||
|
||||
@riverpod
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ class _DownloadHistoryProviderElement
|
|||
}
|
||||
|
||||
String _$simpleDownloadManagerHash() =>
|
||||
r'8ab13f06ec5f2f73b73064bd285813dc890b7f36';
|
||||
r'da5798e4becce751db80c41b93a48217418e4648';
|
||||
|
||||
/// See also [SimpleDownloadManager].
|
||||
@ProviderFor(SimpleDownloadManager)
|
||||
|
|
@ -176,7 +176,7 @@ final simpleDownloadManagerProvider = NotifierProvider<SimpleDownloadManager,
|
|||
);
|
||||
|
||||
typedef _$SimpleDownloadManager = Notifier<core.AudiobookDownloadManager>;
|
||||
String _$downloadManagerHash() => r'852012e32e613f86445afc7f7e4e85bec808e982';
|
||||
String _$downloadManagerHash() => r'92afe484d6735d5de53473011ea9ecbad107fc1c';
|
||||
|
||||
/// See also [DownloadManager].
|
||||
@ProviderFor(DownloadManager)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue