ion
ion copied to clipboard
feat: add push notifications
Proposed changes
- add the ability to send push notifications via webpush
- tests for notifications and pages to view notification logs and send a custom one
- adds user push notification preferences and implements sending push notifications on announcements, absences, glance, etc. (eighth waitlist push notification option is implemented in the preferences model but unused)
Brief description of rationale
Many of Ion's current notification features rely on sending emails but people check push notifications more often. This makes the PWA experience more intuitive especially on mobile
Notes
- In production, the VAPID keys (generated via
create_vapid_keys.py) should be generated once and never changed, otherwise all push subscriptions will be invalidated and users will have to manually subscribe to push notifications again
This is great!!! Are you all done or still working on stuff? One useful notification option to add is when your bus arrives you get sent a notif, and also maybe some text description of where it's parked (e.g. "in front of the curb," "right front row", "left back row"). Maybe those notifs have to be delayed so they aren't sent until the end of the day (4 pm most days, but dynamically calculated for early release). And also maybe a notif that sends at 4 pm "your bus isn't here yet" if it hasn't arrived.
great work!!
Everything is done, I'll try adding that feature 👍
I added it, here's what it looks like:
and the bus spot id -> string translations:
coverage: 79.119% (-0.2%) from 79.361% when pulling 9ca08509803a54ecbc96704f1690b03b7e41921b on aarushtools:webpush into e5e51f2eaad7aaa10b5aee519038167121fb546a on tjcsl:dev.
- On mobile, on preferences the subscribe page looks too transparent, can you decrease the opacity there?
- It doesn't work on Edge, right? I can subscribe now actually, but I don't get notified. If that's right, please include a note to the user about that, and also a decent number of people use Edge so getting support for it would be good.
- There's a notification sound on mobile - can you turn off the sound? I don't think people will like that.
- Can you make Django admin interfaces for the webpush-related models?
- Does the bus notification only check at 4 pm right now? Can you do something where if the bus hasn't arrived at 4 pm, send the bus delayed notification you're already doing, then when the bus does arrive send another notification saying so?
@alanzhu0 everythings done 👍
Idk why it's failing I ran build_docs like 20 times
to test:
- APP: Announcements
- [x] announcement posted sends a push notification when notify option is enabled
- [x] test if content is truncated when its too long
- [x] announcement posted sends a push notification when notify option is enabled
- APP: Bus
- [x] push notification sent at dismissal time indicating where your bus is
- [ ] works with different day end times
- [ ] test all possible bus location messages
- [x] push notification sent at dismissal time indicating if your bus is delayed or not
- [x] works with different day end times
- [x] push notification sent when delayed bus arrives
- [x] works with different day end times
- [x] push notification sent to users with bus mentioned in bus announcement
- [x] test different counties
- [x] push notification sent at dismissal time indicating where your bus is
- APP: Eighth
- [x] push notification sent to student when an activity they signed up for is cancelled
- [ ] push notification sent to student when they get an absence
- [ ] cron
- [ ] admin command
- [ ] push reminder notification to sign up 40 mins prior to blocks locking.
- [ ] works with different signup lock times
- [x] test glance notification
- [ ] works with multiple blocks (2+)
- APP: Polls
- [x] test notification sent when a poll is created (and the notify option is selected)
- APP: Notifications
- [x] test post notification
- [x] content is truncated?
- [x] works on individual user(s)
- [x] works on group(s)
- [x] works on everyone
- [x] test notification logs
- [x] test rescheduling of notifications
- [x] test post notification
- Other:
- Docker:
- [ ] test vapid keys generated on containers creation
- JS:
- [x] test silent notifications option, per device
- [ ] test with different browsers to see if it can detect supported/unsupported accurately
- [x] ios 16.4+ (safari)
- [x] chrome
- [ ] opera
- [ ] macos 16+ (safari)
- [ ] firefox
- [x] edge (confirm that it says the browser is unsupported)
- Docker: