Skip to content
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

Add Desktop notifications #252

Merged
merged 12 commits into from
Jan 29, 2022
Merged

Add Desktop notifications #252

merged 12 commits into from
Jan 29, 2022

Conversation

ginnyTheCat
Copy link
Contributor

@ginnyTheCat ginnyTheCat commented Jan 23, 2022

Description

This adds Desktop notification support.

image
image

(These screenshots are taken in GNOME. They will look different on Windows and macOS.)

This change will however not play a custom sound like element web does. The OS will play a generic notification sound on it's own. Adding this feature at a later date however wouldn't be difficult.

Currently Cinny does not ask for notification permission by default on first launch like element web does. The permission can be granted by going to settings > notifications > request permission. Personally I think the element approach is more intuitive for new users. If the maintainers are ok with Cinny asking for notification permission after the first login I am more than happy to add this.

Fixes #182

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Preview: https://61f417e0a83c150ef05c7d85--pr-cinny.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

@ajbura
Copy link
Member

ajbura commented Jan 25, 2022

Personally I think the element approach is more intuitive for new users. If the maintainers are ok with Cinny asking for notification permission after the first login I am more than happy to add this.

I am ok with asking notification permission after login.

Also I am getting the following error with crash when opening notifications tab in settings in Safari:
undefined is not an object (evaluating 'window.Notification.permission')

@ginnyTheCat
Copy link
Contributor Author

ginnyTheCat commented Jan 26, 2022

It should not crash in Safari now and asks for permission on startup.

src/client/state/Notifications.js Outdated Show resolved Hide resolved
src/app/hooks/usePermission.js Outdated Show resolved Hide resolved
src/client/state/userActivity.js Outdated Show resolved Hide resolved
src/client/state/userActivity.js Outdated Show resolved Hide resolved
src/client/state/Notifications.js Outdated Show resolved Hide resolved
src/client/state/Notifications.js Outdated Show resolved Hide resolved
src/client/state/Notifications.js Outdated Show resolved Hide resolved
src/client/state/settings.js Show resolved Hide resolved
src/client/state/Notifications.js Outdated Show resolved Hide resolved
src/client/state/Notifications.js Outdated Show resolved Hide resolved
@ajbura ajbura merged commit c828dfd into cinnyapp:dev Jan 29, 2022
@ginnyTheCat ginnyTheCat deleted the notifications branch February 13, 2022 18:30
@ginnyTheCat ginnyTheCat restored the notifications branch February 14, 2022 15:34
@ginnyTheCat ginnyTheCat deleted the notifications branch February 14, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Desktop notifications
2 participants