Page MenuHomePhabricator

[desktop] Handle macos notifications
ClosedPublic

Authored by michal on Feb 24 2023, 10:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 6:17 PM
Unknown Object (File)
Sat, Oct 19, 9:28 PM
Unknown Object (File)
Sat, Oct 19, 9:28 PM
Unknown Object (File)
Sat, Oct 19, 12:49 PM
Unknown Object (File)
Sat, Oct 19, 12:49 PM
Unknown Object (File)
Sat, Oct 19, 12:49 PM
Unknown Object (File)
Sat, Oct 19, 10:23 AM
Unknown Object (File)
Sat, Oct 19, 2:15 AM
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