slightly improve bitfield handling for UnreadType
This commit is contained in:
parent
3c6c610f7c
commit
c81000d6c6
2 changed files with 3 additions and 6 deletions
|
|
@ -87,7 +87,7 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
|
||||
final (event, roomMetadata) = pushResponse;
|
||||
|
||||
if (event.unreadType?.shouldNotify() != true ||
|
||||
if (event.unreadType?.has(.notify) != true ||
|
||||
(!isInBackground &&
|
||||
await windowManager.isFocused().onError((_, _) => true) &&
|
||||
await ref.read(
|
||||
|
|
|
|||
|
|
@ -102,9 +102,6 @@ class const UnreadType(final int value) with _$UnreadType {
|
|||
static const highlight = UnreadType(4);
|
||||
static const sound = UnreadType(8);
|
||||
|
||||
bool isNone() => value == 0;
|
||||
bool isNormal() => (value & 1) != 0;
|
||||
bool shouldNotify() => (value & 2) != 0;
|
||||
bool isHighlighted() => (value & 4) != 0;
|
||||
bool playsSound() => (value & 8) != 0;
|
||||
bool has(UnreadType flag) => value & flag.value != 0;
|
||||
UnreadType operator |(UnreadType other) => UnreadType(value | other.value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue