diff --git a/assets/tr.json b/assets/tr.json index 568c802..636fa53 100644 --- a/assets/tr.json +++ b/assets/tr.json @@ -171,7 +171,9 @@ "Choose a way to login": "选择登录方式", "Use Webview: you cannot sign in with Google.": "使用Webview: 无法使用Google登录", "Use an external browser: You can sign in using Google. However, some browsers may not be compatible with the application": "使用外部浏览器: 可以使用Google登录. 但是, 一些浏览器可能与应用程序不兼容", - "External browser": "外部浏览器" + "External browser": "外部浏览器", + "Show comments": "显示评论", + "Show original image": "显示原图" }, "zh_TW": { "Search": "搜索", @@ -345,6 +347,8 @@ "Choose a way to login": "選擇登錄方式", "Use Webview: you cannot sign in with Google.": "使用Webview: 無法使用Google登錄", "Use an external browser: You can sign in using Google. However, some browsers may not be compatible with the application": "使用外部瀏覽器: 可以使用Google登錄. 但是, 一些瀏覽器可能與應用程序不兼容", - "External browser": "外部瀏覽器" + "External browser": "外部瀏覽器", + "Show comments": "顯示評論", + "Show original image": "顯示原圖" } } \ No newline at end of file diff --git a/lib/appdata.dart b/lib/appdata.dart index 94f48c6..3981ad6 100644 --- a/lib/appdata.dart +++ b/lib/appdata.dart @@ -32,6 +32,8 @@ class _Appdata { LogicalKeyboardKey.enter.keyId, LogicalKeyboardKey.keyD.keyId, LogicalKeyboardKey.keyF.keyId, + LogicalKeyboardKey.keyC.keyId, + LogicalKeyboardKey.keyG.keyId, ], "showOriginalImage": false, }; @@ -64,7 +66,7 @@ class _Appdata { final file = File("${App.dataPath}/account.json"); if (file.existsSync()) { var json = jsonDecode(await file.readAsString()); - if(json != null) { + if (json != null) { account = Account.fromJson(json); } } @@ -73,7 +75,15 @@ class _Appdata { var json = jsonDecode(await settingsFile.readAsString()); for (var key in json.keys) { if (json[key] != null) { - settings[key] = json[key]; + if (json[key] is List && settings[key] is List) { + for (int i = 0; + i < json[key].length && i < settings[key].length; + i++) { + settings[key][i] = json[key][i]; + } + } else { + settings[key] = json[key]; + } } } } diff --git a/lib/components/keyboard.dart b/lib/components/keyboard.dart index 162981e..e402b50 100644 --- a/lib/components/keyboard.dart +++ b/lib/components/keyboard.dart @@ -40,12 +40,11 @@ class KeyEventListenerState extends State { focusNode: focusNode, autofocus: true, onKeyEvent: (node, event) { - if (event is! KeyUpEvent) return KeyEventResult.ignored; + if (event is! KeyUpEvent) return KeyEventResult.handled; if (event.logicalKey == LogicalKeyboardKey.escape) { if (App.rootNavigatorKey.currentState?.canPop() ?? false) { App.rootNavigatorKey.currentState?.pop(); - } - if (App.mainNavigatorKey?.currentState?.canPop() ?? false) { + } else if (App.mainNavigatorKey?.currentState?.canPop() ?? false) { App.mainNavigatorKey?.currentState?.pop(); } return KeyEventResult.handled; diff --git a/lib/foundation/history.dart b/lib/foundation/history.dart index 117a778..9bf630e 100644 --- a/lib/foundation/history.dart +++ b/lib/foundation/history.dart @@ -62,12 +62,19 @@ class HistoryManager { illust.width, illust.height ]); + if(length > 1000) { + _db.execute(''' + delete from history where id in ( + select id from history order by time asc limit 100 + ) + '''); + } } List getHistories(int page) { var rows = _db.select(''' - select * from history - limit 20 offset ? + select * from history order by time desc + limit 20 offset ? ''', [(page - 1) * 20]); List res = []; for (var row in rows) { diff --git a/lib/pages/illust_page.dart b/lib/pages/illust_page.dart index 32c3861..34c4b80 100644 --- a/lib/pages/illust_page.dart +++ b/lib/pages/illust_page.dart @@ -319,6 +319,14 @@ class _IllustPageState extends State { _bottomBarController.download(); case 6: _bottomBarController.follow(); + case 7: + if (ModalRoute.of(context)?.isCurrent ?? true) { + CommentsPage.show(context, widget.illust.id.toString()); + } else { + context.pop(); + } + case 8: + openImage(0); } } diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index ebaa816..cc65e49 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -592,6 +592,8 @@ class _ShortcutsSettingsState extends State { "Add to favorites", "Download", "Follow the artist", + "Show comments", + "Show original image" ]; @override