Page MenuHomePhabricator

[desktop] Handle macos notifications
ClosedPublic

Authored by michal on Feb 24 2023, 10:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 5:26 AM
Unknown Object (File)
Fri, Apr 5, 2:42 PM
Unknown Object (File)
Fri, Apr 5, 2:34 PM
Unknown Object (File)
Thu, Apr 4, 2:22 AM
Unknown Object (File)
Mar 21 2024, 12:04 PM
Unknown Object (File)
Mar 15 2024, 9:52 AM
Unknown Object (File)
Mar 15 2024, 9:51 AM
Unknown Object (File)
Mar 12 2024, 5:07 PM
Subscribers

Details

Summary

Register for push notifications and handle them by displaying a native notification. When a user clicks the notification we either navigate to the corresponding chat or if there is no main windows open a new one with a correct url.

Test Plan
  • Check if the notifications display and navigate to a chat when clicked
  • Check if the app is closed notifications show up and open up a new window when clicked
  • Check if we get the notification but then close the app and the other way around, the click action still works correctly

Diff Detail

Repository
rCOMM Comm
Branch
michal/desktop-notifs
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

desktop/flow-typed/npm/electron_v22.0.0.js
302–312 ↗(On Diff #23072)

Why aren't these read-only?

336–338 ↗(On Diff #23072)

Why aren't these read-only?

351–358 ↗(On Diff #23072)

Why aren't these read-only?

361–366 ↗(On Diff #23072)

Should any of these be read-only?

tomek added inline comments.
desktop/src/push-notifications.js
3 ↗(On Diff #23072)

Why do we need to silence this warning?

32 ↗(On Diff #23072)
This revision is now accepted and ready to land.Feb 28 2023, 3:21 AM
desktop/src/push-notifications.js
3 ↗(On Diff #23072)

Fix typo.
The types aren't readonly because either:

  • they are class methods and can't be made readonly
  • the NotificationEvents type isn't actually ever instantiated or exported, it's just a holder that maps event string name to the callback type