-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement push notifications for notifications in templates.js
#2455
Comments
templates.js
templates.js
One of the issues here is that Also, how should the native notifications behave? I mean, when should they be shown? Does the app being open make a difference? Does the app being open and active make a difference? |
👍 Yeah let's just do that.
Great questions! I think we should behave like all other apps. IIRC Slack doesn't show these notifications when the user has it open and active. Since you asked that last question twice, it sounds to me like you're saying there's a difference between "open" and "open and active". I know this difference exists on Desktop but I'm not sure it exist on mobile. On Desktop, push notifications are still shown when "open", but not "open and active". |
Correct, the difference exists, although on mobile, as you say, I think it's generally not possible to be 'open' but not 'active' (maybe some tablets / phablets have this though). I've looked at possible ways to implement this, and it seems like we could either do it in Currently, At first, assuming that we want to support non-SW environments, I thought that we could add a flag to The second issue is that in-app notifications and native notifications work a bit differently. One of those differences is what I've already pointed out about the use of markup. Native notifications have these fields: À propos the Regarding Regarding 'periodic' notifications, you write:
This is an option with its advantages, but it also has some disadvantages, in particular that we aren't supposed to send push events that won't result in notifications. We already send plenty of these, so it's not necessarily worse. However, an alternative approach would be for clients to request a 'wakeup' from the server at a specified time. This would reduce the likelihood of waking up the SW unnecessarily, but at the expense of some privacy from the server and more complexity. In summary, this is how we could go about this:
|
👍
Yeah... let's avoid that complexity for now.
Templates does have Re Individual notifications could also specify |
They do, but they use tags like
It's possible, but the app name already is part of the notification. We can leave it empty, but if it's a notification about a group, using, e.g., the group name could make more sense.
If you look at |
It doesn't need to be error-prone. Introducing a duplicate would violate DRY. We already have code that replaces the
... The phone code could just trim the excess words and add an ellipsis if this is an issue, or the original string can be shortened. I'd really rather avoid violating DRY and writing the same thing twice.
👍 (yeah, or chat channel name) |
Not so sure about this, as they're two similar things but used in different contexts. However,
Yeah, but that code is in the body: L('{strong_}{name}{_strong} was kicked out of the group. Contributions were updated accordingly.', {
name: `${CHATROOM_MEMBER_MENTION_SPECIAL_CHAR}${data.memberID}`,
...LTags('strong')
}) So, we'd be removing not the |
Now, if we followed my (more general) suggestion not to have |
Problem
We need users to be notified when the distribution period is almost up, when a new proposal is opened (or closed), etc.
These notifications are enumerated in the file
templates.js
, and they are called from various places. An in-app notification is created, but a push notification isn't shown to the user.Solution
Make it so that push notifications are shown for these notifications.
Some of these notifications are triggered as a result of side effect functions, while others are on a timer of some sort (like
NEAR_DISTRIBUTION_END
).For the ones that are on a timer, you'll probably need to have the server send a periodic push notification to wake up the service worker periodically (e.g. twice a day or something like that), to then check to see if any of these notifications are worth showing.
The text was updated successfully, but these errors were encountered: