added talk notification levels for chats
This commit is contained in:
@@ -130,6 +130,12 @@ enum GetRoomResponseObjectParticipantNotificationLevel {
|
||||
neverNotify,
|
||||
}
|
||||
|
||||
extension NotificationLevelApiValue
|
||||
on GetRoomResponseObjectParticipantNotificationLevel {
|
||||
int get apiValue =>
|
||||
_$GetRoomResponseObjectParticipantNotificationLevelEnumMap[this]!;
|
||||
}
|
||||
|
||||
enum GetRoomResponseObjectMessageActorType {
|
||||
@JsonValue('deleted_users')
|
||||
deletedUsers,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user