added talk notification levels for chats

This commit is contained in:
2026-09-25 17:04:10 +02:00
parent e21560ed3d
commit ef7d17033d
9 changed files with 281 additions and 0 deletions
@@ -0,0 +1,27 @@
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;
}