Skip to content

Commit 93ef270

Browse files
committed
fixed inbox not refreshing after popping from notifications page
1 parent 4c089eb commit 93ef270

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

lib/inbox/bloc/inbox_bloc.dart

+28
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,34 @@ class InboxBloc extends Bloc<InboxEvent, InboxState> {
107107
),
108108
);
109109
break;
110+
case InboxType.all:
111+
getRepliesResponse = await lemmy.run(
112+
GetReplies(
113+
auth: account!.jwt!,
114+
unreadOnly: !event.showAll,
115+
limit: limit,
116+
sort: CommentSortType.new_,
117+
page: 1,
118+
),
119+
);
120+
getPersonMentionsResponse = await lemmy.run(
121+
GetPersonMentions(
122+
auth: account.jwt!,
123+
unreadOnly: !event.showAll,
124+
sort: CommentSortType.new_,
125+
limit: limit,
126+
page: 1,
127+
),
128+
);
129+
privateMessagesResponse = await lemmy.run(
130+
GetPrivateMessages(
131+
auth: account.jwt!,
132+
unreadOnly: !event.showAll,
133+
limit: limit,
134+
page: 1,
135+
),
136+
);
137+
break;
110138
default:
111139
break;
112140
}

lib/inbox/enums/inbox_type.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
enum InboxType { replies, mentions, messages }
1+
enum InboxType { replies, mentions, messages, all }

lib/notification/utils/navigate_notification.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:thunder/core/auth/bloc/auth_bloc.dart';
1515
import 'package:thunder/core/auth/helpers/fetch_account.dart';
1616
import 'package:thunder/core/singletons/lemmy_client.dart';
1717
import 'package:thunder/inbox/bloc/inbox_bloc.dart';
18+
import 'package:thunder/inbox/enums/inbox_type.dart';
1819
import 'package:thunder/shared/pages/loading_page.dart';
1920
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
2021
import 'package:thunder/thunder/pages/notifications_pages.dart';
@@ -90,8 +91,6 @@ void navigateToNotificationReplyPage(BuildContext context, {required int? replyI
9091
);
9192

9293
pushOnTopOfLoadingPage(context, route).then((_) {
93-
context.read<InboxBloc>().add(const GetInboxEvent(reset: true));
94-
9594
// If needed, switch back to the original account or anonymous instance
9695
if (switchedAccount) {
9796
if (originalAccount != null) {
@@ -104,6 +103,8 @@ void navigateToNotificationReplyPage(BuildContext context, {required int? replyI
104103
context.read<AuthBloc>().add(InstanceChanged(instance: originalAnonymousInstance));
105104
}
106105
}
106+
107+
context.read<InboxBloc>().add(const GetInboxEvent(reset: true, inboxType: InboxType.all));
107108
});
108109
}
109110
}

0 commit comments

Comments
 (0)