Skip to content

Commit

Permalink
feat(card): Direct push to thread notices
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Aug 16, 2024
1 parent c661124 commit d2a21d8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 帖子:支持从消息页的回复提醒跳转过来后滚动到相应回复。
- 帖子:支持在解析网页链接时解析其中指定的楼层,并在页面加载后跳转到该楼层。
- 当网页链接形式为`tid=THREAD_ID&page=PAGE#pidPOST_ID`时,忽视“倒序浏览楼层”的设置以保证加载指定的页数。
- 消息:现在可在帖子中回复的消息会直接跳转到帖子相应的页面中。

### Fixed

Expand Down
39 changes: 30 additions & 9 deletions lib/widgets/card/notice_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,36 @@ class NoticeCard extends StatelessWidget {
return context.dispatchAsUrl(notice.redirectUrl!);
}

await context.pushNamed(
ScreenPaths.reply,
pathParameters: <String, String>{
'target': notice.redirectUrl!,
},
queryParameters: {
'noticeType': '${notice.noticeType.index}',
},
);
// These types of notice redirect to thread page with target
// post:
//
// NoticeType.reply
// NoticeType.rate
// NoticeType.batchRate
// NoticeType.mention
//
// These types of notice redirect to thread page:
//
// NoticeType.invite (no tested)
// NoticeType.newFriend (no tested)
switch (notice.noticeType) {
case NoticeType.reply ||
NoticeType.rate ||
NoticeType.batchRate ||
NoticeType.mention:
// Use dispatch, not parsing parameters from url again.
await context.dispatchAsUrl(notice.redirectUrl!);
case NoticeType.invite || NoticeType.newFriend:
await context.pushNamed(
ScreenPaths.reply,
pathParameters: <String, String>{
'target': notice.redirectUrl!,
},
queryParameters: {
'noticeType': '${notice.noticeType.index}',
},
);
}
}
: null,
child: Column(
Expand Down

0 comments on commit d2a21d8

Please sign in to comment.