Compare commits
16 changed files with 23 additions and 51 deletions
|
|
@ -35,7 +35,7 @@ class RoomsController extends Notifier<IMap<String, Room>> {
|
|||
|
||||
void update(
|
||||
IMap<String, Room> rooms, [
|
||||
ISet<String> leftRooms = const .empty(),
|
||||
ISet<String> leftRooms = const ISet.empty(),
|
||||
]) {
|
||||
final merged = rooms.entries.fold(state, (acc, entry) {
|
||||
final roomId = entry.key;
|
||||
|
|
|
|||
|
|
@ -166,21 +166,6 @@ class SettingsSectionsController
|
|||
: null,
|
||||
),
|
||||
),
|
||||
.new(
|
||||
title: "Hide Membership Events",
|
||||
description: "Hides membership events (invites, joins, leaves, bans & knocks) from appearing in conversations.",
|
||||
icon: Icons.person_off,
|
||||
builder: (title, description, icon) => SwitchListTile(
|
||||
title: Text(title),
|
||||
subtitle: Text(description),
|
||||
secondary: Icon(icon),
|
||||
value: settings.hideMembershipEvents,
|
||||
onChanged: (value) => ref
|
||||
.read(SettingsController.provider.notifier)
|
||||
.set(settings.copyWith(hideMembershipEvents: value))
|
||||
.onError(showError),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class const AccountData({
|
|||
const InvitePermissionConfig(),
|
||||
|
||||
@JsonKey(name: AccountData.directKey)
|
||||
final IMap<String, IList<String>> directMessages = const .empty(),
|
||||
final IMap<String, IList<String>> directMessages = const IMap.empty(),
|
||||
|
||||
@JsonKey(name: AccountData.recentEmojiKey)
|
||||
final RecentEmojiData recentEmoji = const RecentEmojiData(),
|
||||
|
|
@ -30,7 +30,7 @@ class const AccountData({
|
|||
@Freezed(toJson: false, fromJson: false)
|
||||
@JsonSerializable()
|
||||
class const RecentEmojiData({
|
||||
final IList<RecentEmoji> recentEmoji = const .empty(),
|
||||
final IList<RecentEmoji> recentEmoji = const IList.empty(),
|
||||
}) with _$RecentEmojiData {
|
||||
Map<String, Object?> toJson() => _$RecentEmojiDataToJson(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ sealed class PowerLevelsContent extends Content with _$PowerLevelsContent {
|
|||
@JsonSerializable()
|
||||
class const Notifications({
|
||||
final int room = 50,
|
||||
final IMap<String, int> other = const .empty(),
|
||||
final IMap<String, int> other = const IMap.empty(),
|
||||
}) with _$Notifications {
|
||||
Map<String, Object?> toJson() => _$NotificationsToJson(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class const Event({
|
|||
required final String sender,
|
||||
@JsonKey(readValue: Event.typeJsonFromJson) required final String type,
|
||||
@EpochDateTimeConverter() required final DateTime timestamp,
|
||||
final IMap<String, dynamic> unsigned = const .empty(),
|
||||
final IMap<String, dynamic> unsigned = const IMap.empty(),
|
||||
final LocalContent? localContent,
|
||||
final String? transactionId,
|
||||
final String? redactedBy,
|
||||
|
|
@ -27,7 +27,7 @@ class const Event({
|
|||
final String? replyTo,
|
||||
final String? decryptionError,
|
||||
final String? sendError,
|
||||
final IMap<String, int> reactions = const .empty(),
|
||||
final IMap<String, int> reactions = const IMap.empty(),
|
||||
@JsonKey(name: "last_edit_rowid") final int lastEditRowId = 0,
|
||||
final UnreadType? unreadType,
|
||||
final Profile? pmp,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class const EventContext({
|
|||
required final IList<Event> after,
|
||||
required final String start,
|
||||
required final String end,
|
||||
final IList<Event> relatedEvents = const .empty(),
|
||||
final IList<Event> relatedEvents = const IList.empty(),
|
||||
}) with _$EventContext {
|
||||
Map<String, Object?> toJson() => _$EventContextToJson(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ part "paginate_manual.g.dart";
|
|||
@JsonSerializable()
|
||||
class const PaginateManual({
|
||||
required final IList<Event> events,
|
||||
final IList<Event> relatedEvents = const .empty(),
|
||||
final IList<Event> relatedEvents = const IList.empty(),
|
||||
required final String? nextBatch,
|
||||
}) with _$PaginateManual {
|
||||
Map<String, Object?> toJson() => _$PaginateManualToJson(this);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class const Profile({
|
|||
final String? timezone,
|
||||
|
||||
@JsonKey(readValue: Profile.readPronouns, name: "m.pronouns")
|
||||
final IList<Pronoun> pronouns = const .empty(),
|
||||
final IList<Pronoun> pronouns = const IList.empty(),
|
||||
}) with _$Profile {
|
||||
Map<String, Object?> toJson() => _$ProfileToJson(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ class const CreateRoomRequest({
|
|||
final String? roomAliasName,
|
||||
final String? name,
|
||||
final String? topic,
|
||||
final IList<String> invite = const .empty(),
|
||||
final IList<String> invite = const IList.empty(),
|
||||
@JsonKey(name: "uk.timedout.msc4491.invite_reason")
|
||||
final String? inviteReason,
|
||||
final IList<InitialStateEvent> initialState = const .empty(),
|
||||
final IList<InitialStateEvent> initialState = const IList.empty(),
|
||||
final RoomPreset? preset,
|
||||
final bool isDirect = false,
|
||||
final IMap<String, dynamic>? creationContent,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ part "join_room.g.dart";
|
|||
@JsonSerializable()
|
||||
class const JoinRoomRequest({
|
||||
required final String roomIdOrAlias,
|
||||
final IList<String> via = const .empty(),
|
||||
final IList<String> via = const IList.empty(),
|
||||
|
||||
/// Set when accepting an invite, so gomuks can mark DMs as such.
|
||||
final bool fromInvite = false,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class const SendMessageRequest({
|
|||
@JsonSerializable()
|
||||
class const Mentions({
|
||||
final bool room = false,
|
||||
final IList<String> userIds = const .empty(),
|
||||
final IList<String> userIds = const IList.empty(),
|
||||
}) with _$Mentions {
|
||||
Map<String, Object?> toJson() => _$MentionsToJson(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ class const Room({
|
|||
|
||||
/// [timeline] is an IMap of timelineRowId to eventRowId
|
||||
@JsonKey(fromJson: Room.timelineTupleJsonToIMap)
|
||||
final IMap<int, int?> timeline = const .empty(),
|
||||
final IMap<int, int?> timeline = const IMap.empty(),
|
||||
|
||||
/// [clientSticky] is an ISet of eventRowId
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
final ISet<int> clientSticky = const .empty(),
|
||||
final ISet<int> clientSticky = const ISet.empty(),
|
||||
|
||||
/// [events] is an IMap of eventRowId to event
|
||||
@JsonKey(fromJson: Room.eventsJsonToIMap)
|
||||
final IMap<int, Event> events = const .empty(),
|
||||
final IMap<int, Event> events = const IMap.empty(),
|
||||
|
||||
final bool reset = false,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -34,9 +34,9 @@ class const Room({
|
|||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
final bool hasFetchedMembers = false,
|
||||
|
||||
final IMap<String, IMap<String, int>> state = const .empty(),
|
||||
final IMap<String, IMap<String, int>> state = const IMap.empty(),
|
||||
|
||||
final IMap<String, IList<ReadReceipt>> receipts = const .empty(),
|
||||
final IMap<String, IList<ReadReceipt>> receipts = const IMap.empty(),
|
||||
final bool dismissNotifications = false,
|
||||
final bool hasMore = true,
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ class const Settings({
|
|||
final bool showAllInHome = false,
|
||||
final bool showMinimizeButton = false,
|
||||
final bool swipeToReply = false,
|
||||
final bool hideMembershipEvents = false,
|
||||
final RoomOrder roomOrder = .unreadFirst,
|
||||
}) with _$Settings {
|
||||
Map<String, Object?> toJson() => _$SettingsToJson(this);
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ part "sync_data.g.dart";
|
|||
@JsonSerializable(createToJson: false)
|
||||
class const SyncData({
|
||||
final bool clearState = false,
|
||||
final IMap<String, IMap<String, dynamic>> accountData = const .empty(),
|
||||
final IMap<String, Room> rooms = const .empty(),
|
||||
final ISet<String> leftRooms = const .empty(),
|
||||
final IList<InvitedRoom> invitedRooms = const .empty(),
|
||||
final IMap<String, IMap<String, dynamic>> accountData = const IMap.empty(),
|
||||
final IMap<String, Room> rooms = const IMap.empty(),
|
||||
final ISet<String> leftRooms = const ISet.empty(),
|
||||
final IList<InvitedRoom> invitedRooms = const IList.empty(),
|
||||
final IMap<String, IList<SpaceEdge>>? spaceEdges,
|
||||
final IList<String>? topLevelSpaces,
|
||||
}) with _$SyncData {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import "package:hooks_riverpod/hooks_riverpod.dart";
|
|||
import "package:nexus/controllers/event.dart";
|
||||
import "package:nexus/controllers/room_chat.dart";
|
||||
import "package:nexus/controllers/rooms.dart";
|
||||
import "package:nexus/controllers/settings.dart";
|
||||
import "package:nexus/helpers/extensions/show_adaptive_menu.dart";
|
||||
import "package:nexus/helpers/hooks/chat_scroll.dart";
|
||||
import "package:nexus/models/content/avatar.dart";
|
||||
|
|
@ -79,17 +78,6 @@ class const EventRenderer(
|
|||
|
||||
if (event == null) return SizedBox.shrink();
|
||||
|
||||
final hideMembershipEvents = (ref
|
||||
.watch(SettingsController.provider)
|
||||
.maybeWhen(
|
||||
orElse: () => false,
|
||||
data: (settings) => settings.hideMembershipEvents,
|
||||
));
|
||||
|
||||
if (event.content is MembershipContent && hideMembershipEvents) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
|
||||
final isGrouped =
|
||||
previousEvent?.content is MessageContent &&
|
||||
previousEvent?.redactedBy == null &&
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import "package:nexus/main.dart";
|
|||
|
||||
final class const RoomMenuButton(
|
||||
final Room? room, {
|
||||
final IList<Room> children = const .empty(),
|
||||
final IList<Room> children = const IList.empty(),
|
||||
super.key,
|
||||
}) extends ConsumerWidget {
|
||||
@override
|
||||
|
|
|
|||
Loading…
Reference in a new issue