Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inbox not refreshing after popping from notifications page #1477

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions lib/inbox/bloc/inbox_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,34 @@ class InboxBloc extends Bloc<InboxEvent, InboxState> {
),
);
break;
case InboxType.all:
getRepliesResponse = await lemmy.run(
GetReplies(
auth: account!.jwt!,
unreadOnly: !event.showAll,
limit: limit,
sort: CommentSortType.new_,
page: 1,
),
);
getPersonMentionsResponse = await lemmy.run(
GetPersonMentions(
auth: account.jwt!,
unreadOnly: !event.showAll,
sort: CommentSortType.new_,
limit: limit,
page: 1,
),
);
privateMessagesResponse = await lemmy.run(
GetPrivateMessages(
auth: account.jwt!,
unreadOnly: !event.showAll,
limit: limit,
page: 1,
),
);
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/inbox/enums/inbox_type.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
enum InboxType { replies, mentions, messages }
enum InboxType { replies, mentions, messages, all }
5 changes: 3 additions & 2 deletions lib/notification/utils/navigate_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:thunder/core/auth/bloc/auth_bloc.dart';
import 'package:thunder/core/auth/helpers/fetch_account.dart';
import 'package:thunder/core/singletons/lemmy_client.dart';
import 'package:thunder/inbox/bloc/inbox_bloc.dart';
import 'package:thunder/inbox/enums/inbox_type.dart';
import 'package:thunder/shared/pages/loading_page.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/thunder/pages/notifications_pages.dart';
Expand Down Expand Up @@ -90,8 +91,6 @@ void navigateToNotificationReplyPage(BuildContext context, {required int? replyI
);

pushOnTopOfLoadingPage(context, route).then((_) {
context.read<InboxBloc>().add(const GetInboxEvent(reset: true));

// If needed, switch back to the original account or anonymous instance
if (switchedAccount) {
if (originalAccount != null) {
Expand All @@ -104,6 +103,8 @@ void navigateToNotificationReplyPage(BuildContext context, {required int? replyI
context.read<AuthBloc>().add(InstanceChanged(instance: originalAnonymousInstance));
}
}

context.read<InboxBloc>().add(const GetInboxEvent(reset: true, inboxType: InboxType.all));
});
}
}
Loading