mirror of
https://github.com/venera-app/venera.git
synced 2025-12-15 14:41:15 +00:00
Compare commits
6 Commits
upgrade-fl
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
068d6148ad | ||
|
|
0b261f81ba | ||
|
|
781ff2553d | ||
|
|
0ce18cd738 | ||
| 40ef8a63b0 | |||
| 053293839e |
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@@ -84,6 +84,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- run: rm -rf /opt/hostedtoolcache
|
||||||
- uses: subosito/flutter-action@v2
|
- uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: "stable"
|
channel: "stable"
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"Show favorite status on comic tile": "在漫画缩略图上显示收藏状态",
|
"Show favorite status on comic tile": "在漫画缩略图上显示收藏状态",
|
||||||
"Show history on comic tile": "在漫画缩略图上显示历史记录",
|
"Show history on comic tile": "在漫画缩略图上显示历史记录",
|
||||||
"Keyword blocking": "关键词屏蔽",
|
"Keyword blocking": "关键词屏蔽",
|
||||||
|
"Comment keyword blocking": "评论关键词屏蔽",
|
||||||
"Tap to turn Pages": "点击翻页",
|
"Tap to turn Pages": "点击翻页",
|
||||||
"Page animation": "页面动画",
|
"Page animation": "页面动画",
|
||||||
"Reading mode": "阅读模式",
|
"Reading mode": "阅读模式",
|
||||||
@@ -529,6 +530,7 @@
|
|||||||
"Show favorite status on comic tile": "在漫畫縮圖上顯示收藏狀態",
|
"Show favorite status on comic tile": "在漫畫縮圖上顯示收藏狀態",
|
||||||
"Show history on comic tile": "在漫畫縮圖上顯示歷史記錄",
|
"Show history on comic tile": "在漫畫縮圖上顯示歷史記錄",
|
||||||
"Keyword blocking": "關鍵字封鎖",
|
"Keyword blocking": "關鍵字封鎖",
|
||||||
|
"Comment keyword blocking": "評論關鍵字封鎖",
|
||||||
"Tap to turn Pages": "點擊翻頁",
|
"Tap to turn Pages": "點擊翻頁",
|
||||||
"Page animation": "頁面動畫",
|
"Page animation": "頁面動畫",
|
||||||
"Reading mode": "閱讀模式",
|
"Reading mode": "閱讀模式",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export "widget_utils.dart";
|
|||||||
export "context.dart";
|
export "context.dart";
|
||||||
|
|
||||||
class _App {
|
class _App {
|
||||||
final version = "1.6.0";
|
final version = "1.6.1";
|
||||||
|
|
||||||
bool get isAndroid => Platform.isAndroid;
|
bool get isAndroid => Platform.isAndroid;
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ class Settings with ChangeNotifier {
|
|||||||
'showFavoriteStatusOnTile': true,
|
'showFavoriteStatusOnTile': true,
|
||||||
'showHistoryStatusOnTile': false,
|
'showHistoryStatusOnTile': false,
|
||||||
'blockedWords': [],
|
'blockedWords': [],
|
||||||
|
'blockedCommentWords': [],
|
||||||
'defaultSearchTarget': null,
|
'defaultSearchTarget': null,
|
||||||
'autoPageTurningInterval': 5, // in seconds
|
'autoPageTurningInterval': 5, // in seconds
|
||||||
'readerMode': 'galleryLeftToRight', // values of [ReaderMode]
|
'readerMode': 'galleryLeftToRight', // values of [ReaderMode]
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
part of 'comic_page.dart';
|
part of 'comic_page.dart';
|
||||||
|
|
||||||
|
bool _shouldBlockComment(Comment comment) {
|
||||||
|
var blockedWords = appdata.settings["blockedCommentWords"] as List;
|
||||||
|
if (blockedWords.isEmpty) return false;
|
||||||
|
|
||||||
|
var content = comment.content.toLowerCase();
|
||||||
|
for (var word in blockedWords) {
|
||||||
|
if (content.contains(word.toString().toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
class CommentsPage extends StatefulWidget {
|
class CommentsPage extends StatefulWidget {
|
||||||
const CommentsPage({
|
const CommentsPage({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -36,8 +49,9 @@ class _CommentsPageState extends State<CommentsPage> {
|
|||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
} else if (mounted) {
|
} else if (mounted) {
|
||||||
|
var filteredComments = res.data.where((c) => !_shouldBlockComment(c)).toList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_comments = res.data;
|
_comments = filteredComments;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
maxPage = res.subData;
|
maxPage = res.subData;
|
||||||
});
|
});
|
||||||
@@ -54,8 +68,9 @@ class _CommentsPageState extends State<CommentsPage> {
|
|||||||
if (res.error) {
|
if (res.error) {
|
||||||
context.showMessage(message: res.errorMessage ?? "Unknown Error");
|
context.showMessage(message: res.errorMessage ?? "Unknown Error");
|
||||||
} else {
|
} else {
|
||||||
|
var filteredComments = res.data.where((c) => !_shouldBlockComment(c)).toList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_comments!.addAll(res.data);
|
_comments!.addAll(filteredComments);
|
||||||
_page++;
|
_page++;
|
||||||
if (maxPage == null && res.data.isEmpty) {
|
if (maxPage == null && res.data.isEmpty) {
|
||||||
maxPage = _page;
|
maxPage = _page;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class _CommentsPartState extends State<_CommentsPart> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
comments = widget.comments;
|
comments = widget.comments.where((c) => !_shouldBlockComment(c)).toList();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,29 +258,41 @@ class _LocalComicsPageState extends State<LocalComicsPage> {
|
|||||||
else if (searchMode)
|
else if (searchMode)
|
||||||
SliverAppbar(
|
SliverAppbar(
|
||||||
leading: Tooltip(
|
leading: Tooltip(
|
||||||
message: "Cancel".tl,
|
message: multiSelectMode ? "Cancel".tl : "Cancel".tl,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: multiSelectMode
|
||||||
|
? const Icon(Icons.close)
|
||||||
|
: const Icon(Icons.close),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
if (multiSelectMode) {
|
||||||
searchMode = false;
|
setState(() {
|
||||||
keyword = "";
|
multiSelectMode = false;
|
||||||
update();
|
selectedComics.clear();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
searchMode = false;
|
||||||
|
keyword = "";
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: TextField(
|
title: multiSelectMode
|
||||||
autofocus: true,
|
? Text(selectedComics.length.toString())
|
||||||
decoration: InputDecoration(
|
: TextField(
|
||||||
hintText: "Search".tl,
|
autofocus: true,
|
||||||
border: InputBorder.none,
|
decoration: InputDecoration(
|
||||||
),
|
hintText: "Search".tl,
|
||||||
onChanged: (v) {
|
border: InputBorder.none,
|
||||||
keyword = v;
|
),
|
||||||
update();
|
onChanged: (v) {
|
||||||
},
|
keyword = v;
|
||||||
),
|
update();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
actions: multiSelectMode ? selectActions : null,
|
||||||
),
|
),
|
||||||
SliverGridComics(
|
SliverGridComics(
|
||||||
comics: comics,
|
comics: comics,
|
||||||
@@ -344,6 +356,7 @@ class _LocalComicsPageState extends State<LocalComicsPage> {
|
|||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: !multiSelectMode && !searchMode,
|
canPop: !multiSelectMode && !searchMode,
|
||||||
onPopInvokedWithResult: (didPop, result) {
|
onPopInvokedWithResult: (didPop, result) {
|
||||||
|
if (didPop) return;
|
||||||
if (multiSelectMode) {
|
if (multiSelectMode) {
|
||||||
setState(() {
|
setState(() {
|
||||||
multiSelectMode = false;
|
multiSelectMode = false;
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
part of 'reader.dart';
|
part of 'reader.dart';
|
||||||
|
|
||||||
|
bool _shouldBlockComment(Comment comment) {
|
||||||
|
var blockedWords = appdata.settings["blockedCommentWords"] as List;
|
||||||
|
if (blockedWords.isEmpty) return false;
|
||||||
|
|
||||||
|
var content = comment.content.toLowerCase();
|
||||||
|
for (var word in blockedWords) {
|
||||||
|
if (content.contains(word.toString().toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
class ChapterCommentsPage extends StatefulWidget {
|
class ChapterCommentsPage extends StatefulWidget {
|
||||||
const ChapterCommentsPage({
|
const ChapterCommentsPage({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -44,8 +57,9 @@ class _ChapterCommentsPageState extends State<ChapterCommentsPage> {
|
|||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
} else if (mounted) {
|
} else if (mounted) {
|
||||||
|
var filteredComments = res.data.where((c) => !_shouldBlockComment(c)).toList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_comments = res.data;
|
_comments = filteredComments;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
maxPage = res.subData;
|
maxPage = res.subData;
|
||||||
});
|
});
|
||||||
@@ -62,8 +76,9 @@ class _ChapterCommentsPageState extends State<ChapterCommentsPage> {
|
|||||||
if (res.error) {
|
if (res.error) {
|
||||||
context.showMessage(message: res.errorMessage ?? "Unknown Error");
|
context.showMessage(message: res.errorMessage ?? "Unknown Error");
|
||||||
} else {
|
} else {
|
||||||
|
var filteredComments = res.data.where((c) => !_shouldBlockComment(c)).toList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_comments!.addAll(res.data);
|
_comments!.addAll(filteredComments);
|
||||||
_page++;
|
_page++;
|
||||||
if (maxPage == null && res.data.isEmpty) {
|
if (maxPage == null && res.data.isEmpty) {
|
||||||
maxPage = _page;
|
maxPage = _page;
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ class _ExploreSettingsState extends State<ExploreSettings> {
|
|||||||
title: "Keyword blocking".tl,
|
title: "Keyword blocking".tl,
|
||||||
builder: () => const _ManageBlockingWordView(),
|
builder: () => const _ManageBlockingWordView(),
|
||||||
).toSliver(),
|
).toSliver(),
|
||||||
|
_PopupWindowSetting(
|
||||||
|
title: "Comment keyword blocking".tl,
|
||||||
|
builder: () => const _ManageBlockingCommentWordView(),
|
||||||
|
).toSliver(),
|
||||||
SelectSetting(
|
SelectSetting(
|
||||||
title: "Default Search Target".tl,
|
title: "Default Search Target".tl,
|
||||||
settingKey: "defaultSearchTarget",
|
settingKey: "defaultSearchTarget",
|
||||||
@@ -250,4 +254,93 @@ Widget setSearchSourcesWidget() {
|
|||||||
settingsIndex: "searchSources",
|
settingsIndex: "searchSources",
|
||||||
pages: pages,
|
pages: pages,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ManageBlockingCommentWordView extends StatefulWidget {
|
||||||
|
const _ManageBlockingCommentWordView();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_ManageBlockingCommentWordView> createState() =>
|
||||||
|
_ManageBlockingCommentWordViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ManageBlockingCommentWordViewState extends State<_ManageBlockingCommentWordView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
assert(appdata.settings["blockedCommentWords"] is List);
|
||||||
|
return PopUpWidgetScaffold(
|
||||||
|
title: "Comment keyword blocking".tl,
|
||||||
|
tailing: [
|
||||||
|
TextButton.icon(
|
||||||
|
icon: const Icon(Icons.add),
|
||||||
|
label: Text("Add".tl),
|
||||||
|
onPressed: add,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
body: ListView.builder(
|
||||||
|
itemCount: appdata.settings["blockedCommentWords"].length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(appdata.settings["blockedCommentWords"][index]),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () {
|
||||||
|
appdata.settings["blockedCommentWords"].removeAt(index);
|
||||||
|
appdata.saveData();
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void add() {
|
||||||
|
showDialog(
|
||||||
|
context: App.rootContext,
|
||||||
|
builder: (context) {
|
||||||
|
var controller = TextEditingController();
|
||||||
|
String? error;
|
||||||
|
return StatefulBuilder(builder: (context, setState) {
|
||||||
|
return ContentDialog(
|
||||||
|
title: "Add keyword".tl,
|
||||||
|
content: TextField(
|
||||||
|
controller: controller,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
label: Text("Keyword".tl),
|
||||||
|
errorText: error,
|
||||||
|
),
|
||||||
|
onChanged: (s) {
|
||||||
|
if (error != null) {
|
||||||
|
setState(() {
|
||||||
|
error = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
).paddingHorizontal(12),
|
||||||
|
actions: [
|
||||||
|
Button.filled(
|
||||||
|
onPressed: () {
|
||||||
|
if (appdata.settings["blockedCommentWords"]
|
||||||
|
.contains(controller.text)) {
|
||||||
|
setState(() {
|
||||||
|
error = "Keyword already exists".tl;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appdata.settings["blockedCommentWords"].add(controller.text);
|
||||||
|
appdata.saveData();
|
||||||
|
this.setState(() {});
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
child: Text("Add".tl),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ name: venera
|
|||||||
description: "A comic app."
|
description: "A comic app."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.6.0+160
|
version: 1.6.1+161
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.8.0 <4.0.0'
|
sdk: '>=3.8.0 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user