Skip to content

Commit

Permalink
clear retry tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Notsfsssf committed Jul 19, 2020
1 parent 3bfc582 commit 02ad3e0
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_en-US.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Choose_directory" : MessageLookupByLibrary.simpleMessage("Select folder"),
"Clear" : MessageLookupByLibrary.simpleMessage("Clear"),
"Clear_All_Cache" : MessageLookupByLibrary.simpleMessage("Clear all cache"),
"Clear_Completed_Tasks" : MessageLookupByLibrary.simpleMessage("Clear completed tasks"),
"Clearn_cache" : MessageLookupByLibrary.simpleMessage("Clear cache"),
"Clearn_cache_hint" : MessageLookupByLibrary.simpleMessage("Try this when you have problems while playing gifs"),
"Complete" : MessageLookupByLibrary.simpleMessage("Complete"),
Expand Down Expand Up @@ -131,6 +132,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Recommend_for_you" : MessageLookupByLibrary.simpleMessage("For you"),
"Reply" : MessageLookupByLibrary.simpleMessage("Reply"),
"Report_Message" : MessageLookupByLibrary.simpleMessage("Report this content if it makes you feel uncomfortable, we will remove it ASAP once we confirmed that it\'s harmful."),
"Retry_Failed_Tasks" : MessageLookupByLibrary.simpleMessage("Retry failed tasks"),
"Running" : MessageLookupByLibrary.simpleMessage("Running"),
"Save" : MessageLookupByLibrary.simpleMessage("Save"),
"Save_format" : MessageLookupByLibrary.simpleMessage("Naming format"),
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_zh-CN.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Choose_directory" : MessageLookupByLibrary.simpleMessage("选择目录"),
"Clear" : MessageLookupByLibrary.simpleMessage("清空"),
"Clear_All_Cache" : MessageLookupByLibrary.simpleMessage("清除缓存"),
"Clear_Completed_Tasks" : MessageLookupByLibrary.simpleMessage("清空已完成任务"),
"Clearn_cache" : MessageLookupByLibrary.simpleMessage("清除缓存"),
"Clearn_cache_hint" : MessageLookupByLibrary.simpleMessage("如果播放动图反复出现问题可以尝试"),
"Complete" : MessageLookupByLibrary.simpleMessage("完成"),
Expand Down Expand Up @@ -131,6 +132,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Recommend_for_you" : MessageLookupByLibrary.simpleMessage("为你推荐"),
"Reply" : MessageLookupByLibrary.simpleMessage("回复"),
"Report_Message" : MessageLookupByLibrary.simpleMessage("如果该内容让你感到不适,点击确定回报给审核,该内容会在核实后立即删除,我们会尽快处理该内容"),
"Retry_Failed_Tasks" : MessageLookupByLibrary.simpleMessage("重试失败任务"),
"Running" : MessageLookupByLibrary.simpleMessage("进行中"),
"Save" : MessageLookupByLibrary.simpleMessage("保存"),
"Save_format" : MessageLookupByLibrary.simpleMessage("保存格式"),
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_zh-TW.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Choose_directory" : MessageLookupByLibrary.simpleMessage("選擇目錄"),
"Clear" : MessageLookupByLibrary.simpleMessage("清空"),
"Clear_All_Cache" : MessageLookupByLibrary.simpleMessage("清除緩存"),
"Clear_Completed_Tasks" : MessageLookupByLibrary.simpleMessage("清空已完成任務"),
"Clearn_cache" : MessageLookupByLibrary.simpleMessage("清除暫存"),
"Clearn_cache_hint" : MessageLookupByLibrary.simpleMessage("如果播放動態圖反覆出現問題可以嘗試"),
"Complete" : MessageLookupByLibrary.simpleMessage("完成"),
Expand Down Expand Up @@ -131,6 +132,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Recommend_for_you" : MessageLookupByLibrary.simpleMessage("為你推薦"),
"Reply" : MessageLookupByLibrary.simpleMessage("回覆"),
"Report_Message" : MessageLookupByLibrary.simpleMessage("如果該內容讓你感到不適,可點擊確定以回報審核,該內容會在核實後立即刪除,我們會盡快處理該內容"),
"Retry_Failed_Tasks" : MessageLookupByLibrary.simpleMessage("重試失敗任務"),
"Running" : MessageLookupByLibrary.simpleMessage("進行中"),
"Save" : MessageLookupByLibrary.simpleMessage("儲存"),
"Save_format" : MessageLookupByLibrary.simpleMessage("儲存格式"),
Expand Down
20 changes: 20 additions & 0 deletions lib/generated/l10n.dart

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

4 changes: 3 additions & 1 deletion lib/l10n/intl_en_US.arb
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@
"Pull_Up_To_Load_More": "Pull up to load more",
"Loading_Failed_Retry_Message": "Failed to load. Click to try again",
"Let_Go_And_Load_More": "Let go and load more",
"No_More_Data": "There is no more data"
"No_More_Data": "There is no more data",
"Retry_Failed_Tasks": "Retry failed tasks",
"Clear_Completed_Tasks": "Clear completed tasks"
}
4 changes: 3 additions & 1 deletion lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@
"Pull_Up_To_Load_More": "上拉加载",
"Loading_Failed_Retry_Message": "加载失败,点击重试",
"Let_Go_And_Load_More": "松手开加载更多",
"No_More_Data": "没有更多数据了"
"No_More_Data": "没有更多数据了",
"Retry_Failed_Tasks": "重试失败任务",
"Clear_Completed_Tasks": "清空已完成任务"
}
4 changes: 3 additions & 1 deletion lib/l10n/intl_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@
"Pull_Up_To_Load_More": "上拉加載",
"Loading_Failed_Retry_Message": "加載失敗,點擊重試",
"Let_Go_And_Load_More": "松手開加載更多",
"No_More_Data": "沒有更多數據了"
"No_More_Data": "沒有更多數據了",
"Retry_Failed_Tasks": "重試失敗任務",
"Clear_Completed_Tasks": "清空已完成任務"
}
54 changes: 53 additions & 1 deletion lib/page/task/task_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,58 @@ class _TaskPageState extends State<TaskPage> {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).Task_progress),
actions: <Widget>[
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.vertical(top: Radius.circular(16.0))),
builder: (_) {
return SafeArea(
child: Column(
children: <Widget>[
ListTile(
title: Text(I18n.of(context).Retry_Failed_Tasks),
onTap: () async {
final tasks =
await FlutterDownloader.loadTasks();
final targets = tasks.where((element) =>
element.status ==
DownloadTaskStatus.failed);
targets.forEach((element) async {
await FlutterDownloader.retry(
taskId: element.taskId);
});
initMethod();
},
),
ListTile(
title: Text(I18n.of(context).Clear_Completed_Tasks),
onTap: () async {
final tasks =
await FlutterDownloader.loadTasks();
final targets = tasks.where((element) =>
element.status ==
DownloadTaskStatus.complete);
targets.forEach((element) async {
await FlutterDownloader.remove(
taskId: element.taskId);
saveStore.maps[element.taskId] = null;
saveStore.urls.remove(element.url);
});
initMethod();
},
)
],
mainAxisSize: MainAxisSize.min,
),
);
});
})
],
),
body: Container(
child: _list != null
Expand All @@ -154,7 +206,7 @@ class _TaskPageState extends State<TaskPage> {
children: <Widget>[
data.status.value > 3
? IconButton(
icon: Icon(Icons.new_releases),
icon: Icon(Icons.autorenew),
onPressed: () {
FlutterDownloader.retry(
taskId: data.taskId,
Expand Down

0 comments on commit 02ad3e0

Please sign in to comment.