Skip to content

Commit

Permalink
Added new inbox page, fixed actions in inbox (#1463)
Browse files Browse the repository at this point in the history
* switched inbox to use custom scroll views and slivers, using tab bar instead of chips

* switched mentions to use same layout as replies, improved fetching to only fetch necessary information

* re-enable inbox comment actions

* inbox actions are actionable

* fixed private messages not showing

* clean up logging

* clean up comments

* fixed issue with inbox reloading when switching accounts

* fixed notification page

* reached bottom styling matches feed reach bottom

* fixed inbox not refreshing properly when switching accounts
  • Loading branch information
hjiangsu authored Jul 5, 2024
1 parent 65a574b commit 23f4aa2
Show file tree
Hide file tree
Showing 11 changed files with 706 additions and 757 deletions.
1 change: 1 addition & 0 deletions lib/comment/enums/comment_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum CommentAction {
save(permissionType: PermissionType.user),
delete(permissionType: PermissionType.user),
report(permissionType: PermissionType.user),
read(permissionType: PermissionType.user), // This is used for inbox items (replies/mentions)

/// Moderator level post actions
remove(permissionType: PermissionType.moderator),
Expand Down
530 changes: 299 additions & 231 deletions lib/inbox/bloc/inbox_bloc.dart

Large diffs are not rendered by default.

35 changes: 17 additions & 18 deletions lib/inbox/bloc/inbox_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,32 @@ abstract class InboxEvent extends Equatable {
}

class GetInboxEvent extends InboxEvent {
/// The inbox type to fetch from. If null, it will not fetch anything. If [reset] is true, it will only fetch the total unread counts
final InboxType? inboxType;

/// If true, it will fetch read and unread messages
final bool showAll;

/// If true, it will reset the inbox and re-fetch everything depending on [inboxType]
final bool reset;

const GetInboxEvent({this.showAll = false, this.reset = false});
const GetInboxEvent({this.inboxType, this.showAll = false, this.reset = false});
}

class MarkReplyAsReadEvent extends InboxEvent {
final int commentReplyId;
final bool read;
final bool showAll;

const MarkReplyAsReadEvent({required this.commentReplyId, required this.read, required this.showAll});
}
class InboxItemActionEvent extends InboxEvent {
/// The action to perform on the inbox item. This is generally a comment.
final CommentAction action;

class MarkMentionAsReadEvent extends InboxEvent {
final int personMentionId;
final bool read;
/// The id of the comment reply. Only one of [commentReplyId] or [personMentionId] should be set
final int? commentReplyId;

const MarkMentionAsReadEvent({required this.personMentionId, required this.read});
}
/// The id of the person mention reply. Only one of [commentReplyId] or [personMentionId] should be set
final int? personMentionId;

class CreateInboxCommentReplyEvent extends InboxEvent {
final String content;
final int postId;
final int parentCommentId;
/// The value to pass to the action
final dynamic value;

const CreateInboxCommentReplyEvent({required this.content, required this.postId, required this.parentCommentId});
const InboxItemActionEvent({required this.action, this.commentReplyId, this.personMentionId, this.value});
}

class MarkAllAsReadEvent extends InboxEvent {}
1 change: 1 addition & 0 deletions lib/inbox/enums/inbox_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum InboxType { replies, mentions, messages }
Loading

0 comments on commit 23f4aa2

Please sign in to comment.