mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
add task manager
This commit is contained in:
@@ -37,9 +37,11 @@ final dio = Dio()
|
||||
..options.extra['withCredentials'] = true;
|
||||
Config? _prefs;
|
||||
EHApi? _api;
|
||||
PersistCookieJar? _jar;
|
||||
|
||||
Future<void> prepareJar() async {
|
||||
final jar = PersistCookieJar(storage: FileStorage(await getJarPath()));
|
||||
_jar = jar;
|
||||
dio.interceptors.add(CookieManager(jar));
|
||||
}
|
||||
|
||||
@@ -104,6 +106,10 @@ EHApi get api {
|
||||
return _api!;
|
||||
}
|
||||
|
||||
PersistCookieJar? get cookieJar {
|
||||
return _jar;
|
||||
}
|
||||
|
||||
final AuthInfo auth = AuthInfo();
|
||||
final Clipboard platformClipboard = Clipboard();
|
||||
final Display platformDisplay = Display();
|
||||
@@ -121,6 +127,7 @@ enum MoreVertSettings {
|
||||
markAsNsfw,
|
||||
markAsSfw,
|
||||
serverSettings,
|
||||
taskManager,
|
||||
}
|
||||
|
||||
void onMoreVertSettingsSelected(BuildContext context, MoreVertSettings value) {
|
||||
@@ -143,6 +150,9 @@ void onMoreVertSettingsSelected(BuildContext context, MoreVertSettings value) {
|
||||
case MoreVertSettings.serverSettings:
|
||||
context.push("/server_settings");
|
||||
break;
|
||||
case MoreVertSettings.taskManager:
|
||||
context.push("/task_manager");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -176,6 +186,11 @@ List<PopupMenuEntry<MoreVertSettings>> buildMoreVertSettings(
|
||||
value: MoreVertSettings.serverSettings,
|
||||
child: Text(AppLocalizations.of(context)!.serverSettings)));
|
||||
}
|
||||
if (path != "/task_manager" && auth.canManageTasks == true) {
|
||||
list.add(PopupMenuItem(
|
||||
value: MoreVertSettings.taskManager,
|
||||
child: Text(AppLocalizations.of(context)!.taskManager)));
|
||||
}
|
||||
var showNsfw = prefs.getBool("showNsfw") ?? false;
|
||||
list.add(PopupMenuItem(
|
||||
child: StatefulBuilder(
|
||||
|
||||
Reference in New Issue
Block a user