allPushNotificationsMuted property

bool get allPushNotificationsMuted

Whether all push notifications are muted using the .m.rule.master rule of the push rules: https://sdn.org/docs/spec/client_server/r0.6.0#m-rule-master

Implementation

bool get allPushNotificationsMuted {
  final Map<String, Object?>? globalPushRules =
      _accountData[EventTypes.PushRules]
          ?.content
          .tryGetMap<String, Object?>('global');
  if (globalPushRules == null) return false;

  final globalPushRulesOverride = globalPushRules.tryGetList('override');
  if (globalPushRulesOverride != null) {
    for (final pushRule in globalPushRulesOverride) {
      if (pushRule['rule_id'] == '.m.rule.master') {
        return pushRule['enabled'];
      }
    }
  }
  return false;
}