Push rules sound: be a string, not just on/off
This commit is contained in:
@@ -1788,7 +1788,7 @@ class MatrixClient(nio.AsyncClient):
|
||||
notify: Optional[bool] = None,
|
||||
highlight: Optional[bool] = None,
|
||||
bubble: Optional[bool] = None,
|
||||
sound: Optional[bool] = None,
|
||||
sound: Optional[str] = None,
|
||||
urgency_hint: Optional[bool] = None,
|
||||
) -> None:
|
||||
|
||||
@@ -1811,9 +1811,8 @@ class MatrixClient(nio.AsyncClient):
|
||||
elif bubble is False or (bubble is None and not current.bubble):
|
||||
actions.append(nio.PushSetTweak("bubble", False))
|
||||
|
||||
# XXX: don't always override with "default"
|
||||
if sound or (sound is None and current.sound):
|
||||
actions.append(nio.PushSetTweak("sound", "default"))
|
||||
actions.append(nio.PushSetTweak("sound", sound))
|
||||
|
||||
hint = urgency_hint
|
||||
|
||||
|
@@ -107,7 +107,7 @@ class PushRule(ModelItem):
|
||||
notify: bool = False
|
||||
highlight: bool = False
|
||||
bubble: bool = False
|
||||
sound: bool = False
|
||||
sound: str = "" # usually "default" when set
|
||||
urgency_hint: bool = False
|
||||
|
||||
def __lt__(self, other: "PushRule") -> bool:
|
||||
|
@@ -108,7 +108,11 @@ class Model(MutableMapping):
|
||||
del self._sorted_data[index_then]
|
||||
|
||||
self._sorted_data.add(new)
|
||||
index_now = self._sorted_data.index(new)
|
||||
try:
|
||||
index_now = self._sorted_data.index(new)
|
||||
except ValueError:
|
||||
import remote_pdb; remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
|
||||
pass
|
||||
|
||||
# Insert into dict data
|
||||
|
||||
|
@@ -825,7 +825,7 @@ class NioCallbacks:
|
||||
|
||||
high = tweaks.get("highlight", False) is not False
|
||||
bubble = tweaks.get("bubble", notify) is not False
|
||||
sound = tweaks.get("sound", False) is not False
|
||||
sound = str(tweaks.get("sound") or "")
|
||||
hint = tweaks.get("urgency_hint", high) is not False
|
||||
|
||||
model[kind.value, rule.id] = PushRule(
|
||||
|
Reference in New Issue
Block a user