forked from Nexus/nexus
make webpush enabled check better
Because Continuwuity sends a VAPID even when webpush is disabled.
This commit is contained in:
parent
7424bec0fb
commit
9d495410f6
1 changed files with 12 additions and 3 deletions
|
|
@ -10,6 +10,14 @@ class const Capabilities({
|
|||
@JsonKey(name: "org.matrix.msc4174.webpush") final WebPush? webpush,
|
||||
@JsonKey(name: "m.room_versions") final RoomVersions? roomVersions,
|
||||
}) with _$Capabilities {
|
||||
/// The VAPID key to register Web Push pushers with, or null if the
|
||||
/// homeserver can't send Web Push. Continuwuity sends a key even when the
|
||||
/// feature is disabled, so `enabled` must be checked too.
|
||||
String? get webPushVapid => switch (webpush) {
|
||||
WebPush(enabled: true, :final vapid) => vapid,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
Map<String, Object?> toJson() => _$CapabilitiesToJson(this);
|
||||
|
||||
factory Capabilities.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue