Skip to content

Commit

Permalink
Merge pull request #466 from AInfinity-LilacDream/feat-issue-443
Browse files Browse the repository at this point in the history
feat #443: add 'show this person' function to hole
  • Loading branch information
w568w authored Dec 12, 2024
2 parents 21bdbd4 + 2e71609 commit 6f8d861
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -544,5 +544,6 @@
"proxy_setting_input_hint": "e.g. 127.0.0.1:1234 (Leave blank to disable)",
"proxy_setting_set_successfully": "Proxy settings saved, restart the app to take effect.",
"use_webvpn_title": "Use WebVPN proxy",
"use_webvpn_description": "When enabled, certain functions could be accessed directly without Fudan LAN (restart required)"
"use_webvpn_description": "When enabled, certain functions could be accessed directly without Fudan LAN (restart required)",
"show_this_person": "Filter by this user"
}
3 changes: 2 additions & 1 deletion lib/l10n/intl_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -526,5 +526,6 @@
"proxy_setting_input_hint": "例:127.0.0.1:1234(空白のままにしてプロキシを無効にする)",
"proxy_setting_set_successfully": "プロキシ設定が保存されました。再起動すると有効になります。",
"use_webvpn_title": "WebVPN を自動的に使う",
"use_webvpn_description": "有効時、一部の機能はFudan LANなしで、直接に連接するのができます (再起動が必要)"
"use_webvpn_description": "有効時、一部の機能はFudan LANなしで、直接に連接するのができます (再起動が必要)",
"show_this_person": "この人だけ"
}
3 changes: 2 additions & 1 deletion lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -538,5 +538,6 @@
"proxy_setting_input_hint": "如 127.0.0.1:1234(留空以关闭代理)",
"proxy_setting_set_successfully": "代理设置已保存,重启应用后生效",
"use_webvpn_title": "自动使用 WebVPN 代理",
"use_webvpn_description": "启动该项后,允许在非校园网环境下直接访问茶楼、评教等功能(需要重启应用)"
"use_webvpn_description": "启动该项后,允许在非校园网环境下直接访问茶楼、评教等功能(需要重启应用)",
"show_this_person": "只看此人"
}
36 changes: 28 additions & 8 deletions lib/page/forum/hole_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class BBSPostDetailState extends State<BBSPostDetail> {
),
trailingActions: [
if (_renderModel
case Normal(hole: var hole, onlyShowDZ: var onlyShowDZ)) ...[
case Normal(hole: var hole, selectedPerson: var selectedPerson)) ...[
_buildSubscribeActionButton(),
_buildFavoredActionButton(),
PlatformIconButton(
Expand All @@ -327,12 +327,18 @@ class BBSPostDetailState extends State<BBSPostDetail> {
label: S.of(context).scroll_to_end,
onTap: _onTapScrollToEnd),
PopupMenuOption(
label: onlyShowDZ
label: selectedPerson == hole.floors?.first_floor?.anonyname
? S.of(context).show_all_replies
: S.of(context).only_show_dz,
onTap: (_) {
setState(() =>
(_renderModel as Normal).onlyShowDZ = !onlyShowDZ);
setState(() {
if ((_renderModel as Normal).selectedPerson != hole.floors?.first_floor?.anonyname) {
(_renderModel as Normal).selectedPerson = hole.floors?.first_floor?.anonyname;
}
else {
(_renderModel as Normal).selectedPerson = null;
}
});
refreshListView();
}),
PopupMenuOption(
Expand Down Expand Up @@ -878,6 +884,20 @@ class BBSPostDetailState extends State<BBSPostDetail> {
},
child: Text(S.of(context).share_floor),
),
PlatformContextMenuItem(
menuContext: menuContext,
onPressed: () async {
if ((_renderModel as Normal).selectedPerson != null) {
(_renderModel as Normal).selectedPerson = null;
refreshListView();
} else {
setState(() =>
(_renderModel as Normal).selectedPerson = e.anonyname);
refreshListView();
}
},
child: Text((_renderModel as Normal).selectedPerson == e.anonyname ? S.of(context).show_all_replies : S.of(context).show_this_person),
),
PlatformContextMenuItem(
menuContext: menuContext,
isDestructive: true,
Expand Down Expand Up @@ -1009,9 +1029,9 @@ class BBSPostDetailState extends State<BBSPostDetail> {
Widget _getListItems(BuildContext context, ListProvider<OTFloor> dataProvider,
int index, OTFloor floor,
{bool isNested = false}) {
if (_renderModel case Normal(onlyShowDZ: var onlyShowDZ, hole: var hole)) {
if (onlyShowDZ &&
floor.anonyname != hole.floors?.first_floor?.anonyname) {
if (_renderModel case Normal(selectedPerson: var selectedPerson, hole: var hole)) {
if (selectedPerson != null &&
floor.anonyname != selectedPerson) {
return nil;
}
}
Expand Down Expand Up @@ -1190,7 +1210,7 @@ sealed class RenderModel {}
class Normal extends RenderModel {
OTHole hole;
bool? isFavored, isSubscribed;
bool onlyShowDZ = false;
String? selectedPerson = null;

Normal(this.hole);

Expand Down

0 comments on commit 6f8d861

Please sign in to comment.