mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Improve multi-folder favorites management.
This commit is contained in:
@@ -139,8 +139,8 @@
|
|||||||
"Block": "屏蔽",
|
"Block": "屏蔽",
|
||||||
"Add new favorite to": "添加新收藏到",
|
"Add new favorite to": "添加新收藏到",
|
||||||
"Move favorite after reading": "阅读后移动收藏",
|
"Move favorite after reading": "阅读后移动收藏",
|
||||||
"Delete folder?" : "刪除文件夾?",
|
"Delete folder?" : "删除文件夹?",
|
||||||
"Delete folder '@f' ?" : "删除文件夹 '@f' ?",
|
"Delete folder '@f' ?" : "删除文件夹 '@f' ?",
|
||||||
"Import from file": "从文件导入",
|
"Import from file": "从文件导入",
|
||||||
"Failed to import": "导入失败",
|
"Failed to import": "导入失败",
|
||||||
"Cache Limit": "缓存限制",
|
"Cache Limit": "缓存限制",
|
||||||
@@ -324,7 +324,13 @@
|
|||||||
"Success": "成功",
|
"Success": "成功",
|
||||||
"Compressing": "压缩中",
|
"Compressing": "压缩中",
|
||||||
"Exporting": "导出中",
|
"Exporting": "导出中",
|
||||||
"Search Sources": "搜索源"
|
"Search Sources": "搜索源",
|
||||||
|
"Removed": "已移除",
|
||||||
|
"Added to favorites": "已添加到收藏",
|
||||||
|
"Not added": "未添加",
|
||||||
|
"Create a folder": "新建收藏夹",
|
||||||
|
"Created successfully": "创建成功",
|
||||||
|
"name": "名称"
|
||||||
},
|
},
|
||||||
"zh_TW": {
|
"zh_TW": {
|
||||||
"Home": "首頁",
|
"Home": "首頁",
|
||||||
@@ -651,6 +657,12 @@
|
|||||||
"Success": "成功",
|
"Success": "成功",
|
||||||
"Compressing": "壓縮中",
|
"Compressing": "壓縮中",
|
||||||
"Exporting": "匯出中",
|
"Exporting": "匯出中",
|
||||||
"Search Sources": "搜索源"
|
"Search Sources": "搜索源",
|
||||||
|
"Removed": "已移除",
|
||||||
|
"Added to favorites": "已添加到收藏",
|
||||||
|
"Not added": "未添加",
|
||||||
|
"Create a folder": "新建收藏夾",
|
||||||
|
"Created successfully": "創建成功",
|
||||||
|
"name": "名稱"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -37,6 +37,8 @@ class FavoriteData {
|
|||||||
|
|
||||||
final AddOrDelFavFunc? addOrDelFavorite;
|
final AddOrDelFavFunc? addOrDelFavorite;
|
||||||
|
|
||||||
|
final bool singleFolderForSingleComic;
|
||||||
|
|
||||||
const FavoriteData({
|
const FavoriteData({
|
||||||
required this.key,
|
required this.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@@ -49,6 +51,7 @@ class FavoriteData {
|
|||||||
this.allFavoritesId,
|
this.allFavoritesId,
|
||||||
this.addOrDelFavorite,
|
this.addOrDelFavorite,
|
||||||
this.isOldToNewSort,
|
this.isOldToNewSort,
|
||||||
|
this.singleFolderForSingleComic = false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -620,6 +620,7 @@ class ComicSourceParser {
|
|||||||
|
|
||||||
final bool multiFolder = _getValue("favorites.multiFolder");
|
final bool multiFolder = _getValue("favorites.multiFolder");
|
||||||
final bool? isOldToNewSort = _getValue("favorites.isOldToNewSort");
|
final bool? isOldToNewSort = _getValue("favorites.isOldToNewSort");
|
||||||
|
final bool? singleFolderForSingleComic = _getValue("favorites.singleFolderForSingleComic");
|
||||||
|
|
||||||
Future<Res<T>> retryZone<T>(Future<Res<T>> Function() func) async {
|
Future<Res<T>> retryZone<T>(Future<Res<T>> Function() func) async {
|
||||||
if (!ComicSource.find(_key!)!.isLogged) {
|
if (!ComicSource.find(_key!)!.isLogged) {
|
||||||
@@ -773,6 +774,7 @@ class ComicSourceParser {
|
|||||||
deleteFolder: deleteFolder,
|
deleteFolder: deleteFolder,
|
||||||
addOrDelFavorite: addOrDelFavFunc,
|
addOrDelFavorite: addOrDelFavFunc,
|
||||||
isOldToNewSort: isOldToNewSort,
|
isOldToNewSort: isOldToNewSort,
|
||||||
|
singleFolderForSingleComic: singleFolderForSingleComic ?? false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -614,8 +614,10 @@ abstract mixin class _ComicPageActions {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// whether the comic is added to local favorite
|
||||||
bool isAddToLocalFav = false;
|
bool isAddToLocalFav = false;
|
||||||
|
|
||||||
|
/// whether the comic is favorite on the server
|
||||||
bool isFavorite = false;
|
bool isFavorite = false;
|
||||||
|
|
||||||
FavoriteItem _toFavoriteItem() {
|
FavoriteItem _toFavoriteItem() {
|
||||||
@@ -1672,6 +1674,42 @@ class _NetworkFavoritesState extends State<_NetworkFavorites> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildMultiFolder() {
|
Widget buildMultiFolder() {
|
||||||
|
if (widget.isFavorite == true &&
|
||||||
|
widget.comicSource.favoriteData!.singleFolderForSingleComic) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text("Added to favorites".tl),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Button.filled(
|
||||||
|
isLoading: isLoading,
|
||||||
|
onPressed: () async {
|
||||||
|
setState(() {
|
||||||
|
isLoading = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
var res = await widget.comicSource.favoriteData!
|
||||||
|
.addOrDelFavorite!(widget.cid, '', false, null);
|
||||||
|
if (res.success) {
|
||||||
|
widget.onFavorite(false);
|
||||||
|
context.pop();
|
||||||
|
App.rootContext.showMessage(message: "Removed".tl);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
context.showMessage(message: res.errorMessage!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text("Remove".tl),
|
||||||
|
).paddingVertical(8),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
if (isLoadingFolders) {
|
if (isLoadingFolders) {
|
||||||
loadFolders();
|
loadFolders();
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
@@ -476,11 +476,12 @@ class _CreateFolderDialogState extends State<_CreateFolderDialog> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SimpleDialog(
|
return ContentDialog(
|
||||||
title: Text("Create a folder".tl),
|
title: "Create a folder".tl,
|
||||||
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -490,20 +491,13 @@ class _CreateFolderDialogState extends State<_CreateFolderDialog> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 200,
|
height: 16
|
||||||
height: 10,
|
|
||||||
),
|
),
|
||||||
if (loading)
|
],
|
||||||
Center(
|
),
|
||||||
child: const CircularProgressIndicator(
|
actions: [
|
||||||
strokeWidth: 2,
|
Button.filled(
|
||||||
).fixWidth(24).fixHeight(24),
|
isLoading: loading,
|
||||||
)
|
|
||||||
else
|
|
||||||
SizedBox(
|
|
||||||
height: 35,
|
|
||||||
child: Center(
|
|
||||||
child: TextButton(
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = true;
|
loading = true;
|
||||||
@@ -522,8 +516,6 @@ class _CreateFolderDialogState extends State<_CreateFolderDialog> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text("Submit".tl),
|
child: Text("Submit".tl),
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user