- Use a single endpoint
- Use a declarative web push sync hook. This thus handles all edge cases
that had to be manually handled before: logout, login, account sync,
etc.
- Simplify UX: browser notifications are always enabled (unless denied),
web push toggle only shows up if permissions are already granted.
- Use new notification request/opt-in flow for push
- Implement unsubscribing
- Implement muting
- Implement emojis in title
- Add iOS specific PWA warning
- Don’t use websockets when web push is enabled
- Fix duplicate notifications
- Implement default web push setting
- Implement changing subscription type
- Implement web push subscription refresh
- Implement web push notification click
This fixes a pending TODO comment regarding inefficient tags to emojis
mapping, by requiring a full scan over emoji aliases to determine
matches.
Instead, now the JSON file is a map, with aliases as keys, and emojis as
values. The script to convert the file with Python was:
```python
import json
with open("./mailer_emoji.json", "r", encoding="utf-8") as f:
content = json.load(f)
emoji_map = {}
for emoji in content:
for alias in emoji["aliases"]:
if alias in emoji_map:
print("WARNING: Duplicate alias:", alias)
continue
emoji_map[alias] = str(emoji["emoji"])
sorted_emoji_map = {k: emoji_map[k] for k in sorted(emoji_map)}
with open("./mailer_emoji_map.json", "w", encoding="utf-8") as f:
json.dump(sorted_emoji_map, f, indent=4, ensure_ascii=False)
```
Some e-mails are sent using quoted-printable encoding [0], resulting in
notifications with weird characters.
This commit adds support for this encoding, resulting in the following:
**Before**
```
A
=3D=3D=3D=3D=3D
B
=3D=3D=3D=3D=3D
C
```
**After**
```
A
=====
B
=====
C
```
[0] https://www.rfc-editor.org/rfc/rfc2045.html