Skip to content

Commit

Permalink
Feat: 完善下载任务导入导出功能
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Oct 25, 2021
1 parent 47dc76f commit 9511adf
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 109 deletions.
3 changes: 2 additions & 1 deletion lib/common/controller/download_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ class DownloadController extends GetxController {
/// 移除任务
Future<void> removeDownloadGalleryTask({
required int gid,
bool shouldDeleteContent = true,
}) async {
GalleryTaskDao _galleryTaskDao;
ImageTaskDao _imageTaskDao;
Expand All @@ -266,7 +267,7 @@ class DownloadController extends GetxController {
}
String? dirpath = _task.realDirPath;
logger.d('dirPath: $dirpath');
if (dirpath != null) {
if (dirpath != null && shouldDeleteContent) {
Directory(dirpath).delete(recursive: true);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class MessageLookup extends MessageLookupByLibrary {
"default_favorites":
MessageLookupByLibrary.simpleMessage("Default Favorites"),
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
"delete_task": MessageLookupByLibrary.simpleMessage("Delete Task"),
"delete_task_and_content":
MessageLookupByLibrary.simpleMessage("Delete task and content"),
"delete_task_only":
MessageLookupByLibrary.simpleMessage("Delete task only"),
"disabled": MessageLookupByLibrary.simpleMessage("Disabled"),
"domain_fronting":
MessageLookupByLibrary.simpleMessage("Domain fronting"),
Expand Down
5 changes: 5 additions & 0 deletions lib/generated/intl/messages_ko_KR.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class MessageLookup extends MessageLookupByLibrary {
"dark_mode_effect": MessageLookupByLibrary.simpleMessage("다크 모드 효과"),
"default_favorites": MessageLookupByLibrary.simpleMessage("기본 즐겨찾기"),
"delete": MessageLookupByLibrary.simpleMessage("지우기"),
"delete_task": MessageLookupByLibrary.simpleMessage("Delete Task"),
"delete_task_and_content":
MessageLookupByLibrary.simpleMessage("Delete task and content"),
"delete_task_only":
MessageLookupByLibrary.simpleMessage("Delete task only"),
"disabled": MessageLookupByLibrary.simpleMessage("비활성화 됨"),
"domain_fronting": MessageLookupByLibrary.simpleMessage("도메인 프론팅"),
"done": MessageLookupByLibrary.simpleMessage("완료"),
Expand Down
4 changes: 4 additions & 0 deletions lib/generated/intl/messages_zh_CN.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class MessageLookup extends MessageLookupByLibrary {
"dark_mode_effect": MessageLookupByLibrary.simpleMessage("深色模式效果"),
"default_favorites": MessageLookupByLibrary.simpleMessage("默认收藏夹设置"),
"delete": MessageLookupByLibrary.simpleMessage("删除"),
"delete_task": MessageLookupByLibrary.simpleMessage("删除任务"),
"delete_task_and_content":
MessageLookupByLibrary.simpleMessage("删除任务和下载内容"),
"delete_task_only": MessageLookupByLibrary.simpleMessage("仅删除任务"),
"disabled": MessageLookupByLibrary.simpleMessage("停用"),
"domain_fronting": MessageLookupByLibrary.simpleMessage("域名前置"),
"done": MessageLookupByLibrary.simpleMessage("完成"),
Expand Down
5 changes: 5 additions & 0 deletions lib/generated/intl/messages_zh_TW.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ class MessageLookup extends MessageLookupByLibrary {
"default_favorites":
MessageLookupByLibrary.simpleMessage("Default Favorites"),
"delete": MessageLookupByLibrary.simpleMessage("刪除"),
"delete_task": MessageLookupByLibrary.simpleMessage("Delete Task"),
"delete_task_and_content":
MessageLookupByLibrary.simpleMessage("Delete task and content"),
"delete_task_only":
MessageLookupByLibrary.simpleMessage("Delete task only"),
"disabled": MessageLookupByLibrary.simpleMessage("停用"),
"domain_fronting": MessageLookupByLibrary.simpleMessage("域名前置"),
"done": MessageLookupByLibrary.simpleMessage("Done"),
Expand Down
30 changes: 30 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,8 @@
"sync_read_progress": "Sync read progress",
"skip": "Skip",
"export": "Export",
"read_from_clipboard": "Read from clipboard"
"read_from_clipboard": "Read from clipboard",
"delete_task": "Delete Task",
"delete_task_only": "Delete task only",
"delete_task_and_content": "Delete task and content"
}
5 changes: 4 additions & 1 deletion lib/l10n/intl_ko_KR.arb
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,8 @@
"sync_read_progress": "Sync read progress",
"skip": "Skip",
"export": "Export",
"read_from_clipboard": "Read from clipboard"
"read_from_clipboard": "Read from clipboard",
"delete_task": "Delete Task",
"delete_task_only": "Delete task only",
"delete_task_and_content": "Delete task and content"
}
5 changes: 4 additions & 1 deletion lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,8 @@
"sync_read_progress": "同步阅读进度",
"skip": "跳过",
"export": "导出",
"read_from_clipboard": "从剪贴板读取"
"read_from_clipboard": "从剪贴板读取",
"delete_task": "删除任务",
"delete_task_only": "仅删除任务",
"delete_task_and_content": "删除任务和下载内容"
}
5 changes: 4 additions & 1 deletion lib/l10n/intl_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,8 @@
"sync_read_progress": "Sync read progress",
"skip": "Skip",
"export": "Export",
"read_from_clipboard": "Read from clipboard"
"read_from_clipboard": "Read from clipboard",
"delete_task": "Delete Task",
"delete_task_only": "Delete task only",
"delete_task_and_content": "Delete task and content"
}
21 changes: 13 additions & 8 deletions lib/pages/image_view/controller/view_ext_contorller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:fehviewer/utils/vibrate.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_statusbar_manager/flutter_statusbar_manager.dart';
// import 'package:flutter_statusbar_manager/flutter_statusbar_manager.dart';
import 'package:get/get.dart';
import 'package:orientation/orientation.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -172,7 +172,8 @@ class ViewExtController extends GetxController {
vState.sliderValue = vState.currentItemIndex / 1.0;

if (GetPlatform.isIOS) {
FlutterStatusbarManager.setFullscreen(true);
setFullscreen();
// FlutterStatusbarManager.setFullscreen(true);
}
// FlutterStatusbarManager.setHidden(true,
// animation: StatusBarAnimation.SLIDE);
Expand All @@ -194,10 +195,12 @@ class ViewExtController extends GetxController {
extendedPageController.dispose();
vState.getMoreCancelToken.cancel();

FlutterStatusbarManager.setHidden(false,
animation: StatusBarAnimation.SLIDE);
FlutterStatusbarManager.setFullscreen(false);
FlutterStatusbarManager.setTranslucent(false);
unsetFullscreen();

// FlutterStatusbarManager.setHidden(false,
// animation: StatusBarAnimation.SLIDE);
// FlutterStatusbarManager.setFullscreen(false);
// FlutterStatusbarManager.setTranslucent(false);

// 恢复系统旋转设置
logger.v('恢复系统旋转设置');
Expand Down Expand Up @@ -474,15 +477,17 @@ class ViewExtController extends GetxController {
if (GetPlatform.isIOS) {
if (!vState.showBar) {
// show
FlutterStatusbarManager.setFullscreen(false);
// FlutterStatusbarManager.setFullscreen(false);
unsetFullscreen();
vState.showBar = !vState.showBar;
update([idViewBar]);
} else {
// hide
vState.showBar = !vState.showBar;
update([idViewBar]);
// await Future.delayed(const Duration(milliseconds: 200));
FlutterStatusbarManager.setFullscreen(true);
// FlutterStatusbarManager.setFullscreen(true);
setFullscreen();
// FlutterStatusbarManager.setHidden(true);
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/item/download_gallery_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ class DownloadGalleryItem extends GetView<DownloadViewController> {
Widget _buildCover({bool cardType = false}) {
return GestureDetector(
child: DownloadItemCoverImage(
filePath: galleryTask.coverImage != null
filePath: (galleryTask.coverImage != null &&
galleryTask.coverImage!.isNotEmpty)
? path.join(galleryTask.realDirPath ?? '', galleryTask.coverImage)
: null,
url: galleryTask.coverUrl,
Expand Down
Loading

0 comments on commit 9511adf

Please sign in to comment.