import 'get_room_response.dart'; typedef NotificationLevel = GetRoomResponseObjectParticipantNotificationLevel; /// The levels a user can pick in the UI; [NotificationLevel.defaultLevel] /// is only ever reported by the server, never chosen. const selectableNotificationLevels = [ NotificationLevel.alwaysNotify, NotificationLevel.notifyOnMention, NotificationLevel.neverNotify, ]; extension RoomNotificationLevel on GetRoomResponseObject { /// Resolves "default" the way Spreed does: 1:1 chats notify on every /// message, group chats only on mentions (`default_group_notification`). NotificationLevel get effectiveNotificationLevel { if (notificationLevel != NotificationLevel.defaultLevel) { return notificationLevel; } return type == GetRoomResponseObjectConversationType.oneToOne ? NotificationLevel.alwaysNotify : NotificationLevel.notifyOnMention; } bool get isMuted => effectiveNotificationLevel == NotificationLevel.neverNotify; }