From 73625a4453adab6421a1d321e6d2cec9cf4b0586 Mon Sep 17 00:00:00 2001 From: orzogc Date: Tue, 17 Jan 2023 21:53:56 +0800 Subject: [PATCH] bump version 0.3.0 --- CHANGELOG.md | 7 +- TODO.md | 4 +- lib/app/modules/advanced_settings.dart | 2 +- lib/app/modules/basic_ui_settings.dart | 2 +- lib/app/widgets/feed.dart | 95 ++++++++++++++++++-------- pubspec.yaml | 2 +- 6 files changed, 77 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 486e7ff..d7c3c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,16 @@ # 更新记录 -## v0.3.0(未发布) +## v0.3.0 - 支持扫描饼干二维码 - 可以设置时间线和版块是否过滤重复的串(基本设置),默认过滤 - 可以设置串内Po饼干左边是否显示Po标识(界面基本设置),默认不显示 - 可以设置串饼干下方是否显示用户饼干的备注(界面基本设置),默认不显示 - 可以设置串饼干是否使用用户饼干的自定义颜色显示(界面基本设置),默认使用 - 可以设置串时间是否使用相对时间(界面基本设置),默认不使用 -- 可以设置订阅串是否显示最新回复时间(界面基本设置),默认不显示 -- 可以设置白天/黑夜模式是否跟随系统(高级设置),默认不跟随 +- 可以设置订阅界面里的串是否显示最新回复时间(界面基本设置),默认不显示 +- 可以设置白天/黑夜模式是否跟随系统设置(高级设置),默认不跟随 - Po饼干颜色的设置从高级设置移至界面基本设置 - 发串的饼干选择界面会显示饼干在串内的回复数 +- 订阅界面长按串可以选择将该串提升至订阅最上方 - 修复了一些bug ## v0.2.2 diff --git a/TODO.md b/TODO.md index 2d65576..ff8453c 100644 --- a/TODO.md +++ b/TODO.md @@ -10,6 +10,8 @@ - [x] 历史记录添加搜索功能 - [x] 自定义饼干颜色(包括Po和用户曾用过的饼干) - [x] 允许设置发串前选择饼干 +- [x] 增加易读时间 +- [x] 订阅显示最后回复的时间 - [ ] 多图浏览 - [ ] 适应屏幕大小,实现版块/时间线/串瀑布流 - [ ] 定时切换日间和夜间模式 @@ -19,7 +21,6 @@ - [ ] 加载语录 - [ ] 适配iOS - [ ] 自定义串布局顺序 -- [ ] 增加易读时间 - [ ] 自定义UI颜色 - [ ] 备注串(tag) - [ ] 收藏夹功能(和订阅ID结合) @@ -27,6 +28,5 @@ - [ ] 滑动引用能返回 - [ ] 颜文字排序或显示最近使用的颜文字 - [ ] 版块右滑进串 -- [ ] 订阅显示最后回复的时间 - [ ] 底边栏按钮自定义 - [ ] 能够交换侧边栏 diff --git a/lib/app/modules/advanced_settings.dart b/lib/app/modules/advanced_settings.dart index 3ae27d1..b78db5f 100644 --- a/lib/app/modules/advanced_settings.dart +++ b/lib/app/modules/advanced_settings.dart @@ -114,7 +114,7 @@ class _FollowPlatformBrightness extends StatelessWidget { return ListenableBuilder( listenable: settings.followPlatformBrightnessListenable, builder: (context, child) => SwitchListTile( - title: const Text('白天/黑夜模式跟随系统'), + title: const Text('白天/黑夜模式跟随系统设置'), subtitle: const Text('更改后需要重启应用'), value: settings.followPlatformBrightness, onChanged: (value) => settings.followPlatformBrightness = value, diff --git a/lib/app/modules/basic_ui_settings.dart b/lib/app/modules/basic_ui_settings.dart index e7ec1b5..1da6a6f 100644 --- a/lib/app/modules/basic_ui_settings.dart +++ b/lib/app/modules/basic_ui_settings.dart @@ -538,7 +538,7 @@ class _ShowLatestPostTimeInFeed extends StatelessWidget { final textStyle = Theme.of(context).textTheme.bodyMedium; return ListTile( - title: const Text('订阅里的串显示最后回复时间'), + title: const Text('订阅界面里的串显示最后回复时间'), trailing: ListenableBuilder( listenable: settings.showLatestPostTimeInFeedListenable, builder: (context, child) => DropdownButton( diff --git a/lib/app/widgets/feed.dart b/lib/app/widgets/feed.dart index 509d1cd..2918865 100644 --- a/lib/app/widgets/feed.dart +++ b/lib/app/widgets/feed.dart @@ -63,48 +63,87 @@ class FeedAppBarTitle extends StatelessWidget { } class _FeedDialog extends StatelessWidget { + final FeedController controller; + final PostBase post; final VoidCallback onDelete; // ignore: unused_element - const _FeedDialog({super.key, required this.post, required this.onDelete}); + const _FeedDialog( + {super.key, + required this.controller, + required this.post, + required this.onDelete}); @override - Widget build(BuildContext context) => SimpleDialog( - title: Text(post.toPostNumber()), - children: [ - Report(post.id), - SharePost(mainPostId: post.id), - SimpleDialogOption( - onPressed: () async { - postListBack(); + Widget build(BuildContext context) { + final settings = SettingsService.to; + final client = XdnmbClientService.to.client; + final textStyle = Theme.of(context).textTheme.titleMedium; + + return SimpleDialog( + title: Text(post.toPostNumber()), + children: [ + Report(post.id), + SharePost(mainPostId: post.id), + SimpleDialogOption( + onPressed: () async { + postListBack(); + + try { + await client.deleteFeed(settings.feedId, post.id); + + showToast('取消订阅 ${post.toPostNumber()} 成功'); + onDelete(); + } catch (e) { + showToast( + '取消订阅 ${post.toPostNumber()} 失败:${exceptionMessage(e)}'); + } + }, + child: Text('取消订阅', style: textStyle), + ), + CopyPostId(post.id), + CopyPostReference(post.id), + CopyPostContent(post), + SimpleDialogOption( + onPressed: () async { + postListBack(); + + try { + await client.deleteFeed(settings.feedId, post.id); + await client.addFeed(settings.feedId, post.id); + + showToast('提升 ${post.toPostNumber()} 至订阅最上方成功'); + controller.refreshPage(); + } catch (e) { + showToast( + '提升至订阅最上方失败,请手动重新订阅 ${post.toPostNumber()} :${exceptionMessage(e)}'); + try { - await XdnmbClientService.to.client - .deleteFeed(SettingsService.to.feedId, post.id); - showToast('取消订阅 ${post.id.toPostNumber()} 成功'); - onDelete(); + await client.addFeed(settings.feedId, post.id); } catch (e) { - showToast( - '取消订阅 ${post.id.toPostNumber()} 失败:${exceptionMessage(e)}'); + debugPrint( + '订阅 ${post.toPostNumber()} 失败:${exceptionMessage(e)}'); } - }, - child: Text('取消订阅', style: Theme.of(context).textTheme.titleMedium), - ), - CopyPostId(post.id), - CopyPostReference(post.id), - CopyPostContent(post), - NewTab(post), - NewTabBackground(post), - ], - ); + } + }, + child: Text('提升至最上方', style: textStyle), + ), + NewTab(post), + NewTabBackground(post), + ], + ); + } } class _FeedItem extends StatefulWidget { + final FeedController controller; + final Visible> feed; // ignore: unused_element - const _FeedItem(this.feed, {super.key}); + const _FeedItem({super.key, required this.controller, required this.feed}); @override State<_FeedItem> createState() => _FeedItemState(); @@ -216,6 +255,7 @@ class _FeedItemState extends State<_FeedItem> { mainPost: widget.feed.item.post), onLongPress: (post) => postListDialog( _FeedDialog( + controller: widget.controller, post: post, onDelete: () => widget.feed.isVisible = false, ), @@ -292,7 +332,8 @@ class _FeedBodyState extends State { controller: scrollController, index: feed.item.toIndex(), child: _FeedItem( - feed, + controller: widget.controller, + feed: feed, key: ValueKey(settings.isShowLatestPostTimeInFeed), ), ) diff --git a/pubspec.yaml b/pubspec.yaml index 3b55afc..af14955 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: xdnmb description: An app for nmbxd.com. publish_to: 'none' -version: 0.3.0-alpha+6 +version: 0.3.0+7 environment: sdk: ">=2.18.6 <3.0.0"